VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Boot/EFI/Readme.txt2
-rw-r--r--src/Boot/Windows/Release/BootLoader.com.gzbin17457 -> 17425 bytes
-rw-r--r--src/Boot/Windows/Release_AES/BootLoader.com.gzbin11662 -> 11667 bytes
-rw-r--r--src/Boot/Windows/Release_AES_SHA2/BootLoader.com.gzbin11747 -> 11743 bytes
-rw-r--r--src/Boot/Windows/Release_Camellia/BootLoader.com.gzbin12582 -> 12577 bytes
-rw-r--r--src/Boot/Windows/Release_Camellia_SHA2/BootLoader.com.gzbin12619 -> 12652 bytes
-rw-r--r--src/Boot/Windows/Release_SHA2/BootLoader.com.gzbin17480 -> 17488 bytes
-rw-r--r--src/Boot/Windows/Release_Serpent/BootLoader.com.gzbin11985 -> 11994 bytes
-rw-r--r--src/Boot/Windows/Release_Serpent_SHA2/BootLoader.com.gzbin12045 -> 12051 bytes
-rw-r--r--src/Boot/Windows/Release_Twofish/BootLoader.com.gzbin11666 -> 11675 bytes
-rw-r--r--src/Boot/Windows/Release_Twofish_SHA2/BootLoader.com.gzbin11723 -> 11723 bytes
-rw-r--r--src/Boot/Windows/Rescue/BootLoader.com.gzbin17984 -> 17976 bytes
-rw-r--r--src/Boot/Windows/Rescue_AES/BootLoader.com.gzbin12228 -> 12215 bytes
-rw-r--r--src/Boot/Windows/Rescue_AES_SHA2/BootLoader.com.gzbin12281 -> 12280 bytes
-rw-r--r--src/Boot/Windows/Rescue_Camellia/BootLoader.com.gzbin13123 -> 13133 bytes
-rw-r--r--src/Boot/Windows/Rescue_Camellia_SHA2/BootLoader.com.gzbin13164 -> 13180 bytes
-rw-r--r--src/Boot/Windows/Rescue_SHA2/BootLoader.com.gzbin18021 -> 18040 bytes
-rw-r--r--src/Boot/Windows/Rescue_Serpent/BootLoader.com.gzbin12517 -> 12536 bytes
-rw-r--r--src/Boot/Windows/Rescue_Serpent_SHA2/BootLoader.com.gzbin12605 -> 12607 bytes
-rw-r--r--src/Boot/Windows/Rescue_Twofish/BootLoader.com.gzbin12216 -> 12216 bytes
-rw-r--r--src/Boot/Windows/Rescue_Twofish_SHA2/BootLoader.com.gzbin12264 -> 12272 bytes
-rw-r--r--src/Build/CMakeLists.txt25
-rw-r--r--src/Build/Resources/MacOSX/Info.plist.legacy.xml2
-rw-r--r--src/Build/Resources/MacOSX/Info.plist.xml2
-rwxr-xr-xsrc/Build/build_cmake_deb.sh4
-rw-r--r--src/Build/build_cmake_opensuse.sh4
-rw-r--r--src/Build/build_cmake_rpm_gtk2.sh4
-rw-r--r--src/Build/build_cmake_rpm_gtk3.sh4
-rwxr-xr-xsrc/Build/build_veracrypt_freebsd.sh4
-rwxr-xr-xsrc/Build/build_veracrypt_linux.sh4
-rw-r--r--src/Build/build_veracrypt_linux_gtk3.sh4
-rwxr-xr-xsrc/Build/build_veracrypt_linux_no_sse2.sh4
-rwxr-xr-xsrc/Build/build_veracrypt_macosx.sh11
-rw-r--r--src/COMReg/COMReg.rc8
-rw-r--r--src/Common/Apidrvr.h10
-rw-r--r--src/Common/BaseCom.cpp22
-rw-r--r--src/Common/BaseCom.h3
-rw-r--r--src/Common/BootEncryption.cpp89
-rw-r--r--src/Common/BootEncryption.h1
-rw-r--r--src/Common/Cache.c10
-rw-r--r--src/Common/Cache.h2
-rw-r--r--src/Common/CommandAPDU.cpp366
-rw-r--r--src/Common/CommandAPDU.h93
-rw-r--r--src/Common/Common.h1
-rw-r--r--src/Common/Common.rc31
-rw-r--r--src/Common/Crypto.c126
-rw-r--r--src/Common/Crypto.h1
-rw-r--r--src/Common/Dlgcode.c2209
-rw-r--r--src/Common/Dlgcode.h29
-rw-r--r--src/Common/EMVCard.cpp523
-rw-r--r--src/Common/EMVCard.h69
-rw-r--r--src/Common/EMVToken.cpp225
-rw-r--r--src/Common/EMVToken.h42
-rw-r--r--src/Common/Fat.c63
-rw-r--r--src/Common/Fat.h2
-rw-r--r--src/Common/Format.c303
-rw-r--r--src/Common/Format.h18
-rw-r--r--src/Common/GfMul.c6
-rw-r--r--src/Common/IccDataExtractor.cpp0
-rw-r--r--src/Common/IccDataExtractor.h0
-rw-r--r--src/Common/Keyfiles.c69
-rw-r--r--src/Common/Language.xml76
-rw-r--r--src/Common/Lzma.vcxproj1
-rw-r--r--src/Common/Lzma.vcxproj.filters3
-rw-r--r--src/Common/Lzma_vs2019.vcxproj1
-rw-r--r--src/Common/Lzma_vs2019.vcxproj.filters3
-rw-r--r--src/Common/PCSCException.cpp202
-rw-r--r--src/Common/PCSCException.h136
-rw-r--r--src/Common/Password.c10
-rw-r--r--src/Common/Password.h2
-rw-r--r--src/Common/Pkcs5.c50
-rw-r--r--src/Common/Pkcs5.h4
-rw-r--r--src/Common/Random.c45
-rw-r--r--src/Common/Resource.h6
-rw-r--r--src/Common/ResponseAPDU.cpp111
-rw-r--r--src/Common/ResponseAPDU.h44
-rw-r--r--src/Common/SCard.cpp62
-rw-r--r--src/Common/SCard.h27
-rw-r--r--src/Common/SCardLoader.cpp402
-rw-r--r--src/Common/SCardLoader.h125
-rw-r--r--src/Common/SCardManager.cpp109
-rw-r--r--src/Common/SCardManager.h21
-rw-r--r--src/Common/SCardReader.cpp681
-rw-r--r--src/Common/SCardReader.h200
-rw-r--r--src/Common/SecurityToken.cpp522
-rw-r--r--src/Common/SecurityToken.h130
-rw-r--r--src/Common/TLVParser.cpp187
-rw-r--r--src/Common/TLVParser.h80
-rw-r--r--src/Common/Tcdefs.h23
-rw-r--r--src/Common/Tests.c22
-rw-r--r--src/Common/Token.cpp114
-rw-r--r--src/Common/Token.h61
-rw-r--r--src/Common/Volumes.c126
-rw-r--r--src/Common/Volumes.h4
-rw-r--r--src/Common/Xts.c10
-rw-r--r--src/Common/Zip.vcxproj13
-rw-r--r--src/Common/Zip.vcxproj.filters39
-rw-r--r--src/Common/Zip_vs2019.vcxproj37
-rw-r--r--src/Common/libzip/LICENSE2
-rw-r--r--src/Common/libzip/NEWS.md191
-rw-r--r--src/Common/libzip/compat.h68
-rw-r--r--src/Common/libzip/config.h78
-rw-r--r--src/Common/libzip/zip.h103
-rw-r--r--src/Common/libzip/zip_add.c10
-rw-r--r--src/Common/libzip/zip_add_dir.c4
-rw-r--r--src/Common/libzip/zip_add_entry.c52
-rw-r--r--src/Common/libzip/zip_algorithm_bzip2.c293
-rw-r--r--src/Common/libzip/zip_algorithm_deflate.c106
-rw-r--r--src/Common/libzip/zip_algorithm_xz.c408
-rw-r--r--src/Common/libzip/zip_algorithm_zstd.c298
-rw-r--r--src/Common/libzip/zip_buffer.c83
-rw-r--r--src/Common/libzip/zip_close.c790
-rw-r--r--src/Common/libzip/zip_crypto.h54
-rw-r--r--src/Common/libzip/zip_crypto_commoncrypto.c110
-rw-r--r--src/Common/libzip/zip_crypto_commoncrypto.h53
-rw-r--r--src/Common/libzip/zip_crypto_gnutls.c134
-rw-r--r--src/Common/libzip/zip_crypto_gnutls.h68
-rw-r--r--src/Common/libzip/zip_crypto_mbedtls.c171
-rw-r--r--src/Common/libzip/zip_crypto_mbedtls.h56
-rw-r--r--src/Common/libzip/zip_crypto_openssl.c229
-rw-r--r--src/Common/libzip/zip_crypto_openssl.h73
-rw-r--r--src/Common/libzip/zip_crypto_win.c495
-rw-r--r--src/Common/libzip/zip_crypto_win.h53
-rw-r--r--src/Common/libzip/zip_delete.c18
-rw-r--r--src/Common/libzip/zip_dir_add.c40
-rw-r--r--src/Common/libzip/zip_dirent.c1018
-rw-r--r--src/Common/libzip/zip_discard.c18
-rw-r--r--src/Common/libzip/zip_entry.c4
-rw-r--r--src/Common/libzip/zip_err_str.c145
-rw-r--r--src/Common/libzip/zip_error.c52
-rw-r--r--src/Common/libzip/zip_error_clear.c6
-rw-r--r--src/Common/libzip/zip_error_get.c4
-rw-r--r--src/Common/libzip/zip_error_get_sys_type.c11
-rw-r--r--src/Common/libzip/zip_error_strerror.c109
-rw-r--r--src/Common/libzip/zip_error_to_str.c30
-rw-r--r--src/Common/libzip/zip_extra_field.c375
-rw-r--r--src/Common/libzip/zip_extra_field_api.c236
-rw-r--r--src/Common/libzip/zip_fclose.c8
-rw-r--r--src/Common/libzip/zip_fdopen.c39
-rw-r--r--src/Common/libzip/zip_file_add.c14
-rw-r--r--src/Common/libzip/zip_file_error_clear.c6
-rw-r--r--src/Common/libzip/zip_file_error_get.c4
-rw-r--r--src/Common/libzip/zip_file_get_comment.c10
-rw-r--r--src/Common/libzip/zip_file_get_external_attributes.c10
-rw-r--r--src/Common/libzip/zip_file_get_offset.c64
-rw-r--r--src/Common/libzip/zip_file_rename.c18
-rw-r--r--src/Common/libzip/zip_file_replace.c60
-rw-r--r--src/Common/libzip/zip_file_set_comment.c66
-rw-r--r--src/Common/libzip/zip_file_set_encryption.c120
-rw-r--r--src/Common/libzip/zip_file_set_external_attributes.c50
-rw-r--r--src/Common/libzip/zip_file_set_mtime.c27
-rw-r--r--src/Common/libzip/zip_file_strerror.c4
-rw-r--r--src/Common/libzip/zip_fopen.c6
-rw-r--r--src/Common/libzip/zip_fopen_encrypted.c6
-rw-r--r--src/Common/libzip/zip_fopen_index.c4
-rw-r--r--src/Common/libzip/zip_fopen_index_encrypted.c28
-rw-r--r--src/Common/libzip/zip_fread.c21
-rw-r--r--src/Common/libzip/zip_fseek.c61
-rw-r--r--src/Common/libzip/zip_ftell.c54
-rw-r--r--src/Common/libzip/zip_get_archive_comment.c12
-rw-r--r--src/Common/libzip/zip_get_archive_flag.c4
-rw-r--r--src/Common/libzip/zip_get_encryption_implementation.c12
-rw-r--r--src/Common/libzip/zip_get_file_comment.c8
-rw-r--r--src/Common/libzip/zip_get_name.c8
-rw-r--r--src/Common/libzip/zip_get_num_entries.c14
-rw-r--r--src/Common/libzip/zip_get_num_files.c10
-rw-r--r--src/Common/libzip/zip_hash.c294
-rw-r--r--src/Common/libzip/zip_io_util.c80
-rw-r--r--src/Common/libzip/zip_libzip_version.c41
-rw-r--r--src/Common/libzip/zip_memdup.c12
-rw-r--r--src/Common/libzip/zip_name_locate.c82
-rw-r--r--src/Common/libzip/zip_new.c12
-rw-r--r--src/Common/libzip/zip_open.c868
-rw-r--r--src/Common/libzip/zip_pkware.c42
-rw-r--r--src/Common/libzip/zip_progress.c110
-rw-r--r--src/Common/libzip/zip_random_unix.c110
-rw-r--r--src/Common/libzip/zip_random_uwp.c (renamed from src/Common/libzip/zip_filerange_crc.c)76
-rw-r--r--src/Common/libzip/zip_random_win32.c82
-rw-r--r--src/Common/libzip/zip_rename.c4
-rw-r--r--src/Common/libzip/zip_replace.c4
-rw-r--r--src/Common/libzip/zip_set_archive_comment.c40
-rw-r--r--src/Common/libzip/zip_set_archive_flag.c41
-rw-r--r--src/Common/libzip/zip_set_default_password.c18
-rw-r--r--src/Common/libzip/zip_set_file_comment.c8
-rw-r--r--src/Common/libzip/zip_set_file_compression.c58
-rw-r--r--src/Common/libzip/zip_set_name.c114
-rw-r--r--src/Common/libzip/zip_source_accept_empty.c16
-rw-r--r--src/Common/libzip/zip_source_begin_write.c15
-rw-r--r--src/Common/libzip/zip_source_begin_write_cloning.c15
-rw-r--r--src/Common/libzip/zip_source_buffer.c475
-rw-r--r--src/Common/libzip/zip_source_call.c30
-rw-r--r--src/Common/libzip/zip_source_close.c20
-rw-r--r--src/Common/libzip/zip_source_commit_write.c27
-rw-r--r--src/Common/libzip/zip_source_compress.c357
-rw-r--r--src/Common/libzip/zip_source_crc.c186
-rw-r--r--src/Common/libzip/zip_source_error.c4
-rw-r--r--src/Common/libzip/zip_source_file.h6
-rw-r--r--src/Common/libzip/zip_source_file_common.c368
-rw-r--r--src/Common/libzip/zip_source_file_stdio.c68
-rw-r--r--src/Common/libzip/zip_source_file_stdio.h4
-rw-r--r--src/Common/libzip/zip_source_file_stdio_named.c392
-rw-r--r--src/Common/libzip/zip_source_file_win32.c26
-rw-r--r--src/Common/libzip/zip_source_file_win32.h24
-rw-r--r--src/Common/libzip/zip_source_file_win32_ansi.c87
-rw-r--r--src/Common/libzip/zip_source_file_win32_named.c70
-rw-r--r--src/Common/libzip/zip_source_file_win32_utf16.c32
-rw-r--r--src/Common/libzip/zip_source_file_win32_utf8.c8
-rw-r--r--src/Common/libzip/zip_source_free.c20
-rw-r--r--src/Common/libzip/zip_source_function.c16
-rw-r--r--src/Common/libzip/zip_source_get_file_attributes.c94
-rw-r--r--src/Common/libzip/zip_source_is_deleted.c4
-rw-r--r--src/Common/libzip/zip_source_layered.c28
-rw-r--r--src/Common/libzip/zip_source_open.c43
-rw-r--r--src/Common/libzip/zip_source_pass_to_lower_layer.c78
-rw-r--r--src/Common/libzip/zip_source_pkware_decode.c117
-rw-r--r--src/Common/libzip/zip_source_pkware_encode.c192
-rw-r--r--src/Common/libzip/zip_source_read.c54
-rw-r--r--src/Common/libzip/zip_source_remove.c21
-rw-r--r--src/Common/libzip/zip_source_rollback_write.c10
-rw-r--r--src/Common/libzip/zip_source_seek.c34
-rw-r--r--src/Common/libzip/zip_source_seek_write.c13
-rw-r--r--src/Common/libzip/zip_source_stat.c24
-rw-r--r--src/Common/libzip/zip_source_supports.c23
-rw-r--r--src/Common/libzip/zip_source_tell.c18
-rw-r--r--src/Common/libzip/zip_source_tell_write.c13
-rw-r--r--src/Common/libzip/zip_source_window.c331
-rw-r--r--src/Common/libzip/zip_source_winzip_aes_decode.c265
-rw-r--r--src/Common/libzip/zip_source_winzip_aes_encode.c253
-rw-r--r--src/Common/libzip/zip_source_write.c8
-rw-r--r--src/Common/libzip/zip_source_zip.c35
-rw-r--r--src/Common/libzip/zip_source_zip_new.c289
-rw-r--r--src/Common/libzip/zip_stat.c6
-rw-r--r--src/Common/libzip/zip_stat_index.c79
-rw-r--r--src/Common/libzip/zip_stat_init.c20
-rw-r--r--src/Common/libzip/zip_strerror.c4
-rw-r--r--src/Common/libzip/zip_string.c88
-rw-r--r--src/Common/libzip/zip_unchange.c73
-rw-r--r--src/Common/libzip/zip_unchange_all.c8
-rw-r--r--src/Common/libzip/zip_unchange_archive.c10
-rw-r--r--src/Common/libzip/zip_unchange_data.c18
-rw-r--r--src/Common/libzip/zip_utf-8.c116
-rw-r--r--src/Common/libzip/zip_winzip_aes.c162
-rw-r--r--src/Common/libzip/zipconf.h65
-rw-r--r--src/Common/libzip/zipint.h124
-rw-r--r--src/Common/lzma/7zTypes.h274
-rw-r--r--src/Common/lzma/7zWindows.h101
-rw-r--r--src/Common/lzma/Alloc.c192
-rw-r--r--src/Common/lzma/Alloc.h19
-rw-r--r--src/Common/lzma/Compiler.h162
-rw-r--r--src/Common/lzma/CpuArch.c795
-rw-r--r--src/Common/lzma/CpuArch.h233
-rw-r--r--src/Common/lzma/LzFind.c519
-rw-r--r--src/Common/lzma/LzFind.h53
-rw-r--r--src/Common/lzma/LzFindMt.c70
-rw-r--r--src/Common/lzma/LzFindMt.h10
-rw-r--r--src/Common/lzma/LzFindOpt.c14
-rw-r--r--src/Common/lzma/LzHash.h8
-rw-r--r--src/Common/lzma/LzmaDec.c190
-rw-r--r--src/Common/lzma/LzmaDec.h17
-rw-r--r--src/Common/lzma/LzmaEnc.c389
-rw-r--r--src/Common/lzma/LzmaEnc.h23
-rw-r--r--src/Common/lzma/LzmaLib.c8
-rw-r--r--src/Common/lzma/LzmaLib.h12
-rw-r--r--src/Common/lzma/Precomp.h6
-rw-r--r--src/Common/lzma/Threads.c86
-rw-r--r--src/Common/lzma/Threads.h50
-rw-r--r--src/Common/lzma/lzma-history.txt40
-rw-r--r--src/Common/lzma/lzma-sdk.txt2
-rw-r--r--src/Common/reader.h271
-rw-r--r--src/Common/zlib/ChangeLog1618
-rw-r--r--src/Common/zlib/README19
-rw-r--r--src/Common/zlib/adler32.c32
-rw-r--r--src/Common/zlib/compress.c21
-rw-r--r--src/Common/zlib/crc32.c255
-rw-r--r--src/Common/zlib/deflate.c796
-rw-r--r--src/Common/zlib/deflate.h55
-rw-r--r--src/Common/zlib/gzclose.c4
-rw-r--r--src/Common/zlib/gzguts.h31
-rw-r--r--src/Common/zlib/gzlib.c113
-rw-r--r--src/Common/zlib/gzread.c96
-rw-r--r--src/Common/zlib/gzwrite.c84
-rw-r--r--src/Common/zlib/infback.c47
-rw-r--r--src/Common/zlib/inffast.c5
-rw-r--r--src/Common/zlib/inffast.h2
-rw-r--r--src/Common/zlib/inflate.c138
-rw-r--r--src/Common/zlib/inftrees.c17
-rw-r--r--src/Common/zlib/inftrees.h12
-rw-r--r--src/Common/zlib/trees.c645
-rw-r--r--src/Common/zlib/uncompr.c16
-rw-r--r--src/Common/zlib/zconf.h37
-rw-r--r--src/Common/zlib/zlib.h401
-rw-r--r--src/Common/zlib/zutil.c62
-rw-r--r--src/Common/zlib/zutil.h46
-rw-r--r--src/Core/Core.h30
-rw-r--r--src/Core/CoreBase.cpp26
-rw-r--r--src/Core/CoreBase.h8
-rw-r--r--src/Core/MountOptions.cpp9
-rw-r--r--src/Core/MountOptions.h5
-rw-r--r--src/Core/RandomNumberGenerator.cpp68
-rw-r--r--src/Core/RandomNumberGenerator.h1
-rw-r--r--src/Core/Unix/CoreService.cpp8
-rw-r--r--src/Core/Unix/CoreServiceProxy.h6
-rw-r--r--src/Core/Unix/CoreUnix.cpp26
-rw-r--r--src/Core/Unix/Linux/CoreLinux.cpp12
-rw-r--r--src/Core/Unix/MacOSX/CoreMacOSX.cpp8
-rw-r--r--src/Core/Unix/OpenBSD/CoreOpenBSD.cpp2
-rw-r--r--src/Core/VolumeCreator.cpp19
-rw-r--r--src/Core/VolumeCreator.h1
-rw-r--r--src/Crypto/Aes.h20
-rw-r--r--src/Crypto/Crypto_vs2019.vcxproj3
-rw-r--r--src/Crypto/Sha2.h12
-rw-r--r--src/Crypto/Twofish.c2
-rw-r--r--src/Crypto/Whirlpool.c6
-rw-r--r--src/Crypto/config.h8
-rw-r--r--src/Crypto/cpu.c1
-rw-r--r--src/Crypto/cpu.h6
-rw-r--r--src/Crypto/jitterentropy-base-user.h2
-rw-r--r--src/Crypto/misc.h2
-rw-r--r--src/Crypto/wolfCrypt.c243
-rw-r--r--src/Crypto/wolfCrypt.md25
-rw-r--r--src/Driver/DriveFilter.c4
-rw-r--r--src/Driver/Driver.rc8
-rw-r--r--src/Driver/EncryptedIoQueue.c2
-rw-r--r--src/Driver/EncryptedIoQueue.h1
-rw-r--r--src/Driver/Fuse/Driver.make2
-rw-r--r--src/Driver/Fuse/FuseService.cpp4
-rw-r--r--src/Driver/Ntdriver.c75
-rw-r--r--src/Driver/Ntvol.c13
-rw-r--r--src/Driver/veracrypt_vs2019.vcxproj135
-rw-r--r--src/Driver/veracrypt_vs2019.vcxproj.filters9
-rw-r--r--src/ExpandVolume/DlgExpandVolume.cpp73
-rw-r--r--src/ExpandVolume/ExpandVolume.c28
-rw-r--r--src/ExpandVolume/ExpandVolume.rc19
-rw-r--r--src/ExpandVolume/ExpandVolume.vcxproj38
-rw-r--r--src/ExpandVolume/ExpandVolume.vcxproj.filters66
-rw-r--r--src/ExpandVolume/ExpandVolume_vs2019.vcxproj52
-rw-r--r--src/ExpandVolume/ExpandVolume_vs2019.vcxproj.filters66
-rw-r--r--src/ExpandVolume/VeraCryptExpander.manifest35
-rw-r--r--src/ExpandVolume/WinMain.cpp112
-rw-r--r--src/ExpandVolume/resource.h16
-rw-r--r--src/Format/Format.manifest8
-rw-r--r--src/Format/Format.rc12
-rw-r--r--src/Format/Format.vcxproj42
-rw-r--r--src/Format/Format.vcxproj.filters66
-rw-r--r--src/Format/FormatCom.cpp52
-rw-r--r--src/Format/FormatCom.h1
-rw-r--r--src/Format/FormatCom.idl4
-rw-r--r--src/Format/Format_vs2019.vcxproj40
-rw-r--r--src/Format/InPlace.c77
-rw-r--r--src/Format/Resource.h3
-rw-r--r--src/Format/Tcformat.c225
-rw-r--r--src/LICENSE2
-rw-r--r--src/License.html36
-rw-r--r--src/License.txt53
-rw-r--r--src/Main/Application.cpp1
-rw-r--r--src/Main/CommandLineInterface.cpp33
-rw-r--r--src/Main/CommandLineInterface.h9
-rw-r--r--src/Main/Forms/AboutDialog.cpp10
-rw-r--r--src/Main/Forms/BenchmarkDialog.cpp21
-rw-r--r--src/Main/Forms/ChangePasswordDialog.cpp25
-rw-r--r--src/Main/Forms/EncryptionTestDialog.cpp10
-rw-r--r--src/Main/Forms/Forms.cpp2867
-rw-r--r--src/Main/Forms/Forms.h625
-rw-r--r--src/Main/Forms/KeyfilesPanel.cpp2
-rw-r--r--src/Main/Forms/MainFrame.cpp45
-rw-r--r--src/Main/Forms/MainFrame.h1
-rw-r--r--src/Main/Forms/MountOptionsDialog.cpp30
-rw-r--r--src/Main/Forms/PreferencesDialog.cpp64
-rw-r--r--src/Main/Forms/PreferencesDialog.h46
-rw-r--r--src/Main/Forms/SecurityTokenKeyfilesDialog.cpp42
-rw-r--r--src/Main/Forms/SecurityTokenKeyfilesDialog.h8
-rw-r--r--src/Main/Forms/TrueCrypt.fbp9379
-rw-r--r--src/Main/Forms/VolumeCreationWizard.cpp13
-rw-r--r--src/Main/Forms/VolumePasswordPanel.cpp69
-rw-r--r--src/Main/Forms/VolumePasswordPanel.h8
-rw-r--r--src/Main/Forms/VolumePasswordWizardPage.cpp2
-rw-r--r--src/Main/Forms/VolumePasswordWizardPage.h2
-rw-r--r--src/Main/Forms/VolumePimWizardPage.cpp11
-rw-r--r--src/Main/Forms/VolumePropertiesDialog.cpp2
-rw-r--r--src/Main/Forms/VolumeSizeWizardPage.cpp12
-rw-r--r--src/Main/Forms/WaitDialog.cpp21
-rw-r--r--src/Main/Forms/WizardPage.h4
-rw-r--r--src/Main/GraphicUserInterface.cpp45
-rw-r--r--src/Main/GraphicUserInterface.h10
-rw-r--r--src/Main/LanguageStrings.cpp7
-rwxr-xr-xsrc/Main/Main.make16
-rw-r--r--src/Main/Resources.cpp86
-rw-r--r--src/Main/TextUserInterface.cpp171
-rw-r--r--src/Main/TextUserInterface.h10
-rw-r--r--src/Main/Unix/Main.cpp2
-rw-r--r--src/Main/UserInterface.cpp116
-rw-r--r--src/Main/UserInterface.h10
-rw-r--r--src/Main/UserPreferences.cpp44
-rw-r--r--src/Main/UserPreferences.h8
-rw-r--r--src/Makefile64
-rw-r--r--src/Mount/Favorites.cpp49
-rw-r--r--src/Mount/Favorites.h2
-rw-r--r--src/Mount/MainCom.cpp32
-rw-r--r--src/Mount/MainCom.h2
-rw-r--r--src/Mount/MainCom.idl8
-rw-r--r--src/Mount/Mount.c610
-rw-r--r--src/Mount/Mount.h41
-rw-r--r--src/Mount/Mount.manifest8
-rw-r--r--src/Mount/Mount.rc49
-rw-r--r--src/Mount/Mount.vcxproj38
-rw-r--r--src/Mount/Mount.vcxproj.filters66
-rw-r--r--src/Mount/Mount_vs2019.vcxproj40
-rw-r--r--src/Mount/Resource.h8
-rw-r--r--src/NOTICE55
-rw-r--r--src/Platform/Exception.h3
-rw-r--r--src/Platform/SharedPtr.h2
-rw-r--r--src/Platform/Unix/File.cpp11
-rw-r--r--src/Readme.txt21
-rw-r--r--src/Release/Setup Files/Product64.wxs120
-rw-r--r--src/Release/Setup Files/veracrypt-arm64.catbin11663 -> 11734 bytes
-rw-r--r--src/Release/Setup Files/veracrypt-arm64.sysbin437768 -> 437912 bytes
-rw-r--r--src/Release/Setup Files/veracrypt-x64.catbin10682 -> 11785 bytes
-rw-r--r--src/Release/Setup Files/veracrypt-x64.sysbin811512 -> 813096 bytes
-rw-r--r--src/Release/Setup Files/veracrypt.Inf30
-rw-r--r--src/Release/Setup Files/veracrypt.catbin11649 -> 11776 bytes
-rw-r--r--src/Release/Setup Files/veracrypt.sysbin796680 -> 796832 bytes
-rw-r--r--src/Resources/Texts/License.rtf8
-rw-r--r--src/Setup/ComSetup.cpp12
-rw-r--r--src/Setup/FreeBSD/veracrypt_install_template.sh9
-rwxr-xr-x[-rw-r--r--]src/Setup/Linux/mount.veracrypt4
-rw-r--r--src/Setup/Linux/veracrypt_install_template.sh13
-rwxr-xr-xsrc/Setup/MacOSX/veracrypt.pkgproj11
-rwxr-xr-xsrc/Setup/MacOSX/veracrypt_Legacy.pkgproj4
-rw-r--r--src/Setup/Portable.manifest8
-rw-r--r--src/Setup/Portable.rc34
-rw-r--r--src/Setup/Portable.vcxproj8
-rw-r--r--src/Setup/Resource.h26
-rw-r--r--src/Setup/Setup.c109
-rw-r--r--src/Setup/Setup.h2
-rw-r--r--src/Setup/Setup.manifest8
-rw-r--r--src/Setup/Setup.rc45
-rw-r--r--src/Setup/Setup.vcxproj8
-rw-r--r--src/Setup/Wizard.c41
-rw-r--r--src/SetupDLL/Resource.h26
-rw-r--r--src/SetupDLL/Setup.c325
-rw-r--r--src/SetupDLL/Setup.rc34
-rw-r--r--src/SetupDLL/SetupDLL.vcxproj6
-rw-r--r--src/Signing/sign.bat8
-rw-r--r--src/Signing/sign_TESTSIGNING.bat4
-rw-r--r--src/Signing/sign_test.bat6
-rw-r--r--src/Signing/sign_test_debug.bat4
-rw-r--r--src/VeraCrypt_vs2019.sln8
-rw-r--r--src/Volume/Cipher.cpp58
-rw-r--r--src/Volume/Cipher.h48
-rw-r--r--src/Volume/EncryptionAlgorithm.cpp34
-rw-r--r--src/Volume/EncryptionAlgorithm.h5
-rw-r--r--src/Volume/EncryptionMode.cpp7
-rw-r--r--src/Volume/EncryptionModeWolfCryptXTS.cpp119
-rw-r--r--src/Volume/EncryptionModeWolfCryptXTS.h54
-rw-r--r--src/Volume/EncryptionModeXTS.cpp6
-rw-r--r--src/Volume/EncryptionTest.cpp66
-rw-r--r--src/Volume/Hash.cpp11
-rw-r--r--src/Volume/Hash.h4
-rw-r--r--src/Volume/Keyfile.cpp41
-rw-r--r--src/Volume/Keyfile.h4
-rw-r--r--src/Volume/Pkcs5Kdf.cpp37
-rw-r--r--src/Volume/Pkcs5Kdf.h40
-rw-r--r--src/Volume/Volume.cpp25
-rw-r--r--src/Volume/Volume.h20
-rw-r--r--src/Volume/Volume.make61
-rw-r--r--src/Volume/VolumeHeader.cpp71
-rw-r--r--src/Volume/VolumeHeader.h4
-rw-r--r--src/Volume/VolumeInfo.cpp3
-rw-r--r--src/Volume/VolumeInfo.h1
-rw-r--r--src/Volume/VolumeLayout.cpp51
-rw-r--r--src/Volume/VolumeLayout.h4
471 files changed, 27852 insertions, 20835 deletions
diff --git a/src/Boot/EFI/Readme.txt b/src/Boot/EFI/Readme.txt
index a43b0589..ed732bc2 100644
--- a/src/Boot/EFI/Readme.txt
+++ b/src/Boot/EFI/Readme.txt
@@ -5,7 +5,7 @@ VeraCrypt-DCS uses EDK II as its UEFI development environment.
VeraCrypt-DCS is licensed under LGPL: https://github.com/veracrypt/VeraCrypt-DCS/blob/master/LICENSE
Here the steps to build VeraCrypt-DCS (Visual Studio 2010 SP1 should be installed)
- * Clone EDK: git clone https://github.com/tianocore/tianocore.github.io.git edk2
+ * Clone EDK: git clone https://github.com/tianocore/edk2.git edk2
* Switch to UDK2015 branche: git checkout UDK2015
* Clone VeraCrypt-DCS as DcsPkg inside edk2 folder: git clone https://github.com/veracrypt/VeraCrypt-DCS.git DcsPkg
* Switch to VeraCrypt_1.18 branche: git checkout VeraCrypt_1.18
diff --git a/src/Boot/Windows/Release/BootLoader.com.gz b/src/Boot/Windows/Release/BootLoader.com.gz
index d4cd2a66..b2859c5e 100644
--- a/src/Boot/Windows/Release/BootLoader.com.gz
+++ b/src/Boot/Windows/Release/BootLoader.com.gz
Binary files differ
diff --git a/src/Boot/Windows/Release_AES/BootLoader.com.gz b/src/Boot/Windows/Release_AES/BootLoader.com.gz
index de7d9c35..dda3c191 100644
--- a/src/Boot/Windows/Release_AES/BootLoader.com.gz
+++ b/src/Boot/Windows/Release_AES/BootLoader.com.gz
Binary files differ
diff --git a/src/Boot/Windows/Release_AES_SHA2/BootLoader.com.gz b/src/Boot/Windows/Release_AES_SHA2/BootLoader.com.gz
index 42c271aa..89bbd0bb 100644
--- a/src/Boot/Windows/Release_AES_SHA2/BootLoader.com.gz
+++ b/src/Boot/Windows/Release_AES_SHA2/BootLoader.com.gz
Binary files differ
diff --git a/src/Boot/Windows/Release_Camellia/BootLoader.com.gz b/src/Boot/Windows/Release_Camellia/BootLoader.com.gz
index 090efd03..e4113bbc 100644
--- a/src/Boot/Windows/Release_Camellia/BootLoader.com.gz
+++ b/src/Boot/Windows/Release_Camellia/BootLoader.com.gz
Binary files differ
diff --git a/src/Boot/Windows/Release_Camellia_SHA2/BootLoader.com.gz b/src/Boot/Windows/Release_Camellia_SHA2/BootLoader.com.gz
index 13ff1405..a7351aff 100644
--- a/src/Boot/Windows/Release_Camellia_SHA2/BootLoader.com.gz
+++ b/src/Boot/Windows/Release_Camellia_SHA2/BootLoader.com.gz
Binary files differ
diff --git a/src/Boot/Windows/Release_SHA2/BootLoader.com.gz b/src/Boot/Windows/Release_SHA2/BootLoader.com.gz
index d596c445..5cc3ac4a 100644
--- a/src/Boot/Windows/Release_SHA2/BootLoader.com.gz
+++ b/src/Boot/Windows/Release_SHA2/BootLoader.com.gz
Binary files differ
diff --git a/src/Boot/Windows/Release_Serpent/BootLoader.com.gz b/src/Boot/Windows/Release_Serpent/BootLoader.com.gz
index 9cb0b0cb..93d50bd2 100644
--- a/src/Boot/Windows/Release_Serpent/BootLoader.com.gz
+++ b/src/Boot/Windows/Release_Serpent/BootLoader.com.gz
Binary files differ
diff --git a/src/Boot/Windows/Release_Serpent_SHA2/BootLoader.com.gz b/src/Boot/Windows/Release_Serpent_SHA2/BootLoader.com.gz
index 7353e440..9e11a85b 100644
--- a/src/Boot/Windows/Release_Serpent_SHA2/BootLoader.com.gz
+++ b/src/Boot/Windows/Release_Serpent_SHA2/BootLoader.com.gz
Binary files differ
diff --git a/src/Boot/Windows/Release_Twofish/BootLoader.com.gz b/src/Boot/Windows/Release_Twofish/BootLoader.com.gz
index 69e3b264..50ef7af2 100644
--- a/src/Boot/Windows/Release_Twofish/BootLoader.com.gz
+++ b/src/Boot/Windows/Release_Twofish/BootLoader.com.gz
Binary files differ
diff --git a/src/Boot/Windows/Release_Twofish_SHA2/BootLoader.com.gz b/src/Boot/Windows/Release_Twofish_SHA2/BootLoader.com.gz
index 6e008a19..17654817 100644
--- a/src/Boot/Windows/Release_Twofish_SHA2/BootLoader.com.gz
+++ b/src/Boot/Windows/Release_Twofish_SHA2/BootLoader.com.gz
Binary files differ
diff --git a/src/Boot/Windows/Rescue/BootLoader.com.gz b/src/Boot/Windows/Rescue/BootLoader.com.gz
index 3e6ee5c3..dde75739 100644
--- a/src/Boot/Windows/Rescue/BootLoader.com.gz
+++ b/src/Boot/Windows/Rescue/BootLoader.com.gz
Binary files differ
diff --git a/src/Boot/Windows/Rescue_AES/BootLoader.com.gz b/src/Boot/Windows/Rescue_AES/BootLoader.com.gz
index 6a3cfdcb..5bca6dd3 100644
--- a/src/Boot/Windows/Rescue_AES/BootLoader.com.gz
+++ b/src/Boot/Windows/Rescue_AES/BootLoader.com.gz
Binary files differ
diff --git a/src/Boot/Windows/Rescue_AES_SHA2/BootLoader.com.gz b/src/Boot/Windows/Rescue_AES_SHA2/BootLoader.com.gz
index 0cb31996..a3a50d81 100644
--- a/src/Boot/Windows/Rescue_AES_SHA2/BootLoader.com.gz
+++ b/src/Boot/Windows/Rescue_AES_SHA2/BootLoader.com.gz
Binary files differ
diff --git a/src/Boot/Windows/Rescue_Camellia/BootLoader.com.gz b/src/Boot/Windows/Rescue_Camellia/BootLoader.com.gz
index 7c934a57..82e823dc 100644
--- a/src/Boot/Windows/Rescue_Camellia/BootLoader.com.gz
+++ b/src/Boot/Windows/Rescue_Camellia/BootLoader.com.gz
Binary files differ
diff --git a/src/Boot/Windows/Rescue_Camellia_SHA2/BootLoader.com.gz b/src/Boot/Windows/Rescue_Camellia_SHA2/BootLoader.com.gz
index ca2952aa..978d43ae 100644
--- a/src/Boot/Windows/Rescue_Camellia_SHA2/BootLoader.com.gz
+++ b/src/Boot/Windows/Rescue_Camellia_SHA2/BootLoader.com.gz
Binary files differ
diff --git a/src/Boot/Windows/Rescue_SHA2/BootLoader.com.gz b/src/Boot/Windows/Rescue_SHA2/BootLoader.com.gz
index 3a9410ba..bb4fd841 100644
--- a/src/Boot/Windows/Rescue_SHA2/BootLoader.com.gz
+++ b/src/Boot/Windows/Rescue_SHA2/BootLoader.com.gz
Binary files differ
diff --git a/src/Boot/Windows/Rescue_Serpent/BootLoader.com.gz b/src/Boot/Windows/Rescue_Serpent/BootLoader.com.gz
index cd6fe5d5..b2cc5727 100644
--- a/src/Boot/Windows/Rescue_Serpent/BootLoader.com.gz
+++ b/src/Boot/Windows/Rescue_Serpent/BootLoader.com.gz
Binary files differ
diff --git a/src/Boot/Windows/Rescue_Serpent_SHA2/BootLoader.com.gz b/src/Boot/Windows/Rescue_Serpent_SHA2/BootLoader.com.gz
index 37d4d02b..e1e0ac0e 100644
--- a/src/Boot/Windows/Rescue_Serpent_SHA2/BootLoader.com.gz
+++ b/src/Boot/Windows/Rescue_Serpent_SHA2/BootLoader.com.gz
Binary files differ
diff --git a/src/Boot/Windows/Rescue_Twofish/BootLoader.com.gz b/src/Boot/Windows/Rescue_Twofish/BootLoader.com.gz
index 6a2d1c5f..fd17642e 100644
--- a/src/Boot/Windows/Rescue_Twofish/BootLoader.com.gz
+++ b/src/Boot/Windows/Rescue_Twofish/BootLoader.com.gz
Binary files differ
diff --git a/src/Boot/Windows/Rescue_Twofish_SHA2/BootLoader.com.gz b/src/Boot/Windows/Rescue_Twofish_SHA2/BootLoader.com.gz
index f262a558..49afd19b 100644
--- a/src/Boot/Windows/Rescue_Twofish_SHA2/BootLoader.com.gz
+++ b/src/Boot/Windows/Rescue_Twofish_SHA2/BootLoader.com.gz
Binary files differ
diff --git a/src/Build/CMakeLists.txt b/src/Build/CMakeLists.txt
index 24c37df9..288370dd 100644
--- a/src/Build/CMakeLists.txt
+++ b/src/Build/CMakeLists.txt
@@ -11,8 +11,8 @@ elseif ( NOT DEFINED NOGUI )
endif()
# - Set version of the package
-set( FULL_VERSION "1.26.0" )
-set( VERSION "1.26.0" )
+set( FULL_VERSION "1.26.10" )
+set( VERSION "1.26.10" )
set( RELEASE "1" )
# - Set PROJECT_NAME and CONFLICT_PACKAGE values
@@ -247,22 +247,27 @@ if ( ( PLATFORM STREQUAL "Debian" ) OR ( PLATFORM STREQUAL "Ubuntu" ) )
if (NOGUI)
# Link against statically built wxWidgets so that we don't depend on any GTK library
- set( CPACK_DEBIAN_PACKAGE_DEPENDS "libfuse2, dmsetup, sudo" )
+ set( CPACK_DEBIAN_PACKAGE_DEPENDS "libfuse2, dmsetup, sudo, libpcsclite1, pcscd" )
else ()
# Link against gtk3 version of wxWidgets if >= Debian 10 or >= Ubuntu 18.04
# Otherwise, link against gtk2 version of wxWidgets
- if ( ( ( PLATFORM STREQUAL "Debian" ) AND ( PLATFORM_VERSION VERSION_GREATER_EQUAL "10" ) )
+ if ( ( ( PLATFORM STREQUAL "Debian" ) AND ( PLATFORM_VERSION VERSION_GREATER_EQUAL "12" ) )
+ OR ( ( PLATFORM STREQUAL "Ubuntu" ) AND ( PLATFORM_VERSION VERSION_GREATER_EQUAL "23.04" ) ) )
+
+ set( CPACK_DEBIAN_PACKAGE_DEPENDS "libwxgtk3.2-1, libayatana-appindicator3-1, libfuse2, dmsetup, sudo, libpcsclite1, pcscd" )
+
+ elseif ( ( ( PLATFORM STREQUAL "Debian" ) AND ( PLATFORM_VERSION VERSION_GREATER_EQUAL "10" ) )
OR ( ( PLATFORM STREQUAL "Ubuntu" ) AND ( PLATFORM_VERSION VERSION_GREATER_EQUAL "18.04" ) ) )
- set( CPACK_DEBIAN_PACKAGE_DEPENDS "libwxgtk3.0-gtk3-0v5, libayatana-appindicator3-1, libfuse2, dmsetup, sudo" )
+ set( CPACK_DEBIAN_PACKAGE_DEPENDS "libwxgtk3.0-gtk3-0v5, libayatana-appindicator3-1, libfuse2, dmsetup, sudo, libpcsclite1, pcscd" )
else ()
# Link against statically built wxWidgets on Ubuntu 14.04 and older, and Debian 8 and older
if ( ( ( PLATFORM STREQUAL "Debian" ) AND ( PLATFORM_VERSION VERSION_LESS_EQUAL "8" ) )
OR ( ( PLATFORM STREQUAL "Ubuntu" ) AND ( PLATFORM_VERSION VERSION_LESS_EQUAL "14.04" ) ) )
- set( CPACK_DEBIAN_PACKAGE_DEPENDS "libgtk2.0-0, libfuse2, dmsetup, sudo" )
+ set( CPACK_DEBIAN_PACKAGE_DEPENDS "libgtk2.0-0, libfuse2, dmsetup, sudo, libpcsclite1, pcscd" )
else ()
- set( CPACK_DEBIAN_PACKAGE_DEPENDS "libwxgtk3.0-0v5, libfuse2, dmsetup, sudo" )
+ set( CPACK_DEBIAN_PACKAGE_DEPENDS "libwxgtk3.0-0v5, libfuse2, dmsetup, sudo, libpcsclite1, pcscd" )
endif ()
endif()
@@ -303,14 +308,14 @@ elseif ( ( PLATFORM STREQUAL "CentOS" ) OR ( PLATFORM STREQUAL "openSUSE" ) )
if ( PLATFORM STREQUAL "CentOS" )
if ( DEFINED WITHGTK3 AND WITHGTK3 )
- set( CPACK_RPM_PACKAGE_REQUIRES "fuse, device-mapper, gtk3, sudo" )
+ set( CPACK_RPM_PACKAGE_REQUIRES "fuse, device-mapper, gtk3, sudo, pcsc-lite" )
else ()
- set( CPACK_RPM_PACKAGE_REQUIRES "fuse, device-mapper, gtk2, sudo" )
+ set( CPACK_RPM_PACKAGE_REQUIRES "fuse, device-mapper, gtk2, sudo, pcsc-lite" )
endif()
elseif ( PLATFORM STREQUAL "openSUSE" )
- set( CPACK_RPM_PACKAGE_REQUIRES "fuse, device-mapper, gtk2, sudo" )
+ set( CPACK_RPM_PACKAGE_REQUIRES "fuse, device-mapper, gtk2, sudo, pcsc-lite" )
endif()
endif()
diff --git a/src/Build/Resources/MacOSX/Info.plist.legacy.xml b/src/Build/Resources/MacOSX/Info.plist.legacy.xml
index ffe0ed69..6b86f9f5 100644
--- a/src/Build/Resources/MacOSX/Info.plist.legacy.xml
+++ b/src/Build/Resources/MacOSX/Info.plist.legacy.xml
@@ -74,7 +74,7 @@
<string>TRUE</string>
<key>CFBundleVersion</key>
- <string>1.26.0</string>
+ <string>1.26.10</string>
<key>CFBundleShortVersionString</key>
<string>_VERSION_</string>
diff --git a/src/Build/Resources/MacOSX/Info.plist.xml b/src/Build/Resources/MacOSX/Info.plist.xml
index d4729eff..1a12d6bf 100644
--- a/src/Build/Resources/MacOSX/Info.plist.xml
+++ b/src/Build/Resources/MacOSX/Info.plist.xml
@@ -74,7 +74,7 @@
<string>TRUE</string>
<key>CFBundleVersion</key>
- <string>1.26.0</string>
+ <string>1.26.10</string>
<key>CFBundleShortVersionString</key>
<string>_VERSION_</string>
diff --git a/src/Build/build_cmake_deb.sh b/src/Build/build_cmake_deb.sh
index e02edf2f..a6263a90 100755
--- a/src/Build/build_cmake_deb.sh
+++ b/src/Build/build_cmake_deb.sh
@@ -18,8 +18,8 @@ export SOURCEPATH=$(readlink -f "$SCRIPTPATH/..")
# Directory where the VeraCrypt has been checked out
export PARENTDIR=$(readlink -f "$SCRIPTPATH/../../..")
-# The sources of wxWidgets 3.0.5 must be extracted to the parent directory
-export WX_ROOT=$PARENTDIR/wxWidgets-3.0.5
+# The sources of wxWidgets 3.2.2.1 must be extracted to the parent directory
+export WX_ROOT=$PARENTDIR/wxWidgets-3.2.2.1
echo "Using wxWidgets sources in $WX_ROOT"
cd $SOURCEPATH
diff --git a/src/Build/build_cmake_opensuse.sh b/src/Build/build_cmake_opensuse.sh
index 81ca47cf..622eb4cd 100644
--- a/src/Build/build_cmake_opensuse.sh
+++ b/src/Build/build_cmake_opensuse.sh
@@ -18,8 +18,8 @@ export SOURCEPATH=$(readlink -f "$SCRIPTPATH/..")
# Directory where the VeraCrypt has been checked out
export PARENTDIR=$(readlink -f "$SCRIPTPATH/../../..")
-# The sources of wxWidgets 3.0.5 must be extracted to the parent directory
-export WX_ROOT=$PARENTDIR/wxWidgets-3.0.5
+# The sources of wxWidgets 3.2.2.1 must be extracted to the parent directory
+export WX_ROOT=$PARENTDIR/wxWidgets-3.2.2.1
echo "Using wxWidgets sources in $WX_ROOT"
cd $SOURCEPATH
diff --git a/src/Build/build_cmake_rpm_gtk2.sh b/src/Build/build_cmake_rpm_gtk2.sh
index 23472356..3f33cc1c 100644
--- a/src/Build/build_cmake_rpm_gtk2.sh
+++ b/src/Build/build_cmake_rpm_gtk2.sh
@@ -18,8 +18,8 @@ export SOURCEPATH=$(readlink -f "$SCRIPTPATH/..")
# Directory where the VeraCrypt has been checked out
export PARENTDIR=$(readlink -f "$SCRIPTPATH/../../..")
-# The sources of wxWidgets 3.0.5 must be extracted to the parent directory
-export WX_ROOT=$PARENTDIR/wxWidgets-3.0.5
+# The sources of wxWidgets 3.2.2.1 must be extracted to the parent directory
+export WX_ROOT=$PARENTDIR/wxWidgets-3.2.2.1
echo "Using wxWidgets sources in $WX_ROOT"
cd $SOURCEPATH
diff --git a/src/Build/build_cmake_rpm_gtk3.sh b/src/Build/build_cmake_rpm_gtk3.sh
index e13b5d06..72556dcf 100644
--- a/src/Build/build_cmake_rpm_gtk3.sh
+++ b/src/Build/build_cmake_rpm_gtk3.sh
@@ -18,8 +18,8 @@ export SOURCEPATH=$(readlink -f "$SCRIPTPATH/..")
# Directory where the VeraCrypt has been checked out
export PARENTDIR=$(readlink -f "$SCRIPTPATH/../../..")
-# The sources of wxWidgets 3.0.5 must be extracted to the parent directory
-export WX_ROOT=$PARENTDIR/wxWidgets-3.0.5
+# The sources of wxWidgets 3.2.2.1 must be extracted to the parent directory
+export WX_ROOT=$PARENTDIR/wxWidgets-3.2.2.1
echo "Using wxWidgets sources in $WX_ROOT"
cd $SOURCEPATH
diff --git a/src/Build/build_veracrypt_freebsd.sh b/src/Build/build_veracrypt_freebsd.sh
index 33f4bf48..176c8499 100755
--- a/src/Build/build_veracrypt_freebsd.sh
+++ b/src/Build/build_veracrypt_freebsd.sh
@@ -21,8 +21,8 @@ if [ "$(id -u)" != "0" ]; then
exit 1
fi
-# the sources of wxWidgets 3.0.5 must be extracted to the parent directory
-export WX_ROOT=$PARENTDIR/wxWidgets-3.0.5
+# the sources of wxWidgets 3.2.2.1 must be extracted to the parent directory
+export WX_ROOT=$PARENTDIR/wxWidgets-3.2.2.1
echo "Using wxWidgets sources in $WX_ROOT"
cd $SOURCEPATH
diff --git a/src/Build/build_veracrypt_linux.sh b/src/Build/build_veracrypt_linux.sh
index 7815e63f..fa928556 100755
--- a/src/Build/build_veracrypt_linux.sh
+++ b/src/Build/build_veracrypt_linux.sh
@@ -20,8 +20,8 @@ if [ "$(id -u)" != "0" ]; then
exit 1
fi
-# the sources of wxWidgets 3.0.5 must be extracted to the parent directory
-export WX_ROOT=$PARENTDIR/wxWidgets-3.0.5
+# the sources of wxWidgets 3.2.2.1 must be extracted to the parent directory
+export WX_ROOT=$PARENTDIR/wxWidgets-3.2.2.1
echo "Using wxWidgets sources in $WX_ROOT"
cd $SOURCEPATH
diff --git a/src/Build/build_veracrypt_linux_gtk3.sh b/src/Build/build_veracrypt_linux_gtk3.sh
index d5a7444a..bae6a856 100644
--- a/src/Build/build_veracrypt_linux_gtk3.sh
+++ b/src/Build/build_veracrypt_linux_gtk3.sh
@@ -20,8 +20,8 @@ if [ "$(id -u)" != "0" ]; then
exit 1
fi
-# the sources of wxWidgets 3.0.5 must be extracted to the parent directory
-export WX_ROOT=$PARENTDIR/wxWidgets-3.0.5
+# the sources of wxWidgets 3.2.2.1 must be extracted to the parent directory
+export WX_ROOT=$PARENTDIR/wxWidgets-3.2.2.1
echo "Using wxWidgets sources in $WX_ROOT"
cd $SOURCEPATH
diff --git a/src/Build/build_veracrypt_linux_no_sse2.sh b/src/Build/build_veracrypt_linux_no_sse2.sh
index 2916f846..f68641b9 100755
--- a/src/Build/build_veracrypt_linux_no_sse2.sh
+++ b/src/Build/build_veracrypt_linux_no_sse2.sh
@@ -20,8 +20,8 @@ if [ "$(id -u)" != "0" ]; then
exit 1
fi
-# the sources of wxWidgets 3.0.5 must be extracted to the parent directory
-export WX_ROOT=$PARENTDIR/wxWidgets-3.0.5
+# the sources of wxWidgets 3.2.2.1 must be extracted to the parent directory
+export WX_ROOT=$PARENTDIR/wxWidgets-3.2.2.1
echo "Using wxWidgets sources in $WX_ROOT"
cd $SOURCEPATH
diff --git a/src/Build/build_veracrypt_macosx.sh b/src/Build/build_veracrypt_macosx.sh
index 4636d27d..12899620 100755
--- a/src/Build/build_veracrypt_macosx.sh
+++ b/src/Build/build_veracrypt_macosx.sh
@@ -13,15 +13,15 @@ SOURCEPATH=$(cd "$(dirname "$SCRIPTPATH/../.")"; pwd)
PARENTDIR=$(cd "$(dirname "$SCRIPTPATH/../../../.")"; pwd)
# the sources of wxWidgets 3.1.2 must be extracted to the parent directory (for night mode)
-export WX_ROOT=$PARENTDIR/wxWidgets-3.1.2
+export WX_ROOT=$PARENTDIR/wxWidgets-3.2.2.1
echo "Using wxWidgets sources in $WX_ROOT"
# this will be the temporary wxWidgets directory
-export WX_BUILD_DIR=$PARENTDIR/wxBuild-3.1.2
+export WX_BUILD_DIR=$PARENTDIR/wxBuild-3.2.2.1
# define the SDK version to use and OSX minimum target. We target 10.9 by default
-export VC_OSX_TARGET=10.9
-export VC_OSX_SDK=11.3
+export VC_OSX_TARGET=12
+export VC_OSX_SDK=13
echo "Using MacOSX SDK $VC_OSX_SDK with target set to $VC_OSX_TARGET"
cd $SOURCEPATH
@@ -30,4 +30,5 @@ echo "Building VeraCrypt"
make WXSTATIC=FULL wxbuild && make WXSTATIC=FULL clean && make WXSTATIC=FULL && make WXSTATIC=FULL package
# Uncomment below and comment line above to reuse existing wxWidgets build
-# make WXSTATIC=FULL clean && make WXSTATIC=FULL && make WXSTATIC=FULL package \ No newline at end of file
+# make WXSTATIC=FULL clean && make WXSTATIC=FULL && make WXSTATIC=FULL package
+
diff --git a/src/COMReg/COMReg.rc b/src/COMReg/COMReg.rc
index 9923286e..0f789fec 100644
--- a/src/COMReg/COMReg.rc
+++ b/src/COMReg/COMReg.rc
@@ -27,8 +27,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,26,0,0
- PRODUCTVERSION 1,26,0,0
+ FILEVERSION 1,26,10,0
+ PRODUCTVERSION 1,26,10,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -45,11 +45,11 @@ BEGIN
BEGIN
VALUE "CompanyName", "IDRIX"
VALUE "FileDescription", "VeraCrypt COMReg"
- VALUE "FileVersion", "1.26"
+ VALUE "FileVersion", "1.26.10"
VALUE "LegalTrademarks", "VeraCrypt"
VALUE "OriginalFilename", "VeraCrypt COMReg.exe"
VALUE "ProductName", "VeraCrypt"
- VALUE "ProductVersion", "1.26"
+ VALUE "ProductVersion", "1.26.10"
END
END
BLOCK "VarFileInfo"
diff --git a/src/Common/Apidrvr.h b/src/Common/Apidrvr.h
index 2eddc3dd..463d4fa6 100644
--- a/src/Common/Apidrvr.h
+++ b/src/Common/Apidrvr.h
@@ -129,10 +129,6 @@
#define VC_IOCTL_ENCRYPTION_QUEUE_PARAMS TC_IOCTL (43)
-// Legacy IOCTLs used before version 5.0
-#define TC_IOCTL_LEGACY_GET_DRIVER_VERSION 466968
-#define TC_IOCTL_LEGACY_GET_MOUNTED_VOLUMES 466948
-
// Undocumented IOCTL sent by Windows 10 when handling EFS data on volumes
#define IOCTL_UNKNOWN_WINDOWS10_EFS_ACCESS 0x455610D8
@@ -170,7 +166,7 @@ typedef struct
BOOL RecoveryMode;
int pkcs5_prf;
int ProtectedHidVolPkcs5Prf;
- BOOL bTrueCryptMode;
+ BOOL VolumeMountedReadOnlyAfterPartialSysEnc;
uint32 BytesPerPhysicalSector;
int VolumePim;
int ProtectedHidVolPim;
@@ -200,7 +196,7 @@ typedef struct
unsigned __int64 diskLength[26];
int ea[26];
int volumeType[26]; /* Volume type (e.g. PROP_VOL_TYPE_OUTER, PROP_VOL_TYPE_OUTER_VOL_WRITE_PREVENTED, etc.) */
- BOOL truecryptMode[26];
+ BOOL reserved[26]; /* needed to keep the same size for the structure so that installer of new version can communicate with installed old version */
} MOUNT_LIST_STRUCT;
typedef struct
@@ -422,6 +418,8 @@ typedef struct
#define VC_ERASE_KEYS_SHUTDOWN DRIVER_STR("VeraCryptEraseKeysShutdown")
+#define VC_ENABLE_MEMORY_PROTECTION DRIVER_STR("VeraCryptEnableMemoryProtection")
+
// WARNING: Modifying the following values can introduce incompatibility with previous versions.
#define TC_DRIVER_CONFIG_CACHE_BOOT_PASSWORD 0x1
#define TC_DRIVER_CONFIG_CACHE_BOOT_PASSWORD_FOR_SYS_FAVORITES 0x2
diff --git a/src/Common/BaseCom.cpp b/src/Common/BaseCom.cpp
index 32859b11..3eaaf809 100644
--- a/src/Common/BaseCom.cpp
+++ b/src/Common/BaseCom.cpp
@@ -45,12 +45,13 @@ HRESULT CreateElevatedComObject (HWND hwnd, REFGUID guid, REFIID iid, void **ppv
BOOL ComGetInstanceBase (HWND hWnd, REFCLSID clsid, REFIID iid, void **tcServer)
{
BOOL r;
+ HRESULT hr;
if (IsUacSupported ())
{
while (true)
{
- r = CreateElevatedComObject (hWnd, clsid, iid, tcServer) == S_OK;
+ r = (hr = CreateElevatedComObject (hWnd, clsid, iid, tcServer)) == S_OK;
if (r)
break;
else
@@ -64,11 +65,16 @@ BOOL ComGetInstanceBase (HWND hWnd, REFCLSID clsid, REFIID iid, void **tcServer)
}
else
{
- r = CoCreateInstance (clsid, NULL, CLSCTX_LOCAL_SERVER, iid, tcServer) == S_OK;
+ r = (hr = CoCreateInstance (clsid, NULL, CLSCTX_LOCAL_SERVER, iid, tcServer)) == S_OK;
if (!r)
Error ("UAC_INIT_ERROR", hWnd);
}
+ if (!r)
+ {
+ SetLastError((DWORD) hr);
+ }
+
return r;
}
@@ -485,4 +491,14 @@ DWORD BaseCom::UpdateSetupConfigFile (BOOL bForInstall)
}
return ERROR_SUCCESS;
-} \ No newline at end of file
+}
+
+DWORD BaseCom::NotifyService(DWORD dwNotifyCode)
+{
+ return SendServiceNotification(dwNotifyCode);
+}
+
+DWORD BaseCom::FastFileResize (BSTR filePath, __int64 fileSize)
+{
+ return ::FastResizeFile (filePath, fileSize);
+}
diff --git a/src/Common/BaseCom.h b/src/Common/BaseCom.h
index eaf0f8d1..431b0257 100644
--- a/src/Common/BaseCom.h
+++ b/src/Common/BaseCom.h
@@ -119,6 +119,9 @@ public:
static DWORD WriteEfiBootSectorUserConfig (DWORD userConfig, BSTR customUserMessage, int pim, int hashAlg);
static DWORD UpdateSetupConfigFile (BOOL bForInstall);
static DWORD GetSecureBootConfig (BOOL* pSecureBootEnabled, BOOL *pVeraCryptKeysLoaded);
+ static DWORD NotifyService (DWORD dwNotifyCode);
+ static DWORD FastFileResize (BSTR filePath, __int64 fileSize);
+
};
diff --git a/src/Common/BootEncryption.cpp b/src/Common/BootEncryption.cpp
index 079eacc6..af6063e4 100644
--- a/src/Common/BootEncryption.cpp
+++ b/src/Common/BootEncryption.cpp
@@ -667,6 +667,18 @@ namespace VeraCrypt
}
}
+ static void NotifyService (DWORD dwNotifyCmd)
+ {
+ Elevate();
+
+ DWORD result = ElevatedComInstance->NotifyService (dwNotifyCmd);
+ if (result != ERROR_SUCCESS)
+ {
+ SetLastError (result);
+ throw SystemException(SRC_POS);
+ }
+ }
+
static void Release ()
{
if (--ReferenceCount == 0 && ElevatedComInstance)
@@ -700,7 +712,7 @@ namespace VeraCrypt
if (!ElevatedComInstance || ElevatedComInstanceThreadId != GetCurrentThreadId())
{
- CoInitialize (NULL);
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
ElevatedComInstance = GetElevatedInstance (GetActiveWindow() ? GetActiveWindow() : MainDlg);
ElevatedComInstanceThreadId = GetCurrentThreadId();
}
@@ -1136,7 +1148,7 @@ namespace VeraCrypt
if (partition.Info.PartitionNumber != config.SystemPartition.Number)
{
// If there is an extra boot partition, the system partition must be located right behind it
- if (IsOSAtLeast (WIN_7) && config.ExtraBootPartitionPresent)
+ if (config.ExtraBootPartitionPresent)
{
int64 minOffsetFound = config.DrivePartition.Info.PartitionLength.QuadPart;
Partition bootPartition = partition;
@@ -1264,32 +1276,9 @@ namespace VeraCrypt
finally_do_arg (SC_HANDLE, service, { CloseServiceHandle (finally_arg); });
- // Windows versions preceding Vista can be installed on FAT filesystem which does not
- // support long filenames during boot. Convert the driver path to short form if required.
- wstring driverPath;
- if (startOnBoot && !IsOSAtLeast (WIN_VISTA))
- {
- wchar_t pathBuf[MAX_PATH];
- wchar_t filesystem[128];
-
- wstring path (GetWindowsDirectory());
- path += L"\\drivers\\veracrypt.sys";
-
- if (GetVolumePathName (path.c_str(), pathBuf, ARRAYSIZE (pathBuf))
- && GetVolumeInformation (pathBuf, NULL, 0, NULL, NULL, NULL, filesystem, ARRAYSIZE(filesystem))
- && wmemcmp (filesystem, L"FAT", 3) == 0)
- {
- throw_sys_if (GetShortPathName (path.c_str(), pathBuf, ARRAYSIZE (pathBuf)) == 0);
-
- // Convert absolute path to relative to the Windows directory
- driverPath = pathBuf;
- driverPath = driverPath.substr (driverPath.rfind (L"\\", driverPath.rfind (L"\\", driverPath.rfind (L"\\") - 1) - 1) + 1);
- }
- }
-
throw_sys_if (!ChangeServiceConfig (service, SERVICE_NO_CHANGE, SERVICE_NO_CHANGE,
startOnBoot ? SERVICE_ERROR_SEVERE : SERVICE_ERROR_NORMAL,
- driverPath.empty() ? NULL : driverPath.c_str(),
+ NULL,
startOnBoot ? L"Filter" : NULL,
NULL, NULL, NULL, NULL, NULL));
@@ -1649,8 +1638,7 @@ namespace VeraCrypt
{
SystemDriveConfiguration config = GetSystemDriveConfiguration();
- if (IsOSAtLeast (WIN_7)
- && config.Partitions.size() == 2
+ if (config.Partitions.size() == 2
&& config.ExtraBootPartitionPresent
&& config.DrivePartition.Info.PartitionLength.QuadPart - config.SystemPartition.Info.PartitionLength.QuadPart < 164 * BYTES_PER_MB)
{
@@ -1699,23 +1687,26 @@ namespace VeraCrypt
if (_stricmp (request.BootEncryptionAlgorithmName, "AES") == 0)
ea = AES;
- else if (_stricmp (request.BootEncryptionAlgorithmName, "Serpent") == 0)
+ #ifndef WOLFCRYPT_BACKEND
+ else if (_stricmp (request.BootEncryptionAlgorithmName, "Camellia") == 0)
+ ea = CAMELLIA;
+ else if (_stricmp (request.BootEncryptionAlgorithmName, "Serpent") == 0)
ea = SERPENT;
else if (_stricmp (request.BootEncryptionAlgorithmName, "Twofish") == 0)
ea = TWOFISH;
- else if (_stricmp (request.BootEncryptionAlgorithmName, "Camellia") == 0)
- ea = CAMELLIA;
-
+ #endif
if (_stricmp(request.BootPrfAlgorithmName, "SHA-256") == 0)
pkcs5_prf = SHA256;
- else if (_stricmp(request.BootPrfAlgorithmName, "BLAKE2s-256") == 0)
- pkcs5_prf = BLAKE2S;
- else if (_stricmp(request.BootPrfAlgorithmName, "SHA-512") == 0)
+ else if (_stricmp(request.BootPrfAlgorithmName, "SHA-512") == 0)
pkcs5_prf = SHA512;
+ #ifndef WOLFCRYPT_BACKEND
+ else if (_stricmp(request.BootPrfAlgorithmName, "BLAKE2s-256") == 0)
+ pkcs5_prf = BLAKE2S;
else if (_stricmp(request.BootPrfAlgorithmName, "Whirlpool") == 0)
pkcs5_prf = WHIRLPOOL;
else if (_stricmp(request.BootPrfAlgorithmName, "Streebog") == 0)
pkcs5_prf = STREEBOG;
+ #endif
else if (strlen(request.BootPrfAlgorithmName) == 0) // case of version < 1.0f
pkcs5_prf = BLAKE2S;
}
@@ -1826,8 +1817,7 @@ namespace VeraCrypt
*(uint16 *) (buffer + TC_BOOT_SECTOR_VERSION_OFFSET) = BE16 (VERSION_NUM);
- if (IsOSAtLeast (WIN_VISTA))
- buffer[TC_BOOT_SECTOR_CONFIG_OFFSET] |= TC_BOOT_CFG_FLAG_WINDOWS_VISTA_OR_LATER;
+ buffer[TC_BOOT_SECTOR_CONFIG_OFFSET] |= TC_BOOT_CFG_FLAG_WINDOWS_VISTA_OR_LATER;
if (rescueDisk && (ReadDriverConfigurationFlags() & TC_DRIVER_CONFIG_DISABLE_HARDWARE_ENCRYPTION))
buffer[TC_BOOT_SECTOR_CONFIG_OFFSET] |= TC_BOOT_CFG_FLAG_RESCUE_DISABLE_HW_ENCRYPTION;
@@ -4372,7 +4362,7 @@ namespace VeraCrypt
// Initial rescue disk assumes encryption of the drive has been completed (EncryptedAreaLength == volumeSize)
memcpy (RescueVolumeHeader, VolumeHeader, sizeof (RescueVolumeHeader));
- if (0 != ReadVolumeHeader (TRUE, (char *) RescueVolumeHeader, password, pkcs5, pim, FALSE, NULL, cryptoInfo))
+ if (0 != ReadVolumeHeader (TRUE, (char *) RescueVolumeHeader, password, pkcs5, pim, NULL, cryptoInfo))
throw ParameterIncorrect (SRC_POS);
DecryptBuffer (RescueVolumeHeader + HEADER_ENCRYPTED_DATA_OFFSET, HEADER_ENCRYPTED_DATA_SIZE, cryptoInfo);
@@ -4733,9 +4723,6 @@ namespace VeraCrypt
break;
case DumpFilter:
- if (!IsOSAtLeast (WIN_VISTA))
- return;
-
filter = "veracrypt.sys";
filterReg = "DumpFilters";
SetLastError (RegOpenKeyEx (HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\CrashControl", 0, KEY_READ | KEY_WRITE, &regKey));
@@ -5069,7 +5056,7 @@ namespace VeraCrypt
void BootEncryption::SetServiceConfigurationFlag (uint32 flag, bool state)
{
- DWORD configMap = ReadDriverConfigurationFlags();
+ DWORD configMap = ReadServiceConfigurationFlags();
if (state)
configMap |= flag;
@@ -5411,7 +5398,7 @@ namespace VeraCrypt
PCRYPTO_INFO cryptoInfo = NULL;
- int status = ReadVolumeHeader (!encStatus.HiddenSystem, header, oldPassword, old_pkcs5, old_pim, FALSE, &cryptoInfo, NULL);
+ int status = ReadVolumeHeader (!encStatus.HiddenSystem, header, oldPassword, old_pkcs5, old_pim, &cryptoInfo, NULL);
finally_do_arg (PCRYPTO_INFO, cryptoInfo, { if (finally_arg) crypto_close (finally_arg); });
if (status != 0)
@@ -5708,6 +5695,22 @@ namespace VeraCrypt
throw_sys_if (!WriteLocalMachineRegistryDword (keyPath, valueName, value));
}
+ void BootEncryption::NotifyService (DWORD dwNotifyCmd)
+ {
+ if (!IsAdmin() && IsUacSupported())
+ {
+ Elevator::NotifyService (dwNotifyCmd);
+ return;
+ }
+
+ DWORD dwRet = SendServiceNotification(dwNotifyCmd);
+ if (dwRet != ERROR_SUCCESS)
+ {
+ SetLastError(dwRet);
+ throw SystemException (SRC_POS);
+ }
+ }
+
void BootEncryption::StartDecryption (BOOL discardUnreadableEncryptedSectors)
{
BootEncryptionStatus encStatus = GetStatus();
diff --git a/src/Common/BootEncryption.h b/src/Common/BootEncryption.h
index 03c30ea7..ddf6f3e5 100644
--- a/src/Common/BootEncryption.h
+++ b/src/Common/BootEncryption.h
@@ -314,6 +314,7 @@ namespace VeraCrypt
static void UpdateSetupConfigFile (bool bForInstall);
void GetSecureBootConfig (BOOL* pSecureBootEnabled, BOOL *pVeraCryptKeysLoaded);
bool IsUsingUnsupportedAlgorithm(LONG driverVersion);
+ void NotifyService (DWORD dwNotifyCmd);
protected:
static const uint32 RescueIsoImageSize = 1835008; // Size of ISO9660 image with bootable emulated 1.44MB floppy disk image
diff --git a/src/Common/Cache.c b/src/Common/Cache.c
index fe56a554..46249b9c 100644
--- a/src/Common/Cache.c
+++ b/src/Common/Cache.c
@@ -43,7 +43,7 @@ void VcUnprotectPassword (Password* pPassword, uint64 encID)
#endif
-int ReadVolumeHeaderWCache (BOOL bBoot, BOOL bCache, BOOL bCachePim, char *header, Password *password, int pkcs5_prf, int pim, BOOL truecryptMode, PCRYPTO_INFO *retInfo)
+int ReadVolumeHeaderWCache (BOOL bBoot, BOOL bCache, BOOL bCachePim, char *header, Password *password, int pkcs5_prf, int pim, PCRYPTO_INFO *retInfo)
{
int nReturnCode = ERR_PASSWORD_WRONG;
int i, effectivePim;
@@ -51,7 +51,7 @@ int ReadVolumeHeaderWCache (BOOL bBoot, BOOL bCache, BOOL bCachePim, char *heade
/* Attempt to recognize volume using mount password */
if (password->Length > 0)
{
- nReturnCode = ReadVolumeHeader (bBoot, header, password, pkcs5_prf, pim, truecryptMode, retInfo, NULL);
+ nReturnCode = ReadVolumeHeader (bBoot, header, password, pkcs5_prf, pim, retInfo, NULL);
/* Save mount passwords back into cache if asked to do so */
if (bCache && (nReturnCode == 0 || nReturnCode == ERR_CIPHER_INIT_WEAK_KEY))
@@ -124,13 +124,11 @@ int ReadVolumeHeaderWCache (BOOL bBoot, BOOL bCache, BOOL bCachePim, char *heade
#endif
if ((pCurrentPassword->Length > 0) && (pCurrentPassword->Length <= (unsigned int) ((bBoot? MAX_LEGACY_PASSWORD: MAX_PASSWORD))))
{
- if (truecryptMode)
- effectivePim = 0;
- else if (pim == -1)
+ if (pim == -1)
effectivePim = CachedPim[i];
else
effectivePim = pim;
- nReturnCode = ReadVolumeHeader (bBoot, header, pCurrentPassword, pkcs5_prf, effectivePim, truecryptMode, retInfo, NULL);
+ nReturnCode = ReadVolumeHeader (bBoot, header, pCurrentPassword, pkcs5_prf, effectivePim, retInfo, NULL);
if (nReturnCode != ERR_PASSWORD_WRONG)
break;
diff --git a/src/Common/Cache.h b/src/Common/Cache.h
index 841d5e67..0988bf29 100644
--- a/src/Common/Cache.h
+++ b/src/Common/Cache.h
@@ -22,5 +22,5 @@ extern int cacheEmpty;
void AddPasswordToCache (Password *password, int pim, BOOL bCachePim);
void AddLegacyPasswordToCache (PasswordLegacy *password, int pim);
-int ReadVolumeHeaderWCache (BOOL bBoot, BOOL bCache, BOOL bCachePim,char *header, Password *password, int pkcs5_prf, int pim, BOOL truecryptMode, PCRYPTO_INFO *retInfo);
+int ReadVolumeHeaderWCache (BOOL bBoot, BOOL bCache, BOOL bCachePim,char *header, Password *password, int pkcs5_prf, int pim, PCRYPTO_INFO *retInfo);
void WipeCache (void);
diff --git a/src/Common/CommandAPDU.cpp b/src/Common/CommandAPDU.cpp
new file mode 100644
index 00000000..b202cb13
--- /dev/null
+++ b/src/Common/CommandAPDU.cpp
@@ -0,0 +1,366 @@
+#include "CommandAPDU.h"
+#include <string.h>
+
+using namespace std;
+
+namespace VeraCrypt
+{
+ CommandAPDU::CommandAPDU()
+ : m_nc(0), m_ne(0), m_dataOffset(0), m_isExtendedAPDU(false), m_parsingErrorStr(""), m_parsedSuccessfully(false)
+ {
+ }
+
+ void CommandAPDU::parse()
+ {
+ uint32 l1 = 0;
+ uint32 l2 = 0;
+ size_t leOfs = 0;
+ uint32 l3 = 0;
+ m_parsingErrorStr = "";
+ m_parsedSuccessfully = false;
+
+ if (m_apdu.size() < 4)
+ {
+ m_parsingErrorStr = vformat("APDU must be at least 4 bytes long - Length = %zu", m_apdu.size());
+ goto failure;
+ }
+
+ if (m_apdu.size() == 4)
+ {
+ // case 1
+ goto success;
+ }
+
+ /*** SHORT APDUs ***/
+ l1 = m_apdu[4] & 0xff;
+ if (m_apdu.size() == 5)
+ {
+ // case 2s
+ m_ne = (l1 == 0) ? 256 : l1;
+ goto success;
+ }
+ if (l1 != 0)
+ {
+ if (m_apdu.size() == 4 + 1 + l1)
+ {
+ // case 3s
+ m_nc = l1;
+ m_dataOffset = 5;
+ goto success;
+ }
+ else if (m_apdu.size() == 4 + 2 + l1)
+ {
+ // case 4s
+ m_nc = l1;
+ m_dataOffset = 5;
+ l2 = m_apdu[m_apdu.size() - 1] & 0xff;
+ m_ne = (l2 == 0) ? 256 : l2;
+ goto success;
+ }
+ else
+ {
+ m_parsingErrorStr = vformat("Invalid APDU : b1 = %u, expected length to be %u or %u, got %zu", l1, 4 + 1 + l1, 4 + 2 + l1, m_apdu.size());
+ goto failure;
+ }
+ }
+
+ if (m_apdu.size() < 7)
+ {
+ m_parsingErrorStr = vformat("Invalid APDU : b1 = %u, expected length to be >= 7 , got %zu", l1, m_apdu.size());
+ goto failure;
+ }
+
+ /*** EXTENDED APDUs ***/
+ l2 = ((m_apdu[5] & 0xff) << 8) | (m_apdu[6] & 0xff);
+ if (m_apdu.size() == 7)
+ {
+ // case 2e
+ m_ne = (l2 == 0) ? 65536 : l2;
+ m_isExtendedAPDU = true;
+ goto success;
+ }
+ if (l2 == 0)
+ {
+ m_parsingErrorStr = vformat("Invalid APDU: b1 = %u, b2||b3 = %u, length = %zu", l1, l2, m_apdu.size());
+ goto failure;
+ }
+ if (m_apdu.size() == 4 + 3 + l2)
+ {
+ // case 3e
+ m_nc = l2;
+ m_dataOffset = 7;
+ m_isExtendedAPDU = true;
+ goto success;
+ }
+ if (m_apdu.size() == 4 + 5 + l2)
+ {
+ // case 4e
+ m_nc = l2;
+ m_dataOffset = 7;
+ leOfs = m_apdu.size() - 2;
+ l3 = ((m_apdu[leOfs] & 0xff) << 8) | (m_apdu[leOfs + 1] & 0xff);
+ m_ne = (l3 == 0) ? 65536 : l3;
+ m_isExtendedAPDU = true;
+ goto success;
+ }
+ else
+ {
+ m_parsingErrorStr = vformat("Invalid APDU : b1 = %u, b2||b3 = %u, expected length to be %u or %u, got %zu", l1, l2, 4 + 3 + l2, 4 + 5 + l2, m_apdu.size());
+ goto failure;
+ }
+
+ success:
+ m_parsedSuccessfully = true;
+
+ failure:
+ clear();
+ }
+
+ void CommandAPDU::init(byte cla, byte ins, byte p1, byte p2, const byte* data, uint32 dataOffset, uint32 dataLength, uint32 ne)
+ {
+ m_nc = 0;
+ m_ne = 0;
+ m_dataOffset = 0;
+ m_isExtendedAPDU = false;
+ m_parsingErrorStr = "";
+ m_parsedSuccessfully = false;
+
+ if (dataLength > 65535)
+ {
+ m_parsingErrorStr = vformat("dataLength is too large (> 65535) - dataLength = %u", dataLength);
+ clear();
+ return;
+ }
+ if (ne > 65536)
+ {
+ m_parsingErrorStr = vformat("ne is too large (> 65536) - ne = %u", ne);
+ clear();
+ return;
+ }
+
+ m_ne = ne;
+ m_nc = dataLength;
+
+ if (dataLength == 0)
+ {
+ if (m_ne == 0)
+ {
+ // case 1
+ m_apdu.resize(4, 0);
+ setHeader(cla, ins, p1, p2);
+ }
+ else
+ {
+ // case 2s or 2e
+ if (ne <= 256)
+ {
+ // case 2s
+ // 256 is encoded as 0x00
+ byte len = (m_ne != 256) ? (byte)m_ne : 0;
+ m_apdu.resize(5, 0);
+ setHeader(cla, ins, p1, p2);
+ m_apdu[4] = len;
+ }
+ else
+ {
+ // case 2e
+ byte l1, l2;
+ // 65536 is encoded as 0x00 0x00
+ if (m_ne == 65536)
+ {
+ l1 = 0;
+ l2 = 0;
+ }
+ else
+ {
+ l1 = (byte)(m_ne >> 8);
+ l2 = (byte)m_ne;
+ }
+ m_apdu.resize(7, 0);
+ setHeader(cla, ins, p1, p2);
+ m_apdu[5] = l1;
+ m_apdu[6] = l2;
+ m_isExtendedAPDU = true;
+ }
+ }
+ }
+ else
+ {
+ if (m_ne == 0)
+ {
+ // case 3s or 3e
+ if (dataLength <= 255)
+ {
+ // case 3s
+ m_apdu.resize(4 + 1 + dataLength, 0);
+ setHeader(cla, ins, p1, p2);
+ m_apdu[4] = (byte)dataLength;
+ m_dataOffset = 5;
+ memcpy(m_apdu.data() + 5, data + dataOffset, dataLength);
+ }
+ else
+ {
+ // case 3e
+ m_apdu.resize(4 + 3 + dataLength, 0);
+ setHeader(cla, ins, p1, p2);
+ m_apdu[4] = 0;
+ m_apdu[5] = (byte)(dataLength >> 8);
+ m_apdu[6] = (byte)dataLength;
+ m_dataOffset = 7;
+ memcpy(m_apdu.data() + 7, data + dataOffset, dataLength);
+ m_isExtendedAPDU = true;
+ }
+ }
+ else
+ {
+ // case 4s or 4e
+ if ((dataLength <= 255) && (m_ne <= 256))
+ {
+ // case 4s
+ m_apdu.resize(4 + 2 + dataLength, 0);
+ setHeader(cla, ins, p1, p2);
+ m_apdu[4] = (byte)dataLength;
+ m_dataOffset = 5;
+ memcpy(m_apdu.data() + 5, data + dataOffset, dataLength);
+ m_apdu[m_apdu.size() - 1] = (m_ne != 256) ? (byte)m_ne : 0;
+ }
+ else
+ {
+ // case 4e
+ m_apdu.resize(4 + 5 + dataLength, 0);
+ setHeader(cla, ins, p1, p2);
+ m_apdu[4] = 0;
+ m_apdu[5] = (byte)(dataLength >> 8);
+ m_apdu[6] = (byte)dataLength;
+ m_dataOffset = 7;
+ memcpy(m_apdu.data() + 7, data + dataOffset, dataLength);
+ if (ne != 65536)
+ {
+ size_t leOfs = m_apdu.size() - 2;
+ m_apdu[leOfs] = (byte)(m_ne >> 8);
+ m_apdu[leOfs + 1] = (byte)m_ne;
+ } // else le == 65536: no need to fill in, encoded as 0
+ m_isExtendedAPDU = true;
+ }
+ }
+ }
+
+ m_parsedSuccessfully = true;
+ }
+
+ void CommandAPDU::setHeader(byte cla, byte ins, byte p1, byte p2)
+ {
+ m_apdu[0] = (byte)cla;
+ m_apdu[1] = (byte)ins;
+ m_apdu[2] = (byte)p1;
+ m_apdu[3] = (byte)p2;
+ }
+
+ void CommandAPDU::clear()
+ {
+ m_apdu.clear();
+ m_nc = 0;
+ m_ne = 0;
+ m_dataOffset = 0;
+ }
+
+ CommandAPDU::CommandAPDU(byte cla, byte ins, byte p1, byte p2, const byte* data, uint32 dataOffset, uint32 dataLength, uint32 ne)
+ {
+ init(cla, ins, p1, p2, data, dataOffset, dataLength, ne);
+ }
+
+ CommandAPDU::CommandAPDU(byte cla, byte ins, byte p1, byte p2)
+ {
+ init(cla, ins, p1, p2, NULL, 0, 0, 0);
+ }
+
+ CommandAPDU::CommandAPDU(byte cla, byte ins, byte p1, byte p2, uint32 ne)
+ {
+ init(cla, ins, p1, p2, NULL, 0, 0, ne);
+ }
+
+ CommandAPDU::CommandAPDU(byte cla, byte ins, byte p1, byte p2, const vector<byte>& data)
+ {
+ init(cla, ins, p1, p2, data.data(), 0, (uint32)data.size(), 0);
+ }
+
+ CommandAPDU::CommandAPDU(byte cla, byte ins, byte p1, byte p2, const byte* data, uint32 dataOffset, uint32 dataLength)
+ {
+ init(cla, ins, p1, p2, data, dataOffset, dataLength, 0);
+ }
+
+ CommandAPDU::CommandAPDU(byte cla, byte ins, byte p1, byte p2, const vector<byte>& data, uint32 ne)
+ {
+ init(cla, ins, p1, p2, data.data(), 0, (uint32)data.size(), ne);
+ }
+
+ CommandAPDU::CommandAPDU(const vector<byte>& apdu) : m_nc(0), m_ne(0), m_dataOffset(0), m_isExtendedAPDU(false)
+ {
+ m_apdu = apdu;
+ parse();
+ }
+
+ byte CommandAPDU::getCLA()
+ {
+ return m_apdu[0] & 0xff;
+ }
+
+ byte CommandAPDU::getINS()
+ {
+ return m_apdu[1] & 0xff;
+ }
+
+ byte CommandAPDU::getP1()
+ {
+ return m_apdu[2] & 0xff;
+ }
+
+ byte CommandAPDU::getP2()
+ {
+ return m_apdu[3] & 0xff;
+ }
+
+ uint32 CommandAPDU::getNc()
+ {
+ return m_nc;
+ }
+
+ const vector<byte> CommandAPDU::getData()
+ {
+ vector<byte> data;
+
+ if (m_nc > 0)
+ {
+ data.resize(m_nc, 0);
+ memcpy(data.data(), m_apdu.data() + m_dataOffset, data.size());
+ }
+
+ return data;
+ }
+
+ uint32 CommandAPDU::getNe()
+ {
+ return m_ne;
+ }
+
+ const vector<byte> CommandAPDU::getAPDU()
+ {
+ return m_apdu;
+ }
+
+ bool CommandAPDU::isExtended()
+ {
+ return m_isExtendedAPDU;
+ }
+
+ bool CommandAPDU::isValid()
+ {
+ return m_parsedSuccessfully;
+ }
+
+ std::string CommandAPDU::getErrorStr()
+ {
+ return m_parsingErrorStr;
+ }
+}
+
diff --git a/src/Common/CommandAPDU.h b/src/Common/CommandAPDU.h
new file mode 100644
index 00000000..98825faa
--- /dev/null
+++ b/src/Common/CommandAPDU.h
@@ -0,0 +1,93 @@
+#ifndef TC_HEADER_Common_CommandAPDU
+#define TC_HEADER_Common_CommandAPDU
+
+#include "Platform/PlatformBase.h"
+#include <stdarg.h>
+
+namespace VeraCrypt
+{
+ inline const std::string vformat(const char* zcFormat, ...)
+ {
+ if (zcFormat)
+ {
+ va_list vaArgs;
+ va_start(vaArgs, zcFormat);
+
+ const int iLen = vsnprintf(NULL, 0, zcFormat, vaArgs);
+ va_end(vaArgs);
+
+ if (iLen)
+ {
+ std::vector<char> zc((size_t)iLen + 1);
+ va_start(vaArgs, zcFormat);
+ vsnprintf(zc.data(), zc.size(), zcFormat, vaArgs);
+ va_end(vaArgs);
+
+ return std::string(zc.data(), iLen);
+ }
+ }
+
+ return "";
+ }
+
+ class CommandAPDU
+ {
+ protected:
+
+ vector<byte> m_apdu;
+ uint32 m_nc;
+ uint32 m_ne;
+ uint32 m_dataOffset;
+ bool m_isExtendedAPDU;
+ std::string m_parsingErrorStr;
+ bool m_parsedSuccessfully;
+
+ void parse();
+ void init(byte cla, byte ins, byte p1, byte p2, const byte* data, uint32 dataOffset, uint32 dataLength, uint32 ne);
+ void setHeader(byte cla, byte ins, byte p1, byte p2);
+
+ public:
+
+ void clear();
+
+ CommandAPDU();
+
+ CommandAPDU(byte cla, byte ins, byte p1, byte p2, const byte* data, uint32 dataOffset, uint32 dataLength, uint32 ne);
+
+ CommandAPDU(byte cla, byte ins, byte p1, byte p2);
+
+ CommandAPDU(byte cla, byte ins, byte p1, byte p2, uint32 ne);
+
+ CommandAPDU(byte cla, byte ins, byte p1, byte p2, const vector<byte>& data);
+
+ CommandAPDU(byte cla, byte ins, byte p1, byte p2, const byte* data, uint32 dataOffset, uint32 dataLength);
+
+ CommandAPDU(byte cla, byte ins, byte p1, byte p2, const vector<byte>& data, uint32 ne);
+
+ CommandAPDU(const vector<byte>& apdu);
+
+ byte getCLA();
+
+ byte getINS();
+
+ byte getP1();
+
+ byte getP2();
+
+ uint32 getNc();
+
+ const vector<byte> getData();
+
+ uint32 getNe();
+
+ const vector<byte> getAPDU();
+
+ bool isValid();
+
+ std::string getErrorStr();
+
+ bool isExtended();
+ };
+};
+
+#endif // TC_HEADER_Common_CommandAPDU \ No newline at end of file
diff --git a/src/Common/Common.h b/src/Common/Common.h
index 02b2929a..62ee3d65 100644
--- a/src/Common/Common.h
+++ b/src/Common/Common.h
@@ -93,6 +93,7 @@ typedef struct
int ProtectedHidVolPim;
wchar_t Label[33]; /* maximum label length is 32 for NTFS and 11 for FAT32 */
BOOL DisableMountManager;
+ BOOL SkipCachedPasswords;
} MountOptions;
#endif
diff --git a/src/Common/Common.rc b/src/Common/Common.rc
index 6d50a1fb..cbd401d8 100644
--- a/src/Common/Common.rc
+++ b/src/Common/Common.rc
@@ -100,7 +100,7 @@ BEGIN
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,67,297,10
END
-IDD_KEYFILES DIALOGEX 0, 0, 363, 251
+IDD_KEYFILES DIALOGEX 0, 0, 363, 264
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "VeraCrypt - Keyfiles"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
@@ -111,17 +111,18 @@ BEGIN
PUSHBUTTON "Add &Token Files...",IDC_TOKEN_FILES_ADD,151,132,65,14
PUSHBUTTON "&Remove",IDC_KEYREMOVE,227,132,61,14
PUSHBUTTON "Remove &All",IDC_KEYREMOVEALL,299,132,61,14
- CONTROL "U&se keyfiles",IDC_KEYFILES_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,232,100,11
- PUSHBUTTON "&Generate Random Keyfile...",IDC_GENERATE_KEYFILE,237,230,123,14
+ CONTROL "U&se keyfiles",IDC_KEYFILES_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,244,100,11
+ PUSHBUTTON "&Generate Random Keyfile...",IDC_GENERATE_KEYFILE,237,243,123,14
DEFPUSHBUTTON "OK",IDOK,290,8,70,14
PUSHBUTTON "Cancel",IDCANCEL,290,25,70,14
LTEXT "",IDT_KEYFILES_NOTE,10,161,346,41,0,WS_EX_TRANSPARENT
LTEXT "WARNING: If you lose a keyfile or if any bit of its first 1024 kilobytes changes, it will be impossible to mount volumes that use the keyfile!",IDT_KEYFILE_WARNING,290,44,69,85,0,WS_EX_TRANSPARENT
CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,2,154,361,1,WS_EX_STATICEDGE
- CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,2,209,361,1,WS_EX_STATICEDGE
- LTEXT "More information on keyfiles",IDC_LINK_KEYFILES_INFO,111,233,124,10,SS_NOTIFY
+ CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,2,224,361,1,WS_EX_STATICEDGE
+ LTEXT "More information on keyfiles",IDC_LINK_KEYFILES_INFO,111,245,124,10,SS_NOTIFY
CONTROL "Try first to mount with an empty password",IDC_KEYFILES_TRY_EMPTY_PASSWORD,
- "Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,7,217,310,10
+ "Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,7,229,310,10
+ RTEXT "Important information on using third-party file extensions",IDC_LINK_KEYFILES_EXTENSIONS_WARNING,161,210,195,8,SS_NOTIFY
END
IDD_LANGUAGE DIALOGEX 0, 0, 209, 183
@@ -211,7 +212,7 @@ BEGIN
CONTROL "",IDC_INFO_BOX_TEXT,"RichEdit20W",ES_MULTILINE | ES_READONLY | ES_NUMBER | WS_BORDER | WS_VSCROLL | WS_TABSTOP,5,6,361,188
END
-IDD_KEYFILE_GENERATOR DIALOGEX 0, 0, 357, 362
+IDD_KEYFILE_GENERATOR DIALOGEX 0, 0, 357, 385
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "VeraCrypt - Keyfile Generator"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
@@ -221,20 +222,22 @@ BEGIN
CONTROL "Display pool content",IDC_DISPLAY_POOL_CONTENTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,209,51,141,10
EDITTEXT IDC_NUMBER_KEYFILES,124,278,51,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
EDITTEXT IDC_KEYFILES_SIZE,124,298,51,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
+ COMBOBOX IDC_KEYFILES_SIZE_UNIT,182,299,41,137,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Random size ( 64 <-> 1048576 )",IDC_KEYFILES_RANDOM_SIZE,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,181,300,174,10
- EDITTEXT IDC_KEYFILES_BASE_NAME,124,318,141,14,ES_AUTOHSCROLL
- PUSHBUTTON "Generate and Save Keyfile...",IDC_GENERATE_AND_SAVE_KEYFILE,124,336,141,14
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,124,317,174,10
+ EDITTEXT IDC_KEYFILES_BASE_NAME,124,331,141,14,ES_AUTOHSCROLL
+ PUSHBUTTON "Generate and Save Keyfile...",IDC_GENERATE_AND_SAVE_KEYFILE,124,349,141,14
LTEXT "IMPORTANT: Move your mouse as randomly as possible within this window. The longer you move it, the better. This significantly increases the cryptographic strength of the keyfile.",IDT_KEYFILE_GENERATOR_NOTE,11,5,271,33
CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,1,40,356,1,WS_EX_STATICEDGE
RTEXT "Mixing PRF:",IDT_PRF,7,51,85,10,SS_CENTERIMAGE
GROUPBOX "Current Pool Content",IDT_POOL_CONTENTS,6,70,344,170
CTEXT "",IDC_POOL_CONTENTS,16,83,323,148,0,WS_EX_TRANSPARENT
RTEXT "Number of keyfiles:",IDT_NUMBER_KEYFILES,9,281,110,8
- RTEXT "Keyfiles base name:",IDT_KEYFILES_BASE_NAME,9,321,110,8
- RTEXT "Keyfiles size (in Bytes):",IDT_KEYFILES_SIZE,9,300,110,8
+ RTEXT "Keyfiles base name:",IDT_KEYFILES_BASE_NAME,9,334,110,8
+ RTEXT "Keyfiles size:",IDT_KEYFILES_SIZE,9,300,110,8
CONTROL "",IDC_ENTROPY_BAR,"msctls_progress32",PBS_SMOOTH | WS_BORDER,18,255,321,12
GROUPBOX "Randomness Collected From Mouse Movements",IDT_ENTROPY_BAR,6,244,344,29
+ RTEXT "Important information on using third-party file extensions",IDC_LINK_KEYFILES_EXTENSIONS_WARNING,7,370,346,8,SS_NOTIFY
END
IDD_MULTI_CHOICE_DLG DIALOGEX 0, 0, 167, 322
@@ -385,7 +388,7 @@ BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 345
TOPMARGIN, 7
- BOTTOMMARGIN, 244
+ BOTTOMMARGIN, 257
END
IDD_LANGUAGE, DIALOG
@@ -424,7 +427,7 @@ BEGIN
BEGIN
LEFTMARGIN, 7
TOPMARGIN, 7
- BOTTOMMARGIN, 358
+ BOTTOMMARGIN, 381
END
IDD_MULTI_CHOICE_DLG, DIALOG
diff --git a/src/Common/Crypto.c b/src/Common/Crypto.c
index 10c97e98..49948107 100644
--- a/src/Common/Crypto.c
+++ b/src/Common/Crypto.c
@@ -57,15 +57,19 @@ static Cipher Ciphers[] =
// ID Name (Bytes) (Bytes) (Bytes)
#ifdef TC_WINDOWS_BOOT
{ AES, "AES", 16, 32, AES_KS },
- { SERPENT, "Serpent", 16, 32, 140*4 },
+#ifndef WOLFCRYPT_BACKEND
+ { SERPENT, "Serpent", 16, 32, 140*4 },
{ TWOFISH, "Twofish", 16, 32, TWOFISH_KS },
+#endif
#else
{ AES, L"AES", 16, 32, AES_KS },
+#ifndef WOLFCRYPT_BACKEND
{ SERPENT, L"Serpent", 16, 32, 140*4 },
{ TWOFISH, L"Twofish", 16, 32, TWOFISH_KS },
{ CAMELLIA, L"Camellia", 16, 32, CAMELLIA_KS },
{ KUZNYECHIK, L"Kuznyechik",16, 32, KUZNYECHIK_KS },
#endif
+#endif
{ 0, 0, 0, 0, 0 }
};
@@ -79,6 +83,7 @@ static EncryptionAlgorithm EncryptionAlgorithms[] =
{ { 0, 0 }, { 0, 0}, 0, 0 }, // Must be all-zero
{ { AES, 0 }, { XTS, 0 }, 1, 1 },
+#ifndef WOLFCRYPT_BACKEND
{ { SERPENT, 0 }, { XTS, 0 }, 1, 1 },
{ { TWOFISH, 0 }, { XTS, 0 }, 1, 1 },
{ { CAMELLIA, 0 }, { XTS, 0 }, 1, 1 },
@@ -93,6 +98,7 @@ static EncryptionAlgorithm EncryptionAlgorithms[] =
{ { SERPENT, CAMELLIA, 0 }, { XTS, 0 }, 0, 1 },
{ { AES, KUZNYECHIK, 0 }, { XTS, 0 }, 0, 1 },
{ { CAMELLIA, SERPENT, KUZNYECHIK, 0 }, { XTS, 0 }, 0, 1 },
+#endif
{ { 0, 0 }, { 0, 0}, 0, 0 } // Must be all-zero
#else // TC_WINDOWS_BOOT
@@ -100,6 +106,7 @@ static EncryptionAlgorithm EncryptionAlgorithms[] =
// Encryption algorithms available for boot drive encryption
{ { 0, 0 }, { 0, 0 }, 0 }, // Must be all-zero
{ { AES, 0 }, { XTS, 0 }, 1 },
+#ifndef WOLFCRYPT_BACKEND
{ { SERPENT, 0 }, { XTS, 0 }, 1 },
{ { TWOFISH, 0 }, { XTS, 0 }, 1 },
{ { TWOFISH, AES, 0 }, { XTS, 0 }, 1 },
@@ -107,6 +114,7 @@ static EncryptionAlgorithm EncryptionAlgorithms[] =
{ { AES, SERPENT, 0 }, { XTS, 0 }, 1 },
{ { AES, TWOFISH, SERPENT, 0 }, { XTS, 0 }, 1 },
{ { SERPENT, TWOFISH, 0 }, { XTS, 0 }, 1 },
+#endif
{ { 0, 0 }, { 0, 0 }, 0 }, // Must be all-zero
#endif
@@ -119,11 +127,13 @@ static EncryptionAlgorithm EncryptionAlgorithms[] =
static Hash Hashes[] =
{ // ID Name Deprecated System Encryption
{ SHA512, L"SHA-512", FALSE, FALSE },
- { WHIRLPOOL, L"Whirlpool", FALSE, FALSE },
- { BLAKE2S, L"BLAKE2s-256", FALSE, TRUE },
{ SHA256, L"SHA-256", FALSE, TRUE },
+ #ifndef WOLFCRYPT_BACKEND
+ { BLAKE2S, L"BLAKE2s-256", FALSE, TRUE },
+ { WHIRLPOOL, L"Whirlpool", FALSE, FALSE },
{ STREEBOG, L"Streebog", FALSE, FALSE },
- { 0, 0, 0 }
+ #endif
+ { 0, 0, 0 }
};
#endif
@@ -147,6 +157,7 @@ int CipherInit (int cipher, unsigned char *key, unsigned __int8 *ks)
#endif
break;
+#ifndef WOLFCRYPT_BACKEND
case SERPENT:
serpent_set_key (key, ks);
break;
@@ -167,6 +178,7 @@ int CipherInit (int cipher, unsigned char *key, unsigned __int8 *ks)
break;
#endif // !defined(TC_WINDOWS_BOOT)
+#endif
default:
// Unknown/wrong cipher ID
return ERR_CIPHER_INIT_FAILURE;
@@ -189,6 +201,7 @@ void EncipherBlock(int cipher, void *data, void *ks)
aes_encrypt (data, data, ks);
break;
+#ifndef WOLFCRYPT_BACKEND
case TWOFISH: twofish_encrypt (ks, data, data); break;
case SERPENT: serpent_encrypt (data, data, ks); break;
#if !defined (TC_WINDOWS_BOOT) || defined (TC_WINDOWS_BOOT_CAMELLIA)
@@ -197,6 +210,7 @@ void EncipherBlock(int cipher, void *data, void *ks)
#if !defined(TC_WINDOWS_BOOT)
case KUZNYECHIK: kuznyechik_encrypt_block(data, data, ks); break;
#endif // !defined(TC_WINDOWS_BOOT)
+#endif
default: TC_THROW_FATAL_EXCEPTION; // Unknown/wrong ID
}
}
@@ -230,6 +244,7 @@ void EncipherBlocks (int cipher, void *dataPtr, void *ks, size_t blockCount)
KeRestoreFloatingPointState (&floatingPointState);
#endif
}
+#ifndef WOLFCRYPT_BACKEND
#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE && !defined (_UEFI)
else if (cipher == SERPENT
&& (blockCount >= 4)
@@ -267,6 +282,7 @@ void EncipherBlocks (int cipher, void *dataPtr, void *ks, size_t blockCount)
#endif
}
#endif
+#endif
else
{
size_t blockSize = CipherGetBlockSize (cipher);
@@ -284,6 +300,7 @@ void DecipherBlock(int cipher, void *data, void *ks)
{
switch (cipher)
{
+#ifndef WOLFCRYPT_BACKEND
case SERPENT: serpent_decrypt (data, data, ks); break;
case TWOFISH: twofish_decrypt (ks, data, data); break;
#if !defined (TC_WINDOWS_BOOT) || defined (TC_WINDOWS_BOOT_CAMELLIA)
@@ -292,6 +309,7 @@ void DecipherBlock(int cipher, void *data, void *ks)
#if !defined(TC_WINDOWS_BOOT)
case KUZNYECHIK: kuznyechik_decrypt_block(data, data, ks); break;
#endif // !defined(TC_WINDOWS_BOOT)
+#endif
#ifndef TC_WINDOWS_BOOT
@@ -341,6 +359,7 @@ void DecipherBlocks (int cipher, void *dataPtr, void *ks, size_t blockCount)
KeRestoreFloatingPointState (&floatingPointState);
#endif
}
+#ifndef WOLFCRYPT_BACKEND
#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE && !defined (_UEFI)
else if (cipher == SERPENT
&& (blockCount >= 4)
@@ -378,6 +397,7 @@ void DecipherBlocks (int cipher, void *dataPtr, void *ks, size_t blockCount)
#endif
}
#endif
+#endif
else
{
size_t blockSize = CipherGetBlockSize (cipher);
@@ -523,8 +543,16 @@ BOOL EAInitMode (PCRYPTO_INFO ci, unsigned char* key2)
// Secondary key schedule
if (EAInit (ci->ea, key2, ci->ks2) != ERR_SUCCESS)
return FALSE;
+
+ #ifdef WOLFCRYPT_BACKEND
+ if (xts_encrypt_key256 (key2, (aes_encrypt_ctx *) ci->ks) != EXIT_SUCCESS)
+ return ERR_CIPHER_INIT_FAILURE;
- /* Note: XTS mode could potentially be initialized with a weak key causing all blocks in one data unit
+ if (xts_decrypt_key256 (key2, (aes_decrypt_ctx *) (ci->ks + sizeof(aes_encrypt_ctx))) != EXIT_SUCCESS)
+ return ERR_CIPHER_INIT_FAILURE;
+ #endif
+
+ /* Note: XTS mode could potentially be initialized with a weak key causing all blocks in one data unit
on the volume to be tweaked with zero tweaks (i.e. 512 bytes of the volume would be encrypted in ECB
mode). However, to create a TrueCrypt volume with such a weak key, each human being on Earth would have
to create approximately 11,378,125,361,078,862 (about eleven quadrillion) TrueCrypt volumes (provided
@@ -1093,11 +1121,11 @@ void EncipherBlock(int cipher, void *data, void *ks)
aes_hw_cpu_encrypt ((byte *) ks, data);
else
aes_encrypt (data, data, ks);
-#elif defined (TC_WINDOWS_BOOT_SERPENT)
+#elif defined (TC_WINDOWS_BOOT_SERPENT) && !defined (WOLFCRYPT_BACKEND)
serpent_encrypt (data, data, ks);
-#elif defined (TC_WINDOWS_BOOT_TWOFISH)
+#elif defined (TC_WINDOWS_BOOT_TWOFISH) && !defined (WOLFCRYPT_BACKEND)
twofish_encrypt (ks, data, data);
-#elif defined (TC_WINDOWS_BOOT_CAMELLIA)
+#elif defined (TC_WINDOWS_BOOT_CAMELLIA) && !defined (WOLFCRYPT_BACKEND)
camellia_encrypt (data, data, ks);
#endif
}
@@ -1109,11 +1137,11 @@ void DecipherBlock(int cipher, void *data, void *ks)
aes_hw_cpu_decrypt ((byte *) ks + sizeof (aes_encrypt_ctx) + 14 * 16, data);
else
aes_decrypt (data, data, (aes_decrypt_ctx *) ((byte *) ks + sizeof(aes_encrypt_ctx)));
-#elif defined (TC_WINDOWS_BOOT_SERPENT)
+#elif defined (TC_WINDOWS_BOOT_SERPENT) && !defined (WOLFCRYPT_BACKEND)
serpent_decrypt (data, data, ks);
-#elif defined (TC_WINDOWS_BOOT_TWOFISH)
+#elif defined (TC_WINDOWS_BOOT_TWOFISH) && !defined (WOLFCRYPT_BACKEND)
twofish_decrypt (ks, data, data);
-#elif defined (TC_WINDOWS_BOOT_CAMELLIA)
+#elif defined (TC_WINDOWS_BOOT_CAMELLIA) && !defined (WOLFCRYPT_BACKEND)
camellia_decrypt (data, data, ks);
#endif
}
@@ -1180,7 +1208,7 @@ BOOL IsAesHwCpuSupported ()
}
return state && !HwEncryptionDisabled;
-#elif defined (_M_ARM64)
+#elif defined (_M_ARM64) || defined(__arm__) || defined (__arm64__) || defined (__aarch64__)
return 0;
#else
return (HasAESNI() && !HwEncryptionDisabled)? TRUE : FALSE;
@@ -1305,8 +1333,8 @@ BOOL InitializeSecurityParameters(GetRandSeedFn rngCallback)
ChaCha20RngCtx ctx;
byte pbSeed[CHACHA20RNG_KEYSZ + CHACHA20RNG_IVSZ];
#ifdef TC_WINDOWS_DRIVER
- byte i, tagLength;
-
+ byte i;
+ char randomStr[4];
Dump ("InitializeSecurityParameters BEGIN\n");
#endif
@@ -1315,28 +1343,57 @@ BOOL InitializeSecurityParameters(GetRandSeedFn rngCallback)
ChaCha20RngInit (&ctx, pbSeed, rngCallback, 0);
#ifdef TC_WINDOWS_DRIVER
- /* generate random tag length between 1 and 4 */
- tagLength = GetRandomIndex (&ctx, 4) + 1;
- /* generate random value for tag:
- * Each ASCII character in the tag must be a value in the range 0x20 (space) to 0x7E (tilde)
- * So we have 95 possibility
+ /* Generate random value for tag that is similar to pool tag values used by Windows kernel.
+ * Fully random tag would be too suspicious and outstanding.
+ * First character is always a capital letter.
+ * Second character is a letter, lowercase or uppercase.
+ * Third character is a letter, lowercase or uppercase.
+ * Fourth character is a letter or a digit.
*/
+
+ /* 1. First character (Capital Letter) */
+ randomStr[0] = 'A' + GetRandomIndex(&ctx, 26);
+
+ /* 2. Second character (Letter) */
+ i = GetRandomIndex(&ctx, 52);
+ if (i < 26)
+ randomStr[1] = 'A' + i;
+ else
+ randomStr[1] = 'a' + (i - 26);
+
+ /* 3. Third character (Letter) */
+ i = GetRandomIndex(&ctx, 52);
+ if (i < 26)
+ randomStr[2] = 'A' + i;
+ else
+ randomStr[2] = 'a' + (i - 26);
+
+ /* 4. Fourth character (Letter or Digit) */
+ i = GetRandomIndex(&ctx, 62);
+ if (i < 26)
+ randomStr[3] = 'A' + i;
+ else if (i < 52)
+ randomStr[3] = 'a' + (i - 26);
+ else
+ randomStr[3] = '0' + (i - 52);
+
+ /* combine all characters in reverse order as explained in MSDN */
AllocTag = 0;
- for (i = 0; i < tagLength; i++)
+ for (i = 0; i < 4; i++)
{
- AllocTag = (AllocTag << 8) + (((ULONG) GetRandomIndex (&ctx, 95)) + 0x20);
+ AllocTag = (AllocTag << 8) + randomStr[3-i];
}
#endif
cbKeyDerivationArea = 1024 * 1024;
- pbKeyDerivationArea = (byte*) TCalloc(cbKeyDerivationArea);
- if (!pbKeyDerivationArea)
+ do
{
- cbKeyDerivationArea = 2 * PAGE_SIZE;
pbKeyDerivationArea = (byte*) TCalloc(cbKeyDerivationArea);
- }
+ if (!pbKeyDerivationArea)
+ cbKeyDerivationArea >>= 1;
+ } while (!pbKeyDerivationArea && (cbKeyDerivationArea >= (2*PAGE_SIZE)));
if (!pbKeyDerivationArea)
{
@@ -1357,7 +1414,7 @@ BOOL InitializeSecurityParameters(GetRandSeedFn rngCallback)
FAST_ERASE64 (pbSeed, sizeof (pbSeed));
burn (&ctx, sizeof (ctx));
#ifdef TC_WINDOWS_DRIVER
- burn (&tagLength, 1);
+ burn (randomStr, sizeof(randomStr));
Dump ("InitializeSecurityParameters return=TRUE END\n");
#endif
@@ -1402,11 +1459,20 @@ void VcProtectMemory (uint64 encID, unsigned char* pbData, size_t cbData,
hashLow = t1ha2_atonce128(&hashHigh, pbKeyDerivationArea, cbKeyDerivationArea, hashSeed);
/* set the key to the hash result */
- pbKey[0] = pbKey[2] = hashLow;
- pbKey[1] = pbKey[3] = hashHigh;
+ pbKey[0] = hashLow;
+ pbKey[1] = hashHigh;
+ /* we now have a 128-bit key and we will expand it to 256-bit by using ChaCha12 cipher */
+ /* first we need to generate a the other 128-bit half of the key */
+ pbKey[2] = hashLow ^ hashHigh;
+ pbKey[3] = hashLow + hashHigh;
+
+ /* Initialize ChaCha12 cipher */
+ ChaCha256Init (&ctx, (unsigned char*) pbKey, (unsigned char*) &hashSeed, 12);
+ /* encrypt the key by itself */
+ ChaCha256Encrypt (&ctx, (unsigned char*) pbKey, sizeof(pbKey), (unsigned char*) pbKey);
/* Initialize ChaCha12 cipher */
- cipherIV = encID ^ CipherIVMask;
+ cipherIV = (((uint64) pbKeyDerivationArea) + encID) ^ CipherIVMask;
ChaCha256Init (&ctx, (unsigned char*) pbKey, (unsigned char*) &cipherIV, 12);
ChaCha256Encrypt (&ctx, pbData, cbData, pbData);
@@ -1463,7 +1529,7 @@ void VcUnprotectKeys (PCRYPTO_INFO pCryptoInfo, uint64 encID)
#endif
-#ifdef _M_ARM64
+#if defined(_M_ARM64) || defined(__arm__) || defined (__arm64__) || defined (__aarch64__)
/* dummy implementation that should never be called */
void aes_hw_cpu_decrypt(const byte* ks, byte* data)
{
diff --git a/src/Common/Crypto.h b/src/Common/Crypto.h
index b9600cf9..178e08e1 100644
--- a/src/Common/Crypto.h
+++ b/src/Common/Crypto.h
@@ -257,7 +257,6 @@ typedef struct CRYPTO_INFO_t
#endif
int noIterations;
- BOOL bTrueCryptMode;
int volumePim;
BOOL bProtectHiddenVolume; // Indicates whether the volume contains a hidden volume to be protected against overwriting
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index 2c707f5d..78aa3844 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -18,6 +18,7 @@
#include <dbt.h>
#include <Setupapi.h>
#include <aclapi.h>
+#include <Netlistmgr.h>
#include <fcntl.h>
#include <io.h>
#include <math.h>
@@ -32,6 +33,9 @@
#include <process.h>
#include <Tlhelp32.h>
#endif
+#if _WIN32_WINNT >= 0x0602
+#include "processthreadsapi.h"
+#endif
#include "Resource.h"
@@ -87,7 +91,10 @@
#include <Wbemidl.h>
#pragma comment(lib, "wbemuuid.lib")
-#pragma comment( lib, "setupapi.lib" )
+#pragma comment(lib, "Shlwapi.lib")
+#pragma comment(lib, "setupapi.lib" )
+#pragma comment(lib, "Wintrust.lib" )
+#pragma comment(lib, "Comctl32.lib" )
#ifndef TTI_INFO_LARGE
#define TTI_INFO_LARGE 4
@@ -207,11 +214,14 @@ BOOL LastMountedVolumeDirty;
BOOL MountVolumesAsSystemFavorite = FALSE;
BOOL FavoriteMountOnArrivalInProgress = FALSE;
BOOL MultipleMountOperationInProgress = FALSE;
+BOOL EMVSupportEnabled = FALSE;
volatile BOOL NeedPeriodicDeviceListUpdate = FALSE;
BOOL DisablePeriodicDeviceListUpdate = FALSE;
BOOL EnableMemoryProtection = FALSE;
+BOOL MemoryProtectionActivated = FALSE;
+
BOOL WaitDialogDisplaying = FALSE;
/* Handle to the device driver */
@@ -284,139 +294,13 @@ DWORD SystemFileSelectorCallerThreadId;
#define RANDPOOL_DISPLAY_ROWS 16
#define RANDPOOL_DISPLAY_COLUMNS 20
-HMODULE hRichEditDll = NULL;
-HMODULE hComctl32Dll = NULL;
-HMODULE hSetupDll = NULL;
-HMODULE hShlwapiDll = NULL;
-HMODULE hProfApiDll = NULL;
-HMODULE hUsp10Dll = NULL;
-HMODULE hCryptSpDll = NULL;
-HMODULE hUXThemeDll = NULL;
-HMODULE hUserenvDll = NULL;
-HMODULE hRsaenhDll = NULL;
-HMODULE himm32dll = NULL;
-HMODULE hMSCTFdll = NULL;
-HMODULE hfltlibdll = NULL;
-HMODULE hframedyndll = NULL;
-HMODULE hpsapidll = NULL;
-HMODULE hsecur32dll = NULL;
-HMODULE hnetapi32dll = NULL;
-HMODULE hauthzdll = NULL;
-HMODULE hxmllitedll = NULL;
-HMODULE hmprdll = NULL;
-HMODULE hsppdll = NULL;
-HMODULE vssapidll = NULL;
-HMODULE hvsstracedll = NULL;
-HMODULE hcfgmgr32dll = NULL;
-HMODULE hdevobjdll = NULL;
-HMODULE hpowrprofdll = NULL;
-HMODULE hsspiclidll = NULL;
-HMODULE hcryptbasedll = NULL;
-HMODULE hdwmapidll = NULL;
-HMODULE hmsasn1dll = NULL;
-HMODULE hcrypt32dll = NULL;
-HMODULE hbcryptdll = NULL;
-HMODULE hbcryptprimitivesdll = NULL;
-HMODULE hMsls31 = NULL;
-HMODULE hntmartadll = NULL;
-HMODULE hwinscarddll = NULL;
-HMODULE hmsvcrtdll = NULL;
-HMODULE hWinTrustLib = NULL;
-HMODULE hAdvapi32Dll = NULL;
-
-#define FREE_DLL(h) if (h) { FreeLibrary (h); h = NULL;}
-
-#ifndef BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE
-#define BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE 0x00000001
-#endif
-
-#ifndef BASE_SEARCH_PATH_PERMANENT
-#define BASE_SEARCH_PATH_PERMANENT 0x00008000
-#endif
#ifndef LOAD_LIBRARY_SEARCH_SYSTEM32
#define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800
#endif
-
-typedef BOOL (WINAPI *SetDllDirectoryPtr)(LPCWSTR lpPathName);
-typedef BOOL (WINAPI *SetSearchPathModePtr)(DWORD Flags);
typedef BOOL (WINAPI *SetDefaultDllDirectoriesPtr)(DWORD DirectoryFlags);
-
-typedef void (WINAPI *InitCommonControlsPtr)(void);
-typedef HIMAGELIST (WINAPI *ImageList_CreatePtr)(int cx, int cy, UINT flags, int cInitial, int cGrow);
-typedef int (WINAPI *ImageList_AddPtr)(HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask);
-
-typedef VOID (WINAPI *SetupCloseInfFilePtr)(HINF InfHandle);
-typedef HKEY (WINAPI *SetupDiOpenClassRegKeyPtr)(CONST GUID *ClassGuid,REGSAM samDesired);
-typedef BOOL (WINAPI *SetupInstallFromInfSectionWPtr)(HWND,HINF,PCWSTR,UINT,HKEY,PCWSTR,UINT,PSP_FILE_CALLBACK_W,PVOID,HDEVINFO,PSP_DEVINFO_DATA);
-typedef HINF (WINAPI *SetupOpenInfFileWPtr)(PCWSTR FileName,PCWSTR InfClass,DWORD InfStyle,PUINT ErrorLine);
-
-typedef LSTATUS (STDAPICALLTYPE *SHDeleteKeyWPtr)(HKEY hkey, LPCWSTR pszSubKey);
-
-typedef HRESULT (STDAPICALLTYPE *SHStrDupWPtr)(LPCWSTR psz, LPWSTR *ppwsz);
-
-typedef HRESULT (STDAPICALLTYPE *UrlUnescapeWPtr)(
- PWSTR pszUrl,
- PWSTR pszUnescaped,
- DWORD *pcchUnescaped,
- DWORD dwFlags
-);
-
-// ChangeWindowMessageFilter
-typedef BOOL (WINAPI *ChangeWindowMessageFilterPtr) (UINT, DWORD);
-
-typedef BOOL (WINAPI *CreateProcessWithTokenWFn)(
- __in HANDLE hToken,
- __in DWORD dwLogonFlags,
- __in_opt LPCWSTR lpApplicationName,
- __inout_opt LPWSTR lpCommandLine,
- __in DWORD dwCreationFlags,
- __in_opt LPVOID lpEnvironment,
- __in_opt LPCWSTR lpCurrentDirectory,
- __in LPSTARTUPINFOW lpStartupInfo,
- __out LPPROCESS_INFORMATION lpProcessInformation
- );
-
-typedef HRESULT (WINAPI *IUnknown_QueryServiceFn)(
- __in IUnknown* punk,
- __in REFGUID guidService,
- __in REFIID riid,
- __deref_out void ** ppvOut);
-
-SetDllDirectoryPtr SetDllDirectoryFn = NULL;
-SetSearchPathModePtr SetSearchPathModeFn = NULL;
-SetDefaultDllDirectoriesPtr SetDefaultDllDirectoriesFn = NULL;
-
-ImageList_CreatePtr ImageList_CreateFn = NULL;
-ImageList_AddPtr ImageList_AddFn = NULL;
-
-SetupCloseInfFilePtr SetupCloseInfFileFn = NULL;
-SetupDiOpenClassRegKeyPtr SetupDiOpenClassRegKeyFn = NULL;
-SetupInstallFromInfSectionWPtr SetupInstallFromInfSectionWFn = NULL;
-SetupOpenInfFileWPtr SetupOpenInfFileWFn = NULL;
-SHDeleteKeyWPtr SHDeleteKeyWFn = NULL;
-SHStrDupWPtr SHStrDupWFn = NULL;
-UrlUnescapeWPtr UrlUnescapeWFn = NULL;
-ChangeWindowMessageFilterPtr ChangeWindowMessageFilterFn = NULL;
-CreateProcessWithTokenWFn CreateProcessWithTokenWPtr = NULL;
-IUnknown_QueryServiceFn IUnknown_QueryServicePtr = NULL;
-
-typedef LONG (WINAPI *WINVERIFYTRUST)(HWND hwnd, GUID *pgActionID, LPVOID pWVTData);
-typedef CRYPT_PROVIDER_DATA* (WINAPI *WTHELPERPROVDATAFROMSTATEDATA)(HANDLE hStateData);
-typedef CRYPT_PROVIDER_SGNR* (WINAPI *WTHELPERGETPROVSIGNERFROMCHAIN)(CRYPT_PROVIDER_DATA *pProvData,
- DWORD idxSigner,
- BOOL fCounterSigner,
- DWORD idxCounterSigner);
-typedef CRYPT_PROVIDER_CERT* (WINAPI *WTHELPERGETPROVCERTFROMCHAIN)(CRYPT_PROVIDER_SGNR *pSgnr,
- DWORD idxCert);
-
-static WINVERIFYTRUST WinVerifyTrustFn = NULL;
-static WTHELPERPROVDATAFROMSTATEDATA WTHelperProvDataFromStateDataFn = NULL;
-static WTHELPERGETPROVSIGNERFROMCHAIN WTHelperGetProvSignerFromChainFn = NULL;
-static WTHELPERGETPROVCERTFROMCHAIN WTHelperGetProvCertFromChainFn = NULL;
-
-static unsigned char gpbSha256CodeSignCertFingerprint[64] = {
+static unsigned char gpbSha512CodeSignCertFingerprint[64] = {
0x9C, 0xA0, 0x21, 0xD3, 0x7C, 0x90, 0x61, 0x88, 0xEF, 0x5F, 0x99, 0x3D,
0x54, 0x9F, 0xB8, 0xCE, 0x72, 0x32, 0x4F, 0x57, 0x4F, 0x19, 0xD2, 0xA4,
0xDC, 0x84, 0xFF, 0xE2, 0x84, 0x2B, 0xD4, 0x30, 0xAB, 0xA7, 0xE4, 0x63,
@@ -425,23 +309,15 @@ static unsigned char gpbSha256CodeSignCertFingerprint[64] = {
0xDB, 0x6F, 0xC0, 0x62
};
-static unsigned char gpbSha256MSCodeSignCertFingerprint[64] = {
- 0x9C, 0x96, 0x81, 0x3B, 0x88, 0x54, 0xCB, 0x81, 0xB5, 0x94, 0x40, 0x4E,
- 0x15, 0x81, 0x20, 0xA1, 0x19, 0x00, 0x4E, 0x49, 0x8A, 0xA8, 0x98, 0x13,
- 0x9D, 0xE2, 0x86, 0x6A, 0xC1, 0xFA, 0xD3, 0x00, 0x0D, 0xAC, 0xE9, 0xE3,
- 0x3B, 0xFC, 0x6B, 0x26, 0xCE, 0xC8, 0xE2, 0x36, 0x3B, 0x60, 0x9C, 0x8E,
- 0x0A, 0x2A, 0x74, 0x20, 0xD7, 0x4E, 0x0F, 0xEE, 0x2E, 0x79, 0xE2, 0xAF,
- 0x1C, 0x90, 0x0B, 0x9C
+static unsigned char gpbSha512MSCodeSignCertFingerprint[64] = {
+ 0xEB, 0x76, 0x2E, 0xD3, 0x5B, 0x4A, 0xB1, 0x0E, 0xF5, 0x3B, 0x99, 0x4E,
+ 0xC1, 0xF7, 0x48, 0x88, 0xF6, 0xA0, 0xE9, 0xAC, 0x32, 0x69, 0xCF, 0x20,
+ 0xE1, 0x60, 0xC4, 0x0C, 0xEF, 0x01, 0x1F, 0xCB, 0x41, 0x95, 0x72, 0xB9,
+ 0xED, 0x63, 0x0C, 0x6B, 0xB9, 0xE9, 0xA2, 0x72, 0xA6, 0x78, 0x96, 0x4C,
+ 0x69, 0x9F, 0x90, 0x3F, 0xB1, 0x3C, 0x64, 0xF2, 0xAB, 0xCF, 0x14, 0x1D,
+ 0xEC, 0x7C, 0xB0, 0xC7
};
-
-typedef HRESULT (WINAPI *SHGETKNOWNFOLDERPATH) (
- _In_ REFKNOWNFOLDERID rfid,
- _In_ DWORD dwFlags,
- _In_opt_ HANDLE hToken,
- _Out_ PWSTR *ppszPath
-);
-
/* Windows dialog class */
#define WINDOWS_DIALOG_CLASS L"#32770"
@@ -972,54 +848,6 @@ BOOL TCCopyFile (wchar_t *sourceFileName, wchar_t *destinationFile)
return TCCopyFileBase (src, dst);
}
-#if defined(NDEBUG) && !defined(VC_SKIP_OS_DRIVER_REQ_CHECK)
-static BOOL InitializeWintrust()
-{
- if (!hWinTrustLib)
- {
- wchar_t szPath[MAX_PATH] = {0};
-
- if (GetSystemDirectory(szPath, MAX_PATH))
- StringCchCatW (szPath, MAX_PATH, L"\\Wintrust.dll");
- else
- StringCchCopyW (szPath, MAX_PATH, L"C:\\Windows\\System32\\Wintrust.dll");
-
- hWinTrustLib = LoadLibrary (szPath);
- if (hWinTrustLib)
- {
- WinVerifyTrustFn = (WINVERIFYTRUST) GetProcAddress (hWinTrustLib, "WinVerifyTrust");
- WTHelperProvDataFromStateDataFn = (WTHELPERPROVDATAFROMSTATEDATA) GetProcAddress (hWinTrustLib, "WTHelperProvDataFromStateData");
- WTHelperGetProvSignerFromChainFn = (WTHELPERGETPROVSIGNERFROMCHAIN) GetProcAddress (hWinTrustLib, "WTHelperGetProvSignerFromChain");
- WTHelperGetProvCertFromChainFn = (WTHELPERGETPROVCERTFROMCHAIN) GetProcAddress (hWinTrustLib, "WTHelperGetProvCertFromChain");
-
- if ( !WinVerifyTrustFn
- || !WTHelperProvDataFromStateDataFn
- || !WTHelperGetProvSignerFromChainFn
- || !WTHelperGetProvCertFromChainFn)
- {
- FreeLibrary (hWinTrustLib);
- hWinTrustLib = NULL;
- }
-
- }
- }
-
- if (hWinTrustLib)
- return TRUE;
- else
- return FALSE;
-}
-
-static void FinalizeWintrust()
-{
- if (hWinTrustLib)
- {
- FreeLibrary (hWinTrustLib);
- hWinTrustLib = NULL;
- }
-}
-
-#endif
BOOL VerifyModuleSignature (const wchar_t* path)
{
@@ -1050,9 +878,6 @@ BOOL VerifyModuleSignature (const wchar_t* path)
if (filePath [wcslen (filePath) - 1] == L'"')
filePath [wcslen (filePath) - 1] = 0;
- if (!InitializeWintrust ())
- return FALSE;
-
fileInfo.cbStruct = sizeof(WINTRUST_FILE_INFO);
fileInfo.pcwszFilePath = filePath;
fileInfo.hFile = NULL;
@@ -1065,23 +890,23 @@ BOOL VerifyModuleSignature (const wchar_t* path)
WVTData.dwStateAction = WTD_STATEACTION_VERIFY;
WVTData.dwProvFlags = WTD_REVOCATION_CHECK_NONE | WTD_CACHE_ONLY_URL_RETRIEVAL;
- hResult = WinVerifyTrustFn(0, &gActionID, &WVTData);
+ hResult = WinVerifyTrust(0, &gActionID, &WVTData);
if (0 == hResult)
{
- PCRYPT_PROVIDER_DATA pProviderData = WTHelperProvDataFromStateDataFn (WVTData.hWVTStateData);
+ PCRYPT_PROVIDER_DATA pProviderData = WTHelperProvDataFromStateData (WVTData.hWVTStateData);
if (pProviderData)
{
- PCRYPT_PROVIDER_SGNR pProviderSigner = WTHelperGetProvSignerFromChainFn (pProviderData, 0, FALSE, 0);
+ PCRYPT_PROVIDER_SGNR pProviderSigner = WTHelperGetProvSignerFromChain (pProviderData, 0, FALSE, 0);
if (pProviderSigner)
{
- PCRYPT_PROVIDER_CERT pProviderCert = WTHelperGetProvCertFromChainFn (pProviderSigner, 0);
+ PCRYPT_PROVIDER_CERT pProviderCert = WTHelperGetProvCertFromChain (pProviderSigner, 0);
if (pProviderCert && (pProviderCert->pCert))
{
BYTE hashVal[64];
sha512 (hashVal, pProviderCert->pCert->pbCertEncoded, pProviderCert->pCert->cbCertEncoded);
- if ( (0 == memcmp (hashVal, gpbSha256CodeSignCertFingerprint, 64))
- || (0 == memcmp (hashVal, gpbSha256MSCodeSignCertFingerprint, 64))
+ if ( (0 == memcmp (hashVal, gpbSha512CodeSignCertFingerprint, 64))
+ || (0 == memcmp (hashVal, gpbSha512MSCodeSignCertFingerprint, 64))
)
{
bResult = TRUE;
@@ -1093,9 +918,7 @@ BOOL VerifyModuleSignature (const wchar_t* path)
WVTData.dwUIChoice = WTD_UI_NONE;
WVTData.dwStateAction = WTD_STATEACTION_CLOSE;
- WinVerifyTrustFn(0, &gActionID, &WVTData);
-
- FinalizeWintrust ();
+ WinVerifyTrust(0, &gActionID, &WVTData);
return bResult;
#else
@@ -1364,47 +1187,6 @@ void AbortProcessDirect (wchar_t *abortMsg)
// Note that this function also causes localcleanup() to be called (see atexit())
MessageBeep (MB_ICONEXCLAMATION);
MessageBoxW (NULL, abortMsg, lpszTitle, ICON_HAND);
-#ifndef VC_COMREG
- FREE_DLL (hRichEditDll);
- FREE_DLL (hComctl32Dll);
- FREE_DLL (hSetupDll);
- FREE_DLL (hShlwapiDll);
- FREE_DLL (hProfApiDll);
- FREE_DLL (hUsp10Dll);
- FREE_DLL (hCryptSpDll);
- FREE_DLL (hUXThemeDll);
- FREE_DLL (hUserenvDll);
- FREE_DLL (hRsaenhDll);
- FREE_DLL (himm32dll);
- FREE_DLL (hMSCTFdll);
- FREE_DLL (hfltlibdll);
- FREE_DLL (hframedyndll);
- FREE_DLL (hpsapidll);
- FREE_DLL (hsecur32dll);
- FREE_DLL (hnetapi32dll);
- FREE_DLL (hauthzdll);
- FREE_DLL (hxmllitedll);
- FREE_DLL (hmprdll);
- FREE_DLL (hsppdll);
- FREE_DLL (vssapidll);
- FREE_DLL (hvsstracedll);
- FREE_DLL (hCryptSpDll);
- FREE_DLL (hcfgmgr32dll);
- FREE_DLL (hdevobjdll);
- FREE_DLL (hpowrprofdll);
- FREE_DLL (hsspiclidll);
- FREE_DLL (hcryptbasedll);
- FREE_DLL (hdwmapidll);
- FREE_DLL (hmsasn1dll);
- FREE_DLL (hcrypt32dll);
- FREE_DLL (hbcryptdll);
- FREE_DLL (hbcryptprimitivesdll);
- FREE_DLL (hMsls31);
- FREE_DLL (hntmartadll);
- FREE_DLL (hwinscarddll);
- FREE_DLL (hmsvcrtdll);
- FREE_DLL (hAdvapi32Dll);
-#endif
exit (1);
}
@@ -1423,46 +1205,6 @@ void AbortProcess (char *stringId)
#ifndef VC_COMREG
void AbortProcessSilent (void)
{
- FREE_DLL (hRichEditDll);
- FREE_DLL (hComctl32Dll);
- FREE_DLL (hSetupDll);
- FREE_DLL (hShlwapiDll);
- FREE_DLL (hProfApiDll);
- FREE_DLL (hUsp10Dll);
- FREE_DLL (hCryptSpDll);
- FREE_DLL (hUXThemeDll);
- FREE_DLL (hUserenvDll);
- FREE_DLL (hRsaenhDll);
- FREE_DLL (himm32dll);
- FREE_DLL (hMSCTFdll);
- FREE_DLL (hfltlibdll);
- FREE_DLL (hframedyndll);
- FREE_DLL (hpsapidll);
- FREE_DLL (hsecur32dll);
- FREE_DLL (hnetapi32dll);
- FREE_DLL (hauthzdll);
- FREE_DLL (hxmllitedll);
- FREE_DLL (hmprdll);
- FREE_DLL (hsppdll);
- FREE_DLL (vssapidll);
- FREE_DLL (hvsstracedll);
- FREE_DLL (hCryptSpDll);
- FREE_DLL (hcfgmgr32dll);
- FREE_DLL (hdevobjdll);
- FREE_DLL (hpowrprofdll);
- FREE_DLL (hsspiclidll);
- FREE_DLL (hcryptbasedll);
- FREE_DLL (hdwmapidll);
- FREE_DLL (hmsasn1dll);
- FREE_DLL (hcrypt32dll);
- FREE_DLL (hbcryptdll);
- FREE_DLL (hbcryptprimitivesdll);
- FREE_DLL (hMsls31);
- FREE_DLL (hntmartadll);
- FREE_DLL (hwinscarddll);
- FREE_DLL (hmsvcrtdll);
- FREE_DLL (hAdvapi32Dll);
-
// Note that this function also causes localcleanup() to be called (see atexit())
exit (1);
}
@@ -1583,11 +1325,11 @@ void LowerCaseCopy (wchar_t *lpszDest, const wchar_t *lpszSource)
void UpperCaseCopy (wchar_t *lpszDest, size_t cbDest, const wchar_t *lpszSource)
{
- if (lpszDest && cbDest)
+ if (lpszDest && (cbDest >= 2))
{
size_t i = wcslen (lpszSource);
- if (i >= cbDest)
- i = cbDest - 1;
+ if (i >= (cbDest/2))
+ i = (cbDest/2) - 1;
lpszDest[i] = 0;
i++;
@@ -2018,6 +1760,88 @@ void AccommodateTextField (HWND hwndDlg, UINT ctrlId, BOOL bFirstUpdate, HFONT h
}
}
+// Resizes width of a checkbox according to actual width in pixels of its label text (font size is taken into account)
+void AccommodateCheckBoxTextWidth (HWND hwndDlg, UINT ctrlId)
+{
+ RECT rec;
+ HWND hwndCtrl = GetDlgItem (hwndDlg, ctrlId);
+ int width, origWidth, origHeight;
+ int horizSubOffset;
+ wchar_t text [MAX_URL_LENGTH];
+ HFONT hFont = (HFONT) SendDlgItemMessage (hwndDlg, ctrlId, WM_GETFONT, 0, 0);
+
+ // Resize the field according to its length and font size and move if centered or right-aligned
+
+ GetWindowTextW (hwndCtrl, text, sizeof (text) / sizeof (wchar_t));
+
+ width = GetTextGfxWidth (hwndCtrl, text, hFont);
+
+ // add to width variable value the width of the checkbox square. We use SM_CXMENUCHECK which is a little larger than actual width
+ width += GetSystemMetrics(SM_CXMENUCHECK);
+
+
+ GetClientRect (hwndCtrl, &rec);
+ origWidth = rec.right;
+ origHeight = rec.bottom;
+
+ if (width >= 0
+ && (origWidth > width)) // The original width of the field is the maximum allowed size
+ {
+ horizSubOffset = origWidth - width;
+
+ // Resize the text field
+ SetWindowPos (hwndCtrl, 0, 0, 0,
+ origWidth - horizSubOffset,
+ origHeight,
+ SWP_NOMOVE | SWP_NOZORDER);
+
+ InvalidateRect (hwndCtrl, NULL, TRUE);
+ }
+}
+
+// makes controls contiguous by moving the second control right next to the first one horizontally
+void MakeControlsContiguous(HWND hwndDlg, UINT ctrl1ID, UINT ctrl2ID) {
+ HWND hwndCtrl1 = GetDlgItem(hwndDlg, ctrl1ID);
+ HWND hwndCtrl2 = GetDlgItem(hwndDlg, ctrl2ID);
+ RECT rect1, rect2;
+ POINT pt1, pt2;
+ int newLeftPosition;
+
+ // Exit silently if one or both controls are missing
+ if (!hwndCtrl1 || !hwndCtrl2) {
+ return;
+ }
+
+
+ GetWindowRect(hwndCtrl1, &rect1);
+ GetWindowRect(hwndCtrl2, &rect2);
+
+ // Convert the top-right point of the first control from screen to client coordinates
+ pt1.x = rect1.right;
+ pt1.y = rect1.top;
+ if (!ScreenToClient(hwndDlg, &pt1)) {
+ return; // Exit if the conversion fails
+ }
+
+ // Convert the top-left point of the second control from screen to client coordinates
+ pt2.x = rect2.left;
+ pt2.y = rect2.top;
+ if (!ScreenToClient(hwndDlg, &pt2)) {
+ return; // Exit if the conversion fails
+ }
+
+ // Ensure the second control is always placed to the right of the first one
+ newLeftPosition = pt1.x + 1;
+
+ if (pt2.x < pt1.x) { // if the second control is to the left of the first one
+ newLeftPosition += (pt1.x - pt2.x);
+ }
+
+ // Move the second control to its new position
+ SetWindowPos(hwndCtrl2, NULL, newLeftPosition, pt2.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
+}
+
+
// Note that the user can still close the window by right-clicking its taskbar icon and selecting 'Close window', or by pressing Alt-F4, or using the Task Manager.
void DisableCloseButton (HWND hwndDlg)
{
@@ -2332,20 +2156,20 @@ BOOL CALLBACK AboutDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam
L"Based on TrueCrypt 7.1a, freely available at http://www.truecrypt.org/ .\r\n\r\n"
L"Portions of this software:\r\n"
- L"Copyright \xA9 2013-2022 IDRIX. All rights reserved.\r\n"
+ L"Copyright \xA9 2013-2023 IDRIX. All rights reserved.\r\n"
L"Copyright \xA9 2003-2012 TrueCrypt Developers Association. All Rights Reserved.\r\n"
L"Copyright \xA9 1998-2000 Paul Le Roux. All Rights Reserved.\r\n"
L"Copyright \xA9 1998-2008 Brian Gladman. All Rights Reserved.\r\n"
- L"Copyright \xA9 1995-2017 Jean-loup Gailly and Mark Adler.\r\n"
+ L"Copyright \xA9 1995-2023 Jean-loup Gailly and Mark Adler.\r\n"
L"Copyright \xA9 2016 Disk Cryptography Services for EFI (DCS), Alex Kolotnikov.\r\n"
- L"Copyright \xA9 1999-2017 Dieter Baron and Thomas Klausner.\r\n"
+ L"Copyright \xA9 1999-2023 Dieter Baron and Thomas Klausner.\r\n"
L"Copyright \xA9 2013, Alexey Degtyarev. All rights reserved.\r\n"
L"Copyright \xA9 1999-2016 Jack Lloyd. All rights reserved.\r\n"
L"Copyright \xA9 2013-2019 Stephan Mueller <smueller@chronox.de>\r\n"
- L"Copyright \xA9 1999-2021 Igor Pavlov\r\n\r\n"
+ L"Copyright \xA9 1999-2023 Igor Pavlov\r\n\r\n"
L"This software as a whole:\r\n"
- L"Copyright \xA9 2013-2022 IDRIX. All rights reserved.\r\n\r\n"
+ L"Copyright \xA9 2013-2023 IDRIX. All rights reserved.\r\n\r\n"
L"An IDRIX Release");
@@ -2388,6 +2212,42 @@ BOOL CALLBACK AboutDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam
return 0;
}
+HWND CreateToolTip(int toolID, HWND hDlg, const char* strID)
+{
+ if (!toolID || !hDlg)
+ {
+ return FALSE;
+ }
+
+ // Create the tooltip.
+ HWND hwndTip = CreateWindowExW(NULL, TOOLTIPS_CLASS, NULL,
+ WS_POPUP | TTS_ALWAYSTIP | TTS_NOPREFIX | TTS_BALLOON,
+ CW_USEDEFAULT, CW_USEDEFAULT,
+ CW_USEDEFAULT, CW_USEDEFAULT,
+ hDlg, NULL,
+ hInst, NULL);
+
+ if (!hwndTip)
+ {
+ return (HWND)NULL;
+ }
+
+ // Associate the tooltip with the tool.
+ TOOLINFOW toolInfo = { 0 };
+ toolInfo.cbSize = sizeof(toolInfo);
+ toolInfo.hwnd = hDlg;
+ toolInfo.uFlags = TTF_SUBCLASS | TTF_IDISHWND;
+ toolInfo.uId = (UINT_PTR) GetDlgItem(hDlg, toolID);
+ toolInfo.lpszText = GetString(strID);
+
+ // set tooltip maximum width
+ SendMessage(hwndTip, TTM_SETMAXTIPWIDTH, 0, (LPARAM) 300);
+
+ SendMessage(hwndTip, TTM_ADDTOOL, 0, (LPARAM)&toolInfo);
+
+ return hwndTip;
+}
+
static HWND StaticModelessWaitDlgHandle = NULL;
@@ -2507,7 +2367,7 @@ void InitDialog (HWND hwndDlg)
{
StringCbCopyW ((WCHAR *)metric.lfMessageFont.lfFaceName, sizeof (metric.lfMessageFont.lfFaceName), font->FaceName);
}
- else if (IsOSAtLeast (WIN_VISTA))
+ else
{
// Vista's new default font (size and spacing) breaks compatibility with Windows 2k/XP applications.
// Force use of Tahoma (as Microsoft does in many dialogs) until a native Vista look is implemented.
@@ -3502,6 +3362,24 @@ uint32 ReadEncryptionThreadPoolFreeCpuCountLimit ()
return count;
}
+BOOL ReadMemoryProtectionConfig ()
+{
+ DWORD config;
+
+ if (!ReadLocalMachineRegistryDword (L"SYSTEM\\CurrentControlSet\\Services\\veracrypt", VC_ENABLE_MEMORY_PROTECTION, &config))
+ {
+ // enabled by default
+ config = 1;
+ }
+ return (config)? TRUE: FALSE;
+}
+
+BOOL WriteMemoryProtectionConfig (BOOL bEnable)
+{
+ DWORD config = bEnable? 1: 0;
+
+ return WriteLocalMachineRegistryDword (L"SYSTEM\\CurrentControlSet\\Services\\veracrypt", VC_ENABLE_MEMORY_PROTECTION, config);
+}
BOOL LoadSysEncSettings ()
{
@@ -3678,24 +3556,38 @@ void DoPostInstallTasks (HWND hwndDlg)
SavePostInstallTasksSettings (TC_POST_INSTALL_CFG_REMOVE_ALL);
}
-static void LoadSystemDll (LPCTSTR szModuleName, HMODULE *pHandle, BOOL bIgnoreError, const char* srcPos)
-{
- wchar_t dllPath[MAX_PATH];
-
- /* Load dll explictely from System32 to avoid Dll hijacking attacks*/
- if (!GetSystemDirectory(dllPath, MAX_PATH))
- StringCbCopyW(dllPath, sizeof(dllPath), L"C:\\Windows\\System32");
+#ifndef SETUP_DLL
+// Use an idea proposed in https://medium.com/@1ndahous3/safe-code-pitfalls-dll-side-loading-winapi-and-c-73baaf48bdf5
+// it allows to set safe DLL search mode for the entire process very early on, before even the CRT is initialized and global constructors are called
+#pragma comment(linker, "/ENTRY:CustomMainCrtStartup")
+extern "C" {
+ int wWinMainCRTStartup();
+ int APIENTRY CustomMainCrtStartup()
+ {
+ SetDefaultDllDirectoriesPtr SetDefaultDllDirectoriesFn = NULL;
+ SetDefaultDllDirectoriesFn = (SetDefaultDllDirectoriesPtr) GetProcAddress (GetModuleHandle(L"kernel32.dll"), "SetDefaultDllDirectories");
+ if (SetDefaultDllDirectoriesFn)
+ {
+ /* remove current directory from dll search path */
+ SetDllDirectoryW (L"");
+ // Force loading dlls from system32 directory only
+ SetDefaultDllDirectoriesFn (LOAD_LIBRARY_SEARCH_SYSTEM32);
+ }
- StringCbCatW(dllPath, sizeof(dllPath), L"\\");
- StringCbCatW(dllPath, sizeof(dllPath), szModuleName);
+ // activate process mitigations (currently only ASLR, dynamic code and extensions points)
+ ActivateProcessMitigations();
- if (((*pHandle = LoadLibrary(dllPath)) == NULL) && !bIgnoreError)
- {
- // This error is fatal
- handleWin32Error (NULL, srcPos);
- AbortProcess ("INIT_DLL");
+#ifndef SETUP
+ // call ActivateMemoryProtection if corresponding setting has been enabled (default is enabled)
+ if (ReadMemoryProtectionConfig())
+ {
+ ActivateMemoryProtection();
+ }
+#endif
+ return wWinMainCRTStartup();
}
}
+#endif
/* InitApp - initialize the application, this function is called once in the
applications WinMain function, but before the main dialog has been created */
@@ -3703,170 +3595,61 @@ void InitApp (HINSTANCE hInstance, wchar_t *lpszCommandLine)
{
WNDCLASSW wc;
char langId[6];
- InitCommonControlsPtr InitCommonControlsFn = NULL;
+ SetDefaultDllDirectoriesPtr SetDefaultDllDirectoriesFn = NULL;
+#if !defined(SETUP)
wchar_t modPath[MAX_PATH];
-
- GetModuleFileNameW (NULL, modPath, ARRAYSIZE (modPath));
-
- /* remove current directory from dll search path */
- SetDllDirectoryFn = (SetDllDirectoryPtr) GetProcAddress (GetModuleHandle(L"kernel32.dll"), "SetDllDirectoryW");
- SetSearchPathModeFn = (SetSearchPathModePtr) GetProcAddress (GetModuleHandle(L"kernel32.dll"), "SetSearchPathMode");
- SetDefaultDllDirectoriesFn = (SetDefaultDllDirectoriesPtr) GetProcAddress (GetModuleHandle(L"kernel32.dll"), "SetDefaultDllDirectories");
-
- if (SetDllDirectoryFn)
- SetDllDirectoryFn (L"");
- if (SetSearchPathModeFn)
- SetSearchPathModeFn (BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE | BASE_SEARCH_PATH_PERMANENT);
- if (SetDefaultDllDirectoriesFn)
- SetDefaultDllDirectoriesFn (LOAD_LIBRARY_SEARCH_SYSTEM32);
-
- InitOSVersionInfo();
-
- VirtualLock (&CmdTokenPin, sizeof (CmdTokenPin));
-
- InitGlobalLocks ();
-
- LoadSystemDll (L"msvcrt.dll", &hmsvcrtdll, TRUE, SRC_POS);
- LoadSystemDll (L"ntmarta.dll", &hntmartadll, TRUE, SRC_POS);
- LoadSystemDll (L"MPR.DLL", &hmprdll, TRUE, SRC_POS);
-#ifdef SETUP
- if (IsOSAtLeast (WIN_7))
- {
- LoadSystemDll (L"ProfApi.DLL", &hProfApiDll, TRUE, SRC_POS);
- LoadSystemDll (L"cryptbase.dll", &hcryptbasedll, TRUE, SRC_POS);
- LoadSystemDll (L"sspicli.dll", &hsspiclidll, TRUE, SRC_POS);
- }
#endif
- LoadSystemDll (L"psapi.dll", &hpsapidll, TRUE, SRC_POS);
- LoadSystemDll (L"secur32.dll", &hsecur32dll, TRUE, SRC_POS);
- LoadSystemDll (L"msasn1.dll", &hmsasn1dll, TRUE, SRC_POS);
- LoadSystemDll (L"Usp10.DLL", &hUsp10Dll, TRUE, SRC_POS);
- if (IsOSAtLeast (WIN_7))
- LoadSystemDll (L"dwmapi.dll", &hdwmapidll, TRUE, SRC_POS);
- LoadSystemDll (L"UXTheme.dll", &hUXThemeDll, TRUE, SRC_POS);
-
- LoadSystemDll (L"msls31.dll", &hMsls31, TRUE, SRC_POS);
- LoadSystemDll (L"SETUPAPI.DLL", &hSetupDll, FALSE, SRC_POS);
- LoadSystemDll (L"SHLWAPI.DLL", &hShlwapiDll, FALSE, SRC_POS);
+ INITCOMMONCONTROLSEX InitCtrls;
- LoadSystemDll (L"userenv.dll", &hUserenvDll, TRUE, SRC_POS);
- LoadSystemDll (L"rsaenh.dll", &hRsaenhDll, TRUE, SRC_POS);
+ InitOSVersionInfo();
-#ifdef SETUP
- if (nCurrentOS < WIN_7)
+ if (!IsOSAtLeast (WIN_7))
{
- if (nCurrentOS == WIN_XP)
- {
- LoadSystemDll (L"imm32.dll", &himm32dll, TRUE, SRC_POS);
- LoadSystemDll (L"MSCTF.dll", &hMSCTFdll, TRUE, SRC_POS);
- LoadSystemDll (L"fltlib.dll", &hfltlibdll, TRUE, SRC_POS);
- LoadSystemDll (L"wbem\\framedyn.dll", &hframedyndll, TRUE, SRC_POS);
- }
-
- if (IsOSAtLeast (WIN_VISTA))
- {
- LoadSystemDll (L"netapi32.dll", &hnetapi32dll, TRUE, SRC_POS);
- LoadSystemDll (L"authz.dll", &hauthzdll, TRUE, SRC_POS);
- LoadSystemDll (L"xmllite.dll", &hxmllitedll, TRUE, SRC_POS);
- }
+ // abort using a message that says that VeraCrypt can run only on Windows 7 and later and that it is officially supported only on Windows 10 and later
+ AbortProcessDirect(L"VeraCrypt requires at least Windows 7 to run.");
}
- if (IsOSAtLeast (WIN_VISTA))
- {
- LoadSystemDll (L"atl.dll", &hsppdll, TRUE, SRC_POS);
- LoadSystemDll (L"vsstrace.dll", &hvsstracedll, TRUE, SRC_POS);
- LoadSystemDll (L"vssapi.dll", &vssapidll, TRUE, SRC_POS);
- LoadSystemDll (L"spp.dll", &hsppdll, TRUE, SRC_POS);
- }
-#endif
-
- LoadSystemDll (L"crypt32.dll", &hcrypt32dll, TRUE, SRC_POS);
-
- if (IsOSAtLeast (WIN_7))
+ SetDefaultDllDirectoriesFn = (SetDefaultDllDirectoriesPtr) GetProcAddress (GetModuleHandle(L"kernel32.dll"), "SetDefaultDllDirectories");
+ if (!SetDefaultDllDirectoriesFn)
{
- LoadSystemDll (L"CryptSP.dll", &hCryptSpDll, TRUE, SRC_POS);
-
- LoadSystemDll (L"cfgmgr32.dll", &hcfgmgr32dll, TRUE, SRC_POS);
- LoadSystemDll (L"devobj.dll", &hdevobjdll, TRUE, SRC_POS);
- LoadSystemDll (L"powrprof.dll", &hpowrprofdll, TRUE, SRC_POS);
-
- LoadSystemDll (L"bcrypt.dll", &hbcryptdll, TRUE, SRC_POS);
- LoadSystemDll (L"bcryptprimitives.dll", &hbcryptprimitivesdll, TRUE, SRC_POS);
- }
+ // This can happen only if KB2533623 is missing from Windows 7
+ AbortProcessDirect(L"VeraCrypt requires KB2533623 to be installed on Windows 7 and Windows Server 2008 R2 in order to run.");
+ }
-#ifndef SETUP
- LoadSystemDll (L"WINSCARD.DLL", &hwinscarddll, TRUE, SRC_POS);
-#endif
+ VirtualLock (&CmdTokenPin, sizeof (CmdTokenPin));
- LoadSystemDll (L"COMCTL32.DLL", &hComctl32Dll, FALSE, SRC_POS);
+ InitGlobalLocks ();
- // call InitCommonControls function
- InitCommonControlsFn = (InitCommonControlsPtr) GetProcAddress (hComctl32Dll, "InitCommonControls");
- ImageList_AddFn = (ImageList_AddPtr) GetProcAddress (hComctl32Dll, "ImageList_Add");
- ImageList_CreateFn = (ImageList_CreatePtr) GetProcAddress (hComctl32Dll, "ImageList_Create");
+ // call InitCommonControlsEx function to initialize the common controls
+ InitCtrls.dwSize = sizeof (InitCtrls);
+ InitCtrls.dwICC = ICC_WIN95_CLASSES | ICC_PAGESCROLLER_CLASS | ICC_NATIVEFNTCTL_CLASS | ICC_STANDARD_CLASSES | ICC_LINK_CLASS;
+ InitCommonControlsEx (&InitCtrls);
- if (InitCommonControlsFn && ImageList_AddFn && ImageList_CreateFn)
- {
- InitCommonControlsFn();
- }
- else
- AbortProcess ("INIT_DLL");
-
- LoadSystemDll (L"Riched20.dll", &hRichEditDll, FALSE, SRC_POS);
- LoadSystemDll (L"Advapi32.dll", &hAdvapi32Dll, FALSE, SRC_POS);
+ // Load RichEdit library in order to be able to use RichEdit20W class
+ LoadLibraryEx (L"Riched20.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
#if !defined(SETUP)
+ GetModuleFileNameW (NULL, modPath, ARRAYSIZE (modPath));
if (!VerifyModuleSignature (modPath))
- AbortProcess ("DIST_PACKAGE_CORRUPTED");
+ AbortProcessDirect (L"This distribution package is damaged. Please try downloading it again (preferably from the official VeraCrypt website at https://www.veracrypt.fr).");
#endif
- // Get SetupAPI functions pointers
- SetupCloseInfFileFn = (SetupCloseInfFilePtr) GetProcAddress (hSetupDll, "SetupCloseInfFile");
- SetupDiOpenClassRegKeyFn = (SetupDiOpenClassRegKeyPtr) GetProcAddress (hSetupDll, "SetupDiOpenClassRegKey");
- SetupInstallFromInfSectionWFn = (SetupInstallFromInfSectionWPtr) GetProcAddress (hSetupDll, "SetupInstallFromInfSectionW");
- SetupOpenInfFileWFn = (SetupOpenInfFileWPtr) GetProcAddress (hSetupDll, "SetupOpenInfFileW");
-
- if (!SetupCloseInfFileFn || !SetupDiOpenClassRegKeyFn || !SetupInstallFromInfSectionWFn || !SetupOpenInfFileWFn)
- AbortProcess ("INIT_DLL");
-
- // Get SHDeleteKeyW,SHStrDupW, UrlUnescapeW functions pointers
- SHDeleteKeyWFn = (SHDeleteKeyWPtr) GetProcAddress (hShlwapiDll, "SHDeleteKeyW");
- SHStrDupWFn = (SHStrDupWPtr) GetProcAddress (hShlwapiDll, "SHStrDupW");
- UrlUnescapeWFn = (UrlUnescapeWPtr) GetProcAddress(hShlwapiDll, "UrlUnescapeW");
- IUnknown_QueryServicePtr = (IUnknown_QueryServiceFn) GetProcAddress(hShlwapiDll, "IUnknown_QueryService");
- if (!IUnknown_QueryServicePtr)
- IUnknown_QueryServicePtr = (IUnknown_QueryServiceFn) GetProcAddress(hShlwapiDll, MAKEINTRESOURCEA(176));
- if (!SHDeleteKeyWFn || !SHStrDupWFn || !UrlUnescapeWFn || !IUnknown_QueryServicePtr)
- AbortProcess ("INIT_DLL");
-
- if (IsOSAtLeast (WIN_VISTA))
- {
- /* Get ChangeWindowMessageFilter used to enable some messages bypasss UIPI (User Interface Privilege Isolation) */
- ChangeWindowMessageFilterFn = (ChangeWindowMessageFilterPtr) GetProcAddress (GetModuleHandle (L"user32.dll"), "ChangeWindowMessageFilter");
#ifndef SETUP
- /* enable drag-n-drop when we are running elevated */
- AllowMessageInUIPI (WM_DROPFILES);
- AllowMessageInUIPI (WM_COPYDATA);
- AllowMessageInUIPI (WM_COPYGLOBALDATA);
+ /* enable drag-n-drop when we are running elevated */
+ AllowMessageInUIPI (WM_DROPFILES);
+ AllowMessageInUIPI (WM_COPYDATA);
+ AllowMessageInUIPI (WM_COPYGLOBALDATA);
#endif
- }
-
- // Get CreateProcessWithTokenW function pointer
- CreateProcessWithTokenWPtr = (CreateProcessWithTokenWFn) GetProcAddress(hAdvapi32Dll, "CreateProcessWithTokenW");
/* Save the instance handle for later */
hInst = hInstance;
SetErrorMode (SetErrorMode (0) | SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
- CoInitialize (NULL);
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
#ifndef SETUP
// Application ID
- typedef HRESULT (WINAPI *SetAppId_t) (PCWSTR appID);
- SetAppId_t setAppId = (SetAppId_t) GetProcAddress (GetModuleHandle (L"shell32.dll"), "SetCurrentProcessExplicitAppUserModelID");
-
- if (setAppId)
- setAppId (TC_APPLICATION_ID);
+ SetCurrentProcessExplicitAppUserModelID (TC_APPLICATION_ID);
#endif
// Language
@@ -3944,10 +3727,10 @@ void InitApp (HINSTANCE hInstance, wchar_t *lpszCommandLine)
exit (1);
}
#else
- // in TESTSIGNING mode, we support only Windows Vista, Windows 7, Windows 8/8.1
- if ( !IsOSVersionAtLeast(WIN_VISTA, 0)
+ // in TESTSIGNING mode, we support only Windows 7 and Windows 8/8.1
+ if (
#ifndef SETUP
- || IsOSVersionAtLeast(WIN_10, 0)
+ IsOSVersionAtLeast(WIN_10, 0)
#else
|| (IsOSVersionAtLeast(WIN_10, 0) && !bMakePackage)
#endif
@@ -3966,24 +3749,6 @@ void InitApp (HINSTANCE hInstance, wchar_t *lpszCommandLine)
exit (1);
}
#endif
- else
- {
- // Service pack check & warnings about critical MS issues
- switch (nCurrentOS)
- {
- case WIN_XP:
- if (CurrentOSServicePack < 1)
- {
- HKEY k;
- // PE environment does not report version of SP
- if (RegOpenKeyExW (HKEY_LOCAL_MACHINE, L"System\\CurrentControlSet\\Control\\minint", 0, KEY_READ, &k) != ERROR_SUCCESS)
- Warning ("LARGE_IDE_WARNING_XP", NULL);
- else
- RegCloseKey (k);
- }
- break;
- }
- }
/* Get the attributes for the standard dialog class */
if ((GetClassInfoW (hInst, WINDOWS_DIALOG_CLASS, &wc)) == 0)
@@ -4030,106 +3795,21 @@ void InitApp (HINSTANCE hInstance, wchar_t *lpszCommandLine)
#ifndef SETUP
#ifdef _WIN64
- if (IsOSAtLeast (WIN_7))
+ EnableRamEncryption ((ReadDriverConfigurationFlags() & VC_DRIVER_CONFIG_ENABLE_RAM_ENCRYPTION) ? TRUE : FALSE);
+ if (IsRamEncryptionEnabled())
{
- EnableRamEncryption ((ReadDriverConfigurationFlags() & VC_DRIVER_CONFIG_ENABLE_RAM_ENCRYPTION) ? TRUE : FALSE);
- if (IsRamEncryptionEnabled())
- {
- if (!InitializeSecurityParameters(GetAppRandomSeed))
- AbortProcess("OUTOFMEMORY");
- }
+ if (!InitializeSecurityParameters(GetAppRandomSeed))
+ AbortProcess("OUTOFMEMORY");
}
#endif
if (!EncryptionThreadPoolStart (ReadEncryptionThreadPoolFreeCpuCountLimit()))
{
handleWin32Error (NULL, SRC_POS);
- FREE_DLL (hRichEditDll);
- FREE_DLL (hComctl32Dll);
- FREE_DLL (hSetupDll);
- FREE_DLL (hShlwapiDll);
- FREE_DLL (hProfApiDll);
- FREE_DLL (hUsp10Dll);
- FREE_DLL (hCryptSpDll);
- FREE_DLL (hUXThemeDll);
- FREE_DLL (hUserenvDll);
- FREE_DLL (hRsaenhDll);
- FREE_DLL (himm32dll);
- FREE_DLL (hMSCTFdll);
- FREE_DLL (hfltlibdll);
- FREE_DLL (hframedyndll);
- FREE_DLL (hpsapidll);
- FREE_DLL (hsecur32dll);
- FREE_DLL (hnetapi32dll);
- FREE_DLL (hauthzdll);
- FREE_DLL (hxmllitedll);
- FREE_DLL (hmprdll);
- FREE_DLL (hsppdll);
- FREE_DLL (vssapidll);
- FREE_DLL (hvsstracedll);
- FREE_DLL (hCryptSpDll);
- FREE_DLL (hcfgmgr32dll);
- FREE_DLL (hdevobjdll);
- FREE_DLL (hpowrprofdll);
- FREE_DLL (hsspiclidll);
- FREE_DLL (hcryptbasedll);
- FREE_DLL (hdwmapidll);
- FREE_DLL (hmsasn1dll);
- FREE_DLL (hcrypt32dll);
- FREE_DLL (hbcryptdll);
- FREE_DLL (hbcryptprimitivesdll);
- FREE_DLL (hMsls31);
- FREE_DLL (hntmartadll);
- FREE_DLL (hwinscarddll);
- FREE_DLL (hmsvcrtdll);
- FREE_DLL (hAdvapi32Dll);
exit (1);
}
#endif
}
-void FinalizeApp (void)
-{
- FREE_DLL (hRichEditDll);
- FREE_DLL (hComctl32Dll);
- FREE_DLL (hSetupDll);
- FREE_DLL (hShlwapiDll);
- FREE_DLL (hProfApiDll);
- FREE_DLL (hUsp10Dll);
- FREE_DLL (hCryptSpDll);
- FREE_DLL (hUXThemeDll);
- FREE_DLL (hUserenvDll);
- FREE_DLL (hRsaenhDll);
- FREE_DLL (himm32dll);
- FREE_DLL (hMSCTFdll);
- FREE_DLL (hfltlibdll);
- FREE_DLL (hframedyndll);
- FREE_DLL (hpsapidll);
- FREE_DLL (hsecur32dll);
- FREE_DLL (hnetapi32dll);
- FREE_DLL (hauthzdll);
- FREE_DLL (hxmllitedll);
- FREE_DLL (hmprdll);
- FREE_DLL (hsppdll);
- FREE_DLL (vssapidll);
- FREE_DLL (hvsstracedll);
- FREE_DLL (hCryptSpDll);
- FREE_DLL (hcfgmgr32dll);
- FREE_DLL (hdevobjdll);
- FREE_DLL (hpowrprofdll);
- FREE_DLL (hsspiclidll);
- FREE_DLL (hcryptbasedll);
- FREE_DLL (hdwmapidll);
- FREE_DLL (hmsasn1dll);
- FREE_DLL (hcrypt32dll);
- FREE_DLL (hbcryptdll);
- FREE_DLL (hbcryptprimitivesdll);
- FREE_DLL (hMsls31);
- FREE_DLL (hntmartadll);
- FREE_DLL (hwinscarddll);
- FREE_DLL (hmsvcrtdll);
- FREE_DLL (hAdvapi32Dll);
-}
-
void InitHelpFileName (void)
{
wchar_t *lpszTmp;
@@ -4265,24 +3945,21 @@ BOOL GetSysDevicePaths (HWND hwndDlg)
StringCchCopyW (device.IsPartition ? SysPartitionDevicePath : SysDriveDevicePath, TC_MAX_PATH, device.Path.c_str());
}
- if (IsOSAtLeast (WIN_7))
+ // Find extra boot partition
+ foreach (const HostDevice &drive, GetAvailableHostDevices (false, false))
{
- // Find extra boot partition
- foreach (const HostDevice &drive, GetAvailableHostDevices (false, false))
+ if (drive.ContainsSystem)
{
- if (drive.ContainsSystem)
+ foreach (const HostDevice &sysDrivePartition, drive.Partitions)
{
- foreach (const HostDevice &sysDrivePartition, drive.Partitions)
+ if (sysDrivePartition.Bootable)
{
- if (sysDrivePartition.Bootable)
- {
- if (sysDrivePartition.Size <= TC_MAX_EXTRA_BOOT_PARTITION_SIZE)
- ExtraBootPartitionDevicePath = sysDrivePartition.Path;
- break;
- }
+ if (sysDrivePartition.Size <= TC_MAX_EXTRA_BOOT_PARTITION_SIZE)
+ ExtraBootPartitionDevicePath = sysDrivePartition.Path;
+ break;
}
- break;
}
+ break;
}
}
@@ -5208,7 +4885,6 @@ static int DriverLoad ()
BOOL DriverUnload ()
{
- MOUNT_LIST_STRUCT driver;
int refCount;
int volumesMounted;
DWORD dwResult;
@@ -5233,13 +4909,6 @@ BOOL DriverUnload ()
// Test for mounted volumes
bResult = DeviceIoControl (hDriver, TC_IOCTL_IS_ANY_VOLUME_MOUNTED, NULL, 0, &volumesMounted, sizeof (volumesMounted), &dwResult, NULL);
- if (!bResult)
- {
- bResult = DeviceIoControl (hDriver, TC_IOCTL_LEGACY_GET_MOUNTED_VOLUMES, NULL, 0, &driver, sizeof (driver), &dwResult, NULL);
- if (bResult)
- volumesMounted = driver.ulMountedDrives;
- }
-
if (bResult)
{
if (volumesMounted != 0)
@@ -5406,9 +5075,6 @@ load:
BOOL bResult = DeviceIoControl (hDriver, TC_IOCTL_GET_DRIVER_VERSION, NULL, 0, &DriverVersion, sizeof (DriverVersion), &dwResult, NULL);
- if (!bResult)
- bResult = DeviceIoControl (hDriver, TC_IOCTL_LEGACY_GET_DRIVER_VERSION, NULL, 0, &DriverVersion, sizeof (DriverVersion), &dwResult, NULL);
-
#ifndef SETUP // Don't check version during setup to allow removal of another version
if (bResult == FALSE)
{
@@ -5456,144 +5122,139 @@ void ResetCurrentDirectory ()
}
-BOOL BrowseFiles (HWND hwndDlg, char *stringId, wchar_t *lpszFileName, BOOL keepHistory, BOOL saveMode, wchar_t *browseFilter)
+BOOL BrowseFiles (HWND hwndDlg, char *stringId, wchar_t *lpszFileName, BOOL keepHistory, BOOL saveMode)
{
- return BrowseFilesInDir (hwndDlg, stringId, NULL, lpszFileName, keepHistory, saveMode, browseFilter);
+ return BrowseFilesInDir (hwndDlg, stringId, NULL, lpszFileName, keepHistory, saveMode, NULL);
}
-
-BOOL BrowseFilesInDir (HWND hwndDlg, char *stringId, wchar_t *initialDir, wchar_t *lpszFileName, BOOL keepHistory, BOOL saveMode, wchar_t *browseFilter, const wchar_t *initialFileName, const wchar_t *defaultExtension)
+BOOL BrowseFilesInDir(HWND hwndDlg, char *stringId, wchar_t *initialDir, wchar_t *lpszFileName, BOOL keepHistory, BOOL saveMode, wchar_t *browseFilter, const wchar_t *initialFileName, const wchar_t *defaultExtension)
{
- OPENFILENAMEW ofn;
- wchar_t file[TC_MAX_PATH] = { 0 };
+ IFileDialog *pfd = NULL;
+ HRESULT hr;
wchar_t filter[1024];
BOOL status = FALSE;
- CoInitialize (NULL);
-
- ZeroMemory (&ofn, sizeof (ofn));
- *lpszFileName = 0;
-
- if (initialDir)
+ hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
+ if (FAILED(hr))
{
- ofn.lpstrInitialDir = initialDir;
+ return FALSE;
}
- if (initialFileName)
- StringCchCopyW (file, array_capacity (file), initialFileName);
-
- ofn.lStructSize = sizeof (ofn);
- ofn.hwndOwner = hwndDlg;
-
- StringCbPrintfW (filter, sizeof(filter), L"%ls (*.*)%c*.*%c%ls (*.hc)%c*.hc%c%c",
- GetString ("ALL_FILES"), 0, 0, GetString ("TC_VOLUMES"), 0, 0, 0);
- ofn.lpstrFilter = browseFilter ? browseFilter : filter;
- ofn.nFilterIndex = 1;
- ofn.lpstrFile = file;
- ofn.nMaxFile = sizeof (file) / sizeof (file[0]);
- ofn.lpstrTitle = GetString (stringId);
- ofn.lpstrDefExt = defaultExtension;
- ofn.Flags = OFN_HIDEREADONLY
- | OFN_PATHMUSTEXIST
- | (keepHistory ? 0 : OFN_DONTADDTORECENT)
- | (saveMode ? OFN_OVERWRITEPROMPT : 0);
-
- if (!keepHistory)
- CleanLastVisitedMRU ();
-
- SystemFileSelectorCallerThreadId = GetCurrentThreadId();
- SystemFileSelectorCallPending = TRUE;
-
- if (!saveMode)
+ // Choose between the File Open or File Save dialog depending on the saveMode.
+ if (saveMode)
{
- if (!GetOpenFileNameW (&ofn))
- goto ret;
+ hr = CoCreateInstance(CLSID_FileSaveDialog, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pfd));
}
else
{
- if (!GetSaveFileNameW (&ofn))
- goto ret;
+ hr = CoCreateInstance(CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pfd));
}
- SystemFileSelectorCallPending = FALSE;
+ if (SUCCEEDED(hr))
+ {
+ // Set the options for the dialog.
+ DWORD dwFlags;
+ hr = pfd->GetOptions(&dwFlags);
+ if (SUCCEEDED(hr))
+ {
+ dwFlags |= FOS_NOCHANGEDIR | FOS_FILEMUSTEXIST | FOS_PATHMUSTEXIST | FOS_FORCEFILESYSTEM | FOS_NOVALIDATE;
+ if (!keepHistory)
+ dwFlags |= FOS_DONTADDTORECENT;
+ if (saveMode)
+ dwFlags |= FOS_NOTESTFILECREATE | FOS_OVERWRITEPROMPT | FOS_DEFAULTNOMINIMODE;
+ hr = pfd->SetOptions(dwFlags);
+ }
- StringCchCopyW (lpszFileName, MAX_PATH, file);
+ // Set the initial directory, if provided.
+ if (initialDir)
+ {
+ IShellItem *psi;
+ hr = SHCreateItemFromParsingName(initialDir, NULL, IID_PPV_ARGS(&psi));
+ if (SUCCEEDED(hr))
+ {
+ pfd->SetFolder(psi);
+ psi->Release();
+ }
+ }
- if (!keepHistory)
- CleanLastVisitedMRU ();
+ // Set the initial file name, if provided.
+ if (initialFileName)
+ {
+ pfd->SetFileName(initialFileName);
+ }
- status = TRUE;
+ // Set the title.
+ pfd->SetTitle(GetString(stringId));
-ret:
- SystemFileSelectorCallPending = FALSE;
- ResetCurrentDirectory();
- CoUninitialize();
+ // Set the default extension.
+ if (defaultExtension)
+ {
+ pfd->SetDefaultExtension(defaultExtension);
+ }
- return status;
-}
+ // Prepare the filter
+ COMDLG_FILTERSPEC filterSpec[5];
+ UINT cfilterSpec = 0;
+ if (!browseFilter)
+ {
+ StringCbPrintfW(filter, sizeof(filter), L"%ls (*.*)%c*.*%c%ls (*.hc)%c*.hc%c%c",
+ GetString("ALL_FILES"), 0, 0, GetString("TC_VOLUMES"), 0, 0, 0);
+ browseFilter = filter;
+ }
-static wchar_t SelectMultipleFilesPath[131072];
-static int SelectMultipleFilesOffset;
+ // Assume browseFilter is a formatted wide string like L"Text Files (*.txt)\0*.txt\0"
+ // loop over all the filters in the string and add them to filterSpec array
+ while (*browseFilter)
+ {
+ filterSpec[cfilterSpec].pszName = browseFilter;
+ browseFilter += wcslen(browseFilter) + 1;
+ filterSpec[cfilterSpec].pszSpec = browseFilter;
+ browseFilter += wcslen(browseFilter) + 1;
+ cfilterSpec++;
-BOOL SelectMultipleFiles (HWND hwndDlg, const char *stringId, wchar_t *lpszFileName, size_t cbFileName,BOOL keepHistory)
-{
- OPENFILENAMEW ofn;
- wchar_t filter[1024];
- BOOL status = FALSE;
+ if (cfilterSpec >= ARRAYSIZE(filterSpec))
+ break;
+ }
- CoInitialize (NULL);
-
- ZeroMemory (&ofn, sizeof (ofn));
-
- SelectMultipleFilesPath[0] = 0;
- *lpszFileName = 0;
- ofn.lStructSize = sizeof (ofn);
- ofn.hwndOwner = hwndDlg;
- StringCbPrintfW (filter, sizeof(filter), L"%ls (*.*)%c*.*%c%ls (*.hc)%c*.hc%c%c",
- GetString ("ALL_FILES"), 0, 0, GetString ("TC_VOLUMES"), 0, 0, 0);
- ofn.lpstrFilter = filter;
- ofn.nFilterIndex = 1;
- ofn.lpstrFile = SelectMultipleFilesPath;
- ofn.nMaxFile = 0xffff * 2; // The size must not exceed 0xffff*2 due to a bug in Windows 2000 and XP SP1
- ofn.lpstrTitle = GetString (stringId);
- ofn.Flags = OFN_HIDEREADONLY
- | OFN_EXPLORER
- | OFN_PATHMUSTEXIST
- | OFN_ALLOWMULTISELECT
- | (keepHistory ? 0 : OFN_DONTADDTORECENT);
-
- if (!keepHistory)
- CleanLastVisitedMRU ();
+ // Set the file types filter.
+ hr = pfd->SetFileTypes(cfilterSpec, filterSpec);
+ hr = pfd->SetFileTypeIndex(1);
- SystemFileSelectorCallerThreadId = GetCurrentThreadId();
- SystemFileSelectorCallPending = TRUE;
+ if (!keepHistory)
+ CleanLastVisitedMRU();
- if (!GetOpenFileNameW (&ofn))
- goto ret;
+ SystemFileSelectorCallerThreadId = GetCurrentThreadId();
+ SystemFileSelectorCallPending = TRUE;
- SystemFileSelectorCallPending = FALSE;
+ // Show the dialog.
+ hr = pfd->Show(hwndDlg);
- if (SelectMultipleFilesPath[ofn.nFileOffset - 1] != 0)
- {
- // Single file selected
- StringCbCopyW (lpszFileName, cbFileName, SelectMultipleFilesPath);
- SelectMultipleFilesOffset = 0;
- SecureZeroMemory (SelectMultipleFilesPath, sizeof (SelectMultipleFilesPath));
- }
- else
- {
- // Multiple files selected
- SelectMultipleFilesOffset = ofn.nFileOffset;
- SelectMultipleFilesNext (lpszFileName, cbFileName);
- }
+ // Obtain the result if the user clicked the "OK" button.
+ if (SUCCEEDED(hr))
+ {
+ IShellItem *pItem;
+ hr = pfd->GetResult(&pItem);
+ if (SUCCEEDED(hr))
+ {
+ PWSTR pszFilePath;
+ hr = pItem->GetDisplayName(SIGDN_FILESYSPATH, &pszFilePath);
+ if (SUCCEEDED(hr))
+ {
+ StringCchCopyW(lpszFileName, MAX_PATH, pszFilePath);
+ CoTaskMemFree(pszFilePath);
+ status = TRUE;
+ }
+ pItem->Release();
+ }
+ }
- if (!keepHistory)
- CleanLastVisitedMRU ();
+ pfd->Release();
+
+ if (!keepHistory)
+ CleanLastVisitedMRU();
+ }
- status = TRUE;
-
-ret:
SystemFileSelectorCallPending = FALSE;
ResetCurrentDirectory();
CoUninitialize();
@@ -5601,101 +5262,173 @@ ret:
return status;
}
-
-BOOL SelectMultipleFilesNext (wchar_t *lpszFileName, size_t cbFileName)
+BOOL SelectMultipleFiles(HWND hwndDlg, const char *stringId, BOOL keepHistory, std::vector<std::wstring> &filesList)
{
- if (SelectMultipleFilesOffset == 0)
+ IFileOpenDialog *pfd = NULL;
+ HRESULT hr;
+ BOOL status = FALSE;
+
+ filesList.clear();
+
+ hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
+ if (FAILED(hr))
+ {
return FALSE;
+ }
- StringCbCopyW (lpszFileName, cbFileName,SelectMultipleFilesPath);
- lpszFileName[TC_MAX_PATH - 1] = 0;
+ // Create the File Open Dialog object.
+ hr = CoCreateInstance(CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pfd));
+ if (SUCCEEDED(hr))
+ {
+ DWORD dwFlags;
+ hr = pfd->GetOptions(&dwFlags);
+ if (SUCCEEDED(hr))
+ {
+ dwFlags |= FOS_ALLOWMULTISELECT | FOS_NOCHANGEDIR | FOS_FILEMUSTEXIST | FOS_PATHMUSTEXIST | FOS_FORCEFILESYSTEM | FOS_NOVALIDATE;
+ if (!keepHistory)
+ dwFlags |= FOS_DONTADDTORECENT;
- if (lpszFileName[wcslen (lpszFileName) - 1] != L'\\')
- StringCbCatW (lpszFileName, cbFileName,L"\\");
+ hr = pfd->SetOptions(dwFlags);
+ }
- StringCbCatW (lpszFileName, cbFileName,SelectMultipleFilesPath + SelectMultipleFilesOffset);
+ // Set the title and filter
+ pfd->SetTitle(GetString(stringId));
- SelectMultipleFilesOffset += (int) wcslen (SelectMultipleFilesPath + SelectMultipleFilesOffset) + 1;
- if (SelectMultipleFilesPath[SelectMultipleFilesOffset] == 0)
- {
- SelectMultipleFilesOffset = 0;
- SecureZeroMemory (SelectMultipleFilesPath, sizeof (SelectMultipleFilesPath));
- }
+ wchar_t allFilesfilter[512];
+ wchar_t volumesfilter[512];
- return TRUE;
-}
+ StringCbPrintfW(allFilesfilter, sizeof(allFilesfilter), L"%ls (*.*)", GetString("ALL_FILES"));
+ StringCbPrintfW(volumesfilter, sizeof(volumesfilter), L"%ls (*.hc)", GetString("TC_VOLUMES"));
+ COMDLG_FILTERSPEC rgSpec[] =
+ {
+ {allFilesfilter, L"*.*"},
+ {volumesfilter, L"*.hc"}};
+ hr = pfd->SetFileTypes(ARRAYSIZE(rgSpec), rgSpec);
-static int CALLBACK BrowseCallbackProc(HWND hwnd,UINT uMsg,LPARAM lp, LPARAM pData)
-{
- switch(uMsg) {
- case BFFM_INITIALIZED:
- {
- /* WParam is TRUE since we are passing a path.
- It would be FALSE if we were passing a pidl. */
- SendMessageW (hwnd,BFFM_SETSELECTION,TRUE,(LPARAM)pData);
- break;
- }
+ if (!keepHistory)
+ CleanLastVisitedMRU();
- case BFFM_SELCHANGED:
- {
- wchar_t szDir[TC_MAX_PATH];
+ // Show the dialog
+ hr = pfd->Show(hwndDlg);
+ if (SUCCEEDED(hr))
+ {
+ IShellItemArray *psiaResults;
+ hr = pfd->GetResults(&psiaResults);
+ if (SUCCEEDED(hr))
+ {
+ DWORD count;
+ hr = psiaResults->GetCount(&count);
+ if (SUCCEEDED(hr))
+ {
+ for (DWORD i = 0; i < count; ++i)
+ {
+ IShellItem *psi;
+ hr = psiaResults->GetItemAt(i, &psi);
+ if (SUCCEEDED(hr))
+ {
+ PWSTR pszFilePath;
+ hr = psi->GetDisplayName(SIGDN_FILESYSPATH, &pszFilePath);
+ if (SUCCEEDED(hr))
+ {
+ filesList.push_back(pszFilePath);
+ CoTaskMemFree(pszFilePath);
+ }
+ psi->Release();
+ }
+ }
- /* Set the status window to the currently selected path. */
- if (SHGetPathFromIDList((LPITEMIDLIST) lp ,szDir))
- {
- SendMessage (hwnd,BFFM_SETSTATUSTEXT,0,(LPARAM)szDir);
- }
- break;
- }
+ status = TRUE;
+ }
+ psiaResults->Release();
+ }
+ }
- default:
- break;
+ if (!keepHistory)
+ CleanLastVisitedMRU();
+
+ pfd->Release();
}
- return 0;
+ CoUninitialize();
+ return status;
}
-
-BOOL BrowseDirectories (HWND hwndDlg, char *lpszTitle, wchar_t *dirName)
+BOOL BrowseDirectories(HWND hwndDlg, char *lpszTitle, wchar_t *dirName, const wchar_t *initialDir)
{
- BROWSEINFOW bi;
- LPITEMIDLIST pidl;
- LPMALLOC pMalloc;
- BOOL bOK = FALSE;
+ IFileDialog *pfd = NULL;
+ HRESULT hr;
+ BOOL bOK = FALSE;
- CoInitialize (NULL);
+ hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
+ if (FAILED(hr))
+ {
+ return FALSE;
+ }
- if (SUCCEEDED (SHGetMalloc (&pMalloc)))
+ hr = CoCreateInstance(CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pfd));
+ if (SUCCEEDED(hr))
{
- ZeroMemory (&bi, sizeof(bi));
- bi.hwndOwner = hwndDlg;
- bi.pszDisplayName = 0;
- bi.lpszTitle = GetString (lpszTitle);
- bi.pidlRoot = 0;
- bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT;
- bi.lpfn = BrowseCallbackProc;
- bi.lParam = (LPARAM)dirName;
+ // Set the options on the dialog.
+ DWORD dwFlags;
+ hr = pfd->GetOptions(&dwFlags);
+ if (SUCCEEDED(hr))
+ {
+ dwFlags |= FOS_PICKFOLDERS | FOS_FORCEFILESYSTEM | FOS_NOCHANGEDIR; // Important to enable folder-picking mode
+ hr = pfd->SetOptions(dwFlags);
+ }
+
+ // Set the title.
+ if (lpszTitle)
+ {
+ pfd->SetTitle(GetString(lpszTitle));
+ }
+
+ IShellItem *psi;
+ if (initialDir)
+ {
+ // Set the initial directory, if provided.
+ hr = SHCreateItemFromParsingName(initialDir, NULL, IID_PPV_ARGS(&psi));
+ }
+ else
+ {
+ // set folder to "This PC" shel item
+ hr = SHCreateItemInKnownFolder(FOLDERID_ComputerFolder, 0, NULL, IID_PPV_ARGS(&psi));
+ }
+ if (SUCCEEDED(hr))
+ {
+ pfd->SetFolder(psi);
+ psi->Release();
+ }
- pidl = SHBrowseForFolderW (&bi);
- if (pidl != NULL)
+ // Show the dialog.
+ hr = pfd->Show(hwndDlg);
+ if (SUCCEEDED(hr))
{
- if (SHGetPathFromIDList(pidl, dirName))
+ // Obtain the result when the user clicks the "OK" button.
+ // The result is an IShellItem object.
+ IShellItem *pItem;
+ hr = pfd->GetResult(&pItem);
+ if (SUCCEEDED(hr))
{
- bOK = TRUE;
+ PWSTR pszFolderPath;
+ hr = pItem->GetDisplayName(SIGDN_FILESYSPATH, &pszFolderPath);
+ if (SUCCEEDED(hr))
+ {
+ StringCchCopyW(dirName, MAX_PATH, pszFolderPath);
+ CoTaskMemFree(pszFolderPath);
+ bOK = TRUE;
+ }
+ pItem->Release();
}
-
- pMalloc->Free (pidl);
- pMalloc->Release();
}
+ pfd->Release();
}
CoUninitialize();
-
return bOK;
}
-
std::wstring GetWrongPasswordErrorMessage (HWND hwndDlg)
{
WCHAR szTmp[8192];
@@ -5832,11 +5565,6 @@ void handleError (HWND hwndDlg, int code, const char* srcPos)
// A non-error
break;
- case ERR_UNSUPPORTED_TRUECRYPT_FORMAT:
- StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("UNSUPPORTED_TRUECRYPT_FORMAT"), (code >> 24), (code >> 16) & 0x000000FF);
- MessageBoxW (hwndDlg, AppendSrcPos (szTmp, srcPos).c_str(), lpszTitle, ICON_HAND);
- break;
-
#ifndef SETUP
case ERR_RAND_INIT_FAILED:
StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("INIT_RAND"), SRC_POS, GetLastError ());
@@ -6415,11 +6143,13 @@ static BOOL PerformBenchmark(HWND hBenchDlg, HWND hwndDlg)
*/
{
BYTE digest [MAX_DIGESTSIZE];
- WHIRLPOOL_CTX wctx;
- blake2s_state bctx;
+ #ifndef WOLFCRYPT_BACKEND
+ WHIRLPOOL_CTX wctx;
+ STREEBOG_CTX stctx;
+ blake2s_state bctx;
+ #endif
sha512_ctx s2ctx;
sha256_ctx s256ctx;
- STREEBOG_CTX stctx;
int hid, i;
@@ -6444,7 +6174,7 @@ static BOOL PerformBenchmark(HWND hBenchDlg, HWND hwndDlg)
sha256_hash (lpTestBuffer, benchmarkBufferSize, &s256ctx);
sha256_end ((unsigned char *) digest, &s256ctx);
break;
-
+ #ifndef WOLFCRYPT_BACKEND
case BLAKE2S:
blake2s_init(&bctx);
blake2s_update(&bctx, lpTestBuffer, benchmarkBufferSize);
@@ -6464,7 +6194,8 @@ static BOOL PerformBenchmark(HWND hBenchDlg, HWND hwndDlg)
break;
}
- }
+ #endif
+ }
if (QueryPerformanceCounter (&performanceCountEnd) == 0)
goto counter_error;
@@ -6505,37 +6236,38 @@ static BOOL PerformBenchmark(HWND hBenchDlg, HWND hwndDlg)
case SHA512:
/* PKCS-5 test with HMAC-SHA-512 used as the PRF */
- derive_key_sha512 ("passphrase-1234567890", 21, tmp_salt, 64, get_pkcs5_iteration_count(thid, benchmarkPim, FALSE, benchmarkPreBoot), dk, MASTER_KEYDATA_SIZE);
+ derive_key_sha512 ("passphrase-1234567890", 21, tmp_salt, 64, get_pkcs5_iteration_count(thid, benchmarkPim, benchmarkPreBoot), dk, MASTER_KEYDATA_SIZE);
break;
case SHA256:
/* PKCS-5 test with HMAC-SHA-256 used as the PRF */
- derive_key_sha256 ("passphrase-1234567890", 21, tmp_salt, 64, get_pkcs5_iteration_count(thid, benchmarkPim, FALSE, benchmarkPreBoot), dk, MASTER_KEYDATA_SIZE);
+ derive_key_sha256 ("passphrase-1234567890", 21, tmp_salt, 64, get_pkcs5_iteration_count(thid, benchmarkPim, benchmarkPreBoot), dk, MASTER_KEYDATA_SIZE);
break;
-
+ #ifndef WOLFCRYPT_BACKEND
case BLAKE2S:
/* PKCS-5 test with HMAC-BLAKE2s used as the PRF */
- derive_key_blake2s ("passphrase-1234567890", 21, tmp_salt, 64, get_pkcs5_iteration_count(thid, benchmarkPim, FALSE, benchmarkPreBoot), dk, MASTER_KEYDATA_SIZE);
+ derive_key_blake2s ("passphrase-1234567890", 21, tmp_salt, 64, get_pkcs5_iteration_count(thid, benchmarkPim, benchmarkPreBoot), dk, MASTER_KEYDATA_SIZE);
break;
case WHIRLPOOL:
/* PKCS-5 test with HMAC-Whirlpool used as the PRF */
- derive_key_whirlpool ("passphrase-1234567890", 21, tmp_salt, 64, get_pkcs5_iteration_count(thid, benchmarkPim, FALSE, benchmarkPreBoot), dk, MASTER_KEYDATA_SIZE);
+ derive_key_whirlpool ("passphrase-1234567890", 21, tmp_salt, 64, get_pkcs5_iteration_count(thid, benchmarkPim, benchmarkPreBoot), dk, MASTER_KEYDATA_SIZE);
break;
case STREEBOG:
/* PKCS-5 test with HMAC-STREEBOG used as the PRF */
- derive_key_streebog("passphrase-1234567890", 21, tmp_salt, 64, get_pkcs5_iteration_count(thid, benchmarkPim, FALSE, benchmarkPreBoot), dk, MASTER_KEYDATA_SIZE);
+ derive_key_streebog("passphrase-1234567890", 21, tmp_salt, 64, get_pkcs5_iteration_count(thid, benchmarkPim, benchmarkPreBoot), dk, MASTER_KEYDATA_SIZE);
break;
}
- }
+ #endif
+ }
if (QueryPerformanceCounter (&performanceCountEnd) == 0)
goto counter_error;
benchmarkTable[benchmarkTotalItems].encSpeed = performanceCountEnd.QuadPart - performanceCountStart.QuadPart;
benchmarkTable[benchmarkTotalItems].id = thid;
- benchmarkTable[benchmarkTotalItems].decSpeed = get_pkcs5_iteration_count(thid, benchmarkPim, FALSE, benchmarkPreBoot);
+ benchmarkTable[benchmarkTotalItems].decSpeed = get_pkcs5_iteration_count(thid, benchmarkPim, benchmarkPreBoot);
benchmarkTable[benchmarkTotalItems].meanBytesPerSec = (unsigned __int64) (1000 * ((float) benchmarkTable[benchmarkTotalItems].encSpeed / benchmarkPerformanceFrequency.QuadPart / 2));
if (benchmarkPreBoot)
{
@@ -7167,6 +6899,7 @@ BOOL CALLBACK KeyfileGeneratorDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP
case WM_INITDIALOG:
{
HWND hComboBox = GetDlgItem (hwndDlg, IDC_PRF_ID);
+ HWND hSizeUnit = GetDlgItem (hwndDlg, IDC_KEYFILES_SIZE_UNIT);
HCRYPTPROV hRngProv = NULL;
VirtualLock (randPool, sizeof(randPool));
@@ -7196,6 +6929,16 @@ BOOL CALLBACK KeyfileGeneratorDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP
}
SelectAlgo (hComboBox, &hash_algo);
+ // populate keyfiles size unit combo
+ SendMessage (hSizeUnit, CB_RESETCONTENT, 0, 0);
+ AddComboPair (hSizeUnit, GetString ("BYTES"), 0);
+ AddComboPair (hSizeUnit, GetString ("KB"), 1);
+ AddComboPair (hSizeUnit, GetString ("MB"), 2);
+ AddComboPair (hSizeUnit, GetString ("GB"), 3);
+
+ // set default keyfiles size unit
+ SendMessage (hSizeUnit, CB_SETCURSEL, 0, 0);
+
SetCheckBox (hwndDlg, IDC_DISPLAY_POOL_CONTENTS, bDisplayPoolContents);
hEntropyBar = GetDlgItem (hwndDlg, IDC_ENTROPY_BAR);
SendMessage (hEntropyBar, PBM_SETRANGE32, 0, maxEntropyLevel);
@@ -7219,6 +6962,8 @@ BOOL CALLBACK KeyfileGeneratorDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP
SetWindowText(GetDlgItem (hwndDlg, IDC_KEYFILES_SIZE), L"64");
// set the maximum length of the keyfile base name to (TC_MAX_PATH - 1)
SendMessage (GetDlgItem (hwndDlg, IDC_KEYFILES_BASE_NAME), EM_SETLIMITTEXT, (WPARAM) (TC_MAX_PATH - 1), 0);
+
+ ToHyperlink (hwndDlg, IDC_LINK_KEYFILES_EXTENSIONS_WARNING);
return 1;
}
@@ -7303,6 +7048,13 @@ BOOL CALLBACK KeyfileGeneratorDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP
if (lw == IDC_KEYFILES_RANDOM_SIZE)
{
EnableWindow(GetDlgItem (hwndDlg, IDC_KEYFILES_SIZE), !GetCheckBox (hwndDlg, IDC_KEYFILES_RANDOM_SIZE));
+ EnableWindow(GetDlgItem (hwndDlg, IDC_KEYFILES_SIZE_UNIT), !GetCheckBox (hwndDlg, IDC_KEYFILES_RANDOM_SIZE));
+ }
+
+ if (lw == IDC_LINK_KEYFILES_EXTENSIONS_WARNING)
+ {
+ Applink ("keyfilesextensions");
+ return 1;
}
if (lw == IDC_GENERATE_AND_SAVE_KEYFILE)
@@ -7313,7 +7065,10 @@ BOOL CALLBACK KeyfileGeneratorDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP
wchar_t szFileName [2*TC_MAX_PATH + 16];
unsigned char *keyfile = NULL;
int fhKeyfile = -1, status;
- long keyfilesCount = 0, keyfilesSize = 0, i;
+ long keyfilesCount = 0, i;
+ unsigned long long keyfilesSize = 0, remainingBytes = 0;
+ int selectedUnitIndex, selectedUnitFactor, loopIndex, rndBytesLength;
+ DWORD dwLastError = 0;
wchar_t* fileExtensionPtr = 0;
wchar_t szSuffix[32];
BOOL bRandomSize = GetCheckBox (hwndDlg, IDC_KEYFILES_RANDOM_SIZE);
@@ -7335,7 +7090,16 @@ BOOL CALLBACK KeyfileGeneratorDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP
szNumber[0] = 0;
keyfilesSize = wcstoul(szNumber, NULL, 0);
- if (keyfilesSize < 64 || keyfilesSize > 1024*1024)
+ // multiply by the unit factor
+ selectedUnitIndex = ComboBox_GetCurSel (GetDlgItem (hwndDlg, IDC_KEYFILES_SIZE_UNIT));
+ if (selectedUnitIndex != CB_ERR)
+ {
+ selectedUnitFactor = (CK_SLOT_ID) ComboBox_GetItemData (GetDlgItem (hwndDlg, IDC_KEYFILES_SIZE_UNIT), selectedUnitIndex);
+ for (loopIndex = 0; loopIndex < selectedUnitFactor; loopIndex++)
+ keyfilesSize *= 1024ULL;
+ }
+
+ if (keyfilesSize < 64)
{
Warning("KEYFILE_INCORRECT_SIZE", hwndDlg);
SendMessage(hwndDlg, WM_NEXTDLGCTL, (WPARAM) GetDlgItem (hwndDlg, IDC_KEYFILES_SIZE), TRUE);
@@ -7364,7 +7128,7 @@ BOOL CALLBACK KeyfileGeneratorDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP
fileExtensionPtr = wcsrchr(szFileBaseName, L'.');
/* Select directory */
- if (!BrowseDirectories (hwndDlg, "SELECT_KEYFILE_GENERATION_DIRECTORY", szDirName))
+ if (!BrowseDirectories (hwndDlg, "SELECT_KEYFILE_GENERATION_DIRECTORY", szDirName, NULL))
return 1;
if (szDirName[wcslen(szDirName) - 1] != L'\\' && szDirName[wcslen(szDirName) - 1] != L'/')
@@ -7372,7 +7136,7 @@ BOOL CALLBACK KeyfileGeneratorDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP
WaitCursor();
- keyfile = (unsigned char*) TCalloc( bRandomSize? KEYFILE_MAX_READ_LEN : keyfilesSize );
+ keyfile = (unsigned char*) TCalloc(KEYFILE_MAX_READ_LEN);
for (i= 0; i < keyfilesCount; i++)
{
@@ -7435,32 +7199,46 @@ BOOL CALLBACK KeyfileGeneratorDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP
return 1;
}
- /* since keyfilesSize < 1024 * 1024, we mask with 0x000FFFFF */
- keyfilesSize = (long) (((unsigned long) keyfilesSize) & 0x000FFFFF);
+ /* since random keyfilesSize < 1024 * 1024, we mask with 0x000FFFFF */
+ keyfilesSize = (unsigned long long) (((unsigned long) keyfilesSize) & 0x000FFFFF);
keyfilesSize %= ((KEYFILE_MAX_READ_LEN - 64) + 1);
keyfilesSize += 64;
+
}
- /* Generate the keyfile */
- if (!RandgetBytesFull (hwndDlg, keyfile, keyfilesSize, TRUE, TRUE))
- {
- _close (fhKeyfile);
- DeleteFile (szFileName);
- TCfree(keyfile);
- NormalCursor();
- return 1;
- }
+ remainingBytes = keyfilesSize;
+
+ do {
+ rndBytesLength = (int) min (remainingBytes, (unsigned long long) KEYFILE_MAX_READ_LEN);
- /* Write the keyfile */
- status = _write (fhKeyfile, keyfile, keyfilesSize);
- burn (keyfile, keyfilesSize);
+ /* Generate the keyfile */
+ if (!RandgetBytesFull (hwndDlg, keyfile, rndBytesLength, TRUE, TRUE))
+ {
+ _close (fhKeyfile);
+ DeleteFile (szFileName);
+ TCfree(keyfile);
+ NormalCursor();
+ return 1;
+ }
+
+ /* Write the keyfile */
+ status = _write (fhKeyfile, keyfile, rndBytesLength);
+ } while (status != -1 && (remainingBytes -= (unsigned long long) rndBytesLength) > 0);
+
+ /* save last error code */
+ if (status == -1)
+ dwLastError = GetLastError();
+
+ burn (keyfile, KEYFILE_MAX_READ_LEN);
_close (fhKeyfile);
if (status == -1)
{
TCfree(keyfile);
NormalCursor();
+ /* restore last error code */
+ SetLastError(dwLastError);
handleWin32Error (hwndDlg, SRC_POS);
return 1;
}
@@ -8195,15 +7973,6 @@ BOOL CheckFileExtension (wchar_t *fileName)
return FALSE;
}
-BOOL IsTrueCryptFileExtension (wchar_t *fileName)
-{
- wchar_t *ext = wcsrchr (fileName, L'.');
- if (ext && !_wcsicmp (ext, L".tc"))
- return TRUE;
- else
- return FALSE;
-}
-
void CorrectFileName (wchar_t* fileName)
{
/* replace '/' by '\' */
@@ -8432,7 +8201,7 @@ void BroadcastDeviceChange (WPARAM message, int nDosDriveNo, DWORD driveMap)
eventId = SHCNE_DRIVEADD;
else if (message == DBT_DEVICEREMOVECOMPLETE)
eventId = SHCNE_DRIVEREMOVED;
- else if (IsOSAtLeast (WIN_7) && message == DBT_DEVICEREMOVEPENDING) // Explorer on Windows 7 holds open handles of all drives when 'Computer' is expanded in navigation pane. SHCNE_DRIVEREMOVED must be used as DBT_DEVICEREMOVEPENDING is ignored.
+ else if (message == DBT_DEVICEREMOVEPENDING) // Explorer on Windows 7 holds open handles of all drives when 'Computer' is expanded in navigation pane. SHCNE_DRIVEREMOVED must be used as DBT_DEVICEREMOVEPENDING is ignored.
eventId = SHCNE_DRIVEREMOVED;
if (driveMap == 0)
@@ -8847,7 +8616,6 @@ int MountVolume (HWND hwndDlg,
Password *password,
int pkcs5,
int pim,
- BOOL truecryptMode,
BOOL cachePassword,
BOOL cachePim,
BOOL sharedAccess,
@@ -8887,7 +8655,7 @@ int MountVolume (HWND hwndDlg,
}
// If using cached passwords, check cache status first
- if (password == NULL && IsPasswordCacheEmpty ())
+ if (password == NULL && (mountOptions->SkipCachedPasswords || IsPasswordCacheEmpty ()))
return 0;
ZeroMemory (&mount, sizeof (mount));
@@ -8928,7 +8696,6 @@ retry:
else
mount.bMountManager = TRUE;
mount.pkcs5_prf = pkcs5;
- mount.bTrueCryptMode = truecryptMode;
mount.VolumePim = pim;
wstring path = volumePath;
@@ -8995,47 +8762,44 @@ retry:
mount.BytesPerPhysicalSector = bps;
}
- if (IsOSAtLeast (WIN_VISTA))
+ if ( (wcslen(root) >= 2)
+ && (root[1] == L':')
+ && (towupper(root[0]) >= L'A' && towupper(root[0]) <= L'Z')
+ )
{
- if ( (wcslen(root) >= 2)
- && (root[1] == L':')
- && (towupper(root[0]) >= L'A' && towupper(root[0]) <= L'Z')
- )
- {
- wstring drivePath = L"\\\\.\\X:";
- HANDLE dev = INVALID_HANDLE_VALUE;
- VOLUME_DISK_EXTENTS extents = {0};
- DWORD dwResult = 0;
- drivePath[4] = root[0];
+ wstring drivePath = L"\\\\.\\X:";
+ HANDLE dev = INVALID_HANDLE_VALUE;
+ VOLUME_DISK_EXTENTS extents = {0};
+ DWORD dwResult = 0;
+ drivePath[4] = root[0];
- if ((dev = CreateFile (drivePath.c_str(),0, 0, NULL, OPEN_EXISTING, 0, NULL)) != INVALID_HANDLE_VALUE)
+ if ((dev = CreateFile (drivePath.c_str(),0, 0, NULL, OPEN_EXISTING, 0, NULL)) != INVALID_HANDLE_VALUE)
+ {
+ if (DeviceIoControl (dev, IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS, NULL, 0, &extents, sizeof(extents), &dwResult, NULL))
{
- if (DeviceIoControl (dev, IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS, NULL, 0, &extents, sizeof(extents), &dwResult, NULL))
+ if (extents.NumberOfDiskExtents > 0)
{
- if (extents.NumberOfDiskExtents > 0)
+ STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR accessDesc;
+ STORAGE_ADAPTER_DESCRIPTOR adapterDesc;
+
+ if (GetPhysicalDriveStorageInformation (extents.Extents[0].DiskNumber, &accessDesc, &adapterDesc))
{
- STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR accessDesc;
- STORAGE_ADAPTER_DESCRIPTOR adapterDesc;
+ if (accessDesc.Size >= sizeof (STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR))
+ {
+ mount.BytesPerSector = accessDesc.BytesPerLogicalSector;
+ mount.BytesPerPhysicalSector = accessDesc.BytesPerPhysicalSector;
+ }
- if (GetPhysicalDriveStorageInformation (extents.Extents[0].DiskNumber, &accessDesc, &adapterDesc))
+ if (adapterDesc.Size >= sizeof (STORAGE_ADAPTER_DESCRIPTOR))
{
- if (accessDesc.Size >= sizeof (STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR))
- {
- mount.BytesPerSector = accessDesc.BytesPerLogicalSector;
- mount.BytesPerPhysicalSector = accessDesc.BytesPerPhysicalSector;
- }
-
- if (adapterDesc.Size >= sizeof (STORAGE_ADAPTER_DESCRIPTOR))
- {
- mount.MaximumTransferLength = adapterDesc.MaximumTransferLength;
- mount.MaximumPhysicalPages = adapterDesc.MaximumPhysicalPages;
- mount.AlignmentMask = adapterDesc.AlignmentMask;
- }
+ mount.MaximumTransferLength = adapterDesc.MaximumTransferLength;
+ mount.MaximumPhysicalPages = adapterDesc.MaximumPhysicalPages;
+ mount.AlignmentMask = adapterDesc.AlignmentMask;
}
}
}
- CloseHandle (dev);
}
+ CloseHandle (dev);
}
}
@@ -9049,8 +8813,7 @@ retry:
{
if (mount.wszVolume == NULL || swscanf_s ((const wchar_t *) mount.wszVolume,
WIDE("\\Device\\Harddisk%d\\Partition"),
- &mount.nPartitionInInactiveSysEncScopeDriveNo,
- sizeof(mount.nPartitionInInactiveSysEncScopeDriveNo)) != 1)
+ &mount.nPartitionInInactiveSysEncScopeDriveNo) != 1)
{
if (!quiet)
Warning ("NO_SYSENC_PARTITION_SELECTED", hwndDlg);
@@ -9084,7 +8847,6 @@ retry:
burn (&mount.VolumePassword, sizeof (mount.VolumePassword));
burn (&mount.ProtectedHidVolPassword, sizeof (mount.ProtectedHidVolPassword));
burn (&mount.pkcs5_prf, sizeof (mount.pkcs5_prf));
- burn (&mount.bTrueCryptMode, sizeof (mount.bTrueCryptMode));
burn (&mount.ProtectedHidVolPkcs5Prf, sizeof (mount.ProtectedHidVolPkcs5Prf));
SetLastError (dwLastError);
@@ -9243,6 +9005,17 @@ retry:
}
}
+ if (mount.VolumeMountedReadOnlyAfterPartialSysEnc
+ && !Silent
+ && bDevice)
+ {
+ wchar_t msg[1024];
+ wchar_t mountPoint[] = { L'A' + (wchar_t) driveNo, L':', 0 };
+ StringCbPrintfW (msg, sizeof(msg), GetString ("PARTIAL_SYSENC_MOUNT_READONLY"), mountPoint);
+
+ WarningDirect (msg, hwndDlg);
+ }
+
if (mount.wszLabel[0] && !mount.bDriverSetLabel)
{
// try setting the drive label on user-mode using registry
@@ -9329,12 +9102,9 @@ retry:
goto retry;
}
- if (IsOSAtLeast (WIN_7))
- {
- // Undo SHCNE_DRIVEREMOVED
- wchar_t root[] = { (wchar_t) nDosDriveNo + L'A', L':', L'\\', 0 };
- SHChangeNotify (SHCNE_DRIVEADD, SHCNF_PATH, root, NULL);
- }
+ // Undo SHCNE_DRIVEREMOVED
+ wchar_t root[] = { (wchar_t) nDosDriveNo + L'A', L':', L'\\', 0 };
+ SHChangeNotify (SHCNE_DRIVEADD, SHCNF_PATH, root, NULL);
return FALSE;
}
@@ -9534,9 +9304,6 @@ BOOL IsUacSupported ()
HKEY hkey;
DWORD value = 1, size = sizeof (DWORD);
- if (!IsOSAtLeast (WIN_VISTA))
- return FALSE;
-
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", 0, KEY_READ, &hkey) == ERROR_SUCCESS)
{
if (RegQueryValueEx (hkey, L"EnableLUA", 0, 0, (LPBYTE) &value, &size) != ERROR_SUCCESS)
@@ -10203,12 +9970,12 @@ void CleanLastVisitedMRU (void)
GetModuleFileNameW (NULL, exeFilename, sizeof (exeFilename) / sizeof(exeFilename[0]));
strToMatch = wcsrchr (exeFilename, L'\\') + 1;
- StringCbPrintfW (regPath, sizeof(regPath), L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\LastVisited%sMRU", IsOSAtLeast (WIN_VISTA) ? L"Pidl" : L"");
+ StringCbCopyW (regPath, sizeof(regPath), L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\LastVisitedPidlMRU");
- for (id = (IsOSAtLeast (WIN_VISTA) ? 0 : L'a'); id <= (IsOSAtLeast (WIN_VISTA) ? 1000 : L'z'); id++)
+ for (id = 0; id <= 1000; id++)
{
*strTmp = 0;
- StringCbPrintfW (key, sizeof(key), (IsOSAtLeast (WIN_VISTA) ? L"%d" : L"%c"), id);
+ StringCbPrintfW (key, sizeof(key), L"%d", id);
if ((len = ReadRegistryBytes (regPath, key, (char *) strTmp, sizeof (strTmp))) > 0)
{
@@ -10224,48 +9991,26 @@ void CleanLastVisitedMRU (void)
DeleteRegistryValue (regPath, key);
// Remove ID from MRUList
- if (IsOSAtLeast (WIN_VISTA))
- {
- int *p = (int *)buf;
- int *pout = (int *)bufout;
- int l;
-
- l = len = ReadRegistryBytes (L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\LastVisitedPidlMRU", L"MRUListEx", buf, sizeof (buf));
- while (l > 0)
- {
- l -= sizeof (int);
+ int *p = (int *)buf;
+ int *pout = (int *)bufout;
+ int l;
- if (*p == id)
- {
- p++;
- len -= sizeof (int);
- continue;
- }
- *pout++ = *p++;
- }
-
- WriteRegistryBytes (L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\LastVisitedPidlMRU", L"MRUListEx", bufout, len);
- }
- else
+ l = len = ReadRegistryBytes (L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\LastVisitedPidlMRU", L"MRUListEx", buf, sizeof (buf));
+ while (l > 0)
{
- wchar_t *p = (wchar_t*) buf;
- wchar_t *pout = (wchar_t*) bufout;
+ l -= sizeof (int);
- ReadRegistryString (L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\LastVisitedMRU", L"MRUList", L"", (wchar_t*) buf, sizeof (buf));
- while (*p)
+ if (*p == id)
{
- if (*p == id)
- {
- p++;
- continue;
- }
- *pout++ = *p++;
+ p++;
+ len -= sizeof (int);
+ continue;
}
- *pout++ = 0;
-
- WriteRegistryString (L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\LastVisitedMRU", L"MRUList", (wchar_t*) bufout);
+ *pout++ = *p++;
}
+ WriteRegistryBytes (L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\LastVisitedPidlMRU", L"MRUListEx", bufout, len);
+
break;
}
}
@@ -10446,7 +10191,7 @@ void TaskBarIconDisplayBalloonTooltip (HWND hwnd, wchar_t *headline, wchar_t *te
tnid.uFlags = NIF_INFO;
tnid.dwInfoFlags = (warning ? NIIF_WARNING : NIIF_INFO);
- tnid.uTimeout = (IsOSAtLeast (WIN_VISTA) ? 1000 : 5000); // in ms
+ tnid.uTimeout = 1000; // in ms
StringCbCopyW (tnid.szInfoTitle, sizeof(tnid.szInfoTitle), headline);
StringCbCopyW (tnid.szInfo, sizeof(tnid.szInfo),text);
@@ -11043,17 +10788,8 @@ BOOL IsSupportedOS ()
else
MessageBoxW (NULL, L"SHA-2 support missing from Windows.\n\nPlease Install KB3033929 or KB4474419", lpszTitle, MB_ICONWARNING);
}
- else if (IsOSAtLeast(WIN_VISTA))
- {
- if (OneOfKBsInstalled(szWinVistaKBs, 2))
- bRet = TRUE;
- else
- MessageBoxW (NULL, L"SHA-2 support missing from Windows.\n\nPlease Install KB4039648 or KB4474419", lpszTitle, MB_ICONWARNING);
- }
- else if (IsOSAtLeast(WIN_XP))
- bRet = TRUE;
#else
- if (IsOSAtLeast(WIN_XP))
+ if (IsOSAtLeast(WIN_7))
bRet = TRUE;
#endif
@@ -11391,6 +11127,10 @@ void Applink (const char *dest)
{
StringCbCopyW (page, sizeof (page),L"Keyfiles.html");
}
+ else if (strcmp(dest, "keyfilesextensions") == 0)
+ {
+ StringCbCopyW (page, sizeof (page),L"Avoid%20Third-Party%20File%20Extensions.html");
+ }
else if (strcmp(dest, "introcontainer") == 0)
{
StringCbCopyW (page, sizeof (page),L"Creating%20New%20Volumes.html");
@@ -11476,6 +11216,10 @@ void Applink (const char *dest)
{
StringCbCopyW (page, sizeof (page),L"Personal%20Iterations%20Multiplier%20%28PIM%29.html");
}
+ else if (strcmp(dest, "memoryprotection") == 0)
+ {
+ StringCbCopyW (page, sizeof (page),L"VeraCrypt%20Memory%20Protection.html");
+ }
else
{
StringCbCopyW (url, sizeof (url),TC_APPLINK);
@@ -11484,11 +11228,25 @@ void Applink (const char *dest)
if (buildUrl)
{
+ // in case of setup, open the online documentation if we are connected to Internet because existing documentation may be outdated
+#ifdef SETUP
+ if (IsInternetConnected())
+ {
+ StringCbPrintfW (url, sizeof (url), L"https://www.veracrypt.fr/en/%s", page);
+ buildUrl = FALSE;
+ }
+ else
+ {
+ StringCbPrintfW (url, sizeof (url), L"file:///%sdocs/html/en/%s", installDir, page);
+ CorrectURL (url);
+ }
+#else
StringCbPrintfW (url, sizeof (url), L"file:///%sdocs/html/en/%s", installDir, page);
CorrectURL (url);
+#endif
}
- if (IsOSAtLeast (WIN_VISTA) && IsAdmin ())
+ if (IsAdmin ())
{
int openDone = 0;
if (buildUrl)
@@ -11498,7 +11256,7 @@ void Applink (const char *dest)
StringCbCopyW (pageFileName, sizeof(pageFileName), page);
/* remove escape sequences from the page name before calling FileExists function */
- if (S_OK == UrlUnescapeWFn (pageFileName, pageFileName, &cchUnescaped, URL_UNESCAPE_INPLACE))
+ if (S_OK == UrlUnescapeW (pageFileName, pageFileName, &cchUnescaped, URL_UNESCAPE_INPLACE))
{
std::wstring pageFullPath = installDir;
pageFullPath += L"docs\\html\\en\\";
@@ -11570,8 +11328,6 @@ void HandleDriveNotReadyError (HWND hwnd)
{
Warning ("SYS_AUTOMOUNT_DISABLED", hwnd);
}
- else if (nCurrentOS == WIN_VISTA && CurrentOSServicePack < 1)
- Warning ("SYS_ASSIGN_DRIVE_LETTER", hwnd);
else
Warning ("DEVICE_NOT_READY_ERROR", hwnd);
@@ -11586,7 +11342,8 @@ BOOL CALLBACK CloseTCWindowsEnum (HWND hwnd, LPARAM lParam)
{
wchar_t name[1024] = { 0 };
GetWindowText (hwnd, name, ARRAYSIZE (name) - 1);
- if (hwnd != MainDlg && wcsstr (name, L"VeraCrypt"))
+ // check if the window is a VeraCrypt window, excluding current process main dialog and VeraCrypt Setup window
+ if (hwnd != MainDlg && wcsstr (name, L"VeraCrypt") && !wcsstr (name, L"VeraCrypt Setup"))
{
PostMessage (hwnd, TC_APPMSG_CLOSE_BKG_TASK, 0, 0);
@@ -11663,7 +11420,7 @@ void ReportUnexpectedState (const char *techInfo)
#ifndef SETUP
-int OpenVolume (OpenVolumeContext *context, const wchar_t *volumePath, Password *password, int pkcs5_prf, int pim, BOOL truecryptMode, BOOL write, BOOL preserveTimestamps, BOOL useBackupHeader)
+int OpenVolume (OpenVolumeContext *context, const wchar_t *volumePath, Password *password, int pkcs5_prf, int pim, BOOL write, BOOL preserveTimestamps, BOOL useBackupHeader)
{
int status = ERR_PARAMETER_INCORRECT;
int volumeType;
@@ -11838,7 +11595,7 @@ int OpenVolume (OpenVolumeContext *context, const wchar_t *volumePath, Password
}
// Decrypt volume header
- status = ReadVolumeHeader (FALSE, buffer, password, pkcs5_prf, pim, truecryptMode, &context->CryptoInfo, NULL);
+ status = ReadVolumeHeader (FALSE, buffer, password, pkcs5_prf, pim, &context->CryptoInfo, NULL);
if (status == ERR_PASSWORD_WRONG)
continue; // Try next volume type
@@ -12167,11 +11924,11 @@ static BOOL CALLBACK NewSecurityTokenKeyfileDlgProc (HWND hwndDlg, UINT msg, WPA
WaitCursor();
finally_do ({ NormalCursor(); });
- list <SecurityTokenInfo> tokens;
+ list <shared_ptr<TokenInfo>> tokens;
try
{
- tokens = SecurityToken::GetAvailableTokens();
+ tokens = Token::GetAvailableTokens();
}
catch (Exception &e)
{
@@ -12185,12 +11942,12 @@ static BOOL CALLBACK NewSecurityTokenKeyfileDlgProc (HWND hwndDlg, UINT msg, WPA
return 1;
}
- foreach (const SecurityTokenInfo &token, tokens)
+ foreach (const shared_ptr<TokenInfo> token, tokens)
{
wstringstream tokenLabel;
- tokenLabel << L"[" << token.SlotId << L"] " << token.Label;
+ tokenLabel << L"[" << token->SlotId << L"] " << token->Label;
- AddComboPair (GetDlgItem (hwndDlg, IDC_SELECTED_TOKEN), tokenLabel.str().c_str(), token.SlotId);
+ AddComboPair (GetDlgItem (hwndDlg, IDC_SELECTED_TOKEN), tokenLabel.str().c_str(), token->SlotId);
}
ComboBox_SetCurSel (GetDlgItem (hwndDlg, IDC_SELECTED_TOKEN), 0);
@@ -12244,7 +12001,7 @@ static BOOL CALLBACK NewSecurityTokenKeyfileDlgProc (HWND hwndDlg, UINT msg, WPA
}
-static void SecurityTokenKeyfileDlgFillList (HWND hwndDlg, const vector <SecurityTokenKeyfile> &keyfiles)
+static void SecurityTokenKeyfileDlgFillList (HWND hwndDlg, const vector <shared_ptr<TokenKeyfile>> &keyfiles)
{
HWND tokenListControl = GetDlgItem (hwndDlg, IDC_TOKEN_FILE_LIST);
LVITEMW lvItem;
@@ -12252,18 +12009,18 @@ static void SecurityTokenKeyfileDlgFillList (HWND hwndDlg, const vector <Securit
ListView_DeleteAllItems (tokenListControl);
- foreach (const SecurityTokenKeyfile &keyfile, keyfiles)
+ foreach (const shared_ptr<TokenKeyfile> keyfile, keyfiles)
{
memset (&lvItem, 0, sizeof(lvItem));
lvItem.mask = LVIF_TEXT;
lvItem.iItem = line++;
wstringstream s;
- s << keyfile.SlotId;
+ s << keyfile->Token->SlotId;
ListItemAdd (tokenListControl, lvItem.iItem, (wchar_t *) s.str().c_str());
- ListSubItemSet (tokenListControl, lvItem.iItem, 1, (wchar_t *) keyfile.Token.Label.c_str());
- ListSubItemSet (tokenListControl, lvItem.iItem, 2, (wchar_t *) keyfile.Id.c_str());
+ ListSubItemSet (tokenListControl, lvItem.iItem, 1, (wchar_t *) keyfile->Token->Label.c_str());
+ ListSubItemSet (tokenListControl, lvItem.iItem, 2, (wchar_t *) keyfile->Id.c_str());
}
BOOL selected = (ListView_GetNextItem (GetDlgItem (hwndDlg, IDC_TOKEN_FILE_LIST), -1, LVIS_SELECTED) != -1);
@@ -12272,10 +12029,10 @@ static void SecurityTokenKeyfileDlgFillList (HWND hwndDlg, const vector <Securit
}
-static list <SecurityTokenKeyfile> SecurityTokenKeyfileDlgGetSelected (HWND hwndDlg, const vector <SecurityTokenKeyfile> &keyfiles)
+static list <shared_ptr<TokenKeyfile>> SecurityTokenKeyfileDlgGetSelected (HWND hwndDlg, const vector <shared_ptr<TokenKeyfile>> &keyfiles)
{
HWND tokenListControl = GetDlgItem (hwndDlg, IDC_TOKEN_FILE_LIST);
- list <SecurityTokenKeyfile> selectedKeyfiles;
+ list <shared_ptr<TokenKeyfile>> selectedKeyfiles;
int itemId = -1;
while ((itemId = ListView_GetNextItem (tokenListControl, itemId, LVIS_SELECTED)) != -1)
@@ -12289,8 +12046,8 @@ static list <SecurityTokenKeyfile> SecurityTokenKeyfileDlgGetSelected (HWND hwnd
BOOL CALLBACK SecurityTokenKeyfileDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- static list <SecurityTokenKeyfilePath> *selectedTokenKeyfiles;
- static vector <SecurityTokenKeyfile> keyfiles;
+ static list <TokenKeyfilePath> *selectedTokenKeyfiles;
+ static vector <shared_ptr<TokenKeyfile>> keyfiles;
WORD lw = LOWORD (wParam);
@@ -12298,7 +12055,7 @@ BOOL CALLBACK SecurityTokenKeyfileDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam
{
case WM_INITDIALOG:
{
- selectedTokenKeyfiles = (list <SecurityTokenKeyfilePath> *) lParam;
+ selectedTokenKeyfiles = (list <TokenKeyfilePath> *) lParam;
LVCOLUMNW LvCol;
HWND tokenListControl = GetDlgItem (hwndDlg, IDC_TOKEN_FILE_LIST);
@@ -12333,7 +12090,7 @@ BOOL CALLBACK SecurityTokenKeyfileDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam
WaitCursor();
finally_do ({ NormalCursor(); });
- keyfiles = SecurityToken::GetAvailableKeyfiles();
+ keyfiles = Token::GetAvailableKeyfiles(EMVSupportEnabled? true : false);
}
catch (UserAbort&)
{
@@ -12361,9 +12118,9 @@ BOOL CALLBACK SecurityTokenKeyfileDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam
{
if (selectedTokenKeyfiles)
{
- foreach (const SecurityTokenKeyfile &keyfile, SecurityTokenKeyfileDlgGetSelected (hwndDlg, keyfiles))
+ foreach (const shared_ptr<TokenKeyfile> &keyfile, SecurityTokenKeyfileDlgGetSelected (hwndDlg, keyfiles))
{
- selectedTokenKeyfiles->push_back (SecurityTokenKeyfilePath (keyfile));
+ selectedTokenKeyfiles->push_back (TokenKeyfilePath (*keyfile));
}
}
@@ -12374,8 +12131,19 @@ BOOL CALLBACK SecurityTokenKeyfileDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam
if (msg == WM_NOTIFY && ((LPNMHDR) lParam)->code == LVN_ITEMCHANGED)
{
BOOL selected = (ListView_GetNextItem (GetDlgItem (hwndDlg, IDC_TOKEN_FILE_LIST), -1, LVIS_SELECTED) != -1);
+ BOOL deletable = selected;
+ // Multiple key files can be selected.
+ // Therefore, if one of them is not deletable, it means the delete button must be disabled for all.
+ foreach (const shared_ptr<TokenKeyfile> &keyfile, SecurityTokenKeyfileDlgGetSelected (hwndDlg, keyfiles))
+ {
+ if (!keyfile->Token->isEditable())
+ {
+ deletable = false;
+ break;
+ }
+ }
EnableWindow (GetDlgItem (hwndDlg, IDC_EXPORT), selected);
- EnableWindow (GetDlgItem (hwndDlg, IDC_DELETE), selected);
+ EnableWindow (GetDlgItem (hwndDlg, IDC_DELETE), deletable);
return 1;
}
@@ -12391,7 +12159,7 @@ BOOL CALLBACK SecurityTokenKeyfileDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam
{
wchar_t keyfilePath[TC_MAX_PATH];
- if (BrowseFiles (hwndDlg, "SELECT_KEYFILE", keyfilePath, bHistory, FALSE, NULL))
+ if (BrowseFiles (hwndDlg, "SELECT_KEYFILE", keyfilePath, bHistory, FALSE))
{
DWORD keyfileSize;
byte *keyfileData = (byte *) LoadFile (keyfilePath, &keyfileSize);
@@ -12422,7 +12190,7 @@ BOOL CALLBACK SecurityTokenKeyfileDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam
SecurityToken::CreateKeyfile (newParams.SlotId, keyfileDataVector, newParams.Name);
- keyfiles = SecurityToken::GetAvailableKeyfiles();
+ keyfiles = Token::GetAvailableKeyfiles(EMVSupportEnabled? true : false);
SecurityTokenKeyfileDlgFillList (hwndDlg, keyfiles);
}
catch (Exception &e)
@@ -12450,11 +12218,11 @@ BOOL CALLBACK SecurityTokenKeyfileDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam
{
try
{
- foreach (const SecurityTokenKeyfile &keyfile, SecurityTokenKeyfileDlgGetSelected (hwndDlg, keyfiles))
+ foreach (const shared_ptr<TokenKeyfile> &keyfile, SecurityTokenKeyfileDlgGetSelected (hwndDlg, keyfiles))
{
wchar_t keyfilePath[TC_MAX_PATH];
- if (!BrowseFiles (hwndDlg, "OPEN_TITLE", keyfilePath, bHistory, TRUE, NULL))
+ if (!BrowseFiles (hwndDlg, "OPEN_TITLE", keyfilePath, bHistory, TRUE))
break;
{
@@ -12463,7 +12231,7 @@ BOOL CALLBACK SecurityTokenKeyfileDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam
vector <byte> keyfileData;
- SecurityToken::GetKeyfileData (keyfile, keyfileData);
+ keyfile->GetKeyfileData (keyfileData);
if (keyfileData.empty())
{
@@ -12499,12 +12267,12 @@ BOOL CALLBACK SecurityTokenKeyfileDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam
WaitCursor();
finally_do ({ NormalCursor(); });
- foreach (const SecurityTokenKeyfile &keyfile, SecurityTokenKeyfileDlgGetSelected (hwndDlg, keyfiles))
+ foreach (const shared_ptr<TokenKeyfile> keyfile, SecurityTokenKeyfileDlgGetSelected (hwndDlg, keyfiles))
{
- SecurityToken::DeleteKeyfile (keyfile);
+ SecurityToken::DeleteKeyfile (dynamic_cast<SecurityTokenKeyfile&>(*keyfile.get()));
}
- keyfiles = SecurityToken::GetAvailableKeyfiles();
+ keyfiles = Token::GetAvailableKeyfiles(EMVSupportEnabled? true : false);
SecurityTokenKeyfileDlgFillList (hwndDlg, keyfiles);
}
catch (Exception &e)
@@ -13469,11 +13237,6 @@ BOOL IsWindowsIsoBurnerAvailable ()
{
wchar_t path[MAX_PATH*2] = { 0 };
- if (!IsOSAtLeast (WIN_7))
- {
- return FALSE;
- }
-
if (SUCCEEDED(SHGetFolderPath (NULL, CSIDL_SYSTEM, NULL, 0, path)))
{
StringCbCatW (path, MAX_PATH*2, L"\\" ISO_BURNER_TOOL);
@@ -13747,36 +13510,36 @@ void RegisterDriverInf (bool registerFilter, const string& filter, const string&
infFile.Write ((byte *) infTxt.c_str(), (DWORD) infTxt.size());
infFile.Close();
- HINF hInf = SetupOpenInfFileWFn (infFileName.c_str(), NULL, INF_STYLE_OLDNT | INF_STYLE_WIN4, NULL);
+ HINF hInf = SetupOpenInfFileW (infFileName.c_str(), NULL, INF_STYLE_OLDNT | INF_STYLE_WIN4, NULL);
throw_sys_if (hInf == INVALID_HANDLE_VALUE);
- finally_do_arg (HINF, hInf, { SetupCloseInfFileFn (finally_arg); });
+ finally_do_arg (HINF, hInf, { SetupCloseInfFile (finally_arg); });
- throw_sys_if (!SetupInstallFromInfSectionWFn (ParentWindow, hInf, L"veracrypt", SPINST_REGISTRY, regKey, NULL, 0, NULL, NULL, NULL, NULL));
+ throw_sys_if (!SetupInstallFromInfSectionW (ParentWindow, hInf, L"veracrypt", SPINST_REGISTRY, regKey, NULL, 0, NULL, NULL, NULL, NULL));
}
HKEY OpenDeviceClassRegKey (const GUID *deviceClassGuid)
{
- return SetupDiOpenClassRegKeyFn (deviceClassGuid, KEY_READ | KEY_WRITE);
+ return SetupDiOpenClassRegKey (deviceClassGuid, KEY_READ | KEY_WRITE);
}
LSTATUS DeleteRegistryKey (HKEY hKey, LPCTSTR keyName)
{
- return SHDeleteKeyWFn(hKey, keyName);
+ return SHDeleteKeyW(hKey, keyName);
}
HIMAGELIST CreateImageList(int cx, int cy, UINT flags, int cInitial, int cGrow)
{
- return ImageList_CreateFn(cx, cy, flags, cInitial, cGrow);
+ return ImageList_Create(cx, cy, flags, cInitial, cGrow);
}
int AddBitmapToImageList(HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask)
{
- return ImageList_AddFn(himl, hbmImage, hbmMask);
+ return ImageList_Add(himl, hbmImage, hbmMask);
}
HRESULT VCStrDupW(LPCWSTR psz, LPWSTR *ppwsz)
{
- return SHStrDupWFn (psz, ppwsz);
+ return SHStrDupW (psz, ppwsz);
}
@@ -13799,16 +13562,13 @@ void ProcessEntropyEstimate (HWND hProgress, DWORD* pdwInitialValue, DWORD dwCou
else
*pdwEntropy = dwMaxLevel;
- if (IsOSAtLeast (WIN_VISTA))
- {
- int state = PBST_ERROR;
- if (*pdwEntropy >= (dwMaxLevel/2))
- state = PBST_NORMAL;
- else if (*pdwEntropy >= (dwMaxLevel/4))
- state = PBST_PAUSED;
+ int state = PBST_ERROR;
+ if (*pdwEntropy >= (dwMaxLevel/2))
+ state = PBST_NORMAL;
+ else if (*pdwEntropy >= (dwMaxLevel/4))
+ state = PBST_PAUSED;
- SendMessage (hProgress, PBM_SETSTATE, state, 0);
- }
+ SendMessage (hProgress, PBM_SETSTATE, state, 0);
SendMessage (hProgress, PBM_SETPOS,
(WPARAM) (*pdwEntropy),
@@ -13818,10 +13578,8 @@ void ProcessEntropyEstimate (HWND hProgress, DWORD* pdwInitialValue, DWORD dwCou
void AllowMessageInUIPI (UINT msg)
{
- if (ChangeWindowMessageFilterFn)
- {
- ChangeWindowMessageFilterFn (msg, MSGFLT_ADD);
- }
+ /* ChangeWindowMessageFilter is used to enable some messages bypasss UIPI (User Interface Privilege Isolation) */
+ ChangeWindowMessageFilter (msg, MSGFLT_ADD);
}
BOOL IsRepeatedByteArray (byte value, const byte* buffer, size_t bufferSize)
@@ -13937,7 +13695,45 @@ BOOL SetPrivilege(LPTSTR szPrivilegeName, BOOL bEnable)
tkp.Privileges[0].Attributes = bEnable? SE_PRIVILEGE_ENABLED : SE_PRIVILEGE_REMOVED;
bRet = AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, NULL, NULL);
- if (!bRet)
+ dwLastError = GetLastError ();
+ if ( ERROR_SUCCESS != dwLastError)
+ {
+ bRet = FALSE;
+ }
+ }
+ else
+ dwLastError = GetLastError ();
+
+ CloseHandle(hToken);
+ }
+ else
+ dwLastError = GetLastError ();
+
+ SetLastError (dwLastError);
+
+ return bRet;
+}
+
+BOOL IsPrivilegeEnabled (LPTSTR szPrivilegeName)
+{
+ HANDLE hToken;
+ TOKEN_PRIVILEGES tkp;
+ BOOL bRet = FALSE;
+ DWORD dwLastError = 0;
+
+ if (OpenProcessToken(GetCurrentProcess(),
+ TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
+ &hToken))
+ {
+ if (LookupPrivilegeValue(NULL, szPrivilegeName,
+ &tkp.Privileges[0].Luid))
+ {
+ DWORD dwSize = sizeof (tkp);
+ if (GetTokenInformation (hToken, TokenPrivileges, &tkp, dwSize, &dwSize))
+ {
+ bRet = (tkp.Privileges[0].Attributes & SE_PRIVILEGE_ENABLED) != 0;
+ }
+ else
dwLastError = GetLastError ();
}
else
@@ -13991,7 +13787,7 @@ static BOOL GenerateRandomString (HWND hwndDlg, LPTSTR szName, DWORD maxCharsCou
bRet = RandgetBytesFull (hwndDlg, indexes, maxCharsCount + 1, TRUE, TRUE);
if (bRet)
{
- static LPCTSTR chars = _T("0123456789@#$%^&_-*abcdefghijklmnopqrstuvwxyz");
+ static LPCTSTR chars = _T("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_");
DWORD i, charsLen = (DWORD) _tcslen (chars);
DWORD effectiveLen = (indexes[0] % (64 - 16)) + 16; // random length between 16 to 64
effectiveLen = (effectiveLen > maxCharsCount)? maxCharsCount : effectiveLen;
@@ -14032,13 +13828,14 @@ typedef struct
DLGPROC lpDialogFunc;
LPARAM dwInitParam;
INT_PTR retValue;
+ BOOL bDlgDisplayed; // set to TRUE if the dialog was displayed on secure desktop
} SecureDesktopThreadParam;
typedef struct
{
LPCWSTR szVCDesktopName;
HDESK hVcDesktop;
- volatile BOOL* pbStopMonitoring;
+ HANDLE hStopEvent; // event to signal when to stop monitoring
} SecureDesktopMonitoringThreadParam;
#define SECUREDESKTOP_MONOTIR_PERIOD 500
@@ -14050,11 +13847,12 @@ static unsigned int __stdcall SecureDesktopMonitoringThread( LPVOID lpThreadPara
SecureDesktopMonitoringThreadParam* pMonitorParam = (SecureDesktopMonitoringThreadParam*) lpThreadParameter;
if (pMonitorParam)
{
- volatile BOOL* pbStopMonitoring = pMonitorParam->pbStopMonitoring;
+ HANDLE hStopEvent = pMonitorParam->hStopEvent;
LPCWSTR szVCDesktopName = pMonitorParam->szVCDesktopName;
HDESK hVcDesktop = pMonitorParam->hVcDesktop;
- while (!*pbStopMonitoring)
+ // loop until the stop event is signaled
+ while (WaitForSingleObject (hStopEvent, SECUREDESKTOP_MONOTIR_PERIOD) == WAIT_TIMEOUT)
{
// check that our secure desktop is still the input desktop
// otherwise, switch to it
@@ -14071,7 +13869,9 @@ static unsigned int __stdcall SecureDesktopMonitoringThread( LPVOID lpThreadPara
{
if (GetUserObjectInformation (currentDesk, UOI_NAME, szName, dwLen, &dwLen))
{
- if (0 != _wcsicmp (szName, szVCDesktopName))
+ if (0 == _wcsicmp(szName, L"Default")) // default input desktop for the interactive window station
+ bPerformSwitch = TRUE;
+ else if (0 != _wcsicmp (szName, szVCDesktopName))
bPerformSwitch = TRUE;
}
free (szName);
@@ -14082,61 +13882,78 @@ static unsigned int __stdcall SecureDesktopMonitoringThread( LPVOID lpThreadPara
if (bPerformSwitch)
SwitchDesktop (hVcDesktop);
-
- Sleep (SECUREDESKTOP_MONOTIR_PERIOD);
}
}
return 0;
}
-static DWORD WINAPI SecureDesktopThread(LPVOID lpThreadParameter)
+static unsigned int __stdcall SecureDesktopThread( LPVOID lpThreadParameter )
{
- volatile BOOL bStopMonitoring = FALSE;
HANDLE hMonitoringThread = NULL;
unsigned int monitoringThreadID = 0;
SecureDesktopThreadParam* pParam = (SecureDesktopThreadParam*) lpThreadParameter;
SecureDesktopMonitoringThreadParam monitorParam;
- HDESK hOriginalDesk = GetThreadDesktop (GetCurrentThreadId ());
BOOL bNewDesktopSet = FALSE;
+ HDESK hSecureDesk;
+ DWORD desktopAccess = DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | DESKTOP_READOBJECTS | DESKTOP_SWITCHDESKTOP | DESKTOP_WRITEOBJECTS;
+
+ hSecureDesk = CreateDesktop (pParam->szDesktopName, NULL, NULL, 0, desktopAccess, NULL);
+ if (!hSecureDesk)
+ {
+ return 0;
+ }
+
+ StringCbCopy(SecureDesktopName, sizeof (SecureDesktopName), pParam->szDesktopName);
+ pParam->hDesk = hSecureDesk;
// wait for SwitchDesktop to succeed before using it for current thread
while (true)
{
- if (SwitchDesktop (pParam->hDesk))
+ if (SwitchDesktop (hSecureDesk))
{
- bNewDesktopSet = TRUE;
break;
}
Sleep (SECUREDESKTOP_MONOTIR_PERIOD);
}
+ bNewDesktopSet = SetThreadDesktop (hSecureDesk);
+
if (bNewDesktopSet)
{
- SetThreadDesktop (pParam->hDesk);
-
// create the thread that will ensure that VeraCrypt secure desktop has always user input
- monitorParam.szVCDesktopName = pParam->szDesktopName;
- monitorParam.hVcDesktop = pParam->hDesk;
- monitorParam.pbStopMonitoring = &bStopMonitoring;
- hMonitoringThread = (HANDLE) _beginthreadex (NULL, 0, SecureDesktopMonitoringThread, (LPVOID) &monitorParam, 0, &monitoringThreadID);
- }
+ // this is done only if the stop event is created successfully
+ HANDLE hStopEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ if (hStopEvent)
+ {
+ monitorParam.szVCDesktopName = pParam->szDesktopName;
+ monitorParam.hVcDesktop = hSecureDesk;
+ monitorParam.hStopEvent = hStopEvent;
+ hMonitoringThread = (HANDLE) _beginthreadex (NULL, 0, SecureDesktopMonitoringThread, (LPVOID) &monitorParam, 0, &monitoringThreadID);
+ }
- pParam->retValue = DialogBoxParamW (pParam->hInstance, pParam->lpTemplateName,
- NULL, pParam->lpDialogFunc, pParam->dwInitParam);
+ pParam->retValue = DialogBoxParamW (pParam->hInstance, pParam->lpTemplateName,
+ NULL, pParam->lpDialogFunc, pParam->dwInitParam);
- if (hMonitoringThread)
- {
- bStopMonitoring = TRUE;
+ if (hMonitoringThread)
+ {
+ // notify the monitoring thread to stop
+ SetEvent(hStopEvent);
- WaitForSingleObject (hMonitoringThread, INFINITE);
- CloseHandle (hMonitoringThread);
- }
+ WaitForSingleObject (hMonitoringThread, INFINITE);
+ CloseHandle (hMonitoringThread);
+ }
- if (bNewDesktopSet)
+ if (hStopEvent)
+ {
+ CloseHandle (hStopEvent);
+ }
+
+ pParam->bDlgDisplayed = TRUE;
+ }
+ else
{
- SetThreadDesktop (hOriginalDesk);
- SwitchDesktop (hOriginalDesk);
+ pParam->bDlgDisplayed = FALSE;
}
return 0;
@@ -14187,17 +14004,36 @@ INT_PTR SecureDesktopDialogBoxParam(
if (bEffectiveUseSecureDesktop && !IsThreadInSecureDesktop(GetCurrentThreadId()))
{
+ BOOL bRandomNameGenerated = FALSE;
+ HDESK existedDesk = NULL;
EnterCriticalSection (&csSecureDesktop);
bSecureDesktopOngoing = TRUE;
finally_do ({ bSecureDesktopOngoing = FALSE; LeaveCriticalSection (&csSecureDesktop); });
- if (GenerateRandomString (hWndParent, szDesktopName, 64))
+ // ensure that the randomly generated name is not already used
+ do
+ {
+ if (existedDesk)
+ {
+ CloseDesktop (existedDesk);
+ existedDesk = NULL;
+ }
+ if (GenerateRandomString (hWndParent, szDesktopName, 64))
+ {
+ existedDesk = OpenDesktop (szDesktopName, 0, FALSE, GENERIC_READ);
+ if (!existedDesk)
+ {
+ bRandomNameGenerated = TRUE;
+ }
+ }
+ } while (existedDesk);
+
+ if (bRandomNameGenerated)
{
map<DWORD, BOOL> ctfmonBeforeList, ctfmonAfterList;
- DWORD desktopAccess = DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | DESKTOP_READOBJECTS | DESKTOP_SWITCHDESKTOP | DESKTOP_WRITEOBJECTS;
- HDESK hSecureDesk;
+ HDESK hOriginalDesk = NULL;
+ SecureDesktopThreadParam param;
- HDESK hInputDesk = NULL;
// wait for the input desktop to be available before switching to
// secure desktop. Under Windows 10, the user session can be started
@@ -14205,59 +14041,66 @@ INT_PTR SecureDesktopDialogBoxParam(
// case, we wait for the user to be really authenticated before starting
// secure desktop mechanism
- while (!(hInputDesk = OpenInputDesktop (0, TRUE, GENERIC_READ)))
+ while (!(hOriginalDesk = OpenInputDesktop (0, TRUE, GENERIC_ALL)))
{
Sleep (SECUREDESKTOP_MONOTIR_PERIOD);
}
-
- CloseDesktop (hInputDesk);
// get the initial list of ctfmon.exe processes before creating new desktop
GetCtfMonProcessIdList (ctfmonBeforeList);
- hSecureDesk = CreateDesktop (szDesktopName, NULL, NULL, 0, desktopAccess, NULL);
- if (hSecureDesk)
- {
- SecureDesktopThreadParam param;
-
- param.hDesk = hSecureDesk;
- param.szDesktopName = szDesktopName;
- param.hInstance = hInstance;
- param.lpTemplateName = lpTemplateName;
- param.lpDialogFunc = lpDialogFunc;
- param.dwInitParam = dwInitParam;
- param.retValue = 0;
-
- HANDLE hThread = ::CreateThread (NULL, 0, SecureDesktopThread, (LPVOID) &param, 0, NULL);
- if (hThread)
- {
- StringCbCopy(SecureDesktopName, sizeof (SecureDesktopName), szDesktopName);
+ param.hDesk = NULL;
+ param.szDesktopName = szDesktopName;
+ param.hInstance = hInstance;
+ param.lpTemplateName = lpTemplateName;
+ param.lpDialogFunc = lpDialogFunc;
+ param.dwInitParam = dwInitParam;
+ param.retValue = 0;
+ param.bDlgDisplayed = FALSE;
- WaitForSingleObject (hThread, INFINITE);
- CloseHandle (hThread);
+ // use _beginthreadex instead of CreateThread because lpDialogFunc may be using the C runtime library
+ HANDLE hThread = (HANDLE) _beginthreadex (NULL, 0, SecureDesktopThread, (LPVOID) &param, 0, NULL);
+ if (hThread)
+ {
+ WaitForSingleObject (hThread, INFINITE);
+ CloseHandle (hThread);
+ if (param.bDlgDisplayed)
+ {
+ // dialog box was indeed displayed in Secure Desktop
retValue = param.retValue;
bSuccess = TRUE;
}
+ }
+
+ if (param.hDesk)
+ {
+ while (!SwitchDesktop (hOriginalDesk))
+ {
+ Sleep (SECUREDESKTOP_MONOTIR_PERIOD);
+ }
- CloseDesktop (hSecureDesk);
+ SetThreadDesktop (hOriginalDesk);
- // get the new list of ctfmon.exe processes in order to find the ID of the
- // ctfmon.exe instance that corresponds to the desktop we create so that
- // we can kill it, otherwise it would remain running
- GetCtfMonProcessIdList (ctfmonAfterList);
+ CloseDesktop (param.hDesk);
+ }
+
+ // get the new list of ctfmon.exe processes in order to find the ID of the
+ // ctfmon.exe instance that corresponds to the desktop we create so that
+ // we can kill it, otherwise it would remain running
+ GetCtfMonProcessIdList (ctfmonAfterList);
- for (map<DWORD, BOOL>::iterator It = ctfmonAfterList.begin();
- It != ctfmonAfterList.end(); It++)
+ for (map<DWORD, BOOL>::iterator It = ctfmonAfterList.begin();
+ It != ctfmonAfterList.end(); It++)
+ {
+ if (ctfmonBeforeList[It->first] != TRUE)
{
- if (ctfmonBeforeList[It->first] != TRUE)
- {
- // Kill process
- KillProcess (It->first);
- }
+ // Kill process
+ KillProcess (It->first);
}
}
+ CloseDesktop(hOriginalDesk);
burn (szDesktopName, sizeof (szDesktopName));
}
}
@@ -14352,37 +14195,26 @@ void GetInstallationPath (HWND hwndDlg, wchar_t* szInstallPath, DWORD cchSize, B
BOOL GetSetupconfigLocation (wchar_t* path, DWORD cchSize)
{
- wchar_t szShell32Path[MAX_PATH] = {0};
- HMODULE hShell32 = NULL;
BOOL bResult = FALSE;
path[0] = 0;
- if (GetSystemDirectory(szShell32Path, MAX_PATH))
- StringCchCatW (szShell32Path, MAX_PATH, L"\\Shell32.dll");
- else
- StringCchCopyW (szShell32Path, MAX_PATH, L"C:\\Windows\\System32\\Shell32.dll");
-
- hShell32 = LoadLibrary (szShell32Path);
- if (hShell32)
+ wchar_t* pszUsersPath = NULL;
+ if (S_OK == SHGetKnownFolderPath (FOLDERID_UserProfiles, 0, NULL, &pszUsersPath))
{
- SHGETKNOWNFOLDERPATH SHGetKnownFolderPathFn = (SHGETKNOWNFOLDERPATH) GetProcAddress (hShell32, "SHGetKnownFolderPath");
- if (SHGetKnownFolderPathFn)
- {
- wchar_t* pszUsersPath = NULL;
- if (S_OK == SHGetKnownFolderPathFn (FOLDERID_UserProfiles, 0, NULL, &pszUsersPath))
- {
- StringCchPrintfW (path, cchSize, L"%s\\Default\\AppData\\Local\\Microsoft\\Windows\\WSUS\\", pszUsersPath);
- CoTaskMemFree (pszUsersPath);
- bResult = TRUE;
- }
- }
- FreeLibrary (hShell32);
+ StringCchPrintfW (path, cchSize, L"%s\\Default\\AppData\\Local\\Microsoft\\Windows\\WSUS\\", pszUsersPath);
+ CoTaskMemFree (pszUsersPath);
+ bResult = TRUE;
}
if (!bResult && CurrentOSMajor >= 10)
{
- StringCchPrintfW (path, cchSize, L"%c:\\Users\\Default\\AppData\\Local\\Microsoft\\Windows\\WSUS\\", szShell32Path[0]);
+ wchar_t szSys32Path[MAX_PATH];
+ if (!GetSystemDirectory (szSys32Path, ARRAYSIZE (szSys32Path)))
+ {
+ StringCchCopy(szSys32Path, ARRAYSIZE (szSys32Path), L"C:\\Windows\\System32");
+ }
+ StringCchPrintfW (path, cchSize, L"%c:\\Users\\Default\\AppData\\Local\\Microsoft\\Windows\\WSUS\\", szSys32Path[0]);
bResult = TRUE;
}
@@ -14412,7 +14244,7 @@ BOOL BufferHasPattern (const unsigned char* buffer, size_t bufferLen, const void
*
* Reduce current user acess rights for this process to the minimum in order to forbid non-admin users from reading the process memory.
*/
-BOOL EnableProcessProtection()
+BOOL ActivateMemoryProtection()
{
BOOL bSuccess = FALSE;
@@ -14427,7 +14259,10 @@ BOOL EnableProcessProtection()
// Acces mask
DWORD dwAccessMask = SYNCHRONIZE | PROCESS_QUERY_LIMITED_INFORMATION | PROCESS_TERMINATE; // same as protected process
-
+
+ if (MemoryProtectionActivated)
+ return TRUE;
+
if (IsAdmin ())
{
// if we are running elevated, we allow CreateProcessXXX calls alongside PROCESS_DUP_HANDLE and PROCESS_QUERY_INFORMATION in order to be able
@@ -14490,6 +14325,9 @@ BOOL EnableProcessProtection()
NULL // do not change SACL
))? TRUE: FALSE;
+ if (bSuccess)
+ MemoryProtectionActivated = TRUE;
+
Cleanup:
if (pACL != NULL) {
@@ -14505,6 +14343,92 @@ Cleanup:
return bSuccess;
}
+// define missing structures Windows 8
+#if (_WIN32_WINNT < 0x0602)
+
+typedef struct _PROCESS_MITIGATION_ASLR_POLICY {
+ union {
+ DWORD Flags;
+ struct {
+ DWORD EnableBottomUpRandomization : 1;
+ DWORD EnableForceRelocateImages : 1;
+ DWORD EnableHighEntropy : 1;
+ DWORD DisallowStrippedImages : 1;
+ DWORD ReservedFlags : 28;
+ } DUMMYSTRUCTNAME;
+ } DUMMYUNIONNAME;
+} PROCESS_MITIGATION_ASLR_POLICY, *PPROCESS_MITIGATION_ASLR_POLICY;
+
+typedef struct _PROCESS_MITIGATION_EXTENSION_POINT_DISABLE_POLICY {
+ union {
+ DWORD Flags;
+ struct {
+ DWORD DisableExtensionPoints : 1;
+ DWORD ReservedFlags : 31;
+ } DUMMYSTRUCTNAME;
+ } DUMMYUNIONNAME;
+} PROCESS_MITIGATION_EXTENSION_POINT_DISABLE_POLICY, *PPROCESS_MITIGATION_EXTENSION_POINT_DISABLE_POLICY;
+
+typedef struct _PROCESS_MITIGATION_DYNAMIC_CODE_POLICY {
+ union {
+ DWORD Flags;
+ struct {
+ DWORD ProhibitDynamicCode : 1;
+ DWORD AllowThreadOptOut : 1;
+ DWORD AllowRemoteDowngrade : 1;
+ DWORD AuditProhibitDynamicCode : 1;
+ DWORD ReservedFlags : 28;
+ } DUMMYSTRUCTNAME;
+ } DUMMYUNIONNAME;
+} PROCESS_MITIGATION_DYNAMIC_CODE_POLICY, *PPROCESS_MITIGATION_DYNAMIC_CODE_POLICY;
+
+typedef enum _PROCESS_MITIGATION_POLICY {
+ ProcessDEPPolicy,
+ ProcessASLRPolicy,
+ ProcessDynamicCodePolicy,
+ ProcessStrictHandleCheckPolicy,
+ ProcessSystemCallDisablePolicy,
+ ProcessMitigationOptionsMask,
+ ProcessExtensionPointDisablePolicy,
+ ProcessControlFlowGuardPolicy,
+ ProcessSignaturePolicy,
+ ProcessFontDisablePolicy,
+ ProcessImageLoadPolicy,
+ ProcessSystemCallFilterPolicy,
+ ProcessPayloadRestrictionPolicy,
+ ProcessChildProcessPolicy,
+ ProcessSideChannelIsolationPolicy,
+ ProcessUserShadowStackPolicy,
+ MaxProcessMitigationPolicy
+} PROCESS_MITIGATION_POLICY, *PPROCESS_MITIGATION_POLICY;
+
+#endif
+
+void ActivateProcessMitigations()
+{
+ // we load the function pointer of SetProcessMitigationPolicy dynamically because we are building with Windows 7 SDK that does not have the definition of this function
+ typedef BOOL (WINAPI *SetProcessMitigationPolicyFunc) (PROCESS_MITIGATION_POLICY MitigationPolicy, PVOID lpBuffer, SIZE_T dwLength);
+ SetProcessMitigationPolicyFunc SetProcessMitigationPolicyPtr = (SetProcessMitigationPolicyFunc) GetProcAddress (GetModuleHandle (L"kernel32.dll"), "SetProcessMitigationPolicy");
+ if (SetProcessMitigationPolicyPtr)
+ {
+ PROCESS_MITIGATION_ASLR_POLICY aslrPolicy = { 0 };
+ PROCESS_MITIGATION_DYNAMIC_CODE_POLICY dynCodePolicy = { 0 };
+ PROCESS_MITIGATION_EXTENSION_POINT_DISABLE_POLICY extensionPointDisablePolicy = { 0 };
+
+ aslrPolicy.EnableBottomUpRandomization = TRUE;
+ aslrPolicy.EnableForceRelocateImages = TRUE;
+ aslrPolicy.EnableHighEntropy = TRUE;
+
+ dynCodePolicy.ProhibitDynamicCode = TRUE;
+
+ extensionPointDisablePolicy.DisableExtensionPoints = TRUE;
+
+ SetProcessMitigationPolicyPtr (ProcessASLRPolicy, &aslrPolicy, sizeof (aslrPolicy));
+ SetProcessMitigationPolicyPtr (ProcessDynamicCodePolicy, &dynCodePolicy, sizeof (dynCodePolicy));
+ SetProcessMitigationPolicyPtr (ProcessExtensionPointDisablePolicy, &extensionPointDisablePolicy, sizeof (extensionPointDisablePolicy));
+ }
+}
+
// Based on sample code from:
// https://blogs.msdn.microsoft.com/aaron_margosis/2009/06/06/faq-how-do-i-start-a-program-as-the-desktop-user-from-an-elevated-app/
// start a program non-elevated as the desktop user from an elevated app
@@ -14525,12 +14449,6 @@ static bool RunAsDesktopUser(
SecureZeroMemory(&pi, sizeof(pi));
si.cb = sizeof(si);
- // locate CreateProcessWithTokenW in Advapi32.dll
- if (!CreateProcessWithTokenWPtr)
- {
- return false;
- }
-
if (!ImpersonateSelf (SecurityImpersonation))
{
return false;
@@ -14608,7 +14526,7 @@ static bool RunAsDesktopUser(
}
// Start the target process with the new token.
- ret = CreateProcessWithTokenWPtr(
+ ret = CreateProcessWithTokenW(
hPrimaryToken,
0,
szApp,
@@ -14682,7 +14600,7 @@ HRESULT GetShellViewForDesktop(REFIID riid, void **ppv)
if (S_OK == psw->FindWindowSW(&vEmpty, &vEmpty, SWC_DESKTOP, (long*)&hwnd, SWFO_NEEDDISPATCH, &pdisp))
{
IShellBrowser *psb;
- hr = IUnknown_QueryServicePtr(pdisp, SID_STopLevelBrowser, IID_PPV_ARGS(&psb));
+ hr = IUnknown_QueryService(pdisp, SID_STopLevelBrowser, IID_PPV_ARGS(&psb));
if (SUCCEEDED(hr))
{
IShellView *psv;
@@ -14734,7 +14652,7 @@ HRESULT GetShellDispatchFromView(IShellView *psv, REFIID riid, void **ppv)
HRESULT ShellExecInExplorerProcess(PCWSTR pszFile)
{
IShellView *psv;
- CoInitialize(NULL);
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
HRESULT hr = GetShellViewForDesktop(IID_PPV_ARGS(&psv));
if (SUCCEEDED(hr))
{
@@ -14766,7 +14684,7 @@ HRESULT ShellExecInExplorerProcess(PCWSTR pszFile)
void SafeOpenURL (LPCWSTR szUrl)
{
BOOL bFallback = TRUE;
- if (IsOSAtLeast (WIN_VISTA) && IsUacSupported() && IsAdmin () && IsElevated() && GetShellWindow())
+ if (IsUacSupported() && IsAdmin () && IsElevated() && GetShellWindow())
{
WCHAR szRunDllPath[TC_MAX_PATH];
WCHAR szUrlDllPath[TC_MAX_PATH];
@@ -14906,69 +14824,49 @@ BitLockerEncryptionStatus GetBitLockerEncryptionStatus(WCHAR driveLetter)
{
HRESULT hr;
BitLockerEncryptionStatus blStatus = BL_Status_Unknown;
- wchar_t szDllPath[MAX_PATH] = { 0 };
- HMODULE hShell32 = NULL;
+ wchar_t szDllPath[MAX_PATH] = { 0 };
+ HMODULE hPropsys = NULL;
- CoInitialize(NULL);
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
if (GetSystemDirectory(szDllPath, MAX_PATH))
- StringCchCatW(szDllPath, MAX_PATH, L"\\Shell32.dll");
+ StringCchCatW(szDllPath, MAX_PATH, L"\\Propsys.dll");
else
- StringCchCopyW(szDllPath, MAX_PATH, L"C:\\Windows\\System32\\Shell32.dll");
+ StringCchCopyW(szDllPath, MAX_PATH, L"C:\\Windows\\System32\\Propsys.dll");
- hShell32 = LoadLibrary(szDllPath);
- if (hShell32)
+ hPropsys = LoadLibrary(szDllPath);
+ if (hPropsys)
{
- SHCreateItemFromParsingNameFn SHCreateItemFromParsingNamePtr = (SHCreateItemFromParsingNameFn)GetProcAddress(hShell32, "SHCreateItemFromParsingName");
- if (SHCreateItemFromParsingNamePtr)
+ PSGetPropertyKeyFromNameFn PSGetPropertyKeyFromNamePtr = (PSGetPropertyKeyFromNameFn)GetProcAddress(hPropsys, "PSGetPropertyKeyFromName");
+ if (PSGetPropertyKeyFromNamePtr)
{
- HMODULE hPropsys = NULL;
-
- if (GetSystemDirectory(szDllPath, MAX_PATH))
- StringCchCatW(szDllPath, MAX_PATH, L"\\Propsys.dll");
- else
- StringCchCopyW(szDllPath, MAX_PATH, L"C:\\Windows\\System32\\Propsys.dll");
-
- hPropsys = LoadLibrary(szDllPath);
- if (hPropsys)
- {
- PSGetPropertyKeyFromNameFn PSGetPropertyKeyFromNamePtr = (PSGetPropertyKeyFromNameFn)GetProcAddress(hPropsys, "PSGetPropertyKeyFromName");
- if (PSGetPropertyKeyFromNamePtr)
- {
- WCHAR parsingName[3] = {driveLetter, L':', 0};
- IShellItem2* drive = NULL;
- hr = SHCreateItemFromParsingNamePtr(parsingName, NULL, IID_PPV_ARGS(&drive));
+ WCHAR parsingName[3] = {driveLetter, L':', 0};
+ IShellItem2* drive = NULL;
+ hr = SHCreateItemFromParsingName(parsingName, NULL, IID_PPV_ARGS(&drive));
+ if (SUCCEEDED(hr)) {
+ PROPERTYKEY pKey;
+ hr = PSGetPropertyKeyFromNamePtr(L"System.Volume.BitLockerProtection", &pKey);
+ if (SUCCEEDED(hr)) {
+ PROPVARIANT prop;
+ PropVariantInit(&prop);
+ hr = drive->GetProperty(pKey, &prop);
if (SUCCEEDED(hr)) {
- PROPERTYKEY pKey;
- hr = PSGetPropertyKeyFromNamePtr(L"System.Volume.BitLockerProtection", &pKey);
- if (SUCCEEDED(hr)) {
- PROPVARIANT prop;
- PropVariantInit(&prop);
- hr = drive->GetProperty(pKey, &prop);
- if (SUCCEEDED(hr)) {
- int status = prop.intVal;
- if (status == BL_State_FullyEncrypted || status == BL_State_DecryptionInProgress || status == BL_State_DecryptionSuspended)
- blStatus = BL_Status_Protected;
- else
- blStatus = BL_Status_Unprotected;
- }
- }
+ int status = prop.intVal;
+ if (status == BL_State_FullyEncrypted || status == BL_State_DecryptionInProgress || status == BL_State_DecryptionSuspended)
+ blStatus = BL_Status_Protected;
+ else
+ blStatus = BL_Status_Unprotected;
}
- if (drive)
- drive->Release();
}
-
- FreeLibrary(hPropsys);
}
- }
- else
- {
- blStatus = BL_Status_Unprotected; // before Vista, there was no Bitlocker
+ if (drive)
+ drive->Release();
}
- FreeLibrary(hShell32);
+ FreeLibrary(hPropsys);
}
+
CoUninitialize();
return blStatus;
}
@@ -15377,6 +15275,33 @@ void PasswordEditDropTarget::GotDrop(CLIPFORMAT format)
}
+// check if the PC is connected to the internet using INetworkListManager interface
+BOOL IsInternetConnected()
+{
+ HRESULT hr;
+ BOOL isConnected = FALSE;
+ INetworkListManager* pNetworkListManager = nullptr;
+
+ hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
+ if (SUCCEEDED(hr))
+ {
+ hr = CoCreateInstance(CLSID_NetworkListManager, NULL, CLSCTX_ALL, IID_PPV_ARGS(&pNetworkListManager));
+ if (SUCCEEDED(hr))
+ {
+ VARIANT_BOOL isConnectedVariant;
+ hr = pNetworkListManager->get_IsConnectedToInternet(&isConnectedVariant);
+ if (SUCCEEDED(hr))
+ {
+ isConnected = isConnectedVariant == VARIANT_TRUE;
+ }
+ pNetworkListManager->Release();
+ }
+ CoUninitialize();
+ }
+
+ return isConnected;
+}
+
/*
* Query the status of Hibernate and Fast Startup
*/
@@ -15485,7 +15410,7 @@ bool GetKbList (std::vector<std::wstring>& kbList)
kbList.clear();
// Initialize COM.
- hres = CoInitialize(NULL);
+ hres = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
if (FAILED(hres))
{
return false;
@@ -15668,4 +15593,86 @@ bool OneOfKBsInstalled (const wchar_t* szKBs[], int count)
return bRet;
}
-#endif // VC_COMREG \ No newline at end of file
+
+DWORD SendServiceNotification (DWORD dwNotificationCmd)
+{
+ DWORD dwRet = ERROR_INVALID_PARAMETER;
+ // We only support clearing keys on new device insertion
+ if (VC_DRIVER_CONFIG_CLEAR_KEYS_ON_NEW_DEVICE_INSERTION == dwNotificationCmd)
+ {
+ DWORD dwServiceControlCode = VC_SERVICE_CONTROL_BUILD_DEVICE_LIST;
+ // send this control code to VeraCrypt SystemFavorites service
+ SC_HANDLE hSCManager = OpenSCManager (NULL, NULL, SC_MANAGER_CONNECT);
+ if (hSCManager != NULL)
+ {
+ SC_HANDLE hService = OpenService (hSCManager, TC_SYSTEM_FAVORITES_SERVICE_NAME, SERVICE_ALL_ACCESS);
+ if (hService != NULL)
+ {
+ SERVICE_STATUS ss;
+ if (ControlService (hService, dwServiceControlCode, &ss))
+ dwRet = ERROR_SUCCESS;
+ else
+ dwRet = GetLastError ();
+ CloseServiceHandle (hService);
+ }
+ else
+ dwRet = GetLastError ();
+ CloseServiceHandle (hSCManager);
+ }
+ else
+ dwRet = GetLastError ();
+ }
+
+ return dwRet;
+}
+
+DWORD FastResizeFile (const wchar_t* filePath, __int64 fileSize)
+{
+ DWORD dwRet = ERROR_INVALID_PARAMETER;
+ if (filePath && fileSize > 0)
+ {
+ // we set required privileges to speedup file creation before we create the file so that the file handle inherits the privileges
+ BOOL bPrivilegesSet = IsPrivilegeEnabled (SE_MANAGE_VOLUME_NAME);
+ if (!bPrivilegesSet && !SetPrivilege(SE_MANAGE_VOLUME_NAME, TRUE))
+ {
+ dwRet = GetLastError ();
+ }
+ else
+ {
+ HANDLE dev = CreateFile (filePath, GENERIC_WRITE | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
+ if (dev != INVALID_HANDLE_VALUE)
+ {
+ LARGE_INTEGER liSize;
+ liSize.QuadPart = fileSize;
+ // Preallocate the file with desired size
+ if (!SetFilePointerEx (dev, liSize, NULL, FILE_BEGIN)
+ || !SetEndOfFile (dev))
+ {
+ dwRet = GetLastError ();
+ }
+ else
+ {
+ if (!SetFileValidData (dev, fileSize))
+ {
+ dwRet = GetLastError ();
+ }
+ else
+ {
+ dwRet = ERROR_SUCCESS;
+ }
+ }
+
+ FlushFileBuffers (dev);
+ CloseHandle (dev);
+ }
+ else
+ dwRet = GetLastError ();
+
+ if (!bPrivilegesSet)
+ SetPrivilege(SE_MANAGE_VOLUME_NAME, FALSE);
+ }
+ }
+
+ return dwRet;
+}
+#endif // VC_COMREG
diff --git a/src/Common/Dlgcode.h b/src/Common/Dlgcode.h
index 362b2d6d..750b4dc7 100644
--- a/src/Common/Dlgcode.h
+++ b/src/Common/Dlgcode.h
@@ -84,6 +84,9 @@ enum
#define VC_FILENAME_RENAMED_SUFFIX L"_old"
+/* customer service control code to build device list */
+#define VC_SERVICE_CONTROL_BUILD_DEVICE_LIST 128
+
#ifndef USER_DEFAULT_SCREEN_DPI
#define USER_DEFAULT_SCREEN_DPI 96
#endif
@@ -166,6 +169,7 @@ extern BOOL LastMountedVolumeDirty;
extern BOOL MountVolumesAsSystemFavorite;
extern BOOL FavoriteMountOnArrivalInProgress;
extern BOOL MultipleMountOperationInProgress;
+extern BOOL EMVSupportEnabled;
extern volatile BOOL NeedPeriodicDeviceListUpdate;
extern BOOL DisablePeriodicDeviceListUpdate;
@@ -323,6 +327,7 @@ void HandCursor ();
void AddComboPair (HWND hComboBox, const wchar_t *lpszItem, int value);
void SelectAlgo ( HWND hComboBox , int *nCipher );
void PopulateWipeModeCombo (HWND hComboBox, BOOL bNA, BOOL bInPlaceEncryption, BOOL bHeaderWipe);
+HWND CreateToolTip(int toolID, HWND hDlg, const char* strID);
wchar_t *GetWipeModeName (WipeAlgorithmId modeId);
wchar_t *GetPathType (const wchar_t *path, BOOL bUpperCase, BOOL *bIsPartition);
LRESULT CALLBACK CustomDlgProc ( HWND hwnd , UINT uMsg , WPARAM wParam , LPARAM lParam );
@@ -345,6 +350,8 @@ BOOL IsTrueCryptInstallerRunning (void);
uint32 ReadDriverConfigurationFlags ();
uint32 ReadServiceConfigurationFlags ();
uint32 ReadEncryptionThreadPoolFreeCpuCountLimit ();
+BOOL ReadMemoryProtectionConfig ();
+BOOL WriteMemoryProtectionConfig (BOOL bEnable);
BOOL LoadSysEncSettings ();
int LoadNonSysInPlaceEncSettings (WipeAlgorithmId *wipeAlgorithm);
void RemoveNonSysInPlaceEncNotifications (void);
@@ -352,7 +359,6 @@ void SavePostInstallTasksSettings (int command);
void DoPostInstallTasks (HWND hwndDlg);
void InitOSVersionInfo ();
void InitApp ( HINSTANCE hInstance, wchar_t *lpszCommandLine );
-void FinalizeApp (void);
void InitHelpFileName (void);
BOOL OpenDevice (const wchar_t *lpszPath, OPEN_TEST_STRUCT *driver, BOOL detectFilesystem, BOOL computeVolumeID);
void NotifyDriverOfPortableMode (void);
@@ -373,8 +379,8 @@ int DriverAttach ( void );
BOOL CALLBACK CipherTestDialogProc ( HWND hwndDlg , UINT uMsg , WPARAM wParam , LPARAM lParam );
void ResetCipherTest ( HWND hwndDlg , int idTestCipher );
void ResetCurrentDirectory ();
-BOOL BrowseFiles (HWND hwndDlg, char *stringId, wchar_t *lpszFileName, BOOL keepHistory, BOOL saveMode, wchar_t *browseFilter);
-BOOL BrowseDirectories (HWND hWnd, char *lpszTitle, wchar_t *dirName);
+BOOL BrowseFiles (HWND hwndDlg, char *stringId, wchar_t *lpszFileName, BOOL keepHistory, BOOL saveMode);
+BOOL BrowseDirectories(HWND hwndDlg, char *lpszTitle, wchar_t *dirName, const wchar_t *initialDir);
void handleError ( HWND hwndDlg , int code, const char* srcPos );
BOOL CheckFileStreamWriteErrors (HWND hwndDlg, FILE *file, const wchar_t *fileName);
void LocalizeDialog ( HWND hwnd, char *stringId );
@@ -384,7 +390,6 @@ BOOL CloseVolumeExplorerWindows (HWND hwnd, int driveNo);
BOOL UpdateDriveCustomLabel (int driveNo, wchar_t* effectiveLabel, BOOL bSetValue);
BOOL CheckCapsLock (HWND hwnd, BOOL quiet);
BOOL CheckFileExtension (wchar_t *fileName);
-BOOL IsTrueCryptFileExtension (wchar_t *fileName);
void CorrectFileName (wchar_t* fileName);
void CorrectURL (wchar_t* fileName);
void IncreaseWrongPwdRetryCount (int count);
@@ -397,7 +402,7 @@ BOOL IsDriveAvailable (int driveNo);
BOOL IsDeviceMounted (wchar_t *deviceName);
int DriverUnmountVolume (HWND hwndDlg, int nDosDriveNo, BOOL forced);
void BroadcastDeviceChange (WPARAM message, int nDosDriveNo, DWORD driveMap);
-int MountVolume (HWND hwndDlg, int driveNo, wchar_t *volumePath, Password *password, int pkcs5, int pim, BOOL truecryptMode, BOOL cachePassword, BOOL cachePim, BOOL sharedAccess, const MountOptions* const mountOptions, BOOL quiet, BOOL bReportWrongPassword);
+int MountVolume (HWND hwndDlg, int driveNo, wchar_t *volumePath, Password *password, int pkcs5, int pim, BOOL cachePassword, BOOL cachePim, BOOL sharedAccess, const MountOptions* const mountOptions, BOOL quiet, BOOL bReportWrongPassword);
BOOL UnmountVolume (HWND hwndDlg , int nDosDriveNo, BOOL forceUnmount);
BOOL UnmountVolumeAfterFormatExCall (HWND hwndDlg, int nDosDriveNo);
BOOL IsPasswordCacheEmpty (void);
@@ -510,8 +515,6 @@ BOOL CALLBACK FindTCWindowEnum (HWND hwnd, LPARAM lParam);
BYTE *MapResource (wchar_t *resourceType, int resourceId, PDWORD size);
void InconsistencyResolved (char *msg);
void ReportUnexpectedState (const char *techInfo);
-BOOL SelectMultipleFiles (HWND hwndDlg, const char *stringId, wchar_t *lpszFileName, size_t cbFileName, BOOL keepHistory);
-BOOL SelectMultipleFilesNext (wchar_t *lpszFileName, size_t cbFileName);
void OpenOnlineHelp ();
BOOL GetPartitionInfo (const wchar_t *deviceName, PPARTITION_INFORMATION rpartInfo);
BOOL GetDeviceInfo (const wchar_t *deviceName, DISK_PARTITION_INFO_STRUCT *info);
@@ -530,10 +533,12 @@ void EnableCloseButton (HWND hwndDlg);
void ToBootPwdField (HWND hwndDlg, UINT ctrlId);
void ToNormalPwdField (HWND hwndDlg, UINT ctrlId);
void AccommodateTextField (HWND hwndDlg, UINT ctrlId, BOOL bFirstUpdate, HFONT hFont);
+void AccommodateCheckBoxTextWidth (HWND hwndDlg, UINT ctrlId);
+void MakeControlsContiguous(HWND hwndDlg, UINT ctrl1ID, UINT ctrl2ID);
BOOL GetDriveLabel (int driveNo, wchar_t *label, int labelSize);
BOOL GetSysDevicePaths (HWND hwndDlg);
BOOL DoDriverInstall (HWND hwndDlg);
-int OpenVolume (OpenVolumeContext *context, const wchar_t *volumePath, Password *password, int pkcs5_prf, int pim, BOOL truecryptMode, BOOL write, BOOL preserveTimestamps, BOOL useBackupHeader);
+int OpenVolume (OpenVolumeContext *context, const wchar_t *volumePath, Password *password, int pkcs5_prf, int pim, BOOL write, BOOL preserveTimestamps, BOOL useBackupHeader);
void CloseVolume (OpenVolumeContext *context);
int ReEncryptVolumeHeader (HWND hwndDlg, char *buffer, BOOL bBoot, CRYPTO_INFO *cryptoInfo, Password *password, int pim, BOOL wipeMode);
BOOL IsPagingFileActive (BOOL checkNonWindowsPartitionsOnly);
@@ -574,6 +579,7 @@ BOOL CopyTextToClipboard (const wchar_t* txtValue);
BOOL LaunchElevatedProcess (HWND hwndDlg, const wchar_t* szModPath, const wchar_t* args);
BOOL GetFreeDriveLetter(WCHAR* pCh);
BOOL SetPrivilege(LPTSTR szPrivilegeName, BOOL bEnable);
+BOOL IsPrivilegeEnabled (LPTSTR szPrivilegeName);
BOOL DeleteDirectory (const wchar_t* szDirName);
BOOL IsThreadInSecureDesktop(DWORD dwThreadID);
INT_PTR SecureDesktopDialogBoxParam (HINSTANCE, LPCWSTR, HWND, DLGPROC, LPARAM);
@@ -581,13 +587,17 @@ BOOL VerifyModuleSignature (const wchar_t* path);
void GetInstallationPath (HWND hwndDlg, wchar_t* szInstallPath, DWORD cchSize, BOOL* pbInstallPathDetermined);
BOOL GetSetupconfigLocation (wchar_t* path, DWORD cchSize);
BOOL BufferHasPattern (const unsigned char* buffer, size_t bufferLen, const void* pattern, size_t patternLen);
-BOOL EnableProcessProtection();
+void ActivateProcessMitigations();
+BOOL ActivateMemoryProtection();
void SafeOpenURL (LPCWSTR szUrl);
BitLockerEncryptionStatus GetBitLockerEncryptionStatus(WCHAR driveLetter);
BOOL IsTestSigningModeEnabled ();
+DWORD SendServiceNotification (DWORD dwNotificationCmd);
+DWORD FastResizeFile (const wchar_t* filePath, __int64 fileSize);
#ifdef _WIN64
void GetAppRandomSeed (unsigned char* pbRandSeed, size_t cbRandSeed);
#endif
+BOOL IsInternetConnected();
#ifdef __cplusplus
}
@@ -687,6 +697,7 @@ struct RawDevicesDlgParam
wchar_t *pszFileName;
};
+BOOL SelectMultipleFiles (HWND hwndDlg, const char *stringId, BOOL keepHistory, std::vector<std::wstring>& filesList);
BOOL BrowseFilesInDir (HWND hwndDlg, char *stringId, wchar_t *initialDir, wchar_t *lpszFileName, BOOL keepHistory, BOOL saveMode, wchar_t *browseFilter, const wchar_t *initialFileName = NULL, const wchar_t *defaultExtension = NULL);
std::wstring SingleStringToWide (const std::string &singleString);
std::wstring Utf8StringToWide (const std::string &utf8String);
diff --git a/src/Common/EMVCard.cpp b/src/Common/EMVCard.cpp
new file mode 100644
index 00000000..e96422b1
--- /dev/null
+++ b/src/Common/EMVCard.cpp
@@ -0,0 +1,523 @@
+#include "EMVCard.h"
+#include "TLVParser.h"
+#include "SCardReader.h"
+#include "PCSCException.h"
+
+#include "Platform/Finally.h"
+#include "Platform/ForEach.h"
+#include <vector>
+#include <iostream>
+#include <algorithm>
+
+#if !defined(TC_WINDOWS) || defined(TC_PROTOTYPE)
+#include "Platform/SerializerFactory.h"
+#include "Platform/StringConverter.h"
+#include "Platform/SystemException.h"
+#else
+#include "Dictionary.h"
+#include "Language.h"
+#endif
+
+using namespace std;
+
+namespace VeraCrypt
+{
+#ifndef TC_WINDOWS
+ wstring ArrayToHexWideString(const unsigned char * pbData, size_t cbData)
+ {
+ static const wchar_t* hexChar = L"0123456789ABCDEF";
+ wstring result;
+ if (pbData)
+ {
+ for (size_t i = 0; i < cbData; i++)
+ {
+ result += hexChar[pbData[i] >> 4];
+ result += hexChar[pbData[i] & 0x0F];
+ }
+ }
+
+ return result;
+ }
+#endif
+
+ map<EMVCardType, vector<byte>> InitializeSupportedAIDs()
+ {
+ map<EMVCardType, vector<byte>> supportedAIDs;
+ supportedAIDs.insert(std::make_pair(EMVCardType::AMEX, vector<byte>(EMVCard::AMEX_AID, EMVCard::AMEX_AID + sizeof(EMVCard::AMEX_AID))));
+ supportedAIDs.insert(std::make_pair(EMVCardType::MASTERCARD, vector<byte>(EMVCard::MASTERCARD_AID, EMVCard::MASTERCARD_AID + sizeof(EMVCard::MASTERCARD_AID))));
+ supportedAIDs.insert(std::make_pair(EMVCardType::VISA, vector<byte>(EMVCard::VISA_AID, EMVCard::VISA_AID + sizeof(EMVCard::VISA_AID))));
+ return supportedAIDs;
+ }
+
+ const byte EMVCard::AMEX_AID[7] = {0xA0, 0x00, 0x00, 0x00, 0x00, 0x25, 0x10};
+ const byte EMVCard::MASTERCARD_AID[7] = {0xA0, 0x00, 0x00, 0x00, 0x04, 0x10, 0x10};
+ const byte EMVCard::VISA_AID[7] = {0xA0, 0x00, 0x00, 0x00, 0x03, 0x10, 0x10};
+ const map<EMVCardType, vector<byte>> EMVCard::SUPPORTED_AIDS = InitializeSupportedAIDs();
+
+ EMVCard::EMVCard() : SCard(), m_lastPANDigits(L"")
+ {
+ }
+
+ EMVCard::EMVCard(size_t slotId) : SCard(slotId), m_lastPANDigits(L"")
+ {
+ }
+
+ EMVCard::~EMVCard()
+ {
+ Clear();
+ }
+
+ EMVCard::EMVCard(const EMVCard& other) :
+ SCard(other),
+ m_aid(other.m_aid),
+ m_supportedAids(other.m_supportedAids),
+ m_iccCert(other.m_iccCert),
+ m_issuerCert(other.m_issuerCert),
+ m_cplcData(other.m_cplcData),
+ m_lastPANDigits(other.m_lastPANDigits)
+ {
+ }
+
+ EMVCard::EMVCard(EMVCard&& other) :
+ SCard(other),
+ m_aid(std::move(other.m_aid)),
+ m_supportedAids(std::move(other.m_supportedAids)),
+ m_iccCert(std::move(other.m_iccCert)),
+ m_issuerCert(std::move(other.m_issuerCert)),
+ m_cplcData(std::move(other.m_cplcData)),
+ m_lastPANDigits(std::move(other.m_lastPANDigits))
+ {
+ }
+
+ EMVCard& EMVCard::operator = (const EMVCard& other)
+ {
+ if (this != &other)
+ {
+ SCard::operator=(other);
+ m_aid = other.m_aid;
+ m_supportedAids = other.m_supportedAids;
+ m_iccCert = other.m_iccCert;
+ m_issuerCert = other.m_issuerCert;
+ m_cplcData = other.m_cplcData;
+ m_lastPANDigits = other.m_lastPANDigits;
+ }
+ return *this;
+ }
+
+ EMVCard& EMVCard::operator = (EMVCard&& other)
+ {
+ if (this != &other)
+ {
+ SCard::operator=(other);
+ m_reader = std::move(other.m_reader);
+ m_aid = std::move(other.m_aid);
+ m_supportedAids = std::move(other.m_supportedAids);
+ m_iccCert = std::move(other.m_iccCert);
+ m_issuerCert = std::move(other.m_issuerCert);
+ m_cplcData = std::move(other.m_cplcData);
+ m_lastPANDigits = std::move(other.m_lastPANDigits);
+ }
+ return *this;
+ }
+
+ void EMVCard::Clear(void)
+ {
+ m_aid.clear();
+ m_supportedAids.clear();
+ m_iccCert.clear();
+ m_issuerCert.clear();
+ m_cplcData.clear();
+ m_lastPANDigits.clear();
+ }
+
+ vector<byte> EMVCard::GetCardAID(bool forceContactless)
+ {
+ vector<vector<byte>> supportedAIDs;
+ vector<byte> supportedAIDsPriorities;
+ vector<pair<byte, vector<byte>>> supportedAIDsSorted;
+ bool hasBeenReset = false;
+ CommandAPDU command;
+ ResponseAPDU response;
+ vector<byte> responseData;
+ shared_ptr<TLVNode> rootNode;
+ shared_ptr<TLVNode> fciNode;
+ shared_ptr<TLVNode> dfNameNode;
+ shared_ptr<TLVNode> sfiNode;
+ shared_ptr<TLVNode> fciIssuerNode;
+ shared_ptr<TLVNode> fciIssuerDiscretionaryDataNode;
+ shared_ptr<TLVNode> templateNode;
+ vector<shared_ptr<TLVNode>> pseDirectoryNodes;
+ unsigned char sfi;
+ bool usingContactless = false;
+ vector<byte> tokenAID;
+
+ if (m_aid.size())
+ return m_aid;
+
+ if (m_reader)
+ {
+ if (m_reader->IsCardPresent())
+ {
+ m_reader->Connect(SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1, hasBeenReset, true);
+ m_reader->BeginTransaction();
+ finally_do_arg (shared_ptr<SCardReader>, m_reader, { finally_arg->EndTransaction(); });
+
+ try
+ {
+ for (auto it = EMVCard::SUPPORTED_AIDS.begin(); it != EMVCard::SUPPORTED_AIDS.end(); it++)
+ {
+ command = CommandAPDU(CLA_ISO7816, INS_SELECT_FILE, 0x04, 0x00, it->second, SCardReader::shortAPDUMaxTransSize);
+ m_reader->ApduProcessData(command, response);
+ if (response.getSW() == SW_NO_ERROR)
+ {
+ tokenAID = it->second;
+ break;
+ }
+ }
+
+ if (tokenAID.size())
+ {
+ m_supportedAids.push_back(tokenAID);
+ m_aid = tokenAID;
+ }
+ else
+ {
+ // The following code retrieves the supported AIDs from the card using PSE.
+ // If the card supports more than one AID, the returned list is sorted using the AIDs priorities,
+ // the first AID being the one with more priority.
+ if (forceContactless)
+ {
+ usingContactless = true;
+ command = CommandAPDU(CLA_ISO7816, INS_SELECT_FILE, 0x04, 0x00, EMV_PSE2, 0, sizeof(EMV_PSE2), SCardReader::shortAPDUMaxTransSize);
+ m_reader->ApduProcessData(command, response);
+ }
+ else
+ {
+ command = CommandAPDU(CLA_ISO7816, INS_SELECT_FILE, 0x04, 0x00, EMV_PSE1, 0, sizeof(EMV_PSE1), SCardReader::shortAPDUMaxTransSize);
+ m_reader->ApduProcessData(command, response);
+ if (response.getSW() != SW_NO_ERROR)
+ {
+ // EMV_PSE2 not found, try EMV_PSE1
+ usingContactless = true;
+ command = CommandAPDU(CLA_ISO7816, INS_SELECT_FILE, 0x04, 0x00, EMV_PSE2, 0, sizeof(EMV_PSE2), SCardReader::shortAPDUMaxTransSize);
+ m_reader->ApduProcessData(command, response);
+ }
+ }
+ if (response.getSW() == SW_NO_ERROR && response.getData().size() > 0)
+ {
+ responseData = response.getData();
+ rootNode = TLVParser::TLV_Parse(responseData.data(), responseData.size());
+ fciNode = TLVParser::TLV_Find(rootNode, EMV_FCI_TAG);
+ if (fciNode && fciNode->Subs->size() >= 2)
+ {
+ if (usingContactless)
+ {
+ fciIssuerNode = TLVParser::TLV_Find(fciNode, EMV_FCI_ISSUER_TAG);
+ if (fciIssuerNode && fciIssuerNode->Subs->size() >= 1)
+ {
+ fciIssuerDiscretionaryDataNode = TLVParser::TLV_Find(fciIssuerNode, EMV_FCI_ISSUER_DISCRETIONARY_DATA_TAG);
+ if (fciIssuerDiscretionaryDataNode && fciIssuerDiscretionaryDataNode->Subs->size() >= 1)
+ {
+ for (size_t i = 0; i < fciIssuerDiscretionaryDataNode->Subs->size(); i++)
+ {
+ if (fciIssuerDiscretionaryDataNode->Subs->at(i)->Tag == EMV_DIRECTORY_ENTRY_TAG)
+ {
+ pseDirectoryNodes.push_back(fciIssuerDiscretionaryDataNode->Subs->at(i));
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ dfNameNode = TLVParser::TLV_Find(fciNode, EMV_DFNAME_TAG);
+ if (dfNameNode)
+ {
+ fciIssuerNode = TLVParser::TLV_Find(fciNode, EMV_FCI_ISSUER_TAG);
+ if (fciIssuerNode)
+ {
+ sfiNode = TLVParser::TLV_Find(fciIssuerNode, EMV_SFI_TAG);
+ if (sfiNode && sfiNode->Value->size() == 1)
+ {
+ sfi = sfiNode->Value->at(0);
+
+ byte rec = 1;
+ do
+ {
+ command = CommandAPDU(CLA_ISO7816, INS_READ_RECORD, rec++, (sfi << 3) | 4, SCardReader::shortAPDUMaxTransSize);
+ m_reader->ApduProcessData(command, response);
+ if (response.getSW() == SW_NO_ERROR && response.getData().size() > 0)
+ {
+ responseData = response.getData();
+
+ try
+ {
+ templateNode = TLVParser::TLV_Parse(responseData.data(), responseData.size());
+ if (templateNode && templateNode->Tag == EMV_TEMPLATE_TAG && templateNode->Subs->size() >= 1)
+ {
+ for (size_t i = 0; i < templateNode->Subs->size(); i++)
+ {
+ if (templateNode->Subs->at(i)->Tag == EMV_DIRECTORY_ENTRY_TAG)
+ {
+ pseDirectoryNodes.push_back(templateNode->Subs->at(i));
+ }
+ }
+ }
+ }
+ catch(TLVException)
+ {
+ continue;
+ }
+ }
+ } while (response.getData().size() > 0);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ for (size_t i = 0; i < pseDirectoryNodes.size(); i++)
+ {
+ shared_ptr<TLVNode> aidNode;
+ shared_ptr<TLVNode> aidPriorityNode;
+ aidNode = TLVParser::TLV_Find(pseDirectoryNodes[i], EMV_AID_TAG);
+ aidPriorityNode = TLVParser::TLV_Find(pseDirectoryNodes[i], EMV_PRIORITY_TAG);
+ if (aidNode && aidNode->Value->size() > 0 && aidPriorityNode && aidPriorityNode->Value->size() == 1)
+ {
+ supportedAIDs.push_back(*aidNode->Value.get());
+ supportedAIDsPriorities.push_back(aidNode->Value->at(0));
+ }
+ }
+ for(size_t i = 0; i < supportedAIDs.size(); i++)
+ {
+ supportedAIDsSorted.push_back(make_pair(supportedAIDsPriorities[i], supportedAIDs[i]));
+ }
+ std::sort(supportedAIDsSorted.begin(), supportedAIDsSorted.end());
+ for(size_t i = 0; i < supportedAIDs.size(); i++)
+ {
+ supportedAIDs[i] = supportedAIDsSorted[i].second;
+ }
+
+ if (supportedAIDs.size())
+ {
+ m_supportedAids = supportedAIDs;
+ tokenAID = supportedAIDs[0];
+ m_aid = tokenAID;
+ }
+ }
+ }
+ catch (...)
+ {
+ }
+ }
+ }
+
+ return tokenAID;
+ }
+
+ void EMVCard::GetCardContent(vector<byte>& iccCert, vector<byte>& issuerCert, vector<byte>& cplcData)
+ {
+ bool hasBeenReset = false;
+ bool aidSelected = false;
+ bool iccFound = false;
+ bool issuerFound = false;
+ bool cplcFound = false;
+ vector<byte> emvCardAid;
+ shared_ptr<TLVNode> rootNode;
+ shared_ptr<TLVNode> iccPublicKeyCertNode;
+ shared_ptr<TLVNode> issuerPublicKeyCertNode;
+ CommandAPDU command;
+ ResponseAPDU response;
+ vector<byte> responseData;
+
+ iccCert.clear();
+ issuerCert.clear();
+ cplcData.clear();
+
+ if (m_iccCert.size() && m_issuerCert.size() && m_cplcData.size())
+ {
+ iccCert = m_iccCert;
+ issuerCert = m_issuerCert;
+ cplcData = m_cplcData;
+ return;
+ }
+
+ emvCardAid = GetCardAID();
+ if (emvCardAid.size() == 0)
+ {
+ throw EMVUnknownCardType();
+ }
+
+ if (m_reader)
+ {
+ if (m_reader->IsCardPresent())
+ {
+ m_reader->Connect(SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1, hasBeenReset, true);
+ m_reader->BeginTransaction();
+ finally_do_arg (shared_ptr<SCardReader>, m_reader, { finally_arg->EndTransaction(); });
+
+ // First get CPLC before selecting the AID of the card.
+ command = CommandAPDU(0x80, INS_GET_DATA, (EMV_CPLC_TAG >> 8) & 0xFF, EMV_CPLC_TAG & 0xFF, SCardReader::shortAPDUMaxTransSize);
+ m_reader->ApduProcessData(command, response);
+ if (response.getSW() == SW_NO_ERROR && response.getData().size() > 0)
+ {
+ cplcFound = true;
+ cplcData = response.getData();
+
+ // Then get the certs.
+ command = CommandAPDU(CLA_ISO7816, INS_SELECT_FILE, 0x04, 0x00, emvCardAid, SCardReader::shortAPDUMaxTransSize);
+ m_reader->ApduProcessData(command, response);
+ if (response.getSW() == SW_NO_ERROR)
+ {
+ aidSelected = true;
+
+ // TODO: Send GET PROCESSING OPTIONS to get the AIL and AFL,
+ // which will then be used to get the actual start and end of sfi and rec.
+ for (byte sfi = 1; sfi < 32 && (!iccFound || !issuerFound); sfi++)
+ {
+ for (byte rec = 1; rec < 17 && (!iccFound || !issuerFound); rec++)
+ {
+ command = CommandAPDU(CLA_ISO7816, INS_READ_RECORD, rec, (sfi << 3) | 4, SCardReader::shortAPDUMaxTransSize);
+ m_reader->ApduProcessData(command, response);
+ if (response.getSW() == SW_NO_ERROR && response.getData().size() > 0)
+ {
+ responseData = response.getData();
+
+ try
+ {
+ rootNode = TLVParser::TLV_Parse(responseData.data(), responseData.size());
+ }
+ catch(TLVException)
+ {
+ continue;
+ }
+
+ iccPublicKeyCertNode = TLVParser::TLV_Find(rootNode, EMV_ICC_PK_CERT_TAG);
+ if (iccPublicKeyCertNode && iccPublicKeyCertNode->Value->size() > 0)
+ {
+ iccFound = true;
+ iccCert = *iccPublicKeyCertNode->Value.get();
+ }
+
+ issuerPublicKeyCertNode = TLVParser::TLV_Find(rootNode, EMV_ISS_PK_CERT_TAG);
+ if (issuerPublicKeyCertNode && issuerPublicKeyCertNode->Value->size() > 0)
+ {
+ issuerFound = true;
+ issuerCert = *issuerPublicKeyCertNode->Value.get();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (!cplcFound)
+ throw EMVCPLCNotFound();
+
+ if (!aidSelected)
+ throw EMVSelectAIDFailed();
+
+ if (!iccFound)
+ throw EMVIccCertNotFound();
+
+ if (!issuerFound)
+ throw EMVIssuerCertNotFound();
+
+ m_iccCert = iccCert;
+ m_issuerCert = issuerCert;
+ m_cplcData = cplcData;
+ }
+
+ void EMVCard::GetCardPAN(wstring& lastPANDigits)
+ {
+ bool hasBeenReset = false;
+ bool panFound = false;
+ bool aidSelected = false;
+ vector<byte> EMVCardAid;
+ vector<byte> panData;
+ shared_ptr<TLVNode> rootNode;
+ shared_ptr<TLVNode> panNode;
+ CommandAPDU command;
+ ResponseAPDU response;
+ vector<byte> responseData;
+
+ lastPANDigits = L"";
+
+ if (m_lastPANDigits != L"")
+ {
+ lastPANDigits = m_lastPANDigits;
+ return;
+ }
+
+ EMVCardAid = GetCardAID();
+ if (EMVCardAid.size() == 0)
+ {
+ throw EMVUnknownCardType();
+ }
+
+ if (m_reader)
+ {
+ if (m_reader->IsCardPresent())
+ {
+ m_reader->Connect(SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1, hasBeenReset, true);
+ m_reader->BeginTransaction();
+ finally_do_arg (shared_ptr<SCardReader>, m_reader, { finally_arg->EndTransaction(); });
+
+ command = CommandAPDU(CLA_ISO7816, INS_SELECT_FILE, 0x04, 0x00, EMVCardAid, SCardReader::shortAPDUMaxTransSize);
+ m_reader->ApduProcessData(command, response);
+ if (response.getSW() == SW_NO_ERROR)
+ {
+ aidSelected = true;
+
+ // TODO: Send GET PROCESSING OPTIONS to get the AIL and AFL,
+ // which will then be used to get the actual start and end of sfi and rec.
+ for (byte sfi = 1; sfi < 32 && !panFound; sfi++)
+ {
+ for (byte rec = 1; rec < 17 && !panFound; rec++)
+ {
+ command = CommandAPDU(CLA_ISO7816, INS_READ_RECORD, rec, (sfi << 3) | 4, SCardReader::shortAPDUMaxTransSize);
+ m_reader->ApduProcessData(command, response);
+ if (response.getSW() == SW_NO_ERROR && response.getData().size() > 0)
+ {
+ responseData = response.getData();
+
+ try
+ {
+ rootNode = TLVParser::TLV_Parse(responseData.data(), responseData.size());
+ }
+ catch(TLVException)
+ {
+ continue;
+ }
+
+ panNode = TLVParser::TLV_Find(rootNode, EMV_PAN_TAG);
+ if (panNode && panNode->Value->size() >= 8)
+ {
+ panFound = true;
+ panData = *panNode->Value.get();
+ panData = vector<byte>(panData.rbegin(), panData.rbegin() + 2); // only interested in last digits
+ std::swap(panData[0], panData[1]);
+ lastPANDigits = ArrayToHexWideString(panData.data(), (int) panData.size());
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (panData.size())
+ burn(panData.data(), panData.size());
+
+ if (!aidSelected)
+ throw EMVSelectAIDFailed();
+
+ if (!panFound)
+ throw EMVPANNotFound();
+
+ m_lastPANDigits = lastPANDigits;
+ }
+}
diff --git a/src/Common/EMVCard.h b/src/Common/EMVCard.h
new file mode 100644
index 00000000..116de705
--- /dev/null
+++ b/src/Common/EMVCard.h
@@ -0,0 +1,69 @@
+#ifndef TC_HEADER_Common_EMVCard
+#define TC_HEADER_Common_EMVCard
+
+#include "Platform/PlatformBase.h"
+#if defined (TC_WINDOWS) && !defined (TC_PROTOTYPE)
+# include "Exception.h"
+#else
+# include "Platform/Exception.h"
+#endif
+
+#include "Token.h"
+#include "SCard.h"
+
+namespace VeraCrypt
+{
+ typedef enum EMVCardType
+ {
+ NONE = 0,
+ AMEX,
+ MASTERCARD,
+ VISA
+ } EMVCardType;
+
+ class EMVCard : public SCard
+ {
+ protected:
+
+ // The following fields will only be empty if the card has not been read yet.
+ // After the card has been read, and if some or all fields cannot be read, the EMVCard
+ // object will be considered invalid and will not be included in the list of available cards
+ // of EMVToken.
+ vector<byte> m_aid;
+ vector<vector<byte>> m_supportedAids;
+ vector<byte> m_iccCert;
+ vector<byte> m_issuerCert;
+ vector<byte> m_cplcData;
+ wstring m_lastPANDigits;
+
+ public:
+
+ // Add other AIDS
+ // https://gist.github.com/pvieito/6224eed92c99b069f6401996c548d0e4
+ // https://ambimat.com/developer-resources/list-of-application-identifiers-aid/
+ const static byte AMEX_AID[7];
+ const static byte MASTERCARD_AID[7];
+ const static byte VISA_AID[7];
+ const static map<EMVCardType, vector<byte>> SUPPORTED_AIDS;
+
+ EMVCard();
+ EMVCard(size_t slotId);
+ EMVCard(const EMVCard& other);
+ EMVCard(EMVCard&& other);
+ EMVCard& operator = (const EMVCard& other);
+ EMVCard& operator = (EMVCard&& other);
+ virtual ~EMVCard();
+
+ void Clear(void);
+
+ // Retrieves the card's AID.
+ // It first checks the card against a list of supported AIDs.
+ // If that fails, it tries getting the AID from the card using PSE
+ vector<byte> GetCardAID(bool forceContactless = false);
+
+ void GetCardContent(vector<byte>& iccCert, vector<byte>& issuerCert, vector<byte>& cplcData);
+ void GetCardPAN(wstring& lastPANDigits);
+ };
+}
+
+#endif // TC_HEADER_Common_EMVCard
diff --git a/src/Common/EMVToken.cpp b/src/Common/EMVToken.cpp
new file mode 100644
index 00000000..0fe3dc1f
--- /dev/null
+++ b/src/Common/EMVToken.cpp
@@ -0,0 +1,225 @@
+#include "EMVToken.h"
+#include "TLVParser.h"
+#include "SCardReader.h"
+#include "PCSCException.h"
+
+#include "Platform/Finally.h"
+#include "Platform/ForEach.h"
+#include <vector>
+#include <iostream>
+#include <algorithm>
+
+#if !defined(TC_WINDOWS) || defined(TC_PROTOTYPE)
+#include "Platform/SerializerFactory.h"
+#include "Platform/StringConverter.h"
+#include "Platform/SystemException.h"
+#else
+#include "Dictionary.h"
+#include "Language.h"
+#endif
+
+using namespace std;
+
+namespace VeraCrypt
+{
+ void AppendData(vector<byte>& buffer, const unsigned char* pbData, size_t cbData, size_t from, size_t length, bool bEncodeLength = false)
+ {
+ if (cbData > 0 && from <= cbData - 2 && length > 0 && length <= cbData - from)
+ {
+ size_t offset = (bEncodeLength ? 4 : 0);
+ size_t orgSize = buffer.size();
+ buffer.resize(orgSize + length + offset);
+ if (bEncodeLength)
+ {
+ unsigned int dwLength = (unsigned int)(length);
+ memcpy(buffer.data() + orgSize, &dwLength, 4);
+ }
+ memcpy(buffer.data() + orgSize + offset, pbData + from, length);
+ }
+ }
+
+ /* ****************************************************************************************************************************************** */
+
+ map <unsigned long int, shared_ptr<EMVCard>> EMVToken::EMVCards;
+
+ EMVTokenInfo::~EMVTokenInfo()
+ {
+ if (Label.size() > 0)
+ burn(&Label[0], Label.size() * sizeof(wchar_t));
+ }
+
+ EMVTokenKeyfile::EMVTokenKeyfile()
+ {
+ Id = EMV_CARDS_LABEL;
+ Token = shared_ptr<EMVTokenInfo>(new EMVTokenInfo());
+ }
+
+ EMVTokenKeyfile::EMVTokenKeyfile(const TokenKeyfilePath& path)
+ {
+ wstring pathStr = path;
+ unsigned long slotId;
+
+ if (swscanf(pathStr.c_str(), TC_EMV_TOKEN_KEYFILE_URL_PREFIX TC_EMV_TOKEN_KEYFILE_URL_SLOT L"/%lu", &slotId) != 1)
+ throw InvalidEMVPath();
+
+ Id = EMV_CARDS_LABEL;
+ Token = shared_ptr<EMVTokenInfo>(new EMVTokenInfo());
+ Token->SlotId = slotId;
+ }
+
+ EMVTokenKeyfile::operator TokenKeyfilePath () const
+ {
+ wstringstream path;
+ path << TC_EMV_TOKEN_KEYFILE_URL_PREFIX TC_EMV_TOKEN_KEYFILE_URL_SLOT L"/" << Token->SlotId;
+ return path.str();
+ }
+
+ void EMVTokenKeyfile::GetKeyfileData(vector <byte>& keyfileData) const
+ {
+ map <unsigned long int, shared_ptr<EMVCard>>::iterator emvCardsIt;
+ shared_ptr<EMVCard> card;
+ vector<byte> iccCert;
+ vector<byte> issuerCert;
+ vector<byte> cplcData;
+ bool addNewCard = true;
+
+ keyfileData.clear();
+
+ emvCardsIt = EMVToken::EMVCards.find(Token->SlotId);
+ if (emvCardsIt != EMVToken::EMVCards.end())
+ {
+ // An EMVCard object has already been created for this slotId.
+ // We check that it's SCard handle is still valid.
+ // If it is, we use the existing EMVCard to get the card's content.
+ // If it is not, we remove the EMVCard from EMVCards and create a new one.
+
+ if (emvCardsIt->second->IsCardHandleValid())
+ {
+ emvCardsIt->second->GetCardContent(iccCert, issuerCert, cplcData);
+ addNewCard = false;
+ }
+ else
+ {
+ EMVToken::EMVCards.erase(emvCardsIt);
+ }
+ }
+
+ if (addNewCard)
+ {
+ // An EMVCard object does not exist for this slotId, or exists but its handle is not valid anymore.
+ // We create a new one and then add it to EMVCards.
+ card = make_shared<EMVCard>(Token->SlotId);
+ card->GetCardContent(iccCert, issuerCert, cplcData);
+ EMVToken::EMVCards.insert(make_pair(Token->SlotId, card));
+ }
+
+ AppendData(keyfileData, iccCert.data(), iccCert.size(), 0, iccCert.size());
+ AppendData(keyfileData, issuerCert.data(), issuerCert.size(), 0, issuerCert.size());
+ AppendData(keyfileData, cplcData.data(), cplcData.size(), 0, cplcData.size());
+ }
+
+ bool EMVToken::IsKeyfilePathValid(const wstring& emvTokenKeyfilePath)
+ {
+ return emvTokenKeyfilePath.find(TC_EMV_TOKEN_KEYFILE_URL_PREFIX) == 0;
+ }
+
+ vector<EMVTokenKeyfile> EMVToken::GetAvailableKeyfiles(unsigned long int* slotIdFilter, const wstring& keyfileIdFilter)
+ {
+ vector <EMVTokenKeyfile> keyfiles;
+ vector<wstring> readers;
+
+ readers = EMVCard::manager.GetReaders();
+ for (unsigned long int slotId = 0; slotId < readers.size(); slotId++)
+ {
+ EMVTokenInfo token;
+
+ if (slotIdFilter && *slotIdFilter != slotId)
+ continue;
+
+ try
+ {
+ token = GetTokenInfo(slotId);
+ }
+ catch(ParameterIncorrect&)
+ {
+ continue;
+ }
+ catch(EMVUnknownCardType&)
+ {
+ continue;
+ }
+ catch(EMVSelectAIDFailed&)
+ {
+ continue;
+ }
+ catch(EMVPANNotFound&)
+ {
+ continue;
+ }
+ catch(PCSCException&)
+ {
+ continue;
+ }
+
+ EMVTokenKeyfile keyfile;
+ keyfile.Token = shared_ptr<TokenInfo>(new EMVTokenInfo(token));
+ keyfile.Token->SlotId = slotId;
+
+ // keyfileIdFilter is of no use for EMV tokens as the Id is always set to EMV_CARDS_LABEL.
+ // Nonetheless, we keep the following code that is also used in SecurityToken::GetAvailableKeyfiles.
+ if (keyfile.Id.empty() || (!keyfileIdFilter.empty() && keyfileIdFilter != keyfile.Id))
+ continue;
+
+ keyfiles.push_back(keyfile);
+
+ if (!keyfileIdFilter.empty())
+ break;
+ }
+
+ return keyfiles;
+ }
+
+ EMVTokenInfo EMVToken::GetTokenInfo(unsigned long int slotId)
+ {
+ EMVTokenInfo token;
+ wstring lastPANDigits;
+ map <unsigned long int, shared_ptr<EMVCard>>::iterator emvCardsIt;
+ shared_ptr<EMVCard> card;
+ bool addNewCard = true;
+
+ emvCardsIt = EMVCards.find(slotId);
+ if (emvCardsIt != EMVCards.end())
+ {
+ // An EMVCard object has already been created for this slotId.
+ // We check that it's SCard handle is still valid.
+ // If it is, we use the existing EMVCard to get the card's PAN.
+ // If it is not, we remove the EMVCard from EMVCards and create a new one.
+
+ if (emvCardsIt->second->IsCardHandleValid())
+ {
+ emvCardsIt->second->GetCardPAN(lastPANDigits);
+ addNewCard = false;
+ }
+ else
+ {
+ EMVCards.erase(emvCardsIt);
+ }
+ }
+
+ if (addNewCard)
+ {
+ // An EMVCard object does not exist for this slotId, or exists but its handle is not valid anymore.
+ // We create a new one and then add it to EMVCards.
+ card = make_shared<EMVCard>(slotId);
+ card->GetCardPAN(lastPANDigits);
+ EMVCards.insert(make_pair(slotId, card));
+ }
+
+ token.SlotId = slotId;
+ token.Label = L"EMV card **** ";
+ token.Label += lastPANDigits;
+ burn(&lastPANDigits[0], lastPANDigits.size() * sizeof(wchar_t));
+
+ return token;
+ }
+}
diff --git a/src/Common/EMVToken.h b/src/Common/EMVToken.h
new file mode 100644
index 00000000..a1c0a2e1
--- /dev/null
+++ b/src/Common/EMVToken.h
@@ -0,0 +1,42 @@
+#ifndef TC_HEADER_Common_EMVToken
+#define TC_HEADER_Common_EMVToken
+
+#define TC_EMV_TOKEN_KEYFILE_URL_PREFIX L"emv://"
+#define TC_EMV_TOKEN_KEYFILE_URL_SLOT L"slot"
+
+#define EMV_CARDS_LABEL L"EMV Certificates"
+
+#include "EMVCard.h"
+
+namespace VeraCrypt
+{
+ struct EMVTokenInfo: TokenInfo
+ {
+ virtual ~EMVTokenInfo();
+ virtual BOOL isEditable() const { return false; }
+ };
+
+ struct EMVTokenKeyfile: TokenKeyfile
+ {
+ EMVTokenKeyfile();
+ EMVTokenKeyfile(const TokenKeyfilePath& path);
+ virtual ~EMVTokenKeyfile() {};
+
+ virtual operator TokenKeyfilePath () const;
+ virtual void GetKeyfileData(vector <byte>& keyfileData) const;
+ };
+
+ class EMVToken
+ {
+ public:
+ static bool IsKeyfilePathValid(const wstring& emvTokenKeyfilePath);
+ static vector<EMVTokenKeyfile> GetAvailableKeyfiles(unsigned long int* slotIdFilter = nullptr, const wstring& keyfileIdFilter = wstring());
+ static EMVTokenInfo GetTokenInfo(unsigned long int slotId);
+
+ friend void EMVTokenKeyfile::GetKeyfileData(vector <byte>& keyfileData) const;
+
+ static map <unsigned long int, shared_ptr<EMVCard>> EMVCards;
+ };
+}
+
+#endif
diff --git a/src/Common/Fat.c b/src/Common/Fat.c
index cd2c124f..19720b17 100644
--- a/src/Common/Fat.c
+++ b/src/Common/Fat.c
@@ -255,11 +255,14 @@ static void PutFSInfo (unsigned char *sector, fatparams *ft)
int
-FormatFat (void* hwndDlgPtr, unsigned __int64 startSector, fatparams * ft, void * dev, PCRYPTO_INFO cryptoInfo, BOOL quickFormat)
+FormatFat (void* hwndDlgPtr, unsigned __int64 startSector, fatparams * ft, void * dev, PCRYPTO_INFO cryptoInfo, BOOL quickFormat, BOOL bDevice)
{
int write_buf_cnt = 0;
char sector[TC_MAX_VOLUME_SECTOR_SIZE], *write_buf;
unsigned __int64 nSecNo = startSector;
+ unsigned __int64 nSkipSectors = 128 * (unsigned __int64) BYTES_PER_MB / ft->sector_size;
+ unsigned __int64 num_sectors;
+ DWORD bytesWritten;
int x, n;
int retVal;
CRYPTOPP_ALIGN_DATA(16) char temporaryKey[MASTER_KEYDATA_SIZE];
@@ -288,7 +291,7 @@ FormatFat (void* hwndDlgPtr, unsigned __int64 startSector, fatparams * ft, void
goto fail;
PutBoot (ft, (unsigned char *) sector);
- if (WriteSector (dev, sector, write_buf, &write_buf_cnt, &nSecNo,
+ if (WriteSector (dev, sector, write_buf, &write_buf_cnt, &nSecNo, startSector,
cryptoInfo) == FALSE)
goto fail;
@@ -297,7 +300,7 @@ FormatFat (void* hwndDlgPtr, unsigned __int64 startSector, fatparams * ft, void
{
/* fsinfo */
PutFSInfo((unsigned char *) sector, ft);
- if (WriteSector (dev, sector, write_buf, &write_buf_cnt, &nSecNo,
+ if (WriteSector (dev, sector, write_buf, &write_buf_cnt, &nSecNo, startSector,
cryptoInfo) == FALSE)
goto fail;
@@ -307,7 +310,7 @@ FormatFat (void* hwndDlgPtr, unsigned __int64 startSector, fatparams * ft, void
memset (sector, 0, ft->sector_size);
sector[508+3]=0xaa; /* TrailSig */
sector[508+2]=0x55;
- if (WriteSector (dev, sector, write_buf, &write_buf_cnt, &nSecNo,
+ if (WriteSector (dev, sector, write_buf, &write_buf_cnt, &nSecNo, startSector,
cryptoInfo) == FALSE)
goto fail;
}
@@ -315,12 +318,12 @@ FormatFat (void* hwndDlgPtr, unsigned __int64 startSector, fatparams * ft, void
/* bootsector backup */
memset (sector, 0, ft->sector_size);
PutBoot (ft, (unsigned char *) sector);
- if (WriteSector (dev, sector, write_buf, &write_buf_cnt, &nSecNo,
+ if (WriteSector (dev, sector, write_buf, &write_buf_cnt, &nSecNo, startSector,
cryptoInfo) == FALSE)
goto fail;
PutFSInfo((unsigned char *) sector, ft);
- if (WriteSector (dev, sector, write_buf, &write_buf_cnt, &nSecNo,
+ if (WriteSector (dev, sector, write_buf, &write_buf_cnt, &nSecNo, startSector,
cryptoInfo) == FALSE)
goto fail;
}
@@ -329,7 +332,7 @@ FormatFat (void* hwndDlgPtr, unsigned __int64 startSector, fatparams * ft, void
while (nSecNo - startSector < (unsigned int)ft->reserved)
{
memset (sector, 0, ft->sector_size);
- if (WriteSector (dev, sector, write_buf, &write_buf_cnt, &nSecNo,
+ if (WriteSector (dev, sector, write_buf, &write_buf_cnt, &nSecNo, startSector,
cryptoInfo) == FALSE)
goto fail;
}
@@ -373,7 +376,7 @@ FormatFat (void* hwndDlgPtr, unsigned __int64 startSector, fatparams * ft, void
}
}
- if (WriteSector (dev, sector, write_buf, &write_buf_cnt, &nSecNo,
+ if (WriteSector (dev, sector, write_buf, &write_buf_cnt, &nSecNo, startSector,
cryptoInfo) == FALSE)
goto fail;
}
@@ -384,7 +387,7 @@ FormatFat (void* hwndDlgPtr, unsigned __int64 startSector, fatparams * ft, void
for (x = 0; x < ft->size_root_dir / ft->sector_size; x++)
{
memset (sector, 0, ft->sector_size);
- if (WriteSector (dev, sector, write_buf, &write_buf_cnt, &nSecNo,
+ if (WriteSector (dev, sector, write_buf, &write_buf_cnt, &nSecNo, startSector,
cryptoInfo) == FALSE)
goto fail;
@@ -450,11 +453,11 @@ FormatFat (void* hwndDlgPtr, unsigned __int64 startSector, fatparams * ft, void
x = ft->num_sectors - ft->reserved - ft->size_root_dir / ft->sector_size - ft->fat_length * 2;
while (x--)
{
- if (WriteSector (dev, sector, write_buf, &write_buf_cnt, &nSecNo,
+ if (WriteSector (dev, sector, write_buf, &write_buf_cnt, &nSecNo, startSector,
cryptoInfo) == FALSE)
goto fail;
}
- UpdateProgressBar (nSecNo * ft->sector_size);
+ UpdateProgressBar ((nSecNo - startSector) * ft->sector_size);
if (!FlushFormatWriteBuffer (dev, write_buf, &write_buf_cnt, &nSecNo, cryptoInfo))
{
@@ -466,6 +469,44 @@ FormatFat (void* hwndDlgPtr, unsigned __int64 startSector, fatparams * ft, void
burn (&tmpCI, sizeof (tmpCI));
VirtualUnlock (&tmpCI, sizeof (tmpCI));
}
+ else if (!bDevice)
+ {
+ if (!FlushFormatWriteBuffer (dev, write_buf, &write_buf_cnt, &nSecNo, cryptoInfo))
+ goto fail;
+
+ // Quick format: write a zeroed sector every 128 MiB, leaving other sectors untouched
+ // This helps users visualize the progress of actual file creation while forcing Windows
+ // to allocate the disk space of each 128 MiB chunk immediately, otherwise, Windows
+ // would delay the allocation until we write the backup header at the end of the volume which
+ // would make the user think that the format process has stalled after progress bar reaches 100%.
+ num_sectors = ft->num_sectors - ft->reserved - ft->size_root_dir / ft->sector_size - ft->fat_length * 2;
+ while (num_sectors >= nSkipSectors)
+ {
+ // seek to next sector to be written
+ nSecNo += (nSkipSectors - 1);
+ startOffset.QuadPart = nSecNo * ft->sector_size;
+ if (!MoveFilePointer ((HANDLE) dev, startOffset))
+ {
+ goto fail;
+ }
+
+ // sector array has been zeroed above
+ if (!WriteFile ((HANDLE) dev, sector, ft->sector_size, &bytesWritten, NULL)
+ || bytesWritten != ft->sector_size)
+ {
+ goto fail;
+ }
+
+ nSecNo++;
+ num_sectors -= nSkipSectors;
+
+ if (UpdateProgressBar ((nSecNo - startSector)* ft->sector_size))
+ goto fail;
+ }
+
+ nSecNo += num_sectors;
+ UpdateProgressBar ((nSecNo - startSector)* ft->sector_size);
+ }
else
{
UpdateProgressBar ((uint64) ft->num_sectors * ft->sector_size);
diff --git a/src/Common/Fat.h b/src/Common/Fat.h
index 375b9dc2..b2457be2 100644
--- a/src/Common/Fat.h
+++ b/src/Common/Fat.h
@@ -66,4 +66,4 @@ struct msdos_boot_sector
void GetFatParams ( fatparams *ft );
void PutBoot ( fatparams *ft , unsigned char *boot );
-int FormatFat (void* hwndDlg, unsigned __int64 startSector, fatparams * ft, void * dev, PCRYPTO_INFO cryptoInfo, BOOL quickFormat);
+int FormatFat (void* hwndDlg, unsigned __int64 startSector, fatparams * ft, void * dev, PCRYPTO_INFO cryptoInfo, BOOL quickFormat, BOOL bDevice);
diff --git a/src/Common/Format.c b/src/Common/Format.c
index 4363f474..4d8dfed9 100644
--- a/src/Common/Format.c
+++ b/src/Common/Format.c
@@ -218,7 +218,7 @@ begin_format:
bFailedRequiredDASD = TRUE;
}
}
- else if (IsOSAtLeast (WIN_VISTA) && driveLetter == -1)
+ else if (driveLetter == -1)
{
// Windows Vista doesn't allow overwriting sectors belonging to an unformatted partition
// to which no drive letter has been assigned under the system. This problem can be worked
@@ -344,6 +344,32 @@ begin_format:
else
{
/* File-hosted volume */
+ BOOL speedupFileCreation = FALSE;
+ BOOL delayedSpeedupFileCreation = FALSE;
+ // speedup for file creation only makes sens when using quick format for non hidden volumes
+ if (!volParams->hiddenVol && !bInstantRetryOtherFilesys && volParams->quickFormat && volParams->fastCreateFile)
+ {
+ // we set required privileges to speedup file creation before we create the file so that the file handle inherits the privileges
+ if (!SetPrivilege(SE_MANAGE_VOLUME_NAME, TRUE))
+ {
+ DWORD dwLastError = GetLastError();
+ if (!IsAdmin () && IsUacSupported ())
+ {
+ speedupFileCreation = TRUE;
+ delayedSpeedupFileCreation = TRUE;
+ }
+ else if (Silent || (MessageBoxW(hwndDlg, GetString ("ADMIN_PRIVILEGES_WARN_MANAGE_VOLUME"), lpszTitle, MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2) == IDNO))
+ {
+ SetLastError(dwLastError);
+ nStatus = ERR_OS_ERROR;
+ goto error;
+ }
+ }
+ else
+ {
+ speedupFileCreation = TRUE;
+ }
+ }
dev = CreateFile (volParams->volumePath, GENERIC_READ | GENERIC_WRITE,
(volParams->hiddenVol || bInstantRetryOtherFilesys) ? (FILE_SHARE_READ | FILE_SHARE_WRITE) : 0,
@@ -373,13 +399,8 @@ begin_format:
if (!volParams->hiddenVol && !bInstantRetryOtherFilesys)
{
LARGE_INTEGER volumeSize;
- BOOL speedupFileCreation = FALSE;
volumeSize.QuadPart = dataAreaSize + TC_VOLUME_HEADER_GROUP_SIZE;
- // speedup for file creation only makes sens when using quick format
- if (volParams->quickFormat && volParams->fastCreateFile)
- speedupFileCreation = TRUE;
-
if (volParams->sparseFileSwitch && volParams->quickFormat)
{
// Create as sparse file container
@@ -391,12 +412,15 @@ begin_format:
}
}
- // Preallocate the file
- if (!SetFilePointerEx (dev, volumeSize, NULL, FILE_BEGIN)
- || !SetEndOfFile (dev))
+ if (!delayedSpeedupFileCreation)
{
- nStatus = ERR_OS_ERROR;
- goto error;
+ // Preallocate the file
+ if (!SetFilePointerEx (dev, volumeSize, NULL, FILE_BEGIN)
+ || !SetEndOfFile (dev))
+ {
+ nStatus = ERR_OS_ERROR;
+ goto error;
+ }
}
if (speedupFileCreation)
@@ -405,8 +429,46 @@ begin_format:
// this has security issues since it will put existing disk content into file container
// We use this mechanism only when switch /fastCreateFile specific and when quick format
// also specified and which is documented to have security issues.
- // we don't check returned status because failure is not issue for us
- SetFileValidData (dev, volumeSize.QuadPart);
+ if (delayedSpeedupFileCreation)
+ {
+ // in case of delayed speedup we need to set the file size to a minimal value before performing the real preallocation through UAC
+ LARGE_INTEGER minimalSize;
+ DWORD dwOpStatus;
+ // 16K
+ minimalSize.QuadPart = 16 * 1024;
+ if (!SetFilePointerEx (dev, minimalSize, NULL, FILE_BEGIN)
+ || !SetEndOfFile (dev))
+ {
+ nStatus = ERR_OS_ERROR;
+ goto error;
+ }
+
+ FlushFileBuffers (dev);
+ CloseHandle (dev);
+ dev = INVALID_HANDLE_VALUE;
+
+ dwOpStatus = UacFastFileCreation (volParams->hwndDlg, volParams->volumePath, volumeSize.QuadPart);
+ if (dwOpStatus != 0)
+ {
+ SetLastError(dwOpStatus);
+ nStatus = ERR_OS_ERROR;
+ goto error;
+ }
+
+ // open again the file now that it was created
+ dev = CreateFile (volParams->volumePath, GENERIC_READ | GENERIC_WRITE,
+ 0, NULL, OPEN_EXISTING, 0, NULL);
+ if (dev == INVALID_HANDLE_VALUE)
+ {
+ nStatus = ERR_OS_ERROR;
+ goto error;
+ }
+ }
+ else if (!SetFileValidData (dev, volumeSize.QuadPart))
+ {
+ nStatus = ERR_OS_ERROR;
+ goto error;
+ }
}
if (SetFilePointer (dev, 0, NULL, FILE_BEGIN) != 0)
@@ -521,7 +583,7 @@ begin_format:
goto error;
}
- nStatus = FormatNoFs (hwndDlg, startSector, num_sectors, dev, cryptoInfo, volParams->quickFormat);
+ nStatus = FormatNoFs (hwndDlg, startSector, num_sectors, dev, cryptoInfo, volParams->quickFormat, volParams->bDevice);
if (volParams->bDevice)
StopFormatWriteThread();
@@ -554,7 +616,7 @@ begin_format:
goto error;
}
- nStatus = FormatFat (hwndDlg, startSector, &ft, (void *) dev, cryptoInfo, volParams->quickFormat);
+ nStatus = FormatFat (hwndDlg, startSector, &ft, (void *) dev, cryptoInfo, volParams->quickFormat, volParams->bDevice);
if (volParams->bDevice)
StopFormatWriteThread();
@@ -768,7 +830,7 @@ error:
mountOptions.PartitionInInactiveSysEncScope = FALSE;
mountOptions.UseBackupHeader = FALSE;
- if (MountVolume (volParams->hwndDlg, driveNo, volParams->volumePath, volParams->password, volParams->pkcs5, volParams->pim, FALSE, FALSE, FALSE, TRUE, &mountOptions, Silent, TRUE) < 1)
+ if (MountVolume (volParams->hwndDlg, driveNo, volParams->volumePath, volParams->password, volParams->pkcs5, volParams->pim, FALSE, FALSE, TRUE, &mountOptions, Silent, TRUE) < 1)
{
if (!Silent)
{
@@ -780,16 +842,24 @@ error:
}
retCode = ExternalFormatFs (driveNo, volParams->clusterSize, fsType);
- if (retCode != TRUE)
+ if (retCode != 0)
{
+
/* fallback to using FormatEx function from fmifs.dll */
if (!Silent && !IsAdmin () && IsUacSupported ())
retCode = UacFormatFs (volParams->hwndDlg, driveNo, volParams->clusterSize, fsType);
else
- retCode = FormatFs (driveNo, volParams->clusterSize, fsType);
+ retCode = FormatFs (driveNo, volParams->clusterSize, fsType, FALSE); /* no need to fallback to format.com since we have already tried it without elevation */
+
+ if (retCode != 0)
+ {
+ wchar_t auxLine[2048];
+ StringCbPrintfW (auxLine, sizeof(auxLine), GetString ("FORMATEX_API_FAILED"), FormatExGetMessage(retCode));
+ ErrorDirect(auxLine, volParams->hwndDlg);
+ }
}
- if (retCode != TRUE)
+ if (retCode != 0)
{
if (!UnmountVolumeAfterFormatExCall (volParams->hwndDlg, driveNo) && !Silent)
MessageBoxW (volParams->hwndDlg, GetString ("CANT_DISMOUNT_VOLUME"), lpszTitle, ICON_HAND);
@@ -830,11 +900,13 @@ fv_end:
}
-int FormatNoFs (HWND hwndDlg, unsigned __int64 startSector, __int64 num_sectors, void * dev, PCRYPTO_INFO cryptoInfo, BOOL quickFormat)
+int FormatNoFs (HWND hwndDlg, unsigned __int64 startSector, unsigned __int64 num_sectors, void * dev, PCRYPTO_INFO cryptoInfo, BOOL quickFormat, BOOL bDevice)
{
int write_buf_cnt = 0;
char sector[TC_MAX_VOLUME_SECTOR_SIZE], *write_buf;
unsigned __int64 nSecNo = startSector;
+ unsigned __int64 nSkipSectors = 128 * (unsigned __int64) BYTES_PER_MB / FormatSectorSize;
+ DWORD bytesWritten;
int retVal = 0;
DWORD err;
CRYPTOPP_ALIGN_DATA(16) char temporaryKey[MASTER_KEYDATA_SIZE];
@@ -910,18 +982,56 @@ int FormatNoFs (HWND hwndDlg, unsigned __int64 startSector, __int64 num_sectors,
while (num_sectors--)
{
- if (WriteSector (dev, sector, write_buf, &write_buf_cnt, &nSecNo,
+ if (WriteSector (dev, sector, write_buf, &write_buf_cnt, &nSecNo, startSector,
cryptoInfo) == FALSE)
goto fail;
}
+ if (UpdateProgressBar ((nSecNo - startSector) * FormatSectorSize))
+ return FALSE;
+
if (!FlushFormatWriteBuffer (dev, write_buf, &write_buf_cnt, &nSecNo, cryptoInfo))
goto fail;
}
+ else if (!bDevice)
+ {
+ // Quick format: write a zeroed sector every 128 MiB, leaving other sectors untouched
+ // This helps users visualize the progress of actual file creation while forcing Windows
+ // to allocate the disk space of each 128 MiB chunk immediately, otherwise, Windows
+ // would delay the allocation until we write the backup header at the end of the volume which
+ // would make the user think that the format process has stalled after progress bar reaches 100%.
+ while (num_sectors >= nSkipSectors)
+ {
+ // seek to next sector to be written
+ nSecNo += (nSkipSectors - 1);
+ startOffset.QuadPart = nSecNo * FormatSectorSize;
+ if (!MoveFilePointer ((HANDLE) dev, startOffset))
+ {
+ goto fail;
+ }
+
+ // sector array has been zeroed above
+ if (!WriteFile ((HANDLE) dev, sector, FormatSectorSize, &bytesWritten, NULL)
+ || bytesWritten != FormatSectorSize)
+ {
+ goto fail;
+ }
+
+ nSecNo++;
+ num_sectors -= nSkipSectors;
+
+ if (UpdateProgressBar ((nSecNo - startSector)* FormatSectorSize))
+ goto fail;
+ }
+
+ nSecNo += num_sectors;
+ }
else
- nSecNo = num_sectors;
+ {
+ nSecNo += num_sectors;
+ }
- UpdateProgressBar (nSecNo * FormatSectorSize);
+ UpdateProgressBar ((nSecNo - startSector) * FormatSectorSize);
// Restore the original secondary key (XTS mode) in case NTFS format fails and the user wants to try FAT immediately
memcpy (cryptoInfo->k2, originalK2, sizeof (cryptoInfo->k2));
@@ -973,6 +1083,46 @@ fail:
volatile BOOLEAN FormatExError;
+volatile int FormatExErrorCommand;
+
+LPCWSTR FormatExGetMessage (int command)
+{
+ static WCHAR h_szMsg[32];
+ switch (command)
+ {
+ case FMIFS_DONE:
+ return L"FORMAT_FINISHED";
+ case FMIFS_STRUCTURE_PROGRESS:
+ return L"FORMAT_STRUCTURE_PROGRESS";
+ case FMIFS_MEDIA_WRITE_PROTECTED:
+ return L"FORMAT_MEDIA_WRITE_PROTECTED";
+ case FMIFS_INCOMPATIBLE_FILE_SYSTEM:
+ return L"FORMAT_INCOMPATIBLE_FILE_SYSTEM";
+ case FMIFS_ACCESS_DENIED:
+ return L"FORMAT_ACCESS_DENIED";
+ case FMIFS_VOLUME_IN_USE:
+ return L"FORMAT_VOLUME_IN_USE";
+ case FMIFS_CLUSTER_SIZE_TOO_SMALL:
+ return L"FORMAT_CLUSTER_SIZE_TOO_SMALL";
+ case FMIFS_CLUSTER_SIZE_TOO_BIG:
+ return L"FORMAT_CLUSTER_SIZE_TOO_BIG";
+ case FMIFS_VOLUME_TOO_SMALL:
+ return L"FORMAT_VOLUME_TOO_SMALL";
+ case FMIFS_VOLUME_TOO_BIG:
+ return L"FORMAT_VOLUME_TOO_BIG";
+ case FMIFS_NO_MEDIA_IN_DRIVE:
+ return L"FORMAT_NO_MEDIA_IN_DRIVE";
+ case FMIFS_DEVICE_NOT_READY:
+ return L"FORMAT_DEVICE_NOT_READY";
+ case FMIFS_BAD_LABEL:
+ return L"FORMAT_BAD_LABEL";
+ case FMIFS_CANT_QUICK_FORMAT:
+ return L"FORMAT_CANT_QUICK_FORMAT";
+ default:
+ StringCbPrintfW (h_szMsg, sizeof(h_szMsg), L"0x%.8X", command);
+ return h_szMsg;
+ }
+}
BOOLEAN __stdcall FormatExCallback (int command, DWORD subCommand, PVOID parameter)
{
@@ -1029,10 +1179,14 @@ BOOLEAN __stdcall FormatExCallback (int command, DWORD subCommand, PVOID paramet
FormatExError = TRUE;
break;
}
+ if (FormatExError)
+ {
+ FormatExErrorCommand = command;
+ }
return (FormatExError? FALSE : TRUE);
}
-BOOL FormatFs (int driveNo, int clusterSize, int fsType)
+int FormatFs (int driveNo, int clusterSize, int fsType, BOOL bFallBackExternal)
{
wchar_t dllPath[MAX_PATH] = {0};
WCHAR dir[8] = { (WCHAR) driveNo + L'A', 0 };
@@ -1078,41 +1232,45 @@ BOOL FormatFs (int driveNo, int clusterSize, int fsType)
StringCchCatW (dir, ARRAYSIZE(dir), L":\\");
FormatExError = TRUE;
+ FormatExErrorCommand = 0;
// Windows sometimes fails to format a volume (hosted on a removable medium) as NTFS.
// It often helps to retry several times.
for (i = 0; i < 50 && FormatExError; i++)
{
FormatExError = FALSE;
- FormatEx (dir, FMIFS_HARDDISK, szFsFormat, szLabel, TRUE, clusterSize * FormatSectorSize, FormatExCallback);
+ FormatExErrorCommand = 0;
+ FormatEx (dir, FMIFS_REMOVAL, szFsFormat, szLabel, TRUE, clusterSize * FormatSectorSize, FormatExCallback);
}
// The device may be referenced for some time after FormatEx() returns
Sleep (4000);
FreeLibrary (hModule);
- return FormatExError? FALSE : TRUE;
+
+ if (FormatExError && bFallBackExternal)
+ {
+ return ExternalFormatFs (driveNo, clusterSize, fsType);
+ }
+
+ return FormatExError? FormatExErrorCommand : 0;
}
-BOOL FormatNtfs (int driveNo, int clusterSize)
+int FormatNtfs (int driveNo, int clusterSize, BOOL bFallBackExternal)
{
- return FormatFs (driveNo, clusterSize, FILESYS_NTFS);
+ return FormatFs (driveNo, clusterSize, FILESYS_NTFS, bFallBackExternal);
}
/* call Windows format.com program to perform formatting */
-BOOL ExternalFormatFs (int driveNo, int clusterSize, int fsType)
+int ExternalFormatFs (int driveNo, int clusterSize, int fsType)
{
wchar_t exePath[MAX_PATH] = {0};
- HANDLE hChildStd_IN_Rd = NULL;
- HANDLE hChildStd_IN_Wr = NULL;
- HANDLE hChildStd_OUT_Rd = NULL;
- HANDLE hChildStd_OUT_Wr = NULL;
WCHAR szFsFormat[16];
TCHAR szCmdline[2 * MAX_PATH];
STARTUPINFO siStartInfo;
PROCESS_INFORMATION piProcInfo;
BOOL bSuccess = FALSE;
- SECURITY_ATTRIBUTES saAttr;
+ int iRet = 0;
switch (fsType)
{
@@ -1129,35 +1287,6 @@ BOOL ExternalFormatFs (int driveNo, int clusterSize, int fsType)
return FALSE;
}
- /* Set the bInheritHandle flag so pipe handles are inherited. */
- saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
- saAttr.bInheritHandle = TRUE;
- saAttr.lpSecurityDescriptor = NULL;
-
- /* Create a pipe for the child process's STDOUT. */
- if ( !CreatePipe(&hChildStd_OUT_Rd, &hChildStd_OUT_Wr, &saAttr, 0) )
- return FALSE;
-
- /* Ensure the read handle to the pipe for STDOUT is not inherited. */
- /* Create a pipe for the child process's STDIN. */
- if ( !SetHandleInformation(hChildStd_OUT_Rd, HANDLE_FLAG_INHERIT, 0)
- || !CreatePipe(&hChildStd_IN_Rd, &hChildStd_IN_Wr, &saAttr, 0))
- {
- CloseHandle (hChildStd_OUT_Rd);
- CloseHandle (hChildStd_OUT_Wr);
- return FALSE;
- }
-
- /* Ensure the write handle to the pipe for STDIN is not inherited. */
- if ( !SetHandleInformation(hChildStd_IN_Wr, HANDLE_FLAG_INHERIT, 0))
- {
- CloseHandle (hChildStd_OUT_Rd);
- CloseHandle (hChildStd_OUT_Wr);
- CloseHandle (hChildStd_IN_Rd);
- CloseHandle (hChildStd_IN_Wr);
- return FALSE;
- }
-
if (GetSystemDirectory (exePath, MAX_PATH))
{
StringCchCatW(exePath, ARRAYSIZE(exePath), L"\\format.com");
@@ -1165,7 +1294,7 @@ BOOL ExternalFormatFs (int driveNo, int clusterSize, int fsType)
else
StringCchCopyW(exePath, ARRAYSIZE(exePath), L"C:\\Windows\\System32\\format.com");
- StringCbPrintf (szCmdline, sizeof(szCmdline), L"%s %c: /FS:%s /Q /X /V:\"\"", exePath, (WCHAR) driveNo + L'A', szFsFormat);
+ StringCbPrintf (szCmdline, sizeof(szCmdline), L"%s %c: /FS:%s /Q /X /V:\"\" /Y", exePath, (WCHAR) driveNo + L'A', szFsFormat);
if (clusterSize)
{
@@ -1188,15 +1317,11 @@ BOOL ExternalFormatFs (int driveNo, int clusterSize, int fsType)
ZeroMemory( &piProcInfo, sizeof(PROCESS_INFORMATION) );
/* Set up members of the STARTUPINFO structure.
- This structure specifies the STDIN and STDOUT handles for redirection.
*/
ZeroMemory( &siStartInfo, sizeof(STARTUPINFO) );
siStartInfo.cb = sizeof(STARTUPINFO);
- siStartInfo.hStdError = hChildStd_OUT_Wr;
- siStartInfo.hStdOutput = hChildStd_OUT_Wr;
- siStartInfo.hStdInput = hChildStd_IN_Rd;
siStartInfo.wShowWindow = SW_HIDE;
- siStartInfo.dwFlags |= STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
+ siStartInfo.dwFlags |= STARTF_USESHOWWINDOW;
/* Create the child process. */
bSuccess = CreateProcess(NULL,
@@ -1212,47 +1337,33 @@ BOOL ExternalFormatFs (int driveNo, int clusterSize, int fsType)
if (bSuccess)
{
- /* Unblock the format process by simulating hit on ENTER key */
- DWORD dwExitCode, dwWritten;
- LPCSTR newLine = "\n";
-
- if (WriteFile(hChildStd_IN_Wr, (LPCVOID) newLine, 1, &dwWritten, NULL))
- {
- /* wait for the format process to finish */
- WaitForSingleObject (piProcInfo.hProcess, INFINITE);
- }
- else
- {
- /* we failed to write "\n". Maybe process exited too quickly. We wait 1 second */
- WaitForSingleObject (piProcInfo.hProcess, 1000);
- }
+ DWORD dwExitCode;
+
+ /* wait for the format process to finish */
+ WaitForSingleObject (piProcInfo.hProcess, INFINITE);
/* check if it was successfull */
if (GetExitCodeProcess (piProcInfo.hProcess, &dwExitCode))
{
- if (dwExitCode == 0)
- bSuccess = TRUE;
- else
- bSuccess = FALSE;
+ iRet = (int) dwExitCode; /* dwExitCode will be 0 in case of success */
}
else
- bSuccess = FALSE;
+ iRet = (int) GetLastError();
CloseHandle (piProcInfo.hThread);
CloseHandle (piProcInfo.hProcess);
}
+ else
+ {
+ iRet = (int) GetLastError();
+ }
- CloseHandle(hChildStd_OUT_Wr);
- CloseHandle(hChildStd_OUT_Rd);
- CloseHandle(hChildStd_IN_Rd);
- CloseHandle(hChildStd_IN_Wr);
-
- return bSuccess;
+ return iRet;
}
BOOL WriteSector (void *dev, char *sector,
char *write_buf, int *write_buf_cnt,
- __int64 *nSecNo, PCRYPTO_INFO cryptoInfo)
+ unsigned __int64 *nSecNo, unsigned __int64 startSector, PCRYPTO_INFO cryptoInfo)
{
static __int32 updateTime = 0;
@@ -1266,7 +1377,7 @@ BOOL WriteSector (void *dev, char *sector,
if (GetTickCount () - updateTime > 25)
{
- if (UpdateProgressBar (*nSecNo * FormatSectorSize))
+ if (UpdateProgressBar ((*nSecNo - startSector) * FormatSectorSize))
return FALSE;
updateTime = GetTickCount ();
diff --git a/src/Common/Format.h b/src/Common/Format.h
index 139607e5..0a42e5c8 100644
--- a/src/Common/Format.h
+++ b/src/Common/Format.h
@@ -69,20 +69,23 @@ FORMAT_VOL_PARAMETERS;
#define FMIFS_CHECKDISK_PROGRESS 0x19
#define FMIFS_READ_ONLY_MODE 0x20
+#define FMIFS_REMOVAL 0xB
#define FMIFS_HARDDISK 0xC
extern int FormatWriteBufferSize;
int TCFormatVolume (volatile FORMAT_VOL_PARAMETERS *volParams);
-BOOL FormatNtfs (int driveNo, int clusterSize);
-BOOL FormatFs (int driveNo, int clusterSize, int fsType);
-BOOL ExternalFormatFs (int driveNo, int clusterSize, int fsType);
+int FormatNtfs (int driveNo, int clusterSize, BOOL bFallBackExternal);
+int FormatFs (int driveNo, int clusterSize, int fsType, BOOL bFallBackExternal);
+int ExternalFormatFs (int driveNo, int clusterSize, int fsType);
+LPCWSTR FormatExGetMessage (int command);
uint64 GetVolumeDataAreaSize (BOOL hiddenVolume, uint64 volumeSize);
-int FormatNoFs (HWND hwndDlg, unsigned __int64 startSector, __int64 num_sectors, void *dev, PCRYPTO_INFO cryptoInfo, BOOL quickFormat);
-BOOL WriteSector ( void *dev , char *sector , char *write_buf , int *write_buf_cnt , __int64 *nSecNo , PCRYPTO_INFO cryptoInfo );
+int FormatNoFs (HWND hwndDlg, unsigned __int64 startSector, unsigned __int64 num_sectors, void *dev, PCRYPTO_INFO cryptoInfo, BOOL quickFormat, BOOL bDevice);
+BOOL WriteSector ( void *dev , char *sector , char *write_buf , int *write_buf_cnt , unsigned __int64 *nSecNo , unsigned __int64 startSector, PCRYPTO_INFO cryptoInfo );
BOOL FlushFormatWriteBuffer (void *dev, char *write_buf, int *write_buf_cnt, __int64 *nSecNo, PCRYPTO_INFO cryptoInfo);
static BOOL StartFormatWriteThread ();
static void StopFormatWriteThread ();
+BOOL MoveFilePointer (HANDLE dev, LARGE_INTEGER offset);
#define FILESYS_NONE 0
#define FILESYS_FAT 1
@@ -90,6 +93,11 @@ static void StopFormatWriteThread ();
#define FILESYS_EXFAT 3
#define FILESYS_REFS 4
+#define FORMAT_TYPE_FULL 0
+#define FORMAT_TYPE_QUICK 1
+#define FORMAT_TYPE_FAST 2
+
+
#ifdef __cplusplus
}
#endif
diff --git a/src/Common/GfMul.c b/src/Common/GfMul.c
index 970e6318..db51f499 100644
--- a/src/Common/GfMul.c
+++ b/src/Common/GfMul.c
@@ -287,7 +287,7 @@ static mode(32t) gf_poly64[2] = { 0, 0xd8000000 };
/* This function multiples a field element x, in the polynomial */
/* field representation. It uses 32-bit word operations to gain */
-/* speed but compensates for machine endianess and hence works */
+/* speed but compensates for machine endianness and hence works */
/* correctly on both styles of machine */
in_line void mul_x(mode(32t) x[4])
@@ -333,7 +333,7 @@ in_line void mul_x64(mode(32t) x[2])
}
/* Multiply of a GF128 field element by x^8 using 32-bit words */
-/* for speed - machine endianess matters here */
+/* for speed - machine endianness matters here */
#if (PLATFORM_BYTE_ORDER == BRG_LITTLE_ENDIAN)
@@ -380,7 +380,7 @@ in_line void mul_bex8_64(mode(32t) x[2]) /* mutiply with long words */
#endif
-/* hence choose the correct version for the machine endianess */
+/* hence choose the correct version for the machine endianness */
#if PLATFORM_BYTE_ORDER == BRG_BIG_ENDIAN
#define mul_x8 mul_bex8
diff --git a/src/Common/IccDataExtractor.cpp b/src/Common/IccDataExtractor.cpp
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/Common/IccDataExtractor.cpp
diff --git a/src/Common/IccDataExtractor.h b/src/Common/IccDataExtractor.h
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/Common/IccDataExtractor.h
diff --git a/src/Common/Keyfiles.c b/src/Common/Keyfiles.c
index 174aed92..d10daa06 100644
--- a/src/Common/Keyfiles.c
+++ b/src/Common/Keyfiles.c
@@ -23,6 +23,7 @@
#include "Dlgcode.h"
#include "Language.h"
#include "SecurityToken.h"
+#include "EMVToken.h"
#include "Common/resource.h"
#include "Platform/Finally.h"
#include "Platform/ForEach.h"
@@ -249,12 +250,12 @@ BOOL KeyFilesApply (HWND hwndDlg, Password *password, KeyFile *firstKeyFile, con
// Determine whether it's a security token path
try
{
- if (SecurityToken::IsKeyfilePathValid (kf->FileName))
+ if (Token::IsKeyfilePathValid (kf->FileName, EMVSupportEnabled? true : false))
{
// Apply security token keyfile
vector <byte> keyfileData;
- SecurityTokenKeyfilePath secPath (kf->FileName);
- SecurityToken::GetKeyfileData (SecurityTokenKeyfile (secPath), keyfileData);
+ TokenKeyfilePath secPath (kf->FileName);
+ Token::getTokenKeyfile (secPath)->GetKeyfileData (keyfileData);
if (keyfileData.empty())
{
@@ -483,9 +484,23 @@ BOOL CALLBACK KeyFilesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
SetWindowTextW(GetDlgItem(hwndDlg, IDT_KEYFILES_NOTE), GetString ("KEYFILES_NOTE"));
ToHyperlink (hwndDlg, IDC_LINK_KEYFILES_INFO);
+ ToHyperlink (hwndDlg, IDC_LINK_KEYFILES_EXTENSIONS_WARNING);
}
return 1;
+ case WM_CTLCOLORSTATIC:
+ {
+ if (((HWND)lParam == GetDlgItem(hwndDlg, IDT_KEYFILE_WARNING)) )
+ {
+ // we're about to draw the static
+ // set the text colour in (HDC)wParam
+ SetBkMode((HDC)wParam,TRANSPARENT);
+ SetTextColor((HDC)wParam, RGB(255,0,0));
+ return (BOOL)GetSysColorBrush(COLOR_MENU);
+ }
+ }
+ return 0;
+
case WM_COMMAND:
if (lw == IDC_KEYADD)
@@ -493,11 +508,15 @@ BOOL CALLBACK KeyFilesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
KeyFile *kf = (KeyFile *) malloc (sizeof (KeyFile));
if (kf)
{
- if (SelectMultipleFiles (hwndDlg, "SELECT_KEYFILE", kf->FileName, sizeof(kf->FileName),bHistory))
+ std::vector<std::wstring> filesList;
+ if (SelectMultipleFiles (hwndDlg, "SELECT_KEYFILE", bHistory, filesList))
{
bool containerFileSkipped = false;
- do
+ for (std::vector<std::wstring>::const_iterator it = filesList.begin();
+ it != filesList.end();
+ ++it)
{
+ StringCbCopyW (kf->FileName, sizeof (kf->FileName), it->c_str());
CorrectFileName (kf->FileName);
if (_wcsicmp (param->VolumeFileName, kf->FileName) == 0)
containerFileSkipped = true;
@@ -507,13 +526,13 @@ BOOL CALLBACK KeyFilesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
LoadKeyList (hwndDlg, param->FirstKeyFile);
kf = (KeyFile *) malloc (sizeof (KeyFile));
- if (!kf)
- {
- Warning ("ERR_MEM_ALLOC", hwndDlg);
- break;
- }
+ if (!kf)
+ {
+ Warning ("ERR_MEM_ALLOC", hwndDlg);
+ break;
+ }
}
- } while (SelectMultipleFilesNext (kf->FileName, sizeof(kf->FileName)));
+ }
if (containerFileSkipped)
{
@@ -532,7 +551,7 @@ BOOL CALLBACK KeyFilesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
KeyFile *kf = (KeyFile *) malloc (sizeof (KeyFile));
if (kf)
{
- if (BrowseDirectories (hwndDlg,"SELECT_KEYFILE_PATH", kf->FileName))
+ if (BrowseDirectories (hwndDlg,"SELECT_KEYFILE_PATH", kf->FileName, NULL))
{
param->FirstKeyFile = KeyFileAdd (param->FirstKeyFile, kf);
LoadKeyList (hwndDlg, param->FirstKeyFile);
@@ -551,10 +570,10 @@ BOOL CALLBACK KeyFilesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
if (lw == IDC_TOKEN_FILES_ADD)
{
- list <SecurityTokenKeyfilePath> selectedTokenKeyfiles;
+ list <TokenKeyfilePath> selectedTokenKeyfiles;
if (DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_TOKEN_KEYFILES), hwndDlg, (DLGPROC) SecurityTokenKeyfileDlgProc, (LPARAM) &selectedTokenKeyfiles) == IDOK)
{
- foreach (const SecurityTokenKeyfilePath &keyPath, selectedTokenKeyfiles)
+ foreach (const TokenKeyfilePath &keyPath, selectedTokenKeyfiles)
{
KeyFile *kf = (KeyFile *) malloc (sizeof (KeyFile));
if (kf)
@@ -609,6 +628,12 @@ BOOL CALLBACK KeyFilesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
return 1;
}
+ if (lw == IDC_LINK_KEYFILES_EXTENSIONS_WARNING)
+ {
+ Applink ("keyfilesextensions");
+ return 1;
+ }
+
if (lw == IDOK)
{
param->EnableKeyFiles = IsButtonChecked (GetDlgItem (hwndDlg, IDC_KEYFILES_ENABLE));
@@ -710,10 +735,14 @@ BOOL KeyfilesPopupMenu (HWND hwndDlg, POINT popupPosition, KeyFilesDlgParam *par
KeyFile *kf = (KeyFile *) malloc (sizeof (KeyFile));
if (kf)
{
- if (SelectMultipleFiles (hwndDlg, "SELECT_KEYFILE", kf->FileName, sizeof(kf->FileName),bHistory))
+ std::vector<std::wstring> filesList;
+ if (SelectMultipleFiles (hwndDlg, "SELECT_KEYFILE", bHistory, filesList))
{
- do
+ for (std::vector<std::wstring>::const_iterator it = filesList.begin();
+ it != filesList.end();
+ ++it)
{
+ StringCbCopyW (kf->FileName, sizeof (kf->FileName), it->c_str());
param->FirstKeyFile = KeyFileAdd (param->FirstKeyFile, kf);
kf = (KeyFile *) malloc (sizeof (KeyFile));
if (!kf)
@@ -721,7 +750,7 @@ BOOL KeyfilesPopupMenu (HWND hwndDlg, POINT popupPosition, KeyFilesDlgParam *par
Warning ("ERR_MEM_ALLOC", hwndDlg);
break;
}
- } while (SelectMultipleFilesNext (kf->FileName, sizeof(kf->FileName)));
+ }
param->EnableKeyFiles = TRUE;
status = TRUE;
@@ -738,7 +767,7 @@ BOOL KeyfilesPopupMenu (HWND hwndDlg, POINT popupPosition, KeyFilesDlgParam *par
KeyFile *kf = (KeyFile *) malloc (sizeof (KeyFile));
if (kf)
{
- if (BrowseDirectories (hwndDlg,"SELECT_KEYFILE_PATH", kf->FileName))
+ if (BrowseDirectories (hwndDlg,"SELECT_KEYFILE_PATH", kf->FileName, NULL))
{
param->FirstKeyFile = KeyFileAdd (param->FirstKeyFile, kf);
param->EnableKeyFiles = TRUE;
@@ -758,10 +787,10 @@ BOOL KeyfilesPopupMenu (HWND hwndDlg, POINT popupPosition, KeyFilesDlgParam *par
case IDM_KEYFILES_POPUP_ADD_TOKEN_FILES:
{
- list <SecurityTokenKeyfilePath> selectedTokenKeyfiles;
+ list <TokenKeyfilePath> selectedTokenKeyfiles;
if (DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_TOKEN_KEYFILES), hwndDlg, (DLGPROC) SecurityTokenKeyfileDlgProc, (LPARAM) &selectedTokenKeyfiles) == IDOK)
{
- foreach (const SecurityTokenKeyfilePath &keyPath, selectedTokenKeyfiles)
+ foreach (const TokenKeyfilePath &keyPath, selectedTokenKeyfiles)
{
KeyFile *kf = (KeyFile *) malloc (sizeof (KeyFile));
if (kf)
diff --git a/src/Common/Language.xml b/src/Common/Language.xml
index e4ceac7a..e3e96a1f 100644
--- a/src/Common/Language.xml
+++ b/src/Common/Language.xml
@@ -295,6 +295,7 @@
<entry lang="en" key="IDT_NEW_PKCS5_PRF">PKCS-5 PRF:</entry>
<entry lang="en" key="IDT_PW_CACHE_OPTIONS">Password Cache</entry>
<entry lang="en" key="IDT_SECURITY_OPTIONS">Security Options</entry>
+ <entry lang="en" key="IDT_EMV_OPTIONS">EMV Options</entry>
<entry lang="en" key="IDT_TASKBAR_ICON">VeraCrypt Background Task</entry>
<entry lang="en" key="IDT_TRAVELER_MOUNT">VeraCrypt volume to mount (relative to traveler disk root):</entry>
<entry lang="en" key="IDT_TRAVEL_INSERTION">Upon insertion of traveler disk: </entry>
@@ -356,7 +357,7 @@
<entry lang="en" key="IDT_KEYFILE_WARNING">WARNING: If you lose a keyfile or if any bit of its first 1024 kilobytes changes, it will be impossible to mount volumes that use the keyfile!</entry>
<entry lang="en" key="IDT_KEY_UNIT">bits</entry>
<entry lang="en" key="IDT_NUMBER_KEYFILES">Number of keyfiles:</entry>
- <entry lang="en" key="IDT_KEYFILES_SIZE">Keyfiles size (in Bytes):</entry>
+ <entry lang="en" key="IDT_KEYFILES_SIZE">Keyfiles size:</entry>
<entry lang="en" key="IDT_KEYFILES_BASE_NAME">Keyfiles base name:</entry>
<entry lang="en" key="IDT_LANGPACK_AUTHORS">Translated by:</entry>
<entry lang="en" key="IDT_PLAINTEXT">Plaintext size:</entry>
@@ -389,6 +390,7 @@
<entry lang="en" key="ADMINISTRATOR">Administrator</entry>
<entry lang="en" key="ADMIN_PRIVILEGES_DRIVER">In order to load the VeraCrypt driver, you need to be logged into an account with administrator privileges.</entry>
<entry lang="en" key="ADMIN_PRIVILEGES_WARN_DEVICES">Please note that in order to encrypt, decrypt or format a partition/device you need to be logged into an account with administrator privileges.\n\nThis does not apply to file-hosted volumes.</entry>
+ <entry lang="en" key="ADMIN_PRIVILEGES_WARN_MANAGE_VOLUME">Unable to activate fast file creation: Administrator privileges required.\nPlease relaunch the program as an Administrator to enable this feature.\n\nWould you like to proceed without fast file creation?</entry>
<entry lang="en" key="ADMIN_PRIVILEGES_WARN_HIDVOL">In order to create a hidden volume you need to be logged into an account with administrator privileges.\n\nContinue?</entry>
<entry lang="en" key="ADMIN_PRIVILEGES_WARN_NTFS">Please note that in order to format the volume as NTFS/exFAT/ReFS you need to be logged into an account with administrator privileges.\n\nWithout administrator privileges, you can format the volume as FAT.</entry>
<entry lang="en" key="AES_HELP">FIPS-approved cipher (Rijndael, published in 1998) that may be used by U.S. government departments and agencies to protect classified information up to the Top Secret level. 256-bit key, 128-bit block, 14 rounds (AES-256). Mode of operation is XTS.</entry>
@@ -611,7 +613,7 @@
<entry lang="en" key="FAVORITE_PIM_CHANGED">This volume is registered as a System Favorite and its PIM was changed.\nDo you want VeraCrypt to automatically update the System Favorite configuration (administrator privileges required)?\n\nPlease note that if you answer no, you'll have to update the System Favorite manually.</entry>
<entry lang="en" key="SYS_PASSWORD_CHANGED_ASK_RESCUE_DISK">IMPORTANT: If you did not destroy your VeraCrypt Rescue Disk, your system partition/drive can still be decrypted using the old password (by booting the VeraCrypt Rescue Disk and entering the old password). You should create a new VeraCrypt Rescue Disk and then destroy the old one.\n\nDo you want to create a new VeraCrypt Rescue Disk?</entry>
<entry lang="en" key="SYS_HKD_ALGO_CHANGED_ASK_RESCUE_DISK">Note that your VeraCrypt Rescue Disk still uses the previous algorithm. If you consider the previous algorithm insecure, you should create a new VeraCrypt Rescue Disk and then destroy the old one.\n\nDo you want to create a new VeraCrypt Rescue Disk?</entry>
- <entry lang="en" key="KEYFILES_NOTE">Any kind of file (for example, .mp3, .jpg, .zip, .avi) may be used as a VeraCrypt keyfile. Note that VeraCrypt never modifies the keyfile contents. You can select more than one keyfile (the order does not matter). If you add a folder, all non-hidden files found in it will be used as keyfiles. Click 'Add Token Files' to select keyfiles stored on security tokens or smart cards (or to import keyfiles to security tokens or smart cards).</entry>
+ <entry lang="en" key="KEYFILES_NOTE">Note that VeraCrypt never modifies the keyfile contents. You can select more than one keyfile (the order does not matter). If you add a folder, all non-hidden files found in it will be used as keyfiles. Click 'Add Token Files' to select keyfiles stored on security tokens or smart cards (or to import keyfiles to security tokens or smart cards).</entry>
<entry lang="en" key="KEYFILE_CHANGED">Keyfile(s) successfully added/removed.</entry>
<entry lang="en" key="KEYFILE_EXPORTED">Keyfile exported.</entry>
<entry lang="en" key="PKCS5_PRF_CHANGED">Header key derivation algorithm successfully set.</entry>
@@ -938,7 +940,7 @@
<entry lang="en" key="ENTER_HEADER_BACKUP_PASSWORD">Enter password for the header stored in backup file</entry>
<entry lang="en" key="KEYFILE_CREATED">Keyfiles have been successfully created.</entry>
<entry lang="en" key="KEYFILE_INCORRECT_NUMBER">The number of keyfiles you supplied is invalid.</entry>
- <entry lang="en" key="KEYFILE_INCORRECT_SIZE">The keyfile size must be comprized between 64 and 1048576 bytes.</entry>
+ <entry lang="en" key="KEYFILE_INCORRECT_SIZE">The keyfile size must be at least 64 bytes.</entry>
<entry lang="en" key="KEYFILE_EMPTY_BASE_NAME">Please enter a name for the keyfile(s) to be generated</entry>
<entry lang="en" key="KEYFILE_INVALID_BASE_NAME">The base name of the keyfile(s) is invalid</entry>
<entry lang="en" key="KEYFILE_ALREADY_EXISTS">The keyfile '%s' already exists.\nDo you want to overwrite it? The generation process will be stopped if you answer No.</entry>
@@ -1521,6 +1523,7 @@
<entry lang="en" key="LINUX_NOT_SUPPORTED"> (not supported by components available on this platform).\n</entry>
<entry lang="en" key="LINUX_KERNEL_OLD">Your system uses an old version of the Linux kernel.\n\nDue to a bug in the Linux kernel, your system may stop responding when writing data to a VeraCrypt volume. This problem can be solved by upgrading the kernel to version 2.6.24 or later.</entry>
<entry lang="en" key="LINUX_VOL_DISMOUNTED">Volume {0} has been dismounted.</entry>
+ <entry lang="en" key="LINUX_VOL_MOUNTED">Volume {0} has been mounted.</entry>
<entry lang="en" key="LINUX_OOM">Out of memory.</entry>
<entry lang="en" key="LINUX_CANT_GET_ADMIN_PRIV">Failed to obtain administrator privileges</entry>
<entry lang="en" key="LINUX_COMMAND_GET_ERROR">Command {0} returned error {1}.</entry>
@@ -1568,6 +1571,73 @@
<entry lang="en" key="CANT_INSTALL_WITH_EXE_OVER_MSI">VeraCrypt was previously installed using an MSI package and so it can't be updated using the standard installer.\n\nPlease use the MSI package to update your VeraCrypt installation.</entry>
<entry lang="en" key="IDC_USE_ALL_FREE_SPACE">Use all available free space</entry>
<entry lang="en" key="SYS_ENCRYPTION_UPGRADE_UNSUPPORTED_ALGORITHM">VeraCrypt cannot be upgraded because the system partition/drive was encrypted using an algorithm that is not supported anymore.\nPlease decrypt your system before upgrading VeraCrypt and then encrypt it again.</entry>
+ <entry lang="en" key="LINUX_EX2MSG_TERMINALNOTFOUND">Supported terminal application could not be found, you need either xterm, konsole or gnome-terminal (with dbus-x11).</entry>
+ <entry lang="en" key="IDM_MOUNT_NO_CACHE">Mount Without Cache</entry>
+ <entry lang="en" key="EXPANDER_INFO">:: VeraCrypt Expander ::\n\nExpand a VeraCrypt volume on the fly without reformatting\n\n\nAll kind of volumes (container files, disks and partitions) formatted with NTFS are supported. The only condition is that there must be enough free space on the host drive or host device of the VeraCrypt volume.\n\nDo not use this software to expand an outer volume containing a hidden volume, because this destroys the hidden volume!\n</entry>
+ <entry lang="en" key="IDC_STEPSEXPAND">1. Select the VeraCrypt volume to be expanded\n2. Click the 'Mount' button</entry>
+ <entry lang="en" key="IDT_VOL_NAME">Volume: </entry>
+ <entry lang="en" key="IDT_FILE_SYS">File system: </entry>
+ <entry lang="en" key="IDT_CURRENT_SIZE">Current size: </entry>
+ <entry lang="en" key="IDT_NEW_SIZE">New size: </entry>
+ <entry lang="en" key="IDT_NEW_SIZE_BOX_TITLE">Enter new volume size</entry>
+ <entry lang="en" key="IDC_INIT_NEWSPACE">Fill new space with random data</entry>
+ <entry lang="en" key="IDC_QUICKEXPAND">Quick Expand</entry>
+ <entry lang="en" key="IDT_INIT_SPACE">Fill new space: </entry>
+ <entry lang="en" key="EXPANDER_FREE_SPACE">%s free space available on host drive</entry>
+ <entry lang="en" key="EXPANDER_HELP_DEVICE">This is a device-based VeraCrypt volume.\n\nThe new volume size will be chosen automatically as the size of the host device.</entry>
+ <entry lang="en" key="EXPANDER_HELP_FILE">Please specify the new size of the VeraCrypt volume (must be at least %I64u KB larger than the current size).</entry>
+ <entry lang="en" key="QUICK_EXPAND_WARNING">WARNING: You should use Quick Expand only in the following cases:\n\n1) The device where the file container is located contains no sensitive data and you do not need plausible deniability.\n2) The device where the file container is located has already been securely and fully encrypted.\n\nAre you sure you want to use Quick Expand?</entry>
+ <entry lang="en" key="EXPANDER_STATUS_TEXT">IMPORTANT: Move your mouse as randomly as possible within this window. The longer you move it, the better. This significantly increases the cryptographic strength of the encryption keys. Then click 'Continue' to expand the volume.</entry>
+ <entry lang="en" key="EXPANDER_STATUS_TEXT_LEGACY">Click 'Continue' to expand the volume.</entry>
+ <entry lang="en" key="EXPANDER_FINISH_ERROR">Error: volume expansion failed.</entry>
+ <entry lang="en" key="EXPANDER_FINISH_ABORT">Error: operation aborted by user.</entry>
+ <entry lang="en" key="EXPANDER_FINISH_OK">Finished. Volume successfully expanded.</entry>
+ <entry lang="en" key="EXPANDER_CANCEL_WARNING">Warning: Volume expansion is in progress!\n\nStopping now may result in a damaged volume.\n\nDo you really want to cancel?</entry>
+ <entry lang="en" key="EXPANDER_STARTING_STATUS">Starting volume expansion ...\n</entry>
+ <entry lang="en" key="EXPANDER_HIDDEN_VOLUME_ERROR">An outer volume containing a hidden volume can't be expanded, because this destroys the hidden volume.\n</entry>
+ <entry lang="en" key="EXPANDER_SYSTEM_VOLUME_ERROR">A VeraCrypt system volume can't be expanded.</entry>
+ <entry lang="en" key="EXPANDER_NO_FREE_SPACE">Not enough free space to expand the volume</entry>
+ <entry lang="en" key="EXPANDER_WARNING_FILE_CONTAINER_JUNK">Warning: The container file is larger than the VeraCrypt volume area. The data after the VeraCrypt volume area will be overwritten.\n\nDo you want to continue?</entry>
+ <entry lang="en" key="EXPANDER_WARNING_FAT">Warning: The VeraCrypt volume contains a FAT file system!\n\nOnly the VeraCrypt volume itself will be expanded, but not the file system.\n\nDo you want to continue?</entry>
+ <entry lang="en" key="EXPANDER_WARNING_EXFAT">Warning: The VeraCrypt volume contains an exFAT file system!\n\nOnly the VeraCrypt volume itself will be expanded, but not the file system.\n\nDo you want to continue?</entry>
+ <entry lang="en" key="EXPANDER_WARNING_UNKNOWN_FS">Warning: The VeraCrypt volume contains an unknown or no file system!\n\nOnly the VeraCrypt volume itself will be expanded, the file system remains unchanged.\n\nDo you want to continue?</entry>
+ <entry lang="en" key="EXPANDER_ERROR_VOLUME_SIZE_TOO_SMALL">New volume size too small, must be at least %I64u KiB larger than the current size.</entry>
+ <entry lang="en" key="EXPANDER_ERROR_VOLUME_SIZE_TOO_LARGE">New volume size too large, not enough space on host drive.</entry>
+ <entry lang="en" key="EXPANDER_ERROR_MAX_FILE_SIZE_EXCEEDED">Maximum file size of %I64u MB on host drive exceeded.</entry>
+ <entry lang="en" key="EXPANDER_ERROR_QUICKEXPAND_PRIVILEGES">Error: Failed to get necessary privileges to enable Quick Expand!\nPlease uncheck Quick Expand option and try again.</entry>
+ <entry lang="en" key="EXPANDER_ERROR_MAX_VC_VOLUME_SIZE_EXCEEDED">Maximum VeraCrypt volume size of %I64u TB exceeded!\n</entry>
+ <entry lang="en" key="FULL_FORMAT">Full Format</entry>
+ <entry lang="en" key="FAST_CREATE">Fast Create</entry>
+ <entry lang="en" key="WARN_FAST_CREATE">WARNING: You should use Fast Create only in the following cases:\n\n1) The device contains no sensitive data and you do not need plausible deniability.\n2) The device has already been securely and fully encrypted.\n\nAre you sure you want to use Fast Create?</entry>
+ <entry lang="en" key="IDC_ENABLE_EMV_SUPPORT">Enable EMV Support</entry>
+ <entry lang="en" key="COMMAND_APDU_INVALID">The APDU command sent to the card is not valid.</entry>
+ <entry lang="en" key="EXTENDED_APDU_UNSUPPORTED">Extended APDU commands cannot be used with the current token.</entry>
+ <entry lang="en" key="SCARD_MODULE_INIT_FAILED">Error when loading the WinSCard / PCSC library.</entry>
+ <entry lang="en" key="EMV_UNKNOWN_CARD_TYPE">The card in the reader is not a supported EMV card.</entry>
+ <entry lang="en" key="EMV_SELECT_AID_FAILED">The AID of the card in the reader could not be selected.</entry>
+ <entry lang="en" key="EMV_ICC_CERT_NOTFOUND">ICC Public Key Certificate was not found in the card.</entry>
+ <entry lang="en" key="EMV_ISSUER_CERT_NOTFOUND">Issuer Public Key Certificate was not found in the card.</entry>
+ <entry lang="en" key="EMV_CPLC_NOTFOUND">CLPC was not found in the EMV card.</entry>
+ <entry lang="en" key="EMV_PAN_NOTFOUND">No Primary Account Number (PAN) found in the EMV card.</entry>
+ <entry lang="en" key="INVALID_EMV_PATH">EMV path is invalid.</entry>
+ <entry lang="en" key="EMV_KEYFILE_DATA_NOTFOUND">Unable to build a keyfile from the EMV card's data.\n\nOne of the following is missing:\n- ICC Public Key Certificate.\n- Issuer Public Key Certificate.\n- CPCL data.</entry>
+ <entry lang="en" key="SCARD_W_REMOVED_CARD">No card in the reader.\n\nPlease make sure the card is correctly slotted.</entry>
+ <entry lang="en" key="FORMAT_EXTERNAL_FAILED">Windows format.com command failed to format the volume as NTFS/exFAT/ReFS: Error 0x%.8X.\n\nFalling back to using Windows FormatEx API.</entry>
+ <entry lang="en" key="FORMATEX_API_FAILED">Windows FormatEx API failed to format the volume as NTFS/exFAT/ReFS.\n\nFailure status = %s.</entry>
+ <entry lang="en" key="EXPANDER_WRITING_RANDOM_DATA">Writing random data to new space ...\n</entry>
+ <entry lang="en" key="EXPANDER_WRITING_ENCRYPTED_BACKUP">Writing re-encrypted backup header ...\n</entry>
+ <entry lang="en" key="EXPANDER_WRITING_ENCRYPTED_PRIMARY">Writing re-encrypted primary header ...\n</entry>
+ <entry lang="en" key="EXPANDER_WIPING_OLD_HEADER">Wiping old backup header ...\n</entry>
+ <entry lang="en" key="EXPANDER_MOUNTING_VOLUME">Mounting volume ...\n</entry>
+ <entry lang="en" key="EXPANDER_UNMOUNTING_VOLUME">Unmounting volume ...\n</entry>
+ <entry lang="en" key="EXPANDER_EXTENDING_FILESYSTEM">Extending file system ...\n</entry>
+ <entry lang="en" key="PARTIAL_SYSENC_MOUNT_READONLY">Warning: The system partition you attempted to mount was not fully encrypted. As a safety measure to prevent potential corruption or unwanted modifications, volume '%s' was mounted as read-only.</entry>
+ <entry lang="en" key="IDC_LINK_KEYFILES_EXTENSIONS_WARNING">Important information on using third-party file extensions</entry>
+ <entry lang="en" key="IDC_DISABLE_MEMORY_PROTECTION">Disable memory protection for Accessibility tools compatibility</entry>
+ <entry lang="en" key="DISABLE_MEMORY_PROTECTION_WARNING">WARNING: Disabling memory protection significantly reduces security. Enable this option ONLY if you rely on Accessibility tools, like Screen Readers, to interact with VeraCrypt's UI.</entry>
+ <entry lang="en" key="LINUX_LANGUAGE">Language</entry>
+ <entry lang="en" key="LINUX_SELECT_SYS_DEFAULT_LANG">Select system's default language</entry>
+ <entry lang="en" key="LINUX_RESTART_FOR_LANGUAGE_CHANGE">For the language change to come into effect, VeraCrypt needs to be restarted.</entry>
</localization>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="VeraCrypt">
diff --git a/src/Common/Lzma.vcxproj b/src/Common/Lzma.vcxproj
index b6d31bde..a34390aa 100644
--- a/src/Common/Lzma.vcxproj
+++ b/src/Common/Lzma.vcxproj
@@ -35,6 +35,7 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="lzma\7zTypes.h" />
+ <ClInclude Include="lzma\7zWindows.h" />
<ClInclude Include="lzma\Alloc.h" />
<ClInclude Include="lzma\Compiler.h" />
<ClInclude Include="lzma\CpuArch.h" />
diff --git a/src/Common/Lzma.vcxproj.filters b/src/Common/Lzma.vcxproj.filters
index 1c763e5a..82fc24ec 100644
--- a/src/Common/Lzma.vcxproj.filters
+++ b/src/Common/Lzma.vcxproj.filters
@@ -80,5 +80,8 @@
<ClInclude Include="lzma\Threads.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="lzma\7zWindows.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
</Project> \ No newline at end of file
diff --git a/src/Common/Lzma_vs2019.vcxproj b/src/Common/Lzma_vs2019.vcxproj
index fae6762a..81a57daa 100644
--- a/src/Common/Lzma_vs2019.vcxproj
+++ b/src/Common/Lzma_vs2019.vcxproj
@@ -43,6 +43,7 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="lzma\7zTypes.h" />
+ <ClInclude Include="lzma\7zWindows.h" />
<ClInclude Include="lzma\Alloc.h" />
<ClInclude Include="lzma\Compiler.h" />
<ClInclude Include="lzma\CpuArch.h" />
diff --git a/src/Common/Lzma_vs2019.vcxproj.filters b/src/Common/Lzma_vs2019.vcxproj.filters
index 1c763e5a..82fc24ec 100644
--- a/src/Common/Lzma_vs2019.vcxproj.filters
+++ b/src/Common/Lzma_vs2019.vcxproj.filters
@@ -80,5 +80,8 @@
<ClInclude Include="lzma\Threads.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="lzma\7zWindows.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
</Project> \ No newline at end of file
diff --git a/src/Common/PCSCException.cpp b/src/Common/PCSCException.cpp
new file mode 100644
index 00000000..dc5eead3
--- /dev/null
+++ b/src/Common/PCSCException.cpp
@@ -0,0 +1,202 @@
+#include "PCSCException.h"
+
+#if !defined(TC_WINDOWS) || defined(TC_PROTOTYPE)
+#include "Platform/SerializerFactory.h"
+#include "Platform/StringConverter.h"
+#include "Platform/SystemException.h"
+#else
+#include "Dictionary.h"
+#include "Language.h"
+#endif
+
+namespace VeraCrypt
+{
+ PCSCException::operator string() const
+ {
+ if (ErrorCode == SCARD_S_SUCCESS)
+ return string();
+
+ static const struct{
+ LONG_PCSC ErrorCode;
+ const char* ErrorString;
+ } ErrorStrings[] = {
+#define SC_ERR(CODE) { CODE, #CODE },
+#ifdef TC_WINDOWS
+ SC_ERR(ERROR_BROKEN_PIPE)
+ SC_ERR(SCARD_E_NO_PIN_CACHE)
+ SC_ERR(SCARD_E_PIN_CACHE_EXPIRED)
+ SC_ERR(SCARD_E_READ_ONLY_CARD)
+ SC_ERR(SCARD_W_CACHE_ITEM_NOT_FOUND)
+ SC_ERR(SCARD_W_CACHE_ITEM_STALE)
+ SC_ERR(SCARD_W_CACHE_ITEM_TOO_BIG)
+#endif
+ SC_ERR(SCARD_E_BAD_SEEK)
+ SC_ERR(SCARD_E_CANCELLED)
+ SC_ERR(SCARD_E_CANT_DISPOSE)
+ SC_ERR(SCARD_E_CARD_UNSUPPORTED)
+ SC_ERR(SCARD_E_CERTIFICATE_UNAVAILABLE)
+ SC_ERR(SCARD_E_COMM_DATA_LOST)
+ SC_ERR(SCARD_E_COMM_DATA_LOST)
+ SC_ERR(SCARD_E_DIR_NOT_FOUND)
+ SC_ERR(SCARD_E_DUPLICATE_READER)
+ SC_ERR(SCARD_E_FILE_NOT_FOUND)
+ SC_ERR(SCARD_E_ICC_CREATEORDER)
+ SC_ERR(SCARD_E_ICC_INSTALLATION)
+ SC_ERR(SCARD_E_INSUFFICIENT_BUFFER)
+ SC_ERR(SCARD_E_INVALID_ATR)
+ SC_ERR(SCARD_E_INVALID_CHV)
+ SC_ERR(SCARD_E_INVALID_HANDLE)
+ SC_ERR(SCARD_E_INVALID_PARAMETER)
+ SC_ERR(SCARD_E_INVALID_TARGET)
+ SC_ERR(SCARD_E_INVALID_VALUE)
+ SC_ERR(SCARD_E_NO_ACCESS)
+ SC_ERR(SCARD_E_NO_DIR)
+ SC_ERR(SCARD_E_NO_FILE)
+ SC_ERR(SCARD_E_NO_KEY_CONTAINER)
+ SC_ERR(SCARD_E_NO_MEMORY)
+ SC_ERR(SCARD_E_NO_READERS_AVAILABLE)
+ SC_ERR(SCARD_E_NO_SERVICE)
+ SC_ERR(SCARD_E_NO_SMARTCARD)
+ SC_ERR(SCARD_E_NO_SUCH_CERTIFICATE)
+ SC_ERR(SCARD_E_NOT_READY)
+ SC_ERR(SCARD_E_NOT_TRANSACTED)
+ SC_ERR(SCARD_E_PCI_TOO_SMALL)
+ SC_ERR(SCARD_E_PROTO_MISMATCH)
+ SC_ERR(SCARD_E_READER_UNAVAILABLE)
+ SC_ERR(SCARD_E_READER_UNSUPPORTED)
+ SC_ERR(SCARD_E_SERVER_TOO_BUSY)
+ SC_ERR(SCARD_E_SERVICE_STOPPED)
+ SC_ERR(SCARD_E_SHARING_VIOLATION)
+ SC_ERR(SCARD_E_SYSTEM_CANCELLED)
+ SC_ERR(SCARD_E_TIMEOUT)
+ SC_ERR(SCARD_E_UNEXPECTED)
+ SC_ERR(SCARD_E_UNKNOWN_CARD)
+ SC_ERR(SCARD_E_UNKNOWN_READER)
+ SC_ERR(SCARD_E_UNKNOWN_RES_MNG)
+ SC_ERR(SCARD_E_UNSUPPORTED_FEATURE)
+ SC_ERR(SCARD_E_WRITE_TOO_MANY)
+ SC_ERR(SCARD_F_COMM_ERROR)
+ SC_ERR(SCARD_F_INTERNAL_ERROR)
+ SC_ERR(SCARD_F_UNKNOWN_ERROR)
+ SC_ERR(SCARD_W_CANCELLED_BY_USER)
+ SC_ERR(SCARD_W_CARD_NOT_AUTHENTICATED)
+ SC_ERR(SCARD_W_CHV_BLOCKED)
+ SC_ERR(SCARD_W_EOF)
+ SC_ERR(SCARD_W_REMOVED_CARD)
+ SC_ERR(SCARD_W_RESET_CARD)
+ SC_ERR(SCARD_W_SECURITY_VIOLATION)
+ SC_ERR(SCARD_W_UNPOWERED_CARD)
+ SC_ERR(SCARD_W_UNRESPONSIVE_CARD)
+ SC_ERR(SCARD_W_UNSUPPORTED_CARD)
+ SC_ERR(SCARD_W_WRONG_CHV)
+#undef SC_ERR
+ };
+
+ for (size_t i = 0; i < array_capacity(ErrorStrings); ++i)
+ {
+ if (ErrorStrings[i].ErrorCode == ErrorCode)
+ return ErrorStrings[i].ErrorString;
+ }
+
+ stringstream s;
+ s << "0x" << ErrorCode;
+ return s.str();
+ }
+
+#ifdef TC_HEADER_Common_Exception
+ void PCSCException::Show(HWND parent) const
+ {
+ string errorString = string(*this);
+
+ if (!errorString.empty())
+ {
+ if (!GetDictionaryValue(errorString.c_str()))
+ {
+ if (errorString.find("SCARD_E_") == 0 || errorString.find("SCARD_F_") == 0 || errorString.find("SCARD_W_") == 0)
+ {
+ errorString = errorString.substr(8);
+ for (size_t i = 0; i < errorString.size(); ++i)
+ {
+ if (errorString[i] == '_')
+ errorString[i] = ' ';
+ }
+ }
+ wchar_t err[8192];
+ StringCbPrintfW(err, sizeof(err), L"%s:\n\n%hs%s", GetString("PCSC_ERROR"), errorString.c_str());
+ ErrorDirect(err, parent);
+ }
+ else
+ {
+ wstring err = GetString(errorString.c_str());
+ ErrorDirect(err.c_str(), parent);
+ }
+ }
+ }
+#endif // TC_HEADER_Common_Exception
+
+#ifdef TC_HEADER_Platform_Exception
+
+ void PCSCException::Deserialize(shared_ptr <Stream> stream)
+ {
+ Exception::Deserialize(stream);
+ Serializer sr(stream);
+ int64 v;
+ sr.Deserialize("ErrorCode", v);
+ ErrorCode = (LONG_PCSC)v;
+ }
+
+ void PCSCException::Serialize(shared_ptr <Stream> stream) const
+ {
+ Exception::Serialize(stream);
+ Serializer sr(stream);
+ int64 v = (int64)ErrorCode;
+ sr.Serialize("ErrorCode", v);
+ }
+
+# define TC_EXCEPTION(TYPE) TC_SERIALIZER_FACTORY_ADD(TYPE)
+# undef TC_EXCEPTION_NODECL
+# define TC_EXCEPTION_NODECL(TYPE) TC_SERIALIZER_FACTORY_ADD(TYPE)
+
+ TC_SERIALIZER_FACTORY_ADD_EXCEPTION_SET(PCSCException);
+
+#endif
+
+ CommandAPDUNotValid::operator string() const
+ {
+ return string(ErrorStr);
+ }
+
+#ifdef TC_HEADER_Common_Exception
+ void CommandAPDUNotValid::Show(HWND parent) const
+ {
+ string msgBody = "Command APDU invalid.\n\n\n(If you report a bug in connection with this, please include the following technical information in the bug report:\n" + SrcPos + "\nLast Error = " + ErrorStr + ")";
+ MessageBoxA (parent, msgBody.c_str(), "VeraCrypt", MB_ICONERROR | MB_SETFOREGROUND);
+ }
+#endif // TC_HEADER_Common_Exception
+
+#ifdef TC_HEADER_Platform_Exception
+
+ void CommandAPDUNotValid::Deserialize(shared_ptr <Stream> stream)
+ {
+ Exception::Deserialize(stream);
+ Serializer sr(stream);
+ sr.Deserialize("SrcPos", SrcPos);
+ sr.Deserialize("ErrorStr", ErrorStr);
+ }
+
+ void CommandAPDUNotValid::Serialize(shared_ptr <Stream> stream) const
+ {
+ Exception::Serialize(stream);
+ Serializer sr(stream);
+ sr.Serialize("SrcPos", SrcPos);
+ sr.Serialize("ErrorStr", ErrorStr);
+ }
+
+# define TC_EXCEPTION(TYPE) TC_SERIALIZER_FACTORY_ADD(TYPE)
+# undef TC_EXCEPTION_NODECL
+# define TC_EXCEPTION_NODECL(TYPE) TC_SERIALIZER_FACTORY_ADD(TYPE)
+
+ TC_SERIALIZER_FACTORY_ADD_EXCEPTION_SET(CommandAPDUNotValid);
+
+#endif
+} \ No newline at end of file
diff --git a/src/Common/PCSCException.h b/src/Common/PCSCException.h
new file mode 100644
index 00000000..6c7766b5
--- /dev/null
+++ b/src/Common/PCSCException.h
@@ -0,0 +1,136 @@
+#ifndef TC_HEADER_Common_PCSCException
+#define TC_HEADER_Common_PCSCException
+
+#include "Platform/PlatformBase.h"
+#if defined (TC_WINDOWS) && !defined (TC_PROTOTYPE)
+# include "Exception.h"
+#else
+# include "Platform/Exception.h"
+#endif
+
+#include "SCardLoader.h"
+
+#ifdef TC_MACOSX
+#define LONG_PCSC uint32_t
+#else
+#define LONG_PCSC LONG
+#endif
+
+namespace VeraCrypt
+{
+ struct PCSCException: public Exception
+ {
+ PCSCException(LONG_PCSC errorCode = (LONG_PCSC)-1): ErrorCode(errorCode){}
+
+#ifdef TC_HEADER_Platform_Exception
+ virtual ~PCSCException() throw () { }
+ TC_SERIALIZABLE_EXCEPTION(PCSCException);
+#else
+ void Show(HWND parent) const;
+#endif
+
+ operator string () const;
+ LONG_PCSC GetErrorCode() const { return ErrorCode; }
+
+ protected:
+ LONG_PCSC ErrorCode;
+ };
+
+ struct CommandAPDUNotValid: public Exception
+ {
+ CommandAPDUNotValid() : SrcPos (""), ErrorStr ("") { }
+ CommandAPDUNotValid(const string& srcPos, const string& errorStr) : SrcPos (srcPos), ErrorStr(errorStr) { }
+
+#ifdef TC_HEADER_Platform_Exception
+ virtual ~CommandAPDUNotValid() throw () { }
+ TC_SERIALIZABLE_EXCEPTION(CommandAPDUNotValid);
+#else
+ void Show(HWND parent) const;
+#endif
+
+ operator string () const;
+
+ protected:
+ string SrcPos;
+ string ErrorStr;
+ };
+
+#ifdef TC_HEADER_Platform_Exception
+
+ #define TC_EXCEPTION(NAME) TC_EXCEPTION_DECL(NAME,Exception)
+
+ #undef TC_EXCEPTION_SET
+ #define TC_EXCEPTION_SET \
+ TC_EXCEPTION_NODECL (PCSCException); \
+ TC_EXCEPTION_NODECL (CommandAPDUNotValid); \
+ TC_EXCEPTION (ExtendedAPDUNotSupported); \
+ TC_EXCEPTION (ScardLibraryInitializationFailed); \
+ TC_EXCEPTION (EMVUnknownCardType); \
+ TC_EXCEPTION (EMVSelectAIDFailed); \
+ TC_EXCEPTION (EMVIccCertNotFound); \
+ TC_EXCEPTION (EMVIssuerCertNotFound); \
+ TC_EXCEPTION (EMVCPLCNotFound); \
+ TC_EXCEPTION (InvalidEMVPath); \
+ TC_EXCEPTION (EMVKeyfileDataNotFound); \
+ TC_EXCEPTION (EMVPANNotFound); \
+
+ TC_EXCEPTION_SET;
+
+ #undef TC_EXCEPTION
+
+#else // !TC_HEADER_Platform_Exception
+
+ struct ExtendedAPDUNotSupported: public Exception
+ {
+ void Show(HWND parent) const { Error("EXTENDED_APDU_UNSUPPORTED", parent); }
+ };
+
+ struct ScardLibraryInitializationFailed: public Exception
+ {
+ void Show(HWND parent) const { Error("SCARD_MODULE_INIT_FAILED", parent); }
+ };
+
+ struct EMVUnknownCardType: public Exception
+ {
+ void Show(HWND parent) const { Error("EMV_UNKNOWN_CARD_TYPE", parent); }
+ };
+
+ struct EMVSelectAIDFailed: public Exception
+ {
+ void Show(HWND parent) const { Error("EMV_SELECT_AID_FAILED", parent); }
+ };
+
+ struct EMVIccCertNotFound: public Exception
+ {
+ void Show(HWND parent) const { Error("EMV_ICC_CERT_NOTFOUND", parent); }
+ };
+
+ struct EMVIssuerCertNotFound: public Exception
+ {
+ void Show(HWND parent) const { Error("EMV_ISSUER_CERT_NOTFOUND", parent); }
+ };
+
+ struct EMVCPLCNotFound: public Exception
+ {
+ void Show(HWND parent) const { Error("EMV_CPLC_NOTFOUND", parent); }
+ };
+
+ struct EMVPANNotFound: public Exception
+ {
+ void Show(HWND parent) const { Error("EMV_PAN_NOTFOUND", parent); }
+ };
+
+ struct InvalidEMVPath: public Exception
+ {
+ void Show(HWND parent) const { Error("INVALID_EMV_PATH", parent); }
+ };
+
+ struct EMVKeyfileDataNotFound: public Exception
+ {
+ void Show(HWND parent) const { Error("EMV_KEYFILE_DATA_NOTFOUND", parent); }
+ };
+
+#endif // !TC_HEADER_Platform_Exception
+}
+
+#endif // TC_HEADER_Common_PCSCException \ No newline at end of file
diff --git a/src/Common/Password.c b/src/Common/Password.c
index 4caf3a21..ae6b8035 100644
--- a/src/Common/Password.c
+++ b/src/Common/Password.c
@@ -168,7 +168,7 @@ BOOL CheckPasswordLength (HWND hwndDlg, unsigned __int32 passwordLength, int pim
return TRUE;
}
-int ChangePwd (const wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5, int old_pim, BOOL truecryptMode, Password *newPassword, int pkcs5, int pim, int wipePassCount, HWND hwndDlg)
+int ChangePwd (const wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5, int old_pim, Password *newPassword, int pkcs5, int pim, int wipePassCount, HWND hwndDlg)
{
int nDosLinkCreated = 1, nStatus = ERR_OS_ERROR;
wchar_t szDiskFile[TC_MAX_PATH], szCFDevice[TC_MAX_PATH];
@@ -191,7 +191,7 @@ int ChangePwd (const wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5,
if (oldPassword->Length == 0 || newPassword->Length == 0) return -1;
- if ((wipePassCount <= 0) || (truecryptMode && (old_pkcs5 == SHA256)))
+ if (wipePassCount <= 0)
{
nStatus = ERR_PARAMETER_INCORRECT;
handleError (hwndDlg, nStatus, SRC_POS);
@@ -367,7 +367,7 @@ int ChangePwd (const wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5,
/* Try to decrypt the header */
- nStatus = ReadVolumeHeader (FALSE, buffer, oldPassword, old_pkcs5, old_pim, truecryptMode, &cryptoInfo, NULL);
+ nStatus = ReadVolumeHeader (FALSE, buffer, oldPassword, old_pkcs5, old_pim, &cryptoInfo, NULL);
if (nStatus == ERR_CIPHER_INIT_WEAK_KEY)
nStatus = 0; // We can ignore this error here
@@ -440,7 +440,7 @@ int ChangePwd (const wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5,
(volumeType == TC_VOLUME_TYPE_HIDDEN) ? cryptoInfo->hiddenVolumeSize : 0,
cryptoInfo->EncryptedAreaStart.Value,
cryptoInfo->EncryptedAreaLength.Value,
- truecryptMode? 0 : cryptoInfo->RequiredProgramVersion,
+ cryptoInfo->RequiredProgramVersion,
cryptoInfo->HeaderFlags,
cryptoInfo->SectorSize,
wipePass < wipePassCount - 1);
@@ -494,7 +494,7 @@ int ChangePwd (const wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5,
cryptoInfo->VolumeSize.Value,
cryptoInfo->EncryptedAreaStart.Value,
cryptoInfo->EncryptedAreaLength.Value,
- truecryptMode? 0 : cryptoInfo->RequiredProgramVersion,
+ cryptoInfo->RequiredProgramVersion,
cryptoInfo->HeaderFlags,
cryptoInfo->SectorSize,
wipePass < wipePassCount - 1);
diff --git a/src/Common/Password.h b/src/Common/Password.h
index 550558db..dd3fbed6 100644
--- a/src/Common/Password.h
+++ b/src/Common/Password.h
@@ -58,7 +58,7 @@ typedef struct
void VerifyPasswordAndUpdate ( HWND hwndDlg , HWND hButton , HWND hPassword , HWND hVerify , unsigned char *szPassword , char *szVerify, BOOL keyFilesEnabled );
BOOL CheckPasswordLength (HWND hwndDlg, unsigned __int32 passwordLength, int pim, BOOL bForBoot, int bootPRF, BOOL bSkipPasswordWarning, BOOL bSkipPimWarning);
BOOL CheckPasswordCharEncoding (HWND hPassword, Password *ptrPw);
-int ChangePwd (const wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5, int old_pim, BOOL truecryptMode, Password *newPassword, int pkcs5, int pim, int wipePassCount, HWND hwndDlg);
+int ChangePwd (const wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5, int old_pim, Password *newPassword, int pkcs5, int pim, int wipePassCount, HWND hwndDlg);
#endif // defined(_WIN32) && !defined(TC_WINDOWS_DRIVER) && !defined(_UEFI)
diff --git a/src/Common/Pkcs5.c b/src/Common/Pkcs5.c
index 36e491a0..d81078e8 100644
--- a/src/Common/Pkcs5.c
+++ b/src/Common/Pkcs5.c
@@ -557,7 +557,7 @@ typedef struct hmac_blake2s_ctx_struct
blake2s_state ctx;
blake2s_state inner_digest_ctx; /*pre-computed inner digest context */
blake2s_state outer_digest_ctx; /*pre-computed outer digest context */
- char k[PKCS5_SALT_SIZE + 4]; /* enough to hold (salt_len + 4) and also the SHA256 hash */
+ char k[PKCS5_SALT_SIZE + 4]; /* enough to hold (salt_len + 4) and also the Blake2s hash */
char u[BLAKE2S_DIGESTSIZE];
} hmac_blake2s_ctx;
@@ -565,7 +565,7 @@ void hmac_blake2s_internal
(
char *d, /* input data. d pointer is guaranteed to be at least 32-bytes long */
int ld, /* length of input data in bytes */
- hmac_blake2s_ctx* hmac /* HMAC-SHA256 context which holds temporary variables */
+ hmac_blake2s_ctx* hmac /* HMAC-BLAKE2S context which holds temporary variables */
)
{
blake2s_state* ctx = &(hmac->ctx);
@@ -582,7 +582,7 @@ void hmac_blake2s_internal
memcpy (ctx, &(hmac->outer_digest_ctx), sizeof (blake2s_state));
- blake2s_update (ctx, d, SHA256_DIGESTSIZE);
+ blake2s_update (ctx, d, BLAKE2S_DIGESTSIZE);
blake2s_final (ctx, (unsigned char *) d); /* d = outer digest */
}
@@ -648,7 +648,7 @@ void hmac_blake2s
for (b = 0; b < lk; ++b)
buf[b] = (char) (k[b] ^ 0x5C);
- memset (&buf[lk], 0x5C, SHA256_BLOCKSIZE - lk);
+ memset (&buf[lk], 0x5C, BLAKE2S_BLOCKSIZE - lk);
blake2s_update (ctx, (unsigned char *) buf, BLAKE2S_BLOCKSIZE);
@@ -751,7 +751,7 @@ void derive_key_blake2s (char *pwd, int pwd_len, char *salt, int salt_len, uint3
blake2s_final (&tctx, (unsigned char *) key);
pwd = key;
- pwd_len = SHA256_DIGESTSIZE;
+ pwd_len = BLAKE2S_DIGESTSIZE;
burn (&tctx, sizeof(tctx)); // Prevent leaks
}
@@ -1278,10 +1278,9 @@ wchar_t *get_pkcs5_prf_name (int pkcs5_prf_id)
-int get_pkcs5_iteration_count (int pkcs5_prf_id, int pim, BOOL truecryptMode, BOOL bBoot)
+int get_pkcs5_iteration_count (int pkcs5_prf_id, int pim, BOOL bBoot)
{
if ( (pim < 0)
- || (truecryptMode && pim > 0) /* No PIM for TrueCrypt mode */
)
{
return 0;
@@ -1291,9 +1290,7 @@ int get_pkcs5_iteration_count (int pkcs5_prf_id, int pim, BOOL truecryptMode, BO
{
case BLAKE2S:
- if (truecryptMode)
- return 0; // BLAKE2s not supported by TrueCrypt
- else if (pim == 0)
+ if (pim == 0)
return bBoot? 200000 : 500000;
else
{
@@ -1301,15 +1298,13 @@ int get_pkcs5_iteration_count (int pkcs5_prf_id, int pim, BOOL truecryptMode, BO
}
case SHA512:
- return truecryptMode? 1000 : ((pim == 0)? 500000 : 15000 + pim * 1000);
+ return ((pim == 0)? 500000 : 15000 + pim * 1000);
case WHIRLPOOL:
- return truecryptMode? 1000 : ((pim == 0)? 500000 : 15000 + pim * 1000);
+ return ((pim == 0)? 500000 : 15000 + pim * 1000);
case SHA256:
- if (truecryptMode)
- return 0; // SHA-256 not supported by TrueCrypt
- else if (pim == 0)
+ if (pim == 0)
return bBoot? 200000 : 500000;
else
{
@@ -1317,9 +1312,7 @@ int get_pkcs5_iteration_count (int pkcs5_prf_id, int pim, BOOL truecryptMode, BO
}
case STREEBOG:
- if (truecryptMode)
- return 1000;
- else if (pim == 0)
+ if (pim == 0)
return bBoot? 200000 : 500000;
else
{
@@ -1334,26 +1327,15 @@ int get_pkcs5_iteration_count (int pkcs5_prf_id, int pim, BOOL truecryptMode, BO
#endif
}
-int is_pkcs5_prf_supported (int pkcs5_prf_id, BOOL truecryptMode, PRF_BOOT_TYPE bootType)
+int is_pkcs5_prf_supported (int pkcs5_prf_id, PRF_BOOT_TYPE bootType)
{
if (pkcs5_prf_id == 0) // auto-detection always supported
return 1;
- if (truecryptMode)
- {
- if ( (bootType == PRF_BOOT_GPT)
- || (bootType == PRF_BOOT_MBR)
- || (bootType == PRF_BOOT_NO && pkcs5_prf_id != SHA512 && pkcs5_prf_id != WHIRLPOOL)
- )
- return 0;
- }
- else
- {
- if ( (bootType == PRF_BOOT_MBR && pkcs5_prf_id != BLAKE2S && pkcs5_prf_id != SHA256)
- || (bootType != PRF_BOOT_MBR && (pkcs5_prf_id < FIRST_PRF_ID || pkcs5_prf_id > LAST_PRF_ID))
- )
- return 0;
- }
+ if ( (bootType == PRF_BOOT_MBR && pkcs5_prf_id != BLAKE2S && pkcs5_prf_id != SHA256)
+ || (bootType != PRF_BOOT_MBR && (pkcs5_prf_id < FIRST_PRF_ID || pkcs5_prf_id > LAST_PRF_ID))
+ )
+ return 0;
return 1;
diff --git a/src/Common/Pkcs5.h b/src/Common/Pkcs5.h
index 4a6b6882..a9abeec5 100644
--- a/src/Common/Pkcs5.h
+++ b/src/Common/Pkcs5.h
@@ -40,7 +40,7 @@ void derive_key_whirlpool (char *pwd, int pwd_len, char *salt, int salt_len, uin
void hmac_streebog (char *k, int32 lk, char *d, int32 ld);
void derive_key_streebog (char *pwd, int pwd_len, char *salt, int salt_len, uint32 iterations, char *dk, int dklen);
-int get_pkcs5_iteration_count (int pkcs5_prf_id, int pim, BOOL truecryptMode, BOOL bBoot);
+int get_pkcs5_iteration_count (int pkcs5_prf_id, int pim, BOOL bBoot);
wchar_t *get_pkcs5_prf_name (int pkcs5_prf_id);
/* check if given PRF supported.*/
@@ -51,7 +51,7 @@ typedef enum
PRF_BOOT_GPT
} PRF_BOOT_TYPE;
-int is_pkcs5_prf_supported (int pkcs5_prf_id, BOOL truecryptMode, PRF_BOOT_TYPE bootType);
+int is_pkcs5_prf_supported (int pkcs5_prf_id, PRF_BOOT_TYPE bootType);
#endif
#if defined(__cplusplus)
diff --git a/src/Common/Random.c b/src/Common/Random.c
index fd836c7f..ee3fcf53 100644
--- a/src/Common/Random.c
+++ b/src/Common/Random.c
@@ -262,19 +262,17 @@ BOOL Randmix ()
if (bRandmixEnabled)
{
unsigned char hashOutputBuffer [MAX_DIGESTSIZE];
- WHIRLPOOL_CTX wctx;
- blake2s_state bctx;
+ #ifndef WOLFCRYPT_BACKEND
+ WHIRLPOOL_CTX wctx;
+ blake2s_state bctx;
+ STREEBOG_CTX stctx;
+ #endif
sha512_ctx sctx;
sha256_ctx s256ctx;
- STREEBOG_CTX stctx;
int poolIndex, digestIndex, digestSize;
switch (HashFunction)
{
- case BLAKE2S:
- digestSize = BLAKE2S_DIGESTSIZE;
- break;
-
case SHA512:
digestSize = SHA512_DIGESTSIZE;
break;
@@ -283,6 +281,11 @@ BOOL Randmix ()
digestSize = SHA256_DIGESTSIZE;
break;
+ #ifndef WOLFCRYPT_BACKEND
+ case BLAKE2S:
+ digestSize = BLAKE2S_DIGESTSIZE;
+ break;
+
case WHIRLPOOL:
digestSize = WHIRLPOOL_DIGESTSIZE;
break;
@@ -290,7 +293,7 @@ BOOL Randmix ()
case STREEBOG:
digestSize = STREEBOG_DIGESTSIZE;
break;
-
+ #endif
default:
TC_THROW_FATAL_EXCEPTION;
}
@@ -303,12 +306,6 @@ BOOL Randmix ()
/* Compute the message digest of the entire pool using the selected hash function. */
switch (HashFunction)
{
- case BLAKE2S:
- blake2s_init(&bctx);
- blake2s_update(&bctx, pRandPool, RNG_POOL_SIZE);
- blake2s_final(&bctx, hashOutputBuffer);
- break;
-
case SHA512:
sha512_begin (&sctx);
sha512_hash (pRandPool, RNG_POOL_SIZE, &sctx);
@@ -321,6 +318,13 @@ BOOL Randmix ()
sha256_end (hashOutputBuffer, &s256ctx);
break;
+ #ifndef WOLFCRYPT_BACKEND
+ case BLAKE2S:
+ blake2s_init(&bctx);
+ blake2s_update(&bctx, pRandPool, RNG_POOL_SIZE);
+ blake2s_final(&bctx, hashOutputBuffer);
+ break;
+
case WHIRLPOOL:
WHIRLPOOL_init (&wctx);
WHIRLPOOL_add (pRandPool, RNG_POOL_SIZE, &wctx);
@@ -332,7 +336,7 @@ BOOL Randmix ()
STREEBOG_add (&stctx, pRandPool, RNG_POOL_SIZE);
STREEBOG_finalize (&stctx, hashOutputBuffer);
break;
-
+ #endif
default:
// Unknown/wrong ID
TC_THROW_FATAL_EXCEPTION;
@@ -349,10 +353,6 @@ BOOL Randmix ()
burn (hashOutputBuffer, MAX_DIGESTSIZE);
switch (HashFunction)
{
- case BLAKE2S:
- burn (&bctx, sizeof(bctx));
- break;
-
case SHA512:
burn (&sctx, sizeof(sctx));
break;
@@ -361,6 +361,11 @@ BOOL Randmix ()
burn (&s256ctx, sizeof(s256ctx));
break;
+ #ifndef WOLFCRYPT_BACKEND
+ case BLAKE2S:
+ burn (&bctx, sizeof(bctx));
+ break;
+
case WHIRLPOOL:
burn (&wctx, sizeof(wctx));
break;
@@ -368,7 +373,7 @@ BOOL Randmix ()
case STREEBOG:
burn (&stctx, sizeof(sctx));
break;
-
+ #endif
default:
// Unknown/wrong ID
TC_THROW_FATAL_EXCEPTION;
diff --git a/src/Common/Resource.h b/src/Common/Resource.h
index a913bc26..0098542e 100644
--- a/src/Common/Resource.h
+++ b/src/Common/Resource.h
@@ -224,6 +224,10 @@
#define IDC_BENCHMARK_PREBOOT 5140
#define IDD_TEXT_EDIT_DLG 5141
#define IDC_DISABLE_MOUNT_MANAGER 5142
+#define IDC_KEYFILES_SIZE_UNIT 5143
+#define IDC_LINK_KEYFILES_EXTENSIONS_WARNING 5144
+#define IDC_DISABLE_MEMORY_PROTECTION 5145
+#define IDC_DISABLE_MEMORY_PROTECTION_HELP 5146
// Next default values for new objects
//
@@ -232,7 +236,7 @@
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 578
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 5143
+#define _APS_NEXT_CONTROL_VALUE 5147
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/src/Common/ResponseAPDU.cpp b/src/Common/ResponseAPDU.cpp
new file mode 100644
index 00000000..8a7f069c
--- /dev/null
+++ b/src/Common/ResponseAPDU.cpp
@@ -0,0 +1,111 @@
+#include "ResponseAPDU.h"
+#include <string.h>
+
+using namespace std;
+
+namespace VeraCrypt
+{
+ uint16 BytesToUInt16(const vector<byte>& buff)
+ {
+ uint16 value = 0;
+ for (uint16 i = 0; i < buff.size(); i++)
+ {
+ value <<= 8;
+ value |= (uint16)buff.at(i);
+ }
+
+ return value;
+ }
+
+ void AppendData (vector<byte>& buffer, const byte* pbData, size_t cbData)
+ {
+ size_t orgSize = buffer.size ();
+ buffer.resize (orgSize + cbData);
+ memcpy (buffer.data () + orgSize, pbData, cbData);
+ }
+
+ /*********************************************************************************/
+
+ void ResponseAPDU::clear()
+ {
+ m_data.clear();
+ m_SW = 0;
+ }
+
+ ResponseAPDU::ResponseAPDU() : m_SW(0)
+ {
+ }
+
+ ResponseAPDU::ResponseAPDU(const vector<byte>& data, uint16 SW)
+ {
+ m_data = data;
+ m_SW = SW;
+ }
+
+ uint32 ResponseAPDU::getNr()
+ {
+ return (uint32)m_data.size();
+ }
+
+ const vector<byte> ResponseAPDU::getData()
+ {
+ return m_data;
+ }
+
+ byte ResponseAPDU::getSW1()
+ {
+ return (byte)((0xFF00 & m_SW) >> 8);
+ }
+
+ byte ResponseAPDU::getSW2()
+ {
+ return (byte)(0x00FF & m_SW);
+ }
+
+ uint16 ResponseAPDU::getSW()
+ {
+ return m_SW;
+ }
+
+ const vector<byte> ResponseAPDU::getBytes()
+ {
+ vector<byte> apdu;
+
+ AppendData(apdu, m_data.data(), m_data.size());
+ apdu.push_back((byte)getSW1());
+ apdu.push_back((byte)getSW2());
+
+ return apdu;
+ }
+
+ void ResponseAPDU::appendData(const vector<byte>& data)
+ {
+ appendData(data.data(), data.size());
+ }
+
+ void ResponseAPDU::appendData(const byte* data, size_t dataLen)
+ {
+ AppendData(m_data, data, dataLen);
+ }
+
+ void ResponseAPDU::setSW(uint16 SW)
+ {
+ m_SW = SW;
+ }
+
+ void ResponseAPDU::setBytes(const vector<byte>& bytes)
+ {
+ clear();
+ if (bytes.size() >= 2)
+ {
+ vector<byte> SWBytes;
+ m_data.resize(bytes.size() - 2);
+ SWBytes.resize(2);
+
+ memcpy(m_data.data(), bytes.data(), bytes.size() - 2);
+ memcpy(SWBytes.data(), bytes.data() + bytes.size() - 2, 2);
+ m_SW = BytesToUInt16(SWBytes);
+ }
+ }
+}
+
diff --git a/src/Common/ResponseAPDU.h b/src/Common/ResponseAPDU.h
new file mode 100644
index 00000000..b9aa4adc
--- /dev/null
+++ b/src/Common/ResponseAPDU.h
@@ -0,0 +1,44 @@
+#ifndef TC_HEADER_Common_ResponseAPDU
+#define TC_HEADER_Common_ResponseAPDU
+
+#include "Platform/PlatformBase.h"
+
+namespace VeraCrypt
+{
+ class ResponseAPDU
+ {
+ protected:
+
+ vector<byte> m_data;
+
+ uint16 m_SW;
+
+ public:
+
+ void clear();
+
+ ResponseAPDU();
+
+ ResponseAPDU(const vector<byte>& data, uint16 SW);
+
+ uint32 getNr();
+
+ const vector<byte> getData();
+
+ byte getSW1();
+
+ byte getSW2();
+
+ uint16 getSW();
+
+ const vector<byte> getBytes();
+
+ void setSW(uint16 SW);
+ void setBytes(const vector<byte>& bytes);
+
+ void appendData(const vector<byte>& data);
+ void appendData(const byte* data, size_t dataLen);
+ };
+};
+
+#endif // TC_HEADER_Common_ResponseAPDU \ No newline at end of file
diff --git a/src/Common/SCard.cpp b/src/Common/SCard.cpp
new file mode 100644
index 00000000..9f8d1145
--- /dev/null
+++ b/src/Common/SCard.cpp
@@ -0,0 +1,62 @@
+#include "SCard.h"
+
+using namespace std;
+
+namespace VeraCrypt
+{
+ SCardManager SCard::manager;
+
+ SCard::SCard() : m_reader(NULL)
+ {
+ }
+
+ SCard::SCard(size_t slotId)
+ {
+ m_reader = SCard::manager.GetReader(slotId);
+ }
+
+ SCard::~SCard()
+ {
+ if (m_reader)
+ {
+ m_reader->Disconnect();
+ }
+ }
+
+ SCard::SCard(const SCard& other) : m_reader(other.m_reader)
+ {
+ }
+
+ SCard::SCard(SCard&& other) : m_reader(std::move(other.m_reader))
+ {
+ }
+
+ SCard& SCard::operator = (const SCard& other)
+ {
+ if (this != &other)
+ {
+ m_reader = other.m_reader;
+ }
+ return *this;
+ }
+
+ SCard& SCard::operator = (SCard&& other)
+ {
+ if (this != &other)
+ {
+ m_reader = std::move(other.m_reader);
+ }
+ return *this;
+ }
+
+ bool SCard::IsCardHandleValid() const
+ {
+ bool isValid = false;
+ if (m_reader)
+ {
+ isValid = m_reader->CardHandleStatus() == SCARD_S_SUCCESS;
+ }
+
+ return isValid;
+ }
+}
diff --git a/src/Common/SCard.h b/src/Common/SCard.h
new file mode 100644
index 00000000..b02f14f0
--- /dev/null
+++ b/src/Common/SCard.h
@@ -0,0 +1,27 @@
+#ifndef TC_HEADER_Common_SCard
+#define TC_HEADER_Common_SCard
+
+#include "Platform/PlatformBase.h"
+
+#include "SCardManager.h"
+
+namespace VeraCrypt
+{
+ class SCard
+ {
+ protected:
+ shared_ptr<SCardReader> m_reader;
+ public:
+ static SCardManager manager;
+ SCard();
+ SCard(size_t slotId);
+ SCard(const SCard& other);
+ SCard(SCard&& other);
+ SCard& operator = (const SCard& other);
+ SCard& operator = (SCard&& other);
+ virtual ~SCard();
+ bool IsCardHandleValid() const;
+ };
+}
+
+#endif // TC_HEADER_Common_SCard
diff --git a/src/Common/SCardLoader.cpp b/src/Common/SCardLoader.cpp
new file mode 100644
index 00000000..16026e62
--- /dev/null
+++ b/src/Common/SCardLoader.cpp
@@ -0,0 +1,402 @@
+#include "SCardLoader.h"
+#include "PCSCException.h"
+
+#ifndef TC_WINDOWS
+#include <dlfcn.h>
+#define LoadLibrary(x) dlopen(x, RTLD_NOW | RTLD_LOCAL)
+#define FreeLibrary(x) dlclose(x)
+#define GetProcAddress(x, y) dlsym(x, y)
+typedef void* HMODULE;
+#ifdef TC_MACOSX
+#if !defined(USE_SCARD_CONTROL_112)
+#define SCardControlName "SCardControl132"
+#else
+#define SCardControlName "SCardControl"
+#endif
+#else
+#define SCardControlName "SCardControl"
+#endif
+#define SCardConnectName "SCardConnect"
+#define SCardStatusName "SCardStatus"
+#define SCardGetStatusChangeName "SCardGetStatusChange"
+#define SCardListReaderGroupsName "SCardListReaderGroups"
+#define SCardListReadersName "SCardListReaders"
+#else
+#define SCardControlName "SCardControl"
+#define SCardConnectName "SCardConnectW"
+#define SCardStatusName "SCardStatusW"
+#define SCardGetStatusChangeName "SCardGetStatusChangeW"
+#define SCardListReaderGroupsName "SCardListReaderGroupsW"
+#define SCardListReadersName "SCardListReadersW"
+#endif
+
+using namespace std;
+
+namespace VeraCrypt
+{
+ HMODULE SCardLoader::hScardModule = NULL;
+ SCARDCONTEXT SCardLoader::hScardContext = 0;
+ SCardEstablishContextPtr SCardLoader::scardEstablishContext = NULL;
+ SCardReleaseContextPtr SCardLoader::scardReleaseContext = NULL;
+ SCardIsValidContextPtr SCardLoader::scardIsValidContext = NULL;
+#ifndef TC_MACOSX
+ SCardFreeMemoryPtr SCardLoader::scardFreeMemory = NULL;
+#endif
+ SCardConnectPtr SCardLoader::scardConnect = NULL;
+ SCardReconnectPtr SCardLoader::scardReconnect = NULL;
+ SCardDisconnectPtr SCardLoader::scardDisconnect = NULL;
+ SCardBeginTransactionPtr SCardLoader::scardBeginTransaction = NULL;
+ SCardEndTransactionPtr SCardLoader::scardEndTransaction = NULL;
+ SCardStatusPtr SCardLoader::scardStatus = NULL;
+ SCardGetStatusChangePtr SCardLoader::scardGetStatusChange = NULL;
+ SCardControlPtr SCardLoader::scardControl = NULL;
+ SCardTransmitPtr SCardLoader::scardTransmit = NULL;
+ SCardListReaderGroupsPtr SCardLoader::scardListReaderGroups = NULL;
+ SCardListReadersPtr SCardLoader::scardListReaders = NULL;
+ SCardCancelPtr SCardLoader::scardCancel = NULL;
+ SCardGetAttribPtr SCardLoader::scardGetAttrib = NULL;
+ SCardSetAttribPtr SCardLoader::scardSetAttrib = NULL;
+ SCARD_IO_REQUEST* SCardLoader::scardT0Pci = NULL;
+ SCARD_IO_REQUEST* SCardLoader::scardT1Pci = NULL;
+ SCARD_IO_REQUEST* SCardLoader::scardRawPci = NULL;
+ bool SCardLoader::bInitialized = false;
+
+#ifdef TC_WINDOWS
+ wstring SCardLoader::GetSCardPath()
+#else
+ string SCardLoader::GetSCardPath()
+#endif
+ {
+#ifdef TC_WINDOWS
+ wchar_t winscardPath[TC_MAX_PATH];
+ if (GetSystemDirectory(winscardPath, TC_MAX_PATH))
+ {
+ StringCbCat(winscardPath, sizeof(winscardPath), L"\\Winscard.dll");
+ }
+ else
+ StringCbCopy(winscardPath, sizeof(winscardPath), L"C:\\Windows\\System32\\Winscard.dll");
+ return winscardPath;
+#elif TC_MACOSX
+ return "/System/Library/Frameworks/PCSC.framework/PCSC";
+#else
+ string pcscPath = "";
+ FILE* pipe =
+#ifdef TC_LINUX
+ popen("ldconfig -p 2>&1", "r");
+#else
+ popen("ldconfig -r 2>&1", "r"); // FreeBSD
+#endif
+ if (pipe)
+ {
+ char buffer[128];
+ while (!feof(pipe))
+ {
+ if (fgets(buffer, 128, pipe) != NULL)
+ {
+ string line(buffer);
+ if (line.find("libpcsclite.so") != string::npos)
+ {
+ size_t pos = line.find("=>");
+ if (pos != string::npos)
+ {
+ pcscPath = line.substr(pos + 3);
+ pos = pcscPath.find_first_of(" \t\r\n");
+ if (pos != string::npos)
+ pcscPath = pcscPath.substr(0, pos);
+ break;
+ }
+ }
+ }
+ }
+ pclose(pipe);
+ }
+
+ if (pcscPath == "")
+ {
+ pcscPath = "libpcsclite.so";
+ }
+
+ return pcscPath;
+#endif
+ }
+
+ void SCardLoader::Initialize()
+ {
+ if (bInitialized)
+ return;
+
+ hScardModule = LoadLibrary(GetSCardPath().c_str());
+ if (hScardModule)
+ {
+ scardEstablishContext = (SCardEstablishContextPtr)GetProcAddress(hScardModule, "SCardEstablishContext");
+ scardReleaseContext = (SCardReleaseContextPtr)GetProcAddress(hScardModule, "SCardReleaseContext");
+ scardIsValidContext = (SCardIsValidContextPtr)GetProcAddress(hScardModule, "SCardIsValidContext");
+#ifndef TC_MACOSX
+ scardFreeMemory = (SCardFreeMemoryPtr)GetProcAddress(hScardModule, "SCardFreeMemory");
+#endif
+ scardConnect = (SCardConnectPtr)GetProcAddress(hScardModule, SCardConnectName);
+ scardReconnect = (SCardReconnectPtr)GetProcAddress(hScardModule, "SCardReconnect");
+ scardDisconnect = (SCardDisconnectPtr)GetProcAddress(hScardModule, "SCardDisconnect");
+ scardBeginTransaction = (SCardBeginTransactionPtr)GetProcAddress(hScardModule, "SCardBeginTransaction");
+ scardEndTransaction = (SCardEndTransactionPtr)GetProcAddress(hScardModule, "SCardEndTransaction");
+ scardStatus = (SCardStatusPtr)GetProcAddress(hScardModule, SCardStatusName);
+ scardGetStatusChange = (SCardGetStatusChangePtr)GetProcAddress(hScardModule, SCardGetStatusChangeName);
+ scardControl = (SCardControlPtr)GetProcAddress(hScardModule, SCardControlName);
+ scardTransmit = (SCardTransmitPtr)GetProcAddress(hScardModule, "SCardTransmit");
+ scardListReaderGroups = (SCardListReaderGroupsPtr)GetProcAddress(hScardModule, SCardListReaderGroupsName);
+ scardListReaders = (SCardListReadersPtr)GetProcAddress(hScardModule, SCardListReadersName);
+ scardCancel = (SCardCancelPtr)GetProcAddress(hScardModule, "SCardCancel");
+ scardGetAttrib = (SCardGetAttribPtr)GetProcAddress(hScardModule, "SCardGetAttrib");
+ scardSetAttrib = (SCardSetAttribPtr)GetProcAddress(hScardModule, "SCardSetAttrib");
+ scardT0Pci = (SCARD_IO_REQUEST*)GetProcAddress(hScardModule, "g_rgSCardT0Pci");
+ scardT1Pci = (SCARD_IO_REQUEST*)GetProcAddress(hScardModule, "g_rgSCardT1Pci");
+ scardRawPci = (SCARD_IO_REQUEST*)GetProcAddress(hScardModule, "g_rgSCardRawPci");
+ if (
+#ifndef TC_MACOSX
+ scardFreeMemory &&
+#endif
+ scardEstablishContext && scardReleaseContext && scardIsValidContext && scardConnect && scardReconnect && scardDisconnect &&
+ scardBeginTransaction && scardEndTransaction && scardStatus && scardGetStatusChange && scardControl && scardTransmit &&
+ scardListReaderGroups && scardListReaders && scardCancel && scardGetAttrib && scardSetAttrib && scardT0Pci && scardT1Pci && scardRawPci)
+ {
+ if (SCARD_S_SUCCESS == scardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &hScardContext))
+ {
+ bInitialized = true;
+ }
+ }
+ }
+
+ if (!bInitialized)
+ {
+ Finalize();
+ }
+ }
+
+ void SCardLoader::Finalize()
+ {
+ if (hScardContext)
+ {
+ scardReleaseContext(hScardContext);
+ hScardContext = 0;
+ }
+
+ if (hScardModule)
+ {
+ FreeLibrary(hScardModule);
+ hScardModule = NULL;
+ }
+
+ scardEstablishContext = NULL;
+ scardReleaseContext = NULL;
+ scardIsValidContext = NULL;
+#ifndef TC_MACOSX
+ scardFreeMemory = NULL;
+#endif
+ scardConnect = NULL;
+ scardReconnect = NULL;
+ scardDisconnect = NULL;
+ scardBeginTransaction = NULL;
+ scardEndTransaction = NULL;
+ scardStatus = NULL;
+ scardGetStatusChange = NULL;
+ scardControl = NULL;
+ scardTransmit = NULL;
+ scardListReaderGroups = NULL;
+ scardListReaders = NULL;
+ scardCancel = NULL;
+ scardGetAttrib = NULL;
+ scardSetAttrib = NULL;
+ scardT0Pci = NULL;
+ scardT1Pci = NULL;
+ scardRawPci = NULL;
+
+ bInitialized = false;
+ }
+
+ SCARDCONTEXT SCardLoader::GetSCardContext()
+ {
+ return hScardContext;
+ }
+
+ LONG SCardLoader::SCardEstablishContext(DWORD dwScope, LPCVOID pvReserved1, LPCVOID pvReserved2, LPSCARDCONTEXT phContext)
+ {
+ Initialize();
+
+ if (!bInitialized)
+ throw ScardLibraryInitializationFailed();
+
+ return scardEstablishContext(dwScope, pvReserved1, pvReserved2, phContext);
+ }
+
+ LONG SCardLoader::SCardReleaseContext(SCARDCONTEXT hContext)
+ {
+ Initialize();
+
+ if (!bInitialized)
+ throw ScardLibraryInitializationFailed();
+
+ return scardReleaseContext(hContext);
+ }
+
+ LONG SCardLoader::SCardIsValidContext(SCARDCONTEXT hContext)
+ {
+ Initialize();
+
+ if (!bInitialized)
+ throw ScardLibraryInitializationFailed();
+
+ return scardIsValidContext(hContext);
+ }
+
+#ifndef TC_MACOSX
+ LONG SCardLoader::SCardFreeMemory(SCARDCONTEXT hContext, LPCVOID pvMem)
+ {
+ Initialize();
+
+ if (!bInitialized)
+ throw ScardLibraryInitializationFailed();
+
+ return scardFreeMemory(hContext, pvMem);
+ }
+#endif
+
+ LONG SCardLoader::SCardConnect(SCARDCONTEXT hContext, LPCTSTR szReader, DWORD dwShareMode, DWORD dwPreferredProtocols, LPSCARDHANDLE phCard, LPDWORD pdwActiveProtocol)
+ {
+ Initialize();
+
+ if (!bInitialized)
+ throw ScardLibraryInitializationFailed();
+
+ return scardConnect(hContext, szReader, dwShareMode, dwPreferredProtocols, phCard, pdwActiveProtocol);
+ }
+
+ LONG SCardLoader::SCardReconnect(SCARDHANDLE hCard, DWORD dwShareMode, DWORD dwPreferredProtocols, DWORD dwInitialization, LPDWORD pdwActiveProtocol)
+ {
+ Initialize();
+
+ if (!bInitialized)
+ throw ScardLibraryInitializationFailed();
+
+ return scardReconnect(hCard, dwShareMode, dwPreferredProtocols, dwInitialization, pdwActiveProtocol);
+ }
+
+ LONG SCardLoader::SCardDisconnect(SCARDHANDLE hCard, DWORD dwDisposition)
+ {
+ Initialize();
+
+ if (!bInitialized)
+ throw ScardLibraryInitializationFailed();
+
+ return scardDisconnect(hCard, dwDisposition);
+ }
+
+ LONG SCardLoader::SCardBeginTransaction(SCARDHANDLE hCard)
+ {
+ Initialize();
+
+ if (!bInitialized)
+ throw ScardLibraryInitializationFailed();
+
+ return scardBeginTransaction(hCard);
+ }
+
+ LONG SCardLoader::SCardEndTransaction(SCARDHANDLE hCard, DWORD dwDisposition)
+ {
+ Initialize();
+
+ if (!bInitialized)
+ throw ScardLibraryInitializationFailed();
+
+ return scardEndTransaction(hCard, dwDisposition);
+ }
+
+ LONG SCardLoader::SCardStatus(SCARDHANDLE hCard, LPTSTR mszReaderNames, LPDWORD pcchReaderLen, LPDWORD pdwState, LPDWORD pdwProtocol, BYTE* pbAtr, LPDWORD pcbAtrLen)
+ {
+ Initialize();
+
+ if (!bInitialized)
+ throw ScardLibraryInitializationFailed();
+
+ return scardStatus(hCard, mszReaderNames, pcchReaderLen, pdwState, pdwProtocol, pbAtr, pcbAtrLen);
+ }
+
+ LONG SCardLoader::SCardGetStatusChange(SCARDCONTEXT hContext, DWORD dwTimeout, LPSCARD_READERSTATE rgReaderStates, DWORD cReaders)
+ {
+ Initialize();
+
+ if (!bInitialized)
+ throw ScardLibraryInitializationFailed();
+
+ return scardGetStatusChange(hContext, dwTimeout, rgReaderStates, cReaders);
+ }
+
+ LONG SCardLoader::SCardControl(SCARDHANDLE hCard, DWORD dwControlCode, LPCVOID pbSendBuffer, DWORD cbSendLength, LPVOID pbRecvBuffer, DWORD cbRecvLength, LPDWORD lpBytesReturned)
+ {
+ Initialize();
+
+ if (!bInitialized)
+ throw ScardLibraryInitializationFailed();
+
+ return scardControl(hCard, dwControlCode, pbSendBuffer, cbSendLength, pbRecvBuffer, cbRecvLength, lpBytesReturned);
+ }
+
+ LONG SCardLoader::SCardTransmit(SCARDHANDLE hCard, LPCSCARD_IO_REQUEST pioSendPci, const BYTE* pbSendBuffer, DWORD cbSendLength, LPSCARD_IO_REQUEST pioRecvPci, BYTE* pbRecvBuffer, LPDWORD pcbRecvLength)
+ {
+ Initialize();
+
+ if (!bInitialized)
+ throw ScardLibraryInitializationFailed();
+
+ return scardTransmit(hCard, pioSendPci, pbSendBuffer, cbSendLength, pioRecvPci, pbRecvBuffer, pcbRecvLength);
+ }
+
+ LONG SCardLoader::SCardListReaderGroups(SCARDCONTEXT hContext, LPTSTR mszGroups, LPDWORD pcchGroups)
+ {
+ Initialize();
+
+ if (!bInitialized)
+ throw ScardLibraryInitializationFailed();
+
+ return scardListReaderGroups(hContext, mszGroups, pcchGroups);
+ }
+
+ LONG SCardLoader::SCardListReaders(SCARDCONTEXT hContext, LPCTSTR mszGroups, LPTSTR mszReaders, LPDWORD pcchReaders)
+ {
+ Initialize();
+
+ if (!bInitialized)
+ throw ScardLibraryInitializationFailed();
+
+ return scardListReaders(hContext, mszGroups, mszReaders, pcchReaders);
+ }
+
+ LONG SCardLoader::SCardCancel(SCARDCONTEXT hContext)
+ {
+ Initialize();
+
+ if (!bInitialized)
+ throw ScardLibraryInitializationFailed();
+
+ return scardCancel(hContext);
+ }
+
+ LONG SCardLoader::SCardGetAttrib(SCARDHANDLE hCard, DWORD dwAttrId, BYTE* pbAttr, LPDWORD pcbAttrLen)
+ {
+ Initialize();
+
+ if (!bInitialized)
+ throw ScardLibraryInitializationFailed();
+
+ return scardGetAttrib(hCard, dwAttrId, pbAttr, pcbAttrLen);
+ }
+
+ LONG SCardLoader::SCardSetAttrib(SCARDHANDLE hCard, DWORD dwAttrId, const BYTE* pbAttr, DWORD cbAttrLen)
+ {
+ Initialize();
+
+ if (!bInitialized)
+ throw ScardLibraryInitializationFailed();
+
+ return scardSetAttrib(hCard, dwAttrId, pbAttr, cbAttrLen);
+ }
+} \ No newline at end of file
diff --git a/src/Common/SCardLoader.h b/src/Common/SCardLoader.h
new file mode 100644
index 00000000..b1ab114b
--- /dev/null
+++ b/src/Common/SCardLoader.h
@@ -0,0 +1,125 @@
+#ifndef TC_HEADER_Common_SCardLoader
+#define TC_HEADER_Common_SCardLoader
+
+#include "Platform/PlatformBase.h"
+
+#ifdef TC_WINDOWS
+#include <winscard.h>
+#include <windows.h>
+#else
+#ifdef TC_MACOSX
+#undef BOOL
+#include <PCSC/pcsclite.h>
+#include <PCSC/winscard.h>
+#include <PCSC/wintypes.h>
+#include "reader.h"
+typedef LPSCARD_READERSTATE_A LPSCARD_READERSTATE;
+using VeraCrypt::byte;
+#define BOOL int
+#else
+#undef BOOL
+#include "pcsclite.h"
+#include <winscard.h>
+#include <wintypes.h>
+#include <reader.h>
+using VeraCrypt::byte;
+#define BOOL int
+#endif
+#endif
+
+#ifndef TC_WINDOWS
+typedef void* HMODULE;
+#define SCARD_CALL_SPEC
+#else
+#define SCARD_CALL_SPEC WINAPI
+#endif
+
+namespace VeraCrypt
+{
+ typedef LONG (SCARD_CALL_SPEC *SCardEstablishContextPtr)(DWORD dwScope, LPCVOID pvReserved1, LPCVOID pvReserved2, LPSCARDCONTEXT phContext);
+ typedef LONG (SCARD_CALL_SPEC *SCardReleaseContextPtr)(SCARDCONTEXT hContext);
+ typedef LONG (SCARD_CALL_SPEC *SCardIsValidContextPtr)(SCARDCONTEXT hContext);
+#ifndef TC_MACOSX
+ typedef LONG (SCARD_CALL_SPEC *SCardFreeMemoryPtr)(SCARDCONTEXT hContext, LPCVOID pvMem);
+#endif
+ typedef LONG (SCARD_CALL_SPEC *SCardConnectPtr)(SCARDCONTEXT hContext, LPCTSTR szReader, DWORD dwShareMode, DWORD dwPreferredProtocols, LPSCARDHANDLE phCard, LPDWORD pdwActiveProtocol);
+ typedef LONG (SCARD_CALL_SPEC *SCardReconnectPtr)(SCARDHANDLE hCard, DWORD dwShareMode, DWORD dwPreferredProtocols, DWORD dwInitialization, LPDWORD pdwActiveProtocol);
+ typedef LONG (SCARD_CALL_SPEC *SCardDisconnectPtr)(SCARDHANDLE hCard, DWORD dwDisposition);
+ typedef LONG (SCARD_CALL_SPEC *SCardBeginTransactionPtr)(SCARDHANDLE hCard);
+ typedef LONG (SCARD_CALL_SPEC *SCardEndTransactionPtr)(SCARDHANDLE hCard, DWORD dwDisposition);
+ typedef LONG (SCARD_CALL_SPEC *SCardStatusPtr)(SCARDHANDLE hCard, LPTSTR mszReaderNames, LPDWORD pcchReaderLen, LPDWORD pdwState, LPDWORD pdwProtocol, BYTE* pbAtr, LPDWORD pcbAtrLen);
+ typedef LONG (SCARD_CALL_SPEC *SCardGetStatusChangePtr)(SCARDCONTEXT hContext, DWORD dwTimeout, LPSCARD_READERSTATE rgReaderStates, DWORD cReaders);
+ typedef LONG (SCARD_CALL_SPEC *SCardControlPtr)(SCARDHANDLE hCard, DWORD dwControlCode, LPCVOID pbSendBuffer, DWORD cbSendLength, LPVOID pbRecvBuffer, DWORD cbRecvLength, LPDWORD lpBytesReturned);
+ typedef LONG (SCARD_CALL_SPEC *SCardTransmitPtr)(SCARDHANDLE hCard, LPCSCARD_IO_REQUEST pioSendPci, const BYTE* pbSendBuffer, DWORD cbSendLength, LPSCARD_IO_REQUEST pioRecvPci, BYTE* pbRecvBuffer, LPDWORD pcbRecvLength);
+ typedef LONG (SCARD_CALL_SPEC *SCardListReaderGroupsPtr)(SCARDCONTEXT hContext, LPTSTR mszGroups, LPDWORD pcchGroups);
+ typedef LONG (SCARD_CALL_SPEC *SCardListReadersPtr)(SCARDCONTEXT hContext, LPCTSTR mszGroups, LPTSTR mszReaders, LPDWORD pcchReaders);
+ typedef LONG (SCARD_CALL_SPEC *SCardCancelPtr)(SCARDCONTEXT hContext);
+ typedef LONG (SCARD_CALL_SPEC *SCardGetAttribPtr)(SCARDHANDLE hCard, DWORD dwAttrId, BYTE* pbAttr, LPDWORD pcbAttrLen);
+ typedef LONG (SCARD_CALL_SPEC *SCardSetAttribPtr)(SCARDHANDLE hCard, DWORD dwAttrId, const BYTE* pbAttr, DWORD cbAttrLen);
+
+ class SCardLoader
+ {
+ protected:
+ static HMODULE hScardModule;
+ static SCARDCONTEXT hScardContext;
+ static SCardEstablishContextPtr scardEstablishContext;
+ static SCardReleaseContextPtr scardReleaseContext;
+ static SCardIsValidContextPtr scardIsValidContext;
+#ifndef TC_MACOSX
+ static SCardFreeMemoryPtr scardFreeMemory;
+#endif
+ static SCardConnectPtr scardConnect;
+ static SCardReconnectPtr scardReconnect;
+ static SCardDisconnectPtr scardDisconnect;
+ static SCardBeginTransactionPtr scardBeginTransaction;
+ static SCardEndTransactionPtr scardEndTransaction;
+ static SCardStatusPtr scardStatus;
+ static SCardGetStatusChangePtr scardGetStatusChange;
+ static SCardControlPtr scardControl;
+ static SCardTransmitPtr scardTransmit;
+ static SCardListReaderGroupsPtr scardListReaderGroups;
+ static SCardListReadersPtr scardListReaders;
+ static SCardCancelPtr scardCancel;
+ static SCardGetAttribPtr scardGetAttrib;
+ static SCardSetAttribPtr scardSetAttrib;
+ static bool bInitialized;
+
+ public:
+ static SCARD_IO_REQUEST* scardT0Pci;
+ static SCARD_IO_REQUEST* scardT1Pci;
+ static SCARD_IO_REQUEST* scardRawPci;
+
+ SCardLoader() { };
+ static void Initialize();
+ static void Finalize();
+#ifdef TC_WINDOWS
+ static wstring GetSCardPath();
+#else
+ static string GetSCardPath();
+#endif
+ static SCARDCONTEXT GetSCardContext();
+
+ static LONG SCardEstablishContext(DWORD dwScope, LPCVOID pvReserved1, LPCVOID pvReserved2, LPSCARDCONTEXT phContext);
+ static LONG SCardReleaseContext(SCARDCONTEXT hContext);
+ static LONG SCardIsValidContext(SCARDCONTEXT hContext);
+#ifndef TC_MACOSX
+ static LONG SCardFreeMemory(SCARDCONTEXT hContext, LPCVOID pvMem);
+#endif
+ static LONG SCardConnect(SCARDCONTEXT hContext, LPCTSTR szReader, DWORD dwShareMode, DWORD dwPreferredProtocols, LPSCARDHANDLE phCard, LPDWORD pdwActiveProtocol);
+ static LONG SCardReconnect(SCARDHANDLE hCard, DWORD dwShareMode, DWORD dwPreferredProtocols, DWORD dwInitialization, LPDWORD pdwActiveProtocol);
+ static LONG SCardDisconnect(SCARDHANDLE hCard, DWORD dwDisposition);
+ static LONG SCardBeginTransaction(SCARDHANDLE hCard);
+ static LONG SCardEndTransaction(SCARDHANDLE hCard, DWORD dwDisposition);
+ static LONG SCardStatus(SCARDHANDLE hCard, LPTSTR mszReaderNames, LPDWORD pcchReaderLen, LPDWORD pdwState, LPDWORD pdwProtocol, BYTE* pbAtr, LPDWORD pcbAtrLen);
+ static LONG SCardGetStatusChange(SCARDCONTEXT hContext, DWORD dwTimeout, LPSCARD_READERSTATE rgReaderStates, DWORD cReaders);
+ static LONG SCardControl(SCARDHANDLE hCard, DWORD dwControlCode, LPCVOID pbSendBuffer, DWORD cbSendLength, LPVOID pbRecvBuffer, DWORD cbRecvLength, LPDWORD lpBytesReturned);
+ static LONG SCardTransmit(SCARDHANDLE hCard, LPCSCARD_IO_REQUEST pioSendPci, const BYTE* pbSendBuffer, DWORD cbSendLength, LPSCARD_IO_REQUEST pioRecvPci, BYTE* pbRecvBuffer, LPDWORD pcbRecvLength);
+ static LONG SCardListReaderGroups(SCARDCONTEXT hContext, LPTSTR mszGroups, LPDWORD pcchGroups);
+ static LONG SCardListReaders(SCARDCONTEXT hContext, LPCTSTR mszGroups, LPTSTR mszReaders, LPDWORD pcchReaders);
+ static LONG SCardCancel(SCARDCONTEXT hContext);
+ static LONG SCardGetAttrib(SCARDHANDLE hCard, DWORD dwAttrId, BYTE* pbAttr, LPDWORD pcbAttrLen);
+ static LONG SCardSetAttrib(SCARDHANDLE hCard, DWORD dwAttrId, const BYTE* pbAttr, DWORD cbAttrLen);
+ };
+};
+
+#endif // TC_HEADER_Common_SCardLoader \ No newline at end of file
diff --git a/src/Common/SCardManager.cpp b/src/Common/SCardManager.cpp
new file mode 100644
index 00000000..40578d39
--- /dev/null
+++ b/src/Common/SCardManager.cpp
@@ -0,0 +1,109 @@
+#include "SCardManager.h"
+#include "PCSCException.h"
+
+namespace VeraCrypt
+{
+ shared_ptr<SCardLoader> SCardManager::loader = make_shared<SCardLoader>();
+
+ SCardManager::SCardManager()
+ {
+ loader->Initialize();
+ }
+
+ SCardManager::~SCardManager()
+ {
+ loader->Finalize();
+ }
+
+ vector<wstring> SCardManager::GetReaders()
+ {
+ vector<wstring> readers;
+ LPTSTR mszReaders = NULL;
+ LPTSTR ptr = NULL;
+ DWORD dwReaders = 0;
+ SCARDCONTEXT hScardContext = 0;
+ LONG lRet = SCARD_S_SUCCESS;
+
+ hScardContext = loader->GetSCardContext();
+ lRet = loader->SCardIsValidContext(hScardContext);
+ if (SCARD_S_SUCCESS != lRet)
+ {
+ loader->SCardReleaseContext(hScardContext);
+ lRet = loader->SCardEstablishContext(SCARD_SCOPE_USER, NULL, NULL, &hScardContext);
+ if (lRet != SCARD_S_SUCCESS)
+ throw PCSCException(lRet);
+ }
+
+#ifdef SCARD_AUTOALLOCATE
+ dwReaders = SCARD_AUTOALLOCATE;
+ lRet = loader->SCardListReaders(hScardContext, NULL, (LPTSTR)&mszReaders, &dwReaders);
+#else
+ lRet = loader->SCardListReaders(hScardContext, NULL, NULL, &dwReaders);
+ if (lRet == SCARD_S_SUCCESS)
+ {
+ mszReaders = (LPTSTR)calloc(dwReaders, sizeof(char));
+ lRet = loader->SCardListReaders(hScardContext, NULL, mszReaders, &dwReaders);
+ }
+#endif
+
+ if (lRet == SCARD_S_SUCCESS && !mszReaders)
+ {
+ lRet = SCARD_E_NO_READERS_AVAILABLE;
+ }
+ if (lRet == SCARD_E_NO_READERS_AVAILABLE)
+ {
+ readers.clear();
+ lRet = SCARD_S_SUCCESS;
+ }
+
+ if (lRet == SCARD_S_SUCCESS && mszReaders)
+ {
+ ptr = mszReaders;
+ while (*ptr)
+ {
+#ifdef TC_WINDOWS
+ readers.push_back(ptr);
+#else
+ readers.push_back(StringConverter::ToWide(ptr));
+#endif
+ ptr +=
+#ifdef TC_WINDOWS
+ wcslen(ptr) + 1;
+#else
+ strlen(ptr) + 1;
+#endif
+ }
+
+#ifdef SCARD_AUTOALLOCATE
+ loader->SCardFreeMemory(hScardContext, mszReaders);
+#else
+ free(mszReaders);
+#endif
+ }
+
+ if (lRet != SCARD_S_SUCCESS)
+ throw PCSCException(lRet);
+
+ return readers;
+ }
+
+ shared_ptr<SCardReader> SCardManager::GetReader(size_t readerNumber)
+ {
+ vector<wstring> readers;
+ shared_ptr<SCardReader> smartCardReader;
+
+ loader->Initialize();
+
+ readers = GetReaders();
+ if (readerNumber < readers.size())
+ {
+ smartCardReader = make_shared<SCardReader>(readers[readerNumber], loader);
+ if (smartCardReader)
+ {
+ return smartCardReader;
+ }
+ }
+
+ throw InvalidEMVPath();
+ }
+} \ No newline at end of file
diff --git a/src/Common/SCardManager.h b/src/Common/SCardManager.h
new file mode 100644
index 00000000..94a58cb7
--- /dev/null
+++ b/src/Common/SCardManager.h
@@ -0,0 +1,21 @@
+#ifndef TC_HEADER_Common_SCardManager
+#define TC_HEADER_Common_SCardManager
+
+#include "Platform/PlatformBase.h"
+#include "SCardReader.h"
+
+namespace VeraCrypt
+{
+ class SCardManager
+ {
+ protected:
+ static shared_ptr<SCardLoader> loader;
+ public:
+ SCardManager();
+ virtual ~SCardManager();
+ static vector<wstring> GetReaders();
+ static shared_ptr<SCardReader> GetReader(size_t readerNumber);
+ };
+};
+
+#endif // TC_HEADER_Common_SCardManager \ No newline at end of file
diff --git a/src/Common/SCardReader.cpp b/src/Common/SCardReader.cpp
new file mode 100644
index 00000000..3a762415
--- /dev/null
+++ b/src/Common/SCardReader.cpp
@@ -0,0 +1,681 @@
+#include "SCardReader.h"
+#include "PCSCException.h"
+
+#include <locale>
+
+using namespace std;
+
+namespace VeraCrypt
+{
+ void SCardReader::Init(const wstring& szSCReaderName, const shared_ptr<SCardLoader> scardLoader, const SCARDHANDLE& hCard, const DWORD& dwProtocol, LPCSCARD_IO_REQUEST pIO_Protocol)
+ {
+ m_szSCReaderName = szSCReaderName;
+ if (scardLoader)
+ {
+ m_scardLoader = scardLoader;
+ m_hSCReaderContext = m_scardLoader->GetSCardContext();
+ }
+ else
+ {
+ m_scardLoader = NULL;
+ m_hSCReaderContext = 0;
+ }
+ m_hCard = hCard;
+ m_dwProtocol = dwProtocol;
+ m_pIO_Protocol = pIO_Protocol;
+ }
+
+ SCardReader::SCardReader(const wstring &szName, const shared_ptr<SCardLoader> scardLoader)
+ {
+ Init(szName, scardLoader, 0, 0, NULL);
+ }
+
+ SCardReader::SCardReader(const SCardReader& other)
+ : m_szSCReaderName(other.m_szSCReaderName),
+ m_scardLoader(other.m_scardLoader),
+ m_hSCReaderContext(other.m_hSCReaderContext),
+ m_hCard(other.m_hCard),
+ m_dwProtocol(other.m_dwProtocol),
+ m_pIO_Protocol(other.m_pIO_Protocol)
+ {
+ }
+
+ SCardReader::SCardReader(SCardReader&& other)
+ : m_szSCReaderName(other.m_szSCReaderName),
+ m_scardLoader(other.m_scardLoader),
+ m_hSCReaderContext(other.m_hSCReaderContext),
+ m_hCard(other.m_hCard),
+ m_dwProtocol(other.m_dwProtocol),
+ m_pIO_Protocol(other.m_pIO_Protocol)
+ {
+ other.Clear();
+ }
+
+ SCardReader& SCardReader::operator=(const SCardReader& other)
+ {
+ if (this != &other)
+ {
+ m_szSCReaderName = other.m_szSCReaderName;
+ m_scardLoader = other.m_scardLoader;
+ m_hSCReaderContext = other.m_hSCReaderContext;
+ m_hCard = other.m_hCard;
+ m_dwProtocol = other.m_dwProtocol;
+ m_pIO_Protocol = other.m_pIO_Protocol;
+ }
+ return *this;
+ }
+
+ SCardReader& SCardReader::operator=(SCardReader&& other)
+ {
+ if (this != &other)
+ {
+ m_szSCReaderName = other.m_szSCReaderName;
+ m_scardLoader = other.m_scardLoader;
+ m_hSCReaderContext = other.m_hSCReaderContext;
+ m_hCard = other.m_hCard;
+ m_dwProtocol = other.m_dwProtocol;
+ m_pIO_Protocol = other.m_pIO_Protocol;
+
+ other.Clear();
+ }
+ return *this;
+ }
+
+ void SCardReader::Clear(void)
+ {
+ m_szSCReaderName = L"";
+ m_scardLoader = NULL;
+ m_hSCReaderContext = 0;
+ m_hCard = 0;
+ m_dwProtocol = 0;
+ m_pIO_Protocol = NULL;
+ }
+
+ SCardReader::~SCardReader()
+ {
+ Clear();
+ }
+
+ const wstring SCardReader::GetNameWide() const
+ {
+ return m_szSCReaderName;
+ }
+
+ const string SCardReader::GetName() const
+ {
+ string name = "";
+ size_t size = wcstombs(NULL, m_szSCReaderName.c_str(), 0) + 1;
+ if (size)
+ {
+ name.resize(size);
+ size = wcstombs(&name[0], m_szSCReaderName.c_str(), size);
+ if (size)
+ {
+ name.resize(size);
+ }
+ }
+ return name;
+ }
+
+ bool SCardReader::IsCardPresent(vector<byte>& cardAtr)
+ {
+ LONG lRet = SCARD_S_SUCCESS;
+ SCARD_READERSTATE state;
+ bool bIsCardPresent = false;
+#ifdef TC_WINDOWS
+ wstring readerName = GetNameWide();
+#else
+ string readerName = GetName();
+#endif
+
+ if (!m_scardLoader)
+ throw ScardLibraryInitializationFailed();
+
+ cardAtr.clear();
+ burn(&state, sizeof(SCARD_READERSTATE));
+ state.szReader = readerName.c_str();
+
+ lRet = m_scardLoader->SCardIsValidContext(m_hSCReaderContext);
+ if (SCARD_S_SUCCESS != lRet)
+ {
+ m_scardLoader->SCardReleaseContext(m_hSCReaderContext);
+ lRet = m_scardLoader->SCardEstablishContext(SCARD_SCOPE_USER, NULL, NULL, &m_hSCReaderContext);
+ if (lRet != SCARD_S_SUCCESS)
+ throw PCSCException(lRet);
+ }
+
+ lRet = m_scardLoader->SCardGetStatusChange(m_hSCReaderContext, 0, &state, 1);
+ if (lRet == SCARD_S_SUCCESS)
+ {
+ if ((state.dwEventState & SCARD_STATE_PRESENT) == SCARD_STATE_PRESENT && (state.dwEventState & SCARD_STATE_MUTE) == 0)
+ {
+ cardAtr.resize(state.cbAtr, 0);
+ memcpy(cardAtr.data(), state.rgbAtr, state.cbAtr);
+ bIsCardPresent = true;
+ burn(&state, sizeof(SCARD_READERSTATE));
+ }
+ }
+ else
+ {
+ throw PCSCException(lRet);
+ }
+
+ return bIsCardPresent;
+ }
+
+ bool SCardReader::IsCardPresent()
+ {
+ vector<byte> dummy;
+ return IsCardPresent(dummy);
+ }
+
+ LONG SCardReader::CardHandleStatus()
+ {
+ LONG lRet = SCARD_E_INVALID_HANDLE;
+
+ if (!m_scardLoader)
+ throw ScardLibraryInitializationFailed();
+
+ if (m_hCard != 0)
+ {
+#ifdef TC_WINDOWS
+ wchar_t
+#else
+ char
+#endif
+ szName[TC_MAX_PATH] = {};
+ BYTE pbAtr[36] = {};
+ DWORD dwState, dwProtocol, dwNameLen = TC_MAX_PATH, dwAtrLen = 36;
+ lRet = m_scardLoader->SCardStatus(m_hCard, szName, &dwNameLen, &dwState, &dwProtocol, pbAtr, &dwAtrLen);
+ }
+
+ return lRet;
+ }
+
+ void SCardReader::Connect(DWORD dwProtocolToUse, bool& bHasBeenReset, bool resetAfterConnect)
+ {
+ LONG lRet = SCARD_S_SUCCESS;
+ bHasBeenReset = false;
+#ifdef TC_WINDOWS
+ wstring readerName = GetNameWide();
+#else
+ string readerName = GetName();
+#endif
+
+ if (!m_scardLoader)
+ throw ScardLibraryInitializationFailed();
+
+ lRet = m_scardLoader->SCardIsValidContext(m_hSCReaderContext);
+ if (SCARD_S_SUCCESS != lRet)
+ {
+ m_scardLoader->SCardReleaseContext(m_hSCReaderContext);
+ lRet = m_scardLoader->SCardEstablishContext(SCARD_SCOPE_USER, NULL, NULL, &m_hSCReaderContext);
+ if (lRet != SCARD_S_SUCCESS)
+ throw PCSCException(lRet);
+ }
+
+ if (m_hCard != 0)
+ {
+ lRet = CardHandleStatus();
+ if (lRet == SCARD_W_RESET_CARD)
+ {
+ bHasBeenReset = true;
+ lRet = m_scardLoader->SCardReconnect(
+ m_hCard,
+ SCARD_SHARE_SHARED,
+ dwProtocolToUse,
+ SCARD_LEAVE_CARD,
+ &m_dwProtocol);
+ if (lRet != SCARD_S_SUCCESS)
+ {
+ throw PCSCException(lRet);
+ }
+ }
+ else if (lRet != SCARD_S_SUCCESS)
+ {
+ // Card handle is invalid, disconnect and reconnect.
+ Disconnect();
+ }
+ }
+
+ if (m_hCard == 0)
+ {
+ lRet = m_scardLoader->SCardConnect(
+ m_hSCReaderContext,
+ readerName.c_str(),
+ SCARD_SHARE_SHARED,
+ dwProtocolToUse,
+ &m_hCard,
+ &m_dwProtocol);
+ if (lRet != SCARD_S_SUCCESS)
+ {
+ throw PCSCException(lRet);
+ }
+ }
+
+ if (m_pIO_Protocol == NULL)
+ {
+ if (m_dwProtocol == SCARD_PROTOCOL_T0)
+ {
+ m_pIO_Protocol = m_scardLoader->scardT0Pci;
+ }
+ else if (m_dwProtocol == SCARD_PROTOCOL_T1)
+ {
+ m_pIO_Protocol = m_scardLoader->scardT1Pci;
+ }
+ else if (m_dwProtocol == SCARD_PROTOCOL_RAW)
+ {
+ m_pIO_Protocol = m_scardLoader->scardRawPci;
+ }
+ else
+ {
+ lRet = SCARD_E_INVALID_PARAMETER;
+ Disconnect();
+ throw PCSCException(lRet);
+ }
+ }
+
+ if (resetAfterConnect)
+ {
+ lRet = m_scardLoader->SCardReconnect(
+ m_hCard,
+ SCARD_SHARE_SHARED,
+ m_dwProtocol,
+ SCARD_RESET_CARD,
+ &m_dwProtocol);
+
+ if (lRet != SCARD_S_SUCCESS)
+ {
+ Disconnect();
+ throw PCSCException(lRet);
+ }
+ }
+ }
+
+ bool SCardReader::IsConnected()
+ {
+ return m_hCard != 0;
+ }
+
+ void SCardReader::Disconnect() const
+ {
+ if (!m_scardLoader)
+ throw ScardLibraryInitializationFailed();
+
+ if (m_hCard != 0)
+ {
+ m_scardLoader->SCardDisconnect(m_hCard, SCARD_LEAVE_CARD);
+ m_dwProtocol = 0;
+ m_hCard = 0;
+ m_pIO_Protocol = NULL;
+ }
+ }
+
+ LONG SCardReader::SendAPDU(LPCBYTE pbSendBuffer, DWORD cbSendLength, LPBYTE pbRecvBuffer, LPDWORD pcbRecvLength, uint16& SW) const
+ {
+ if (!m_scardLoader)
+ throw ScardLibraryInitializationFailed();
+
+ LONG lRet = m_scardLoader->SCardTransmit(m_hCard, m_pIO_Protocol, pbSendBuffer, cbSendLength, NULL, pbRecvBuffer, pcbRecvLength);
+
+ if (SCARD_S_SUCCESS == lRet)
+ {
+ if (*pcbRecvLength < 2) // must be at least = 2 (SW)
+ {
+ lRet = SCARD_E_UNEXPECTED;
+ }
+ else
+ {
+ SW = (pbRecvBuffer[*pcbRecvLength - 2] << 8) | pbRecvBuffer[*pcbRecvLength - 1];
+ *pcbRecvLength -= 2;
+ }
+ }
+
+ return lRet;
+ }
+
+ void SCardReader::BeginTransaction()
+ {
+ LONG lRet = 0;
+
+ if (!m_scardLoader)
+ throw ScardLibraryInitializationFailed();
+
+ if (m_hCard != 0)
+ {
+#ifndef _DEBUG
+ lRet = m_scardLoader->SCardBeginTransaction(m_hCard);
+ if (lRet != SCARD_S_SUCCESS)
+ {
+ throw PCSCException(lRet);
+ }
+#else
+ lRet = SCARD_S_SUCCESS;
+#endif
+ }
+ else
+ {
+ lRet = SCARD_E_INVALID_HANDLE;
+ throw PCSCException(lRet);
+ }
+ }
+
+ void SCardReader::EndTransaction()
+ {
+ LONG lRet = 0;
+
+ if (!m_scardLoader)
+ throw ScardLibraryInitializationFailed();
+
+ if (m_hCard != 0)
+ {
+#ifndef _DEBUG
+ lRet = m_scardLoader->SCardEndTransaction(m_hCard, SCARD_LEAVE_CARD);
+ if (lRet != SCARD_S_SUCCESS)
+ {
+ throw PCSCException(lRet);
+ }
+#endif
+ lRet = SCARD_S_SUCCESS;
+ }
+ else
+ {
+ lRet = SCARD_E_INVALID_HANDLE;
+ throw PCSCException(lRet);
+ }
+ }
+
+ void SCardReader::ApduProcessData(CommandAPDU commandAPDU, ResponseAPDU& responseAPDU) const
+ {
+ LONG lRet = 0;
+ uint16 SW = 0;
+
+ uint32 nc = 0, ne = 0;
+
+ bool expectingResponse = false;
+ bool useExtendedAPDU = false;
+
+ size_t indexOfLe = 0;
+ size_t indexOfLcData = 0;
+
+ vector<byte> pbSendBuffer;
+ vector<byte> pbRecvBuffer;
+ DWORD cbSendLength = 0;
+ DWORD cbRecvLength = 0;
+
+ responseAPDU.clear();
+
+ if (!commandAPDU.isValid())
+ {
+ throw CommandAPDUNotValid(SRC_POS, commandAPDU.getErrorStr());
+ }
+
+ // See whether the CommandAPDU is extended or not
+ useExtendedAPDU = commandAPDU.isExtended();
+
+ // If T != 1, cannot use Extended-APDU
+ if (m_dwProtocol != SCARD_PROTOCOL_T1 && useExtendedAPDU)
+ {
+ throw ExtendedAPDUNotSupported();
+ }
+
+ // Set some needed vars
+ nc = commandAPDU.getNc();
+ ne = commandAPDU.getNe();
+ pbSendBuffer.resize(useExtendedAPDU ? extendedAPDUMaxSendSize : shortAPDUMaxSendSize, 0);
+ pbRecvBuffer.resize(useExtendedAPDU ? extendedAPDUMaxRecvSize : shortAPDUMaxRecvSize, 0);
+ cbRecvLength = (DWORD)pbRecvBuffer.size();
+
+ if (nc > (useExtendedAPDU ? extendedAPDUMaxTransSize : shortAPDUMaxTransSize) - 1) // Max = 255 or 65535
+ {
+ std::string errStr = vformat("Nc > %d", (useExtendedAPDU ? extendedAPDUMaxTransSize : shortAPDUMaxTransSize) - 1);
+ throw CommandAPDUNotValid(SRC_POS, commandAPDU.getErrorStr());
+ }
+ if (ne > (useExtendedAPDU ? extendedAPDUMaxTransSize : shortAPDUMaxTransSize)) // Max = 256 or 65536
+ {
+ std::string errStr = vformat("Ne > %d", (useExtendedAPDU ? extendedAPDUMaxTransSize : shortAPDUMaxTransSize) - 1);
+ throw CommandAPDUNotValid(SRC_POS, commandAPDU.getErrorStr());
+ }
+
+ // Create and populate buffer to send to card
+ pbSendBuffer[0] = commandAPDU.getCLA();
+ pbSendBuffer[1] = commandAPDU.getINS();
+ pbSendBuffer[2] = commandAPDU.getP1();
+ pbSendBuffer[3] = commandAPDU.getP2();
+ if (nc == 0)
+ {
+ if (ne == 0)
+ {
+ // case 1
+ cbSendLength = 4;
+ }
+ else
+ {
+ expectingResponse = true;
+
+ // case 2s or 2e
+ if (ne <= 256)
+ {
+ // case 2s
+ // 256 is encoded as 0x00
+ pbSendBuffer[4] = (BYTE)ne;
+ indexOfLe = 4;
+ cbSendLength = 4 + 1; // header || Le (1 byte)
+ }
+ else
+ {
+ // case 2e
+ // 65536 is encoded as 0x00 0x00 0x00
+ BYTE l1, l2;
+ if (ne == 65536)
+ {
+ l1 = 0;
+ l2 = 0;
+ }
+ else
+ {
+ l1 = (BYTE)(ne >> 8);
+ l2 = (BYTE)ne;
+ }
+ pbSendBuffer[4] = 0x00;
+ pbSendBuffer[5] = l1;
+ pbSendBuffer[6] = l2;
+ cbSendLength = 4 + 3; // header || Le (3 bytes)
+ }
+ }
+ }
+ else
+ {
+ if (ne == 0)
+ {
+ // case 3s or 3e
+ if (nc <= 255)
+ {
+ // case 3s
+ pbSendBuffer[4] = (BYTE)nc;
+ indexOfLcData = 5;
+ cbSendLength = 4 + 1 + nc; // header || Lc (1 byte) || Data
+ memcpy(&pbSendBuffer[indexOfLcData], commandAPDU.getData().data(), nc);
+ }
+ else
+ {
+ // case 3e
+ pbSendBuffer[4] = 0;
+ pbSendBuffer[5] = (BYTE)(nc >> 8);
+ pbSendBuffer[6] = (BYTE)nc;
+ indexOfLcData = 7;
+ cbSendLength = 4 + 3 + nc; // header || Lc (3 bytes) || Data
+ memcpy(&pbSendBuffer[indexOfLcData], commandAPDU.getData().data(), nc);
+ }
+ }
+ else
+ {
+ expectingResponse = true;
+
+ // case 4s or 4e
+ if ((nc <= 255) && (ne <= 256))
+ {
+ // case 4s
+ pbSendBuffer[4] = (BYTE)nc;
+ indexOfLcData = 5;
+ cbSendLength = 4 + 1 + nc + 1; // header || Lc (1 byte) || Data || Le (1 byte)
+ memcpy(&pbSendBuffer[indexOfLcData], commandAPDU.getData().data(), nc);
+ pbSendBuffer[indexOfLcData + nc] = (ne != 256) ? (BYTE)ne : 0;
+ indexOfLe = indexOfLcData + nc;
+ }
+ else
+ {
+ // case 4e
+ pbSendBuffer[4] = 0;
+ pbSendBuffer[5] = (BYTE)(nc >> 8);
+ pbSendBuffer[6] = (BYTE)nc;
+ indexOfLcData = 7;
+ cbSendLength = 4 + 3 + nc + 2; // header || Lc (3 bytes) || Data || Le (2 bytes)
+ memcpy(&pbSendBuffer[indexOfLcData], commandAPDU.getData().data(), nc);
+ if (ne != 65536)
+ {
+ size_t leOfs = cbSendLength - 2;
+ pbSendBuffer[leOfs] = (BYTE)(ne >> 8);
+ pbSendBuffer[leOfs + 1] = (BYTE)ne;
+ }// 65536 is 0x00 0x00 and the buffer has already been initialized with 0s
+ }
+ }
+ }
+ cbRecvLength = (DWORD)pbRecvBuffer.size();
+ lRet = SendAPDU(pbSendBuffer.data(), cbSendLength, pbRecvBuffer.data(), &cbRecvLength, SW);
+ if (lRet != SCARD_S_SUCCESS)
+ {
+ responseAPDU.setSW(SW);
+ goto end;
+ }
+
+ // If Expecting Response
+ if (expectingResponse)
+ {
+ // If Short-APDU
+ if (!useExtendedAPDU)
+ {
+ // If SW != 0x9000
+ if (SW != SW_NO_ERROR)
+ {
+ // If SW == 0x6CXX => Le larger than actual available data on ICC, SW2 contains the appropriate value
+ if ((BYTE)(SW >> 8) == (BYTE)(SW_CORRECT_LENGTH_00 >> 8)) // 0x6C
+ {
+ pbSendBuffer[indexOfLe] = (BYTE)(SW & 0x00FF);
+ cbRecvLength = (DWORD)pbRecvBuffer.size();
+ lRet = SendAPDU(pbSendBuffer.data(), cbSendLength, pbRecvBuffer.data(), &cbRecvLength, SW);
+
+ if (lRet != SCARD_S_SUCCESS)
+ {
+ responseAPDU.setSW(SW);
+ goto end;
+ }
+ }
+
+ // If SW != 0x61XX (GET RESPONSE REMAINING BYTES) => there was an unexpected error
+ if (SW != SW_NO_ERROR && ((BYTE)(SW >> 8) != (BYTE)(SW_BYTES_REMAINING_00 >> 8))) // 0x61
+ {
+ responseAPDU.setSW(SW);
+ goto end;
+ }
+ }
+
+ // Get response data from APDU Response
+ // Response might be complete (1 APDU, <= 256 bytes : SW = 0x9000) or needs a Get Response to get the rest (1st APDU, == 256 bytes, SW = 0x61XX)
+ if (cbRecvLength)
+ responseAPDU.appendData(pbRecvBuffer.data(), cbRecvLength);
+
+ // Send get response to get the rest as long as we receive SW == 0x61XX
+ // In case of PACE, this is never the case
+ while ((lRet == SCARD_S_SUCCESS) && ((BYTE)(SW >> 8) == (BYTE)(SW_BYTES_REMAINING_00 >> 8))) // 0x61
+ {
+ // GET RESPONSE APDU
+ pbSendBuffer[0] = commandAPDU.getCLA();
+ pbSendBuffer[1] = INS_GET_RESPONSE;
+ pbSendBuffer[2] = 0x00;
+ pbSendBuffer[3] = 0x00;
+ pbSendBuffer[4] = (BYTE)(SW & 0x00FF);
+ cbSendLength = 5;
+
+ cbRecvLength = (DWORD)pbRecvBuffer.size();
+ lRet = SendAPDU(pbSendBuffer.data(), cbSendLength, pbRecvBuffer.data(), &cbRecvLength, SW);
+
+ if (lRet == SCARD_S_SUCCESS)
+ {
+ if ((SW != SW_NO_ERROR) && ((SW >> 8) != (BYTE)(SW_BYTES_REMAINING_00 >> 8))) // 0x61
+ {
+ responseAPDU.clear();
+ responseAPDU.setSW(SW);
+ }
+ else
+ responseAPDU.appendData(pbRecvBuffer.data(), cbRecvLength);
+ }
+ }
+ }
+ // If Extended-APDU (SW = 0x6CXX and SW = 0x61XX are handled by the low-level driver + smart card reader)
+ else
+ {
+ // If SW != 0x9000 => there was an unexpected error
+ if (SW != SW_NO_ERROR)
+ {
+ responseAPDU.setSW(SW);
+ goto end;
+ }
+
+ // Response is complete in 1 ResponseAPDU
+ if (cbRecvLength)
+ responseAPDU.appendData(pbRecvBuffer.data(), cbRecvLength);
+ }
+
+ if (lRet == SCARD_S_SUCCESS)
+ {
+ responseAPDU.setSW(SW);
+ }
+ }
+ else
+ {
+ responseAPDU.setSW(SW);
+ }
+
+ end:
+
+ burn(pbSendBuffer.data(), pbSendBuffer.size());
+ burn(pbRecvBuffer.data(), pbRecvBuffer.size());
+
+ if (lRet != SCARD_S_SUCCESS)
+ throw PCSCException(lRet);
+ }
+
+ void SCardReader::GetATRFromHandle(vector<byte>& atrValue)
+ {
+ vector<byte> pbATR;
+ DWORD cByte = 0;
+ LONG lRet = 0;
+
+ atrValue.clear();
+
+ if (!m_scardLoader)
+ throw ScardLibraryInitializationFailed();
+
+ lRet = m_scardLoader->SCardGetAttrib(m_hCard, SCARD_ATTR_ATR_STRING, NULL, &cByte);
+ if (lRet == SCARD_S_SUCCESS)
+ {
+ pbATR.resize(cByte, 0);
+ lRet = m_scardLoader->SCardGetAttrib(m_hCard, SCARD_ATTR_ATR_STRING, pbATR.data(), &cByte);
+
+ if (lRet == SCARD_S_SUCCESS)
+ {
+ atrValue = pbATR;
+ }
+ else
+ {
+ throw PCSCException(lRet);
+ }
+ }
+ else
+ {
+ throw PCSCException(lRet);
+ }
+ }
+}
+
diff --git a/src/Common/SCardReader.h b/src/Common/SCardReader.h
new file mode 100644
index 00000000..95586963
--- /dev/null
+++ b/src/Common/SCardReader.h
@@ -0,0 +1,200 @@
+#ifndef TC_HEADER_Common_SCardReader
+#define TC_HEADER_Common_SCardReader
+
+#include "Platform/PlatformBase.h"
+#include "CommandAPDU.h"
+#include "ResponseAPDU.h"
+#include "SCardLoader.h"
+
+namespace VeraCrypt
+{
+ /* ================================================================================================ */
+ /* SW values */
+ /* ================================================================================================ */
+ const uint16 SW_BYTES_REMAINING_00 = (uint16)0x6100;
+ const uint16 SW_STATE_NON_VOLATILE_MEMORY_UNCHANGED_NO_INFORMATION_GIVEN = (uint16)0x6200;
+ const uint16 SW_END_OF_FILE = (uint16)0x6282;
+ const uint16 SW_LESS_DATA_RESPONDED_THAN_REQUESTED = (uint16)0x6287;
+ const uint16 SW_NON_VOLATILE_MEMORY_CHANGED_NO_INFORMATION_GIVEN = (uint16)0x6300;
+ const uint16 SW_NON_VOLATILE_MEMORY_CHANGED_FILE_FILLED_UP_BY_LAST_WRITE = (uint16)0x6381;
+ const uint16 SW_NON_VOLATILE_MEMORY_CHANGED_COUNTER_0 = (uint16)0x63C0;
+ const uint16 SW_WRONG_LENGTH = (uint16)0x6700;
+ const uint16 SW_LOGICAL_CHANNEL_NOT_SUPPORTED = (uint16)0x6881;
+ const uint16 SW_SECURE_MESSAGING_NOT_SUPPORTED = (uint16)0x6882;
+ const uint16 SW_LAST_COMMAND_EXPECTED = (uint16)0x6883;
+ const uint16 SW_SECURITY_STATUS_NOT_SATISFIED = (uint16)0x6982;
+ const uint16 SW_FILE_INVALID = (uint16)0x6983;
+ const uint16 SW_DATA_INVALID = (uint16)0x6984;
+ const uint16 SW_CONDITIONS_NOT_SATISFIED = (uint16)0x6985;
+ const uint16 SW_COMMAND_NOT_ALLOWED = (uint16)0x6986;
+ const uint16 SW_EXPECTED_SM_DATA_OBJECTS_MISSING = (uint16)0x6987;
+ const uint16 SW_SM_DATA_OBJECTS_INCORRECT = (uint16)0x6988;
+ const uint16 SW_APPLET_SELECT_FAILED = (uint16)0x6999;
+ const uint16 SW_KEY_USAGE_ERROR = (uint16)0x69C1;
+ const uint16 SW_WRONG_DATA = (uint16)0x6A80;
+ const uint16 SW_FILEHEADER_INCONSISTENT = (uint16)0x6A80;
+ const uint16 SW_FUNC_NOT_SUPPORTED = (uint16)0x6A81;
+ const uint16 SW_FILE_NOT_FOUND = (uint16)0x6A82;
+ const uint16 SW_RECORD_NOT_FOUND = (uint16)0x6A83;
+ const uint16 SW_FILE_FULL = (uint16)0x6A84;
+ const uint16 SW_OUT_OF_MEMORY = (uint16)0x6A84;
+ const uint16 SW_INCORRECT_P1P2 = (uint16)0x6A86;
+ const uint16 SW_KEY_NOT_FOUND = (uint16)0x6A88;
+ const uint16 SW_WRONG_P1P2 = (uint16)0x6B00;
+ const uint16 SW_CORRECT_LENGTH_00 = (uint16)0x6C00;
+ const uint16 SW_INS_NOT_SUPPORTED = (uint16)0x6D00;
+ const uint16 SW_CLA_NOT_SUPPORTED = (uint16)0x6E00;
+ const uint16 SW_UNKNOWN = (uint16)0x6F00;
+ const uint16 SW_CARD_TERMINATED = (uint16)0x6FFF;
+ const uint16 SW_NO_ERROR = (uint16)0x9000;
+
+ /* ================================================================================================ */
+ /* CLA values */
+ /* ================================================================================================ */
+ const byte CLA_ISO7816 = (byte)0x00;
+ const byte CLA_COMMAND_CHAINING = (byte)0x10;
+
+ /* ================================================================================================ */
+ /* INS values */
+ /* ================================================================================================ */
+ const byte INS_ERASE_BINARY = 0x0E;
+ const byte INS_VERIFY = 0x20;
+ const byte INS_CHANGE_CHV = 0x24;
+ const byte INS_UNBLOCK_CHV = 0x2C;
+ const byte INS_DECREASE = 0x30;
+ const byte INS_INCREASE = 0x32;
+ const byte INS_DECREASE_STAMPED = 0x34;
+ const byte INS_REHABILITATE_CHV = 0x44;
+ const byte INS_MANAGE_CHANNEL = 0x70;
+ const byte INS_EXTERNAL_AUTHENTICATE = (byte)0x82;
+ const byte INS_MUTUAL_AUTHENTICATE = (byte)0x82;
+ const byte INS_GET_CHALLENGE = (byte)0x84;
+ const byte INS_ASK_RANDOM = (byte)0x84;
+ const byte INS_GIVE_RANDOM = (byte)0x86;
+ const byte INS_INTERNAL_AUTHENTICATE = (byte)0x88;
+ const byte INS_SEEK = (byte)0xA2;
+ const byte INS_SELECT = (byte)0xA4;
+ const byte INS_SELECT_FILE = (byte)0xA4;
+ const byte INS_CLOSE_APPLICATION = (byte)0xAC;
+ const byte INS_READ_BINARY = (byte)0xB0;
+ const byte INS_READ_BINARY2 = (byte)0xB1;
+ const byte INS_READ_RECORD = (byte)0xB2;
+ const byte INS_READ_RECORD2 = (byte)0xB3;
+ const byte INS_READ_RECORDS = (byte)0xB2;
+ const byte INS_READ_BINARY_STAMPED = (byte)0xB4;
+ const byte INS_READ_RECORD_STAMPED = (byte)0xB6;
+ const byte INS_GET_RESPONSE = (byte)0xC0;
+ const byte INS_ENVELOPE = (byte)0xC2;
+ const byte INS_GET_DATA = (byte)0xCA;
+ const byte INS_WRITE_BINARY = (byte)0xD0;
+ const byte INS_WRITE_RECORD = (byte)0xD2;
+ const byte INS_UPDATE_BINARY = (byte)0xD6;
+ const byte INS_LOAD_KEY_FILE = (byte)0xD8;
+ const byte INS_PUT_DATA = (byte)0xDA;
+ const byte INS_UPDATE_RECORD = (byte)0xDC;
+ const byte INS_CREATE_FILE = (byte)0xE0;
+ const byte INS_APPEND_RECORD = (byte)0xE2;
+ const byte INS_DELETE_FILE = (byte)0xE4;
+ const byte INS_PSO = (byte)0x2A;
+ const byte INS_MSE = (byte)0x22;
+
+ /* ================================================================================================ */
+ /* EMV values */
+ /* ================================================================================================ */
+ const uint16 EMV_CPLC_TAG = (uint16)0x9F7F;
+ const uint16 EMV_ICC_PK_CERT_TAG = (uint16)0x9F46;
+ const uint16 EMV_FCI_ISSUER_DISCRETIONARY_DATA_TAG = (uint16)0xBF0C;
+ const byte EMV_ISS_PK_CERT_TAG = (byte)0x90;
+ const byte EMV_PAN_TAG = (byte)0x5A;
+ const byte EMV_FCI_TAG = (byte)0x6F;
+ const byte EMV_DFNAME_TAG = (byte)0x84;
+ const byte EMV_FCI_ISSUER_TAG = (byte)0xA5;
+ const byte EMV_DIRECTORY_ENTRY_TAG = (byte)0x61;
+ const byte EMV_SFI_TAG = (byte)0x88;
+ const byte EMV_TEMPLATE_TAG = (byte)0x70;
+ const byte EMV_AID_TAG = (byte)0x4F;
+ const byte EMV_LABEL_TAG = (byte)0x50;
+ const byte EMV_PRIORITY_TAG = (byte)0x87;
+ const byte EMV_PSE1[] = { 0x31, 0x50, 0x41, 0x59, 0x2E, 0x53, 0x59, 0x53, 0x2E, 0x44, 0x44, 0x46, 0x30, 0x31 }; // "1PAY.SYS.DDF01" (contact)
+ const byte EMV_PSE2[] = { 0x32, 0x50, 0x41, 0x59, 0x2E, 0x53, 0x59, 0x53, 0x2E, 0x44, 0x44, 0x46, 0x30, 0x31 }; // "2PAY.SYS.DDF01" (contactless)
+
+ /* ================================================================================================ */
+
+ class SCardReader
+ {
+ protected:
+
+ wstring m_szSCReaderName;
+
+ shared_ptr<SCardLoader> m_scardLoader;
+ mutable SCARDCONTEXT m_hSCReaderContext;
+ mutable SCARDHANDLE m_hCard;
+ mutable DWORD m_dwProtocol;
+ mutable LPCSCARD_IO_REQUEST m_pIO_Protocol;
+
+ void Init(const wstring& szSCReaderName, const shared_ptr<SCardLoader> scardLoader, const SCARDHANDLE& hCard, const DWORD& dwProtocol, LPCSCARD_IO_REQUEST pIO_Protocol);
+
+ public:
+
+ /* Card variables */
+ // Max Command APDU total size ; Typically either 261 (short) or 65544 (extended)
+ // Max Response APDU total size ; Typically either 258 (short) or 65538 (extended)
+ // Max Response APDU data size ; Ne ; Typically either 256 (short : 0x00) of 65536 (extended : 0x0000)
+ const static uint32 shortAPDUMaxSendSize = 261;
+ const static uint32 shortAPDUMaxRecvSize = 258;
+ const static uint32 shortAPDUMaxTransSize = 256;
+ const static uint32 extendedAPDUMaxSendSize = 65544;
+ const static uint32 extendedAPDUMaxRecvSize = 65538;
+ const static uint32 extendedAPDUMaxTransSize = 65536;
+
+ // ------------------------------------------------------------------------------------------------------------------------------------- //
+ // Ctors, dtors
+ // ------------------------------------------------------------------------------------------------------------------------------------- //
+
+ SCardReader(const wstring &szName, const shared_ptr<SCardLoader> scardLoader);
+
+ SCardReader(const SCardReader& other);
+ SCardReader(SCardReader&& other);
+ SCardReader& operator = (const SCardReader& other);
+ SCardReader& operator = (SCardReader&& other);
+
+ void Clear(void);
+
+ ~SCardReader();
+
+ // ------------------------------------------------------------------------------------------------------------------------------------- //
+ // Getters & Setters
+ // ------------------------------------------------------------------------------------------------------------------------------------- //
+
+ const wstring GetNameWide() const;
+ const string GetName() const;
+
+ // ------------------------------------------------------------------------------------------------------------------------------------- //
+ // Card Connection management methods
+ // ------------------------------------------------------------------------------------------------------------------------------------- //
+
+ bool IsCardPresent(vector<byte>& cardAtr);
+ bool IsCardPresent();
+
+ LONG CardHandleStatus();
+
+ void Connect(DWORD dwProtocolToUse, bool& bHasBeenReset, bool resetAfterConnect = false);
+ bool IsConnected();
+ void Disconnect() const;
+
+ LONG SendAPDU(LPCBYTE pbSendBuffer,
+ DWORD cbSendLength,
+ LPBYTE pbRecvBuffer,
+ LPDWORD pcbRecvLength,
+ uint16& SW) const;
+
+ void BeginTransaction();
+ void EndTransaction();
+
+ void ApduProcessData(CommandAPDU commandAPDU, ResponseAPDU& responseAPDU) const;
+
+ void GetATRFromHandle(vector<byte>& atrValue);
+ };
+};
+
+#endif // TC_HEADER_Common_SCardReader \ No newline at end of file
diff --git a/src/Common/SecurityToken.cpp b/src/Common/SecurityToken.cpp
index 8401a0eb..ad8ed33e 100644
--- a/src/Common/SecurityToken.cpp
+++ b/src/Common/SecurityToken.cpp
@@ -36,23 +36,31 @@ using namespace std;
namespace VeraCrypt
{
- SecurityTokenKeyfile::SecurityTokenKeyfile (const SecurityTokenKeyfilePath &path)
+ SecurityTokenKeyfile::SecurityTokenKeyfile(): Handle(CK_INVALID_HANDLE) {
+ SecurityTokenInfo* token = new SecurityTokenInfo();
+ Token = shared_ptr<SecurityTokenInfo>(token);
+ Token->SlotId = CK_UNAVAILABLE_INFORMATION;
+ token->Flags = 0;
+ }
+
+ SecurityTokenKeyfile::SecurityTokenKeyfile(const TokenKeyfilePath& path)
{
+ Token = shared_ptr<SecurityTokenInfo>(new SecurityTokenInfo());
wstring pathStr = path;
unsigned long slotId;
- if (swscanf (pathStr.c_str(), TC_SECURITY_TOKEN_KEYFILE_URL_PREFIX TC_SECURITY_TOKEN_KEYFILE_URL_SLOT L"/%lu", &slotId) != 1)
+ if (swscanf(pathStr.c_str(), TC_SECURITY_TOKEN_KEYFILE_URL_PREFIX TC_SECURITY_TOKEN_KEYFILE_URL_SLOT L"/%lu", &slotId) != 1)
throw InvalidSecurityTokenKeyfilePath();
- SlotId = slotId;
+ Token->SlotId = slotId;
- size_t keyIdPos = pathStr.find (L"/" TC_SECURITY_TOKEN_KEYFILE_URL_FILE L"/");
+ size_t keyIdPos = pathStr.find(L"/" TC_SECURITY_TOKEN_KEYFILE_URL_FILE L"/");
if (keyIdPos == wstring::npos)
throw InvalidSecurityTokenKeyfilePath();
- Id = pathStr.substr (keyIdPos + wstring (L"/" TC_SECURITY_TOKEN_KEYFILE_URL_FILE L"/").size());
+ Id = pathStr.substr(keyIdPos + wstring(L"/" TC_SECURITY_TOKEN_KEYFILE_URL_FILE L"/").size());
- vector <SecurityTokenKeyfile> keyfiles = SecurityToken::GetAvailableKeyfiles (&SlotId, Id);
+ vector <SecurityTokenKeyfile> keyfiles = SecurityToken::GetAvailableKeyfiles(&Token->SlotId, Id);
if (keyfiles.empty())
throw SecurityTokenKeyfileNotFound();
@@ -60,69 +68,69 @@ namespace VeraCrypt
*this = keyfiles.front();
}
- SecurityTokenKeyfile::operator SecurityTokenKeyfilePath () const
+ SecurityTokenKeyfile::operator TokenKeyfilePath () const
{
wstringstream path;
- path << TC_SECURITY_TOKEN_KEYFILE_URL_PREFIX TC_SECURITY_TOKEN_KEYFILE_URL_SLOT L"/" << SlotId << L"/" TC_SECURITY_TOKEN_KEYFILE_URL_FILE L"/" << Id;
+ path << TC_SECURITY_TOKEN_KEYFILE_URL_PREFIX TC_SECURITY_TOKEN_KEYFILE_URL_SLOT L"/" << Token->SlotId << L"/" TC_SECURITY_TOKEN_KEYFILE_URL_FILE L"/" << Id;
return path.str();
}
- void SecurityToken::CheckLibraryStatus ()
+ void SecurityToken::CheckLibraryStatus()
{
if (!Initialized)
throw SecurityTokenLibraryNotInitialized();
}
- void SecurityToken::CloseLibrary ()
+ void SecurityToken::CloseLibrary()
{
if (Initialized)
{
CloseAllSessions();
- Pkcs11Functions->C_Finalize (NULL_PTR);
+ Pkcs11Functions->C_Finalize(NULL_PTR);
#ifdef TC_WINDOWS
- FreeLibrary (Pkcs11LibraryHandle);
+ FreeLibrary(Pkcs11LibraryHandle);
#else
- dlclose (Pkcs11LibraryHandle);
+ dlclose(Pkcs11LibraryHandle);
#endif
Initialized = false;
}
}
- void SecurityToken::CloseAllSessions () throw ()
+ void SecurityToken::CloseAllSessions() throw ()
{
if (!Initialized)
return;
typedef pair <CK_SLOT_ID, Pkcs11Session> SessionMapPair;
- foreach (SessionMapPair p, Sessions)
+ foreach(SessionMapPair p, Sessions)
{
try
{
- CloseSession (p.first);
+ CloseSession(p.first);
}
- catch (...) { }
+ catch (...) {}
}
}
- void SecurityToken::CloseSession (CK_SLOT_ID slotId)
+ void SecurityToken::CloseSession(CK_SLOT_ID slotId)
{
- if (Sessions.find (slotId) == Sessions.end())
- throw ParameterIncorrect (SRC_POS);
+ if (Sessions.find(slotId) == Sessions.end())
+ throw ParameterIncorrect(SRC_POS);
- Pkcs11Functions->C_CloseSession (Sessions[slotId].Handle);
- Sessions.erase (Sessions.find (slotId));
+ Pkcs11Functions->C_CloseSession(Sessions[slotId].Handle);
+ Sessions.erase(Sessions.find(slotId));
}
- void SecurityToken::CreateKeyfile (CK_SLOT_ID slotId, vector <byte> &keyfileData, const string &name)
+ void SecurityToken::CreateKeyfile(CK_SLOT_ID slotId, vector <byte>& keyfileData, const string& name)
{
if (name.empty())
- throw ParameterIncorrect (SRC_POS);
+ throw ParameterIncorrect(SRC_POS);
- LoginUserIfRequired (slotId);
+ LoginUserIfRequired(slotId);
- foreach (const SecurityTokenKeyfile &keyfile, GetAvailableKeyfiles (&slotId))
+ foreach(const SecurityTokenKeyfile & keyfile, GetAvailableKeyfiles(&slotId))
{
if (keyfile.IdUtf8 == name)
throw SecurityTokenKeyfileAlreadyExists();
@@ -133,16 +141,16 @@ namespace VeraCrypt
CK_ATTRIBUTE keyfileTemplate[] =
{
- { CKA_CLASS, &dataClass, sizeof (dataClass) },
- { CKA_TOKEN, &trueVal, sizeof (trueVal) },
- { CKA_PRIVATE, &trueVal, sizeof (trueVal) },
- { CKA_LABEL, (CK_UTF8CHAR *) name.c_str(), (CK_ULONG) name.size() },
- { CKA_VALUE, &keyfileData.front(), (CK_ULONG) keyfileData.size() }
+ { CKA_CLASS, &dataClass, sizeof(dataClass) },
+ { CKA_TOKEN, &trueVal, sizeof(trueVal) },
+ { CKA_PRIVATE, &trueVal, sizeof(trueVal) },
+ { CKA_LABEL, (CK_UTF8CHAR*)name.c_str(), (CK_ULONG)name.size() },
+ { CKA_VALUE, &keyfileData.front(), (CK_ULONG)keyfileData.size() }
};
CK_OBJECT_HANDLE keyfileHandle;
- CK_RV status = Pkcs11Functions->C_CreateObject (Sessions[slotId].Handle, keyfileTemplate, array_capacity (keyfileTemplate), &keyfileHandle);
+ CK_RV status = Pkcs11Functions->C_CreateObject(Sessions[slotId].Handle, keyfileTemplate, array_capacity(keyfileTemplate), &keyfileHandle);
switch (status)
{
@@ -156,36 +164,36 @@ namespace VeraCrypt
}
if (status != CKR_OK)
- throw Pkcs11Exception (status);
+ throw Pkcs11Exception(status);
// Some tokens report success even if the new object was truncated to fit in the available memory
vector <byte> objectData;
- GetObjectAttribute (slotId, keyfileHandle, CKA_VALUE, objectData);
- finally_do_arg (vector <byte> *, &objectData, { if (!finally_arg->empty()) burn (&finally_arg->front(), finally_arg->size()); });
+ GetObjectAttribute(slotId, keyfileHandle, CKA_VALUE, objectData);
+ finally_do_arg(vector <byte> *, &objectData, { if (!finally_arg->empty()) burn(&finally_arg->front(), finally_arg->size()); });
if (objectData.size() != keyfileData.size())
{
- Pkcs11Functions->C_DestroyObject (Sessions[slotId].Handle, keyfileHandle);
- throw Pkcs11Exception (CKR_DEVICE_MEMORY);
+ Pkcs11Functions->C_DestroyObject(Sessions[slotId].Handle, keyfileHandle);
+ throw Pkcs11Exception(CKR_DEVICE_MEMORY);
}
}
- void SecurityToken::DeleteKeyfile (const SecurityTokenKeyfile &keyfile)
+ void SecurityToken::DeleteKeyfile(const SecurityTokenKeyfile& keyfile)
{
- LoginUserIfRequired (keyfile.SlotId);
+ LoginUserIfRequired(keyfile.Token->SlotId);
- CK_RV status = Pkcs11Functions->C_DestroyObject (Sessions[keyfile.SlotId].Handle, keyfile.Handle);
+ CK_RV status = Pkcs11Functions->C_DestroyObject(Sessions[keyfile.Token->SlotId].Handle, keyfile.Handle);
if (status != CKR_OK)
- throw Pkcs11Exception (status);
+ throw Pkcs11Exception(status);
}
- vector <SecurityTokenKeyfile> SecurityToken::GetAvailableKeyfiles (CK_SLOT_ID *slotIdFilter, const wstring keyfileIdFilter)
+ vector <SecurityTokenKeyfile> SecurityToken::GetAvailableKeyfiles(CK_SLOT_ID* slotIdFilter, const wstring keyfileIdFilter)
{
bool unrecognizedTokenPresent = false;
vector <SecurityTokenKeyfile> keyfiles;
- foreach (const CK_SLOT_ID &slotId, GetTokenSlots())
+ foreach(const CK_SLOT_ID & slotId, GetTokenSlots())
{
SecurityTokenInfo token;
@@ -194,14 +202,14 @@ namespace VeraCrypt
try
{
- LoginUserIfRequired (slotId);
- token = GetTokenInfo (slotId);
+ LoginUserIfRequired(slotId);
+ token = GetTokenInfo(slotId);
}
- catch (UserAbort &)
+ catch (UserAbort&)
{
continue;
}
- catch (Pkcs11Exception &e)
+ catch (Pkcs11Exception& e)
{
if (e.GetErrorCode() == CKR_TOKEN_NOT_RECOGNIZED)
{
@@ -212,34 +220,34 @@ namespace VeraCrypt
throw;
}
- foreach (const CK_OBJECT_HANDLE &dataHandle, GetObjects (slotId, CKO_DATA))
+ foreach(const CK_OBJECT_HANDLE & dataHandle, GetObjects(slotId, CKO_DATA))
{
SecurityTokenKeyfile keyfile;
keyfile.Handle = dataHandle;
- keyfile.SlotId = slotId;
- keyfile.Token = token;
+ keyfile.Token->SlotId = slotId;
+ keyfile.Token = shared_ptr<SecurityTokenInfo>(new SecurityTokenInfo(token));
vector <byte> privateAttrib;
- GetObjectAttribute (slotId, dataHandle, CKA_PRIVATE, privateAttrib);
+ GetObjectAttribute(slotId, dataHandle, CKA_PRIVATE, privateAttrib);
- if (privateAttrib.size() == sizeof (CK_BBOOL) && *(CK_BBOOL *) &privateAttrib.front() != CK_TRUE)
+ if (privateAttrib.size() == sizeof(CK_BBOOL) && *(CK_BBOOL*)&privateAttrib.front() != CK_TRUE)
continue;
vector <byte> label;
- GetObjectAttribute (slotId, dataHandle, CKA_LABEL, label);
- label.push_back (0);
+ GetObjectAttribute(slotId, dataHandle, CKA_LABEL, label);
+ label.push_back(0);
- keyfile.IdUtf8 = (char *) &label.front();
+ keyfile.IdUtf8 = (char*)&label.front();
#if defined (TC_WINDOWS) && !defined (TC_PROTOTYPE)
- keyfile.Id = Utf8StringToWide ((const char *) &label.front());
+ keyfile.Id = Utf8StringToWide((const char*)&label.front());
#else
- keyfile.Id = StringConverter::ToWide ((const char *) &label.front());
+ keyfile.Id = StringConverter::ToWide((const char*)&label.front());
#endif
if (keyfile.Id.empty() || (!keyfileIdFilter.empty() && keyfileIdFilter != keyfile.Id))
continue;
- keyfiles.push_back (keyfile);
+ keyfiles.push_back(keyfile);
if (!keyfileIdFilter.empty())
break;
@@ -247,23 +255,23 @@ namespace VeraCrypt
}
if (keyfiles.empty() && unrecognizedTokenPresent)
- throw Pkcs11Exception (CKR_TOKEN_NOT_RECOGNIZED);
+ throw Pkcs11Exception(CKR_TOKEN_NOT_RECOGNIZED);
return keyfiles;
}
- list <SecurityTokenInfo> SecurityToken::GetAvailableTokens ()
+ list <SecurityTokenInfo> SecurityToken::GetAvailableTokens()
{
bool unrecognizedTokenPresent = false;
list <SecurityTokenInfo> tokens;
- foreach (const CK_SLOT_ID &slotId, GetTokenSlots())
+ foreach(const CK_SLOT_ID & slotId, GetTokenSlots())
{
try
{
- tokens.push_back (GetTokenInfo (slotId));
+ tokens.push_back(GetTokenInfo(slotId));
}
- catch (Pkcs11Exception &e)
+ catch (Pkcs11Exception& e)
{
if (e.GetErrorCode() == CKR_TOKEN_NOT_RECOGNIZED)
{
@@ -276,63 +284,63 @@ namespace VeraCrypt
}
if (tokens.empty() && unrecognizedTokenPresent)
- throw Pkcs11Exception (CKR_TOKEN_NOT_RECOGNIZED);
+ throw Pkcs11Exception(CKR_TOKEN_NOT_RECOGNIZED);
return tokens;
}
- SecurityTokenInfo SecurityToken::GetTokenInfo (CK_SLOT_ID slotId)
+ SecurityTokenInfo SecurityToken::GetTokenInfo(CK_SLOT_ID slotId)
{
CK_TOKEN_INFO info;
- CK_RV status = Pkcs11Functions->C_GetTokenInfo (slotId, &info);
+ CK_RV status = Pkcs11Functions->C_GetTokenInfo(slotId, &info);
if (status != CKR_OK)
- throw Pkcs11Exception (status);
+ throw Pkcs11Exception(status);
SecurityTokenInfo token;
token.SlotId = slotId;
token.Flags = info.flags;
- char label[sizeof (info.label) + 1];
- memset (label, 0, sizeof (label));
- memcpy (label, info.label, sizeof (info.label));
+ char label[sizeof(info.label) + 1];
+ memset(label, 0, sizeof(label));
+ memcpy(label, info.label, sizeof(info.label));
token.LabelUtf8 = label;
- size_t lastSpace = token.LabelUtf8.find_last_not_of (' ');
+ size_t lastSpace = token.LabelUtf8.find_last_not_of(' ');
if (lastSpace == string::npos)
token.LabelUtf8.clear();
else
- token.LabelUtf8 = token.LabelUtf8.substr (0, lastSpace + 1);
+ token.LabelUtf8 = token.LabelUtf8.substr(0, lastSpace + 1);
#if defined (TC_WINDOWS) && !defined (TC_PROTOTYPE)
- token.Label = Utf8StringToWide (token.LabelUtf8);
+ token.Label = Utf8StringToWide(token.LabelUtf8);
#else
- token.Label = StringConverter::ToWide (token.LabelUtf8);
+ token.Label = StringConverter::ToWide(token.LabelUtf8);
#endif
return token;
}
- void SecurityToken::GetKeyfileData (const SecurityTokenKeyfile &keyfile, vector <byte> &keyfileData)
+ void SecurityTokenKeyfile::GetKeyfileData(vector <byte>& keyfileData) const
{
- LoginUserIfRequired (keyfile.SlotId);
- GetObjectAttribute (keyfile.SlotId, keyfile.Handle, CKA_VALUE, keyfileData);
+ SecurityToken::LoginUserIfRequired(Token->SlotId);
+ SecurityToken::GetObjectAttribute(Token->SlotId, Handle, CKA_VALUE, keyfileData);
}
- vector <CK_OBJECT_HANDLE> SecurityToken::GetObjects (CK_SLOT_ID slotId, CK_ATTRIBUTE_TYPE objectClass)
+ vector <CK_OBJECT_HANDLE> SecurityToken::GetObjects(CK_SLOT_ID slotId, CK_ATTRIBUTE_TYPE objectClass)
{
- if (Sessions.find (slotId) == Sessions.end())
- throw ParameterIncorrect (SRC_POS);
+ if (Sessions.find(slotId) == Sessions.end())
+ throw ParameterIncorrect(SRC_POS);
CK_ATTRIBUTE findTemplate;
findTemplate.type = CKA_CLASS;
findTemplate.pValue = &objectClass;
- findTemplate.ulValueLen = sizeof (objectClass);
+ findTemplate.ulValueLen = sizeof(objectClass);
- CK_RV status = Pkcs11Functions->C_FindObjectsInit (Sessions[slotId].Handle, &findTemplate, 1);
+ CK_RV status = Pkcs11Functions->C_FindObjectsInit(Sessions[slotId].Handle, &findTemplate, 1);
if (status != CKR_OK)
- throw Pkcs11Exception (status);
+ throw Pkcs11Exception(status);
- finally_do_arg (CK_SLOT_ID, slotId, { Pkcs11Functions->C_FindObjectsFinal (Sessions[finally_arg].Handle); });
+ finally_do_arg(CK_SLOT_ID, slotId, { Pkcs11Functions->C_FindObjectsFinal(Sessions[finally_arg].Handle); });
CK_ULONG objectCount;
vector <CK_OBJECT_HANDLE> objects;
@@ -340,112 +348,112 @@ namespace VeraCrypt
while (true)
{
CK_OBJECT_HANDLE object;
- CK_RV status = Pkcs11Functions->C_FindObjects (Sessions[slotId].Handle, &object, 1, &objectCount);
+ CK_RV status = Pkcs11Functions->C_FindObjects(Sessions[slotId].Handle, &object, 1, &objectCount);
if (status != CKR_OK)
- throw Pkcs11Exception (status);
+ throw Pkcs11Exception(status);
if (objectCount != 1)
break;
- objects.push_back (object);
+ objects.push_back(object);
}
return objects;
}
- void SecurityToken::GetObjectAttribute (CK_SLOT_ID slotId, CK_OBJECT_HANDLE tokenObject, CK_ATTRIBUTE_TYPE attributeType, vector <byte> &attributeValue)
+ void SecurityToken::GetObjectAttribute(CK_SLOT_ID slotId, CK_OBJECT_HANDLE tokenObject, CK_ATTRIBUTE_TYPE attributeType, vector <byte>& attributeValue)
{
attributeValue.clear();
- if (Sessions.find (slotId) == Sessions.end())
- throw ParameterIncorrect (SRC_POS);
+ if (Sessions.find(slotId) == Sessions.end())
+ throw ParameterIncorrect(SRC_POS);
CK_ATTRIBUTE attribute;
attribute.type = attributeType;
attribute.pValue = NULL_PTR;
- CK_RV status = Pkcs11Functions->C_GetAttributeValue (Sessions[slotId].Handle, tokenObject, &attribute, 1);
+ CK_RV status = Pkcs11Functions->C_GetAttributeValue(Sessions[slotId].Handle, tokenObject, &attribute, 1);
if (status != CKR_OK)
- throw Pkcs11Exception (status);
+ throw Pkcs11Exception(status);
if (attribute.ulValueLen == 0)
return;
- attributeValue = vector <byte> (attribute.ulValueLen);
+ attributeValue = vector <byte>(attribute.ulValueLen);
attribute.pValue = &attributeValue.front();
- status = Pkcs11Functions->C_GetAttributeValue (Sessions[slotId].Handle, tokenObject, &attribute, 1);
+ status = Pkcs11Functions->C_GetAttributeValue(Sessions[slotId].Handle, tokenObject, &attribute, 1);
if (status != CKR_OK)
- throw Pkcs11Exception (status);
+ throw Pkcs11Exception(status);
}
- list <CK_SLOT_ID> SecurityToken::GetTokenSlots ()
+ list <CK_SLOT_ID> SecurityToken::GetTokenSlots()
{
CheckLibraryStatus();
list <CK_SLOT_ID> slots;
CK_ULONG slotCount;
- CK_RV status = Pkcs11Functions->C_GetSlotList (TRUE, NULL_PTR, &slotCount);
+ CK_RV status = Pkcs11Functions->C_GetSlotList(TRUE, NULL_PTR, &slotCount);
if (status != CKR_OK)
- throw Pkcs11Exception (status);
+ throw Pkcs11Exception(status);
if (slotCount > 0)
{
- vector <CK_SLOT_ID> slotArray (slotCount);
- status = Pkcs11Functions->C_GetSlotList (TRUE, &slotArray.front(), &slotCount);
+ vector <CK_SLOT_ID> slotArray(slotCount);
+ status = Pkcs11Functions->C_GetSlotList(TRUE, &slotArray.front(), &slotCount);
if (status != CKR_OK)
- throw Pkcs11Exception (status);
+ throw Pkcs11Exception(status);
for (size_t i = 0; i < slotCount; i++)
{
CK_SLOT_INFO slotInfo;
- status = Pkcs11Functions->C_GetSlotInfo (slotArray[i], &slotInfo);
+ status = Pkcs11Functions->C_GetSlotInfo(slotArray[i], &slotInfo);
if (status != CKR_OK || !(slotInfo.flags & CKF_TOKEN_PRESENT))
continue;
- slots.push_back (slotArray[i]);
+ slots.push_back(slotArray[i]);
}
}
return slots;
}
- bool SecurityToken::IsKeyfilePathValid (const wstring &securityTokenKeyfilePath)
+ bool SecurityToken::IsKeyfilePathValid(const wstring& securityTokenKeyfilePath)
{
- return securityTokenKeyfilePath.find (TC_SECURITY_TOKEN_KEYFILE_URL_PREFIX) == 0;
+ return securityTokenKeyfilePath.find(TC_SECURITY_TOKEN_KEYFILE_URL_PREFIX) == 0;
}
- void SecurityToken::Login (CK_SLOT_ID slotId, const char* pin)
+ void SecurityToken::Login(CK_SLOT_ID slotId, const char* pin)
{
- if (Sessions.find (slotId) == Sessions.end())
- OpenSession (slotId);
+ if (Sessions.find(slotId) == Sessions.end())
+ OpenSession(slotId);
else if (Sessions[slotId].UserLoggedIn)
return;
- size_t pinLen = pin? strlen (pin) : 0;
- CK_RV status = Pkcs11Functions->C_Login (Sessions[slotId].Handle, CKU_USER, (CK_CHAR_PTR) pin, (CK_ULONG) pinLen);
+ size_t pinLen = pin ? strlen(pin) : 0;
+ CK_RV status = Pkcs11Functions->C_Login(Sessions[slotId].Handle, CKU_USER, (CK_CHAR_PTR)pin, (CK_ULONG)pinLen);
if (status != CKR_OK)
- throw Pkcs11Exception (status);
+ throw Pkcs11Exception(status);
Sessions[slotId].UserLoggedIn = true;
}
- void SecurityToken::LoginUserIfRequired (CK_SLOT_ID slotId)
+ void SecurityToken::LoginUserIfRequired(CK_SLOT_ID slotId)
{
CheckLibraryStatus();
CK_RV status;
- if (Sessions.find (slotId) == Sessions.end())
+ if (Sessions.find(slotId) == Sessions.end())
{
- OpenSession (slotId);
+ OpenSession(slotId);
}
else
{
CK_SESSION_INFO sessionInfo;
- status = Pkcs11Functions->C_GetSessionInfo (Sessions[slotId].Handle, &sessionInfo);
+ status = Pkcs11Functions->C_GetSessionInfo(Sessions[slotId].Handle, &sessionInfo);
if (status == CKR_OK)
{
@@ -455,14 +463,14 @@ namespace VeraCrypt
{
try
{
- CloseSession (slotId);
+ CloseSession(slotId);
}
- catch (...) { }
- OpenSession (slotId);
+ catch (...) {}
+ OpenSession(slotId);
}
}
- SecurityTokenInfo tokenInfo = GetTokenInfo (slotId);
+ SecurityTokenInfo tokenInfo = GetTokenInfo(slotId);
while (!Sessions[slotId].UserLoggedIn && (tokenInfo.Flags & CKF_LOGIN_REQUIRED))
{
@@ -470,9 +478,9 @@ namespace VeraCrypt
{
if (tokenInfo.Flags & CKF_PROTECTED_AUTHENTICATION_PATH)
{
- status = Pkcs11Functions->C_Login (Sessions[slotId].Handle, CKU_USER, NULL_PTR, 0);
+ status = Pkcs11Functions->C_Login(Sessions[slotId].Handle, CKU_USER, NULL_PTR, 0);
if (status != CKR_OK)
- throw Pkcs11Exception (status);
+ throw Pkcs11Exception(status);
}
else
{
@@ -484,15 +492,15 @@ namespace VeraCrypt
pin = s.str();
}
- finally_do_arg (string*, &pin, { burn ((void *) finally_arg->c_str(), finally_arg->size()); });
+ finally_do_arg(string*, &pin, { burn((void*)finally_arg->c_str(), finally_arg->size()); });
(*PinCallback) (pin);
- Login (slotId, pin.c_str());
+ Login(slotId, pin.c_str());
}
Sessions[slotId].UserLoggedIn = true;
}
- catch (Pkcs11Exception &e)
+ catch (Pkcs11Exception& e)
{
CK_RV error = e.GetErrorCode();
@@ -502,8 +510,8 @@ namespace VeraCrypt
}
else if (error == CKR_PIN_INCORRECT && !(tokenInfo.Flags & CKF_PROTECTED_AUTHENTICATION_PATH))
{
- PinCallback->notifyIncorrectPin ();
- (*WarningCallback) (Pkcs11Exception (CKR_PIN_INCORRECT));
+ PinCallback->notifyIncorrectPin();
+ (*WarningCallback) (Pkcs11Exception(CKR_PIN_INCORRECT));
continue;
}
@@ -513,40 +521,40 @@ namespace VeraCrypt
}
#ifdef TC_WINDOWS
- void SecurityToken::InitLibrary (const wstring &pkcs11LibraryPath, unique_ptr <GetPinFunctor> pinCallback, unique_ptr <SendExceptionFunctor> warningCallback)
+ void SecurityToken::InitLibrary(const wstring& pkcs11LibraryPath, unique_ptr <GetPinFunctor> pinCallback, unique_ptr <SendExceptionFunctor> warningCallback)
#else
- void SecurityToken::InitLibrary (const string &pkcs11LibraryPath, unique_ptr <GetPinFunctor> pinCallback, unique_ptr <SendExceptionFunctor> warningCallback)
+ void SecurityToken::InitLibrary(const string& pkcs11LibraryPath, unique_ptr <GetPinFunctor> pinCallback, unique_ptr <SendExceptionFunctor> warningCallback)
#endif
{
if (Initialized)
CloseLibrary();
#ifdef TC_WINDOWS
- Pkcs11LibraryHandle = LoadLibraryW (pkcs11LibraryPath.c_str());
- throw_sys_if (!Pkcs11LibraryHandle);
+ Pkcs11LibraryHandle = LoadLibraryW(pkcs11LibraryPath.c_str());
+ throw_sys_if(!Pkcs11LibraryHandle);
#else
- Pkcs11LibraryHandle = dlopen (pkcs11LibraryPath.c_str(), RTLD_NOW | RTLD_LOCAL);
- throw_sys_sub_if (!Pkcs11LibraryHandle, dlerror());
+ Pkcs11LibraryHandle = dlopen(pkcs11LibraryPath.c_str(), RTLD_NOW | RTLD_LOCAL);
+ throw_sys_sub_if(!Pkcs11LibraryHandle, dlerror());
#endif
- typedef CK_RV (*C_GetFunctionList_t) (CK_FUNCTION_LIST_PTR_PTR ppFunctionList);
+ typedef CK_RV(*C_GetFunctionList_t) (CK_FUNCTION_LIST_PTR_PTR ppFunctionList);
#ifdef TC_WINDOWS
- C_GetFunctionList_t C_GetFunctionList = (C_GetFunctionList_t) GetProcAddress (Pkcs11LibraryHandle, "C_GetFunctionList");
+ C_GetFunctionList_t C_GetFunctionList = (C_GetFunctionList_t)GetProcAddress(Pkcs11LibraryHandle, "C_GetFunctionList");
#else
- C_GetFunctionList_t C_GetFunctionList = (C_GetFunctionList_t) dlsym (Pkcs11LibraryHandle, "C_GetFunctionList");
+ C_GetFunctionList_t C_GetFunctionList = (C_GetFunctionList_t)dlsym(Pkcs11LibraryHandle, "C_GetFunctionList");
#endif
if (!C_GetFunctionList)
throw SecurityTokenLibraryNotInitialized();
- CK_RV status = C_GetFunctionList (&Pkcs11Functions);
+ CK_RV status = C_GetFunctionList(&Pkcs11Functions);
if (status != CKR_OK)
- throw Pkcs11Exception (status);
+ throw Pkcs11Exception(status);
- status = Pkcs11Functions->C_Initialize (NULL_PTR);
+ status = Pkcs11Functions->C_Initialize(NULL_PTR);
if (status != CKR_OK)
- throw Pkcs11Exception (status);
+ throw Pkcs11Exception(status);
PinCallback = move_ptr(pinCallback);
WarningCallback = move_ptr(warningCallback);
@@ -554,21 +562,21 @@ namespace VeraCrypt
Initialized = true;
}
- void SecurityToken::OpenSession (CK_SLOT_ID slotId)
+ void SecurityToken::OpenSession(CK_SLOT_ID slotId)
{
- if (Sessions.find (slotId) != Sessions.end())
+ if (Sessions.find(slotId) != Sessions.end())
return;
CK_SESSION_HANDLE session;
CK_FLAGS flags = CKF_SERIAL_SESSION;
- if (!(GetTokenInfo (slotId).Flags & CKF_WRITE_PROTECTED))
- flags |= CKF_RW_SESSION;
+ if (!(GetTokenInfo(slotId).Flags & CKF_WRITE_PROTECTED))
+ flags |= CKF_RW_SESSION;
- CK_RV status = Pkcs11Functions->C_OpenSession (slotId, flags, NULL_PTR, NULL_PTR, &session);
+ CK_RV status = Pkcs11Functions->C_OpenSession(slotId, flags, NULL_PTR, NULL_PTR, &session);
if (status != CKR_OK)
- throw Pkcs11Exception (status);
+ throw Pkcs11Exception(status);
Sessions[slotId].Handle = session;
}
@@ -581,103 +589,103 @@ namespace VeraCrypt
static const struct
{
CK_RV ErrorCode;
- const char *ErrorString;
+ const char* ErrorString;
} ErrorStrings[] =
{
# define TC_TOKEN_ERR(CODE) { CODE, #CODE },
- TC_TOKEN_ERR (CKR_CANCEL)
- TC_TOKEN_ERR (CKR_HOST_MEMORY)
- TC_TOKEN_ERR (CKR_SLOT_ID_INVALID)
- TC_TOKEN_ERR (CKR_GENERAL_ERROR)
- TC_TOKEN_ERR (CKR_FUNCTION_FAILED)
- TC_TOKEN_ERR (CKR_ARGUMENTS_BAD)
- TC_TOKEN_ERR (CKR_NO_EVENT)
- TC_TOKEN_ERR (CKR_NEED_TO_CREATE_THREADS)
- TC_TOKEN_ERR (CKR_CANT_LOCK)
- TC_TOKEN_ERR (CKR_ATTRIBUTE_READ_ONLY)
- TC_TOKEN_ERR (CKR_ATTRIBUTE_SENSITIVE)
- TC_TOKEN_ERR (CKR_ATTRIBUTE_TYPE_INVALID)
- TC_TOKEN_ERR (CKR_ATTRIBUTE_VALUE_INVALID)
- TC_TOKEN_ERR (CKR_DATA_INVALID)
- TC_TOKEN_ERR (CKR_DATA_LEN_RANGE)
- TC_TOKEN_ERR (CKR_DEVICE_ERROR)
- TC_TOKEN_ERR (CKR_DEVICE_MEMORY)
- TC_TOKEN_ERR (CKR_DEVICE_REMOVED)
- TC_TOKEN_ERR (CKR_ENCRYPTED_DATA_INVALID)
- TC_TOKEN_ERR (CKR_ENCRYPTED_DATA_LEN_RANGE)
- TC_TOKEN_ERR (CKR_FUNCTION_CANCELED)
- TC_TOKEN_ERR (CKR_FUNCTION_NOT_PARALLEL)
- TC_TOKEN_ERR (CKR_FUNCTION_NOT_SUPPORTED)
- TC_TOKEN_ERR (CKR_KEY_HANDLE_INVALID)
- TC_TOKEN_ERR (CKR_KEY_SIZE_RANGE)
- TC_TOKEN_ERR (CKR_KEY_TYPE_INCONSISTENT)
- TC_TOKEN_ERR (CKR_KEY_NOT_NEEDED)
- TC_TOKEN_ERR (CKR_KEY_CHANGED)
- TC_TOKEN_ERR (CKR_KEY_NEEDED)
- TC_TOKEN_ERR (CKR_KEY_INDIGESTIBLE)
- TC_TOKEN_ERR (CKR_KEY_FUNCTION_NOT_PERMITTED)
- TC_TOKEN_ERR (CKR_KEY_NOT_WRAPPABLE)
- TC_TOKEN_ERR (CKR_KEY_UNEXTRACTABLE)
- TC_TOKEN_ERR (CKR_MECHANISM_INVALID)
- TC_TOKEN_ERR (CKR_MECHANISM_PARAM_INVALID)
- TC_TOKEN_ERR (CKR_OBJECT_HANDLE_INVALID)
- TC_TOKEN_ERR (CKR_OPERATION_ACTIVE)
- TC_TOKEN_ERR (CKR_OPERATION_NOT_INITIALIZED)
- TC_TOKEN_ERR (CKR_PIN_INCORRECT)
- TC_TOKEN_ERR (CKR_PIN_INVALID)
- TC_TOKEN_ERR (CKR_PIN_LEN_RANGE)
- TC_TOKEN_ERR (CKR_PIN_EXPIRED)
- TC_TOKEN_ERR (CKR_PIN_LOCKED)
- TC_TOKEN_ERR (CKR_SESSION_CLOSED)
- TC_TOKEN_ERR (CKR_SESSION_COUNT)
- TC_TOKEN_ERR (CKR_SESSION_HANDLE_INVALID)
- TC_TOKEN_ERR (CKR_SESSION_PARALLEL_NOT_SUPPORTED)
- TC_TOKEN_ERR (CKR_SESSION_READ_ONLY)
- TC_TOKEN_ERR (CKR_SESSION_EXISTS)
- TC_TOKEN_ERR (CKR_SESSION_READ_ONLY_EXISTS)
- TC_TOKEN_ERR (CKR_SESSION_READ_WRITE_SO_EXISTS)
- TC_TOKEN_ERR (CKR_SIGNATURE_INVALID)
- TC_TOKEN_ERR (CKR_SIGNATURE_LEN_RANGE)
- TC_TOKEN_ERR (CKR_TEMPLATE_INCOMPLETE)
- TC_TOKEN_ERR (CKR_TEMPLATE_INCONSISTENT)
- TC_TOKEN_ERR (CKR_TOKEN_NOT_PRESENT)
- TC_TOKEN_ERR (CKR_TOKEN_NOT_RECOGNIZED)
- TC_TOKEN_ERR (CKR_TOKEN_WRITE_PROTECTED)
- TC_TOKEN_ERR (CKR_UNWRAPPING_KEY_HANDLE_INVALID)
- TC_TOKEN_ERR (CKR_UNWRAPPING_KEY_SIZE_RANGE)
- TC_TOKEN_ERR (CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT)
- TC_TOKEN_ERR (CKR_USER_ALREADY_LOGGED_IN)
- TC_TOKEN_ERR (CKR_USER_NOT_LOGGED_IN)
- TC_TOKEN_ERR (CKR_USER_PIN_NOT_INITIALIZED)
- TC_TOKEN_ERR (CKR_USER_TYPE_INVALID)
- TC_TOKEN_ERR (CKR_USER_ANOTHER_ALREADY_LOGGED_IN)
- TC_TOKEN_ERR (CKR_USER_TOO_MANY_TYPES)
- TC_TOKEN_ERR (CKR_WRAPPED_KEY_INVALID)
- TC_TOKEN_ERR (CKR_WRAPPED_KEY_LEN_RANGE)
- TC_TOKEN_ERR (CKR_WRAPPING_KEY_HANDLE_INVALID)
- TC_TOKEN_ERR (CKR_WRAPPING_KEY_SIZE_RANGE)
- TC_TOKEN_ERR (CKR_WRAPPING_KEY_TYPE_INCONSISTENT)
- TC_TOKEN_ERR (CKR_RANDOM_SEED_NOT_SUPPORTED)
- TC_TOKEN_ERR (CKR_RANDOM_NO_RNG)
- TC_TOKEN_ERR (CKR_DOMAIN_PARAMS_INVALID)
- TC_TOKEN_ERR (CKR_BUFFER_TOO_SMALL)
- TC_TOKEN_ERR (CKR_SAVED_STATE_INVALID)
- TC_TOKEN_ERR (CKR_INFORMATION_SENSITIVE)
- TC_TOKEN_ERR (CKR_STATE_UNSAVEABLE)
- TC_TOKEN_ERR (CKR_CRYPTOKI_NOT_INITIALIZED)
- TC_TOKEN_ERR (CKR_CRYPTOKI_ALREADY_INITIALIZED)
- TC_TOKEN_ERR (CKR_MUTEX_BAD)
- TC_TOKEN_ERR (CKR_MUTEX_NOT_LOCKED)
- TC_TOKEN_ERR (CKR_NEW_PIN_MODE)
- TC_TOKEN_ERR (CKR_NEXT_OTP)
- TC_TOKEN_ERR (CKR_FUNCTION_REJECTED)
+ TC_TOKEN_ERR(CKR_CANCEL)
+ TC_TOKEN_ERR(CKR_HOST_MEMORY)
+ TC_TOKEN_ERR(CKR_SLOT_ID_INVALID)
+ TC_TOKEN_ERR(CKR_GENERAL_ERROR)
+ TC_TOKEN_ERR(CKR_FUNCTION_FAILED)
+ TC_TOKEN_ERR(CKR_ARGUMENTS_BAD)
+ TC_TOKEN_ERR(CKR_NO_EVENT)
+ TC_TOKEN_ERR(CKR_NEED_TO_CREATE_THREADS)
+ TC_TOKEN_ERR(CKR_CANT_LOCK)
+ TC_TOKEN_ERR(CKR_ATTRIBUTE_READ_ONLY)
+ TC_TOKEN_ERR(CKR_ATTRIBUTE_SENSITIVE)
+ TC_TOKEN_ERR(CKR_ATTRIBUTE_TYPE_INVALID)
+ TC_TOKEN_ERR(CKR_ATTRIBUTE_VALUE_INVALID)
+ TC_TOKEN_ERR(CKR_DATA_INVALID)
+ TC_TOKEN_ERR(CKR_DATA_LEN_RANGE)
+ TC_TOKEN_ERR(CKR_DEVICE_ERROR)
+ TC_TOKEN_ERR(CKR_DEVICE_MEMORY)
+ TC_TOKEN_ERR(CKR_DEVICE_REMOVED)
+ TC_TOKEN_ERR(CKR_ENCRYPTED_DATA_INVALID)
+ TC_TOKEN_ERR(CKR_ENCRYPTED_DATA_LEN_RANGE)
+ TC_TOKEN_ERR(CKR_FUNCTION_CANCELED)
+ TC_TOKEN_ERR(CKR_FUNCTION_NOT_PARALLEL)
+ TC_TOKEN_ERR(CKR_FUNCTION_NOT_SUPPORTED)
+ TC_TOKEN_ERR(CKR_KEY_HANDLE_INVALID)
+ TC_TOKEN_ERR(CKR_KEY_SIZE_RANGE)
+ TC_TOKEN_ERR(CKR_KEY_TYPE_INCONSISTENT)
+ TC_TOKEN_ERR(CKR_KEY_NOT_NEEDED)
+ TC_TOKEN_ERR(CKR_KEY_CHANGED)
+ TC_TOKEN_ERR(CKR_KEY_NEEDED)
+ TC_TOKEN_ERR(CKR_KEY_INDIGESTIBLE)
+ TC_TOKEN_ERR(CKR_KEY_FUNCTION_NOT_PERMITTED)
+ TC_TOKEN_ERR(CKR_KEY_NOT_WRAPPABLE)
+ TC_TOKEN_ERR(CKR_KEY_UNEXTRACTABLE)
+ TC_TOKEN_ERR(CKR_MECHANISM_INVALID)
+ TC_TOKEN_ERR(CKR_MECHANISM_PARAM_INVALID)
+ TC_TOKEN_ERR(CKR_OBJECT_HANDLE_INVALID)
+ TC_TOKEN_ERR(CKR_OPERATION_ACTIVE)
+ TC_TOKEN_ERR(CKR_OPERATION_NOT_INITIALIZED)
+ TC_TOKEN_ERR(CKR_PIN_INCORRECT)
+ TC_TOKEN_ERR(CKR_PIN_INVALID)
+ TC_TOKEN_ERR(CKR_PIN_LEN_RANGE)
+ TC_TOKEN_ERR(CKR_PIN_EXPIRED)
+ TC_TOKEN_ERR(CKR_PIN_LOCKED)
+ TC_TOKEN_ERR(CKR_SESSION_CLOSED)
+ TC_TOKEN_ERR(CKR_SESSION_COUNT)
+ TC_TOKEN_ERR(CKR_SESSION_HANDLE_INVALID)
+ TC_TOKEN_ERR(CKR_SESSION_PARALLEL_NOT_SUPPORTED)
+ TC_TOKEN_ERR(CKR_SESSION_READ_ONLY)
+ TC_TOKEN_ERR(CKR_SESSION_EXISTS)
+ TC_TOKEN_ERR(CKR_SESSION_READ_ONLY_EXISTS)
+ TC_TOKEN_ERR(CKR_SESSION_READ_WRITE_SO_EXISTS)
+ TC_TOKEN_ERR(CKR_SIGNATURE_INVALID)
+ TC_TOKEN_ERR(CKR_SIGNATURE_LEN_RANGE)
+ TC_TOKEN_ERR(CKR_TEMPLATE_INCOMPLETE)
+ TC_TOKEN_ERR(CKR_TEMPLATE_INCONSISTENT)
+ TC_TOKEN_ERR(CKR_TOKEN_NOT_PRESENT)
+ TC_TOKEN_ERR(CKR_TOKEN_NOT_RECOGNIZED)
+ TC_TOKEN_ERR(CKR_TOKEN_WRITE_PROTECTED)
+ TC_TOKEN_ERR(CKR_UNWRAPPING_KEY_HANDLE_INVALID)
+ TC_TOKEN_ERR(CKR_UNWRAPPING_KEY_SIZE_RANGE)
+ TC_TOKEN_ERR(CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT)
+ TC_TOKEN_ERR(CKR_USER_ALREADY_LOGGED_IN)
+ TC_TOKEN_ERR(CKR_USER_NOT_LOGGED_IN)
+ TC_TOKEN_ERR(CKR_USER_PIN_NOT_INITIALIZED)
+ TC_TOKEN_ERR(CKR_USER_TYPE_INVALID)
+ TC_TOKEN_ERR(CKR_USER_ANOTHER_ALREADY_LOGGED_IN)
+ TC_TOKEN_ERR(CKR_USER_TOO_MANY_TYPES)
+ TC_TOKEN_ERR(CKR_WRAPPED_KEY_INVALID)
+ TC_TOKEN_ERR(CKR_WRAPPED_KEY_LEN_RANGE)
+ TC_TOKEN_ERR(CKR_WRAPPING_KEY_HANDLE_INVALID)
+ TC_TOKEN_ERR(CKR_WRAPPING_KEY_SIZE_RANGE)
+ TC_TOKEN_ERR(CKR_WRAPPING_KEY_TYPE_INCONSISTENT)
+ TC_TOKEN_ERR(CKR_RANDOM_SEED_NOT_SUPPORTED)
+ TC_TOKEN_ERR(CKR_RANDOM_NO_RNG)
+ TC_TOKEN_ERR(CKR_DOMAIN_PARAMS_INVALID)
+ TC_TOKEN_ERR(CKR_BUFFER_TOO_SMALL)
+ TC_TOKEN_ERR(CKR_SAVED_STATE_INVALID)
+ TC_TOKEN_ERR(CKR_INFORMATION_SENSITIVE)
+ TC_TOKEN_ERR(CKR_STATE_UNSAVEABLE)
+ TC_TOKEN_ERR(CKR_CRYPTOKI_NOT_INITIALIZED)
+ TC_TOKEN_ERR(CKR_CRYPTOKI_ALREADY_INITIALIZED)
+ TC_TOKEN_ERR(CKR_MUTEX_BAD)
+ TC_TOKEN_ERR(CKR_MUTEX_NOT_LOCKED)
+ TC_TOKEN_ERR(CKR_NEW_PIN_MODE)
+ TC_TOKEN_ERR(CKR_NEXT_OTP)
+ TC_TOKEN_ERR(CKR_FUNCTION_REJECTED)
#undef TC_TOKEN_ERR
};
- for (size_t i = 0; i < array_capacity (ErrorStrings); ++i)
+ for (size_t i = 0; i < array_capacity(ErrorStrings); ++i)
{
if (ErrorStrings[i].ErrorCode == ErrorCode)
return ErrorStrings[i].ErrorString;
@@ -690,9 +698,9 @@ namespace VeraCrypt
}
#ifdef TC_HEADER_Common_Exception
- void Pkcs11Exception::Show (HWND parent) const
+ void Pkcs11Exception::Show(HWND parent) const
{
- string errorString = string (*this);
+ string errorString = string(*this);
if (!errorString.empty())
{
@@ -700,11 +708,11 @@ namespace VeraCrypt
if (SubjectErrorCodeValid)
subjectErrorCode << L": " << SubjectErrorCode;
- if (!GetDictionaryValue (errorString.c_str()))
+ if (!GetDictionaryValue(errorString.c_str()))
{
- if (errorString.find ("CKR_") == 0)
+ if (errorString.find("CKR_") == 0)
{
- errorString = errorString.substr (4);
+ errorString = errorString.substr(4);
for (size_t i = 0; i < errorString.size(); ++i)
{
if (errorString[i] == '_')
@@ -712,17 +720,17 @@ namespace VeraCrypt
}
}
wchar_t err[8192];
- StringCbPrintfW (err, sizeof(err),L"%s:\n\n%hs%s", GetString ("SECURITY_TOKEN_ERROR"), errorString.c_str(), subjectErrorCode.str().c_str());
- ErrorDirect (err, parent);
+ StringCbPrintfW(err, sizeof(err), L"%s:\n\n%hs%s", GetString("SECURITY_TOKEN_ERROR"), errorString.c_str(), subjectErrorCode.str().c_str());
+ ErrorDirect(err, parent);
}
else
{
- wstring err = GetString (errorString.c_str());
+ wstring err = GetString(errorString.c_str());
if (SubjectErrorCodeValid)
err += L"\n\nError code" + subjectErrorCode.str();
- ErrorDirect (err.c_str(), parent);
+ ErrorDirect(err.c_str(), parent);
}
}
}
@@ -738,36 +746,36 @@ namespace VeraCrypt
#ifdef TC_WINDOWS
HMODULE SecurityToken::Pkcs11LibraryHandle;
#else
- void *SecurityToken::Pkcs11LibraryHandle;
+ void* SecurityToken::Pkcs11LibraryHandle;
#endif
#ifdef TC_HEADER_Platform_Exception
- void Pkcs11Exception::Deserialize (shared_ptr <Stream> stream)
+ void Pkcs11Exception::Deserialize(shared_ptr <Stream> stream)
{
- Exception::Deserialize (stream);
- Serializer sr (stream);
+ Exception::Deserialize(stream);
+ Serializer sr(stream);
uint64 code;
- sr.Deserialize ("ErrorCode", code);
- sr.Deserialize ("SubjectErrorCodeValid", SubjectErrorCodeValid);
- sr.Deserialize ("SubjectErrorCode", SubjectErrorCode);
- ErrorCode = (CK_RV) code;
+ sr.Deserialize("ErrorCode", code);
+ sr.Deserialize("SubjectErrorCodeValid", SubjectErrorCodeValid);
+ sr.Deserialize("SubjectErrorCode", SubjectErrorCode);
+ ErrorCode = (CK_RV)code;
}
- void Pkcs11Exception::Serialize (shared_ptr <Stream> stream) const
+ void Pkcs11Exception::Serialize(shared_ptr <Stream> stream) const
{
- Exception::Serialize (stream);
- Serializer sr (stream);
- sr.Serialize ("ErrorCode", (uint64) ErrorCode);
- sr.Serialize ("SubjectErrorCodeValid", SubjectErrorCodeValid);
- sr.Serialize ("SubjectErrorCode", SubjectErrorCode);
+ Exception::Serialize(stream);
+ Serializer sr(stream);
+ sr.Serialize("ErrorCode", (uint64)ErrorCode);
+ sr.Serialize("SubjectErrorCodeValid", SubjectErrorCodeValid);
+ sr.Serialize("SubjectErrorCode", SubjectErrorCode);
}
# define TC_EXCEPTION(TYPE) TC_SERIALIZER_FACTORY_ADD(TYPE)
# undef TC_EXCEPTION_NODECL
# define TC_EXCEPTION_NODECL(TYPE) TC_SERIALIZER_FACTORY_ADD(TYPE)
- TC_SERIALIZER_FACTORY_ADD_EXCEPTION_SET (SecurityTokenException);
+ TC_SERIALIZER_FACTORY_ADD_EXCEPTION_SET(SecurityTokenException);
#endif
}
diff --git a/src/Common/SecurityToken.h b/src/Common/SecurityToken.h
index 6b228895..4dff42fa 100644
--- a/src/Common/SecurityToken.h
+++ b/src/Common/SecurityToken.h
@@ -53,62 +53,59 @@
#define TC_SECURITY_TOKEN_KEYFILE_URL_SLOT L"slot"
#define TC_SECURITY_TOKEN_KEYFILE_URL_FILE L"file"
+#include "Token.h"
+
namespace VeraCrypt
{
- struct SecurityTokenInfo
+ struct SecurityTokenInfo: TokenInfo
{
- CK_SLOT_ID SlotId;
+ virtual ~SecurityTokenInfo() {};
+ virtual BOOL isEditable() const {return true;}
+
CK_FLAGS Flags;
- wstring Label;
string LabelUtf8;
};
- struct SecurityTokenKeyfilePath
+ struct SecurityTokenKeyfile: TokenKeyfile
{
- SecurityTokenKeyfilePath () { }
- SecurityTokenKeyfilePath (const wstring &path) : Path (path) { }
- operator wstring () const { return Path; }
- wstring Path;
- };
+ SecurityTokenKeyfile();
- struct SecurityTokenKeyfile
- {
- SecurityTokenKeyfile () : Handle(CK_INVALID_HANDLE), SlotId(CK_UNAVAILABLE_INFORMATION) { Token.SlotId = CK_UNAVAILABLE_INFORMATION; Token.Flags = 0; }
- SecurityTokenKeyfile (const SecurityTokenKeyfilePath &path);
+ SecurityTokenKeyfile(const TokenKeyfilePath& path);
- operator SecurityTokenKeyfilePath () const;
+ virtual ~SecurityTokenKeyfile() {}
+
+ operator TokenKeyfilePath () const;
+
+ void GetKeyfileData(vector<byte>& keyfileData) const;
- CK_OBJECT_HANDLE Handle;
- wstring Id;
string IdUtf8;
- CK_SLOT_ID SlotId;
- SecurityTokenInfo Token;
+ CK_OBJECT_HANDLE Handle;
};
- struct Pkcs11Exception : public Exception
+ struct Pkcs11Exception: public Exception
{
- Pkcs11Exception (CK_RV errorCode = (CK_RV) -1)
- : ErrorCode (errorCode),
- SubjectErrorCodeValid (false),
- SubjectErrorCode( (uint64) -1)
+ Pkcs11Exception(CK_RV errorCode = (CK_RV)-1)
+ : ErrorCode(errorCode),
+ SubjectErrorCodeValid(false),
+ SubjectErrorCode((uint64)-1)
{
}
- Pkcs11Exception (CK_RV errorCode, uint64 subjectErrorCode)
- : ErrorCode (errorCode),
- SubjectErrorCodeValid (true),
- SubjectErrorCode (subjectErrorCode)
+ Pkcs11Exception(CK_RV errorCode, uint64 subjectErrorCode)
+ : ErrorCode(errorCode),
+ SubjectErrorCodeValid(true),
+ SubjectErrorCode(subjectErrorCode)
{
}
#ifdef TC_HEADER_Platform_Exception
- virtual ~Pkcs11Exception () throw () { }
- TC_SERIALIZABLE_EXCEPTION (Pkcs11Exception);
+ virtual ~Pkcs11Exception() throw () { }
+ TC_SERIALIZABLE_EXCEPTION(Pkcs11Exception);
#else
- void Show (HWND parent) const;
+ void Show(HWND parent) const;
#endif
operator string () const;
- CK_RV GetErrorCode () const { return ErrorCode; }
+ CK_RV GetErrorCode() const { return ErrorCode; }
protected:
CK_RV ErrorCode;
@@ -135,24 +132,24 @@ namespace VeraCrypt
#else // !TC_HEADER_Platform_Exception
- struct SecurityTokenLibraryNotInitialized : public Exception
+ struct SecurityTokenLibraryNotInitialized: public Exception
{
- void Show (HWND parent) const { Error (SecurityTokenLibraryPath[0] == 0 ? "NO_PKCS11_MODULE_SPECIFIED" : "PKCS11_MODULE_INIT_FAILED", parent); }
+ void Show(HWND parent) const { Error(SecurityTokenLibraryPath[0] == 0 ? "NO_PKCS11_MODULE_SPECIFIED" : "PKCS11_MODULE_INIT_FAILED", parent); }
};
- struct InvalidSecurityTokenKeyfilePath : public Exception
+ struct InvalidSecurityTokenKeyfilePath: public Exception
{
- void Show (HWND parent) const { Error ("INVALID_TOKEN_KEYFILE_PATH", parent); }
+ void Show(HWND parent) const { Error("INVALID_TOKEN_KEYFILE_PATH", parent); }
};
- struct SecurityTokenKeyfileAlreadyExists : public Exception
+ struct SecurityTokenKeyfileAlreadyExists: public Exception
{
- void Show (HWND parent) const { Error ("TOKEN_KEYFILE_ALREADY_EXISTS", parent); }
+ void Show(HWND parent) const { Error("TOKEN_KEYFILE_ALREADY_EXISTS", parent); }
};
- struct SecurityTokenKeyfileNotFound : public Exception
+ struct SecurityTokenKeyfileNotFound: public Exception
{
- void Show (HWND parent) const { Error ("TOKEN_KEYFILE_NOT_FOUND", parent); }
+ void Show(HWND parent) const { Error("TOKEN_KEYFILE_NOT_FOUND", parent); }
};
#endif // !TC_HEADER_Platform_Exception
@@ -160,7 +157,7 @@ namespace VeraCrypt
struct Pkcs11Session
{
- Pkcs11Session () : Handle (CK_UNAVAILABLE_INFORMATION), UserLoggedIn (false) { }
+ Pkcs11Session(): Handle(CK_UNAVAILABLE_INFORMATION), UserLoggedIn(false) { }
CK_SESSION_HANDLE Handle;
bool UserLoggedIn;
@@ -168,47 +165,46 @@ namespace VeraCrypt
struct GetPinFunctor
{
- virtual ~GetPinFunctor () { }
- virtual void operator() (string &str) = 0;
- virtual void notifyIncorrectPin () = 0;
+ virtual ~GetPinFunctor() { }
+ virtual void operator() (string& str) = 0;
+ virtual void notifyIncorrectPin() = 0;
};
struct SendExceptionFunctor
{
- virtual ~SendExceptionFunctor () { }
- virtual void operator() (const Exception &e) = 0;
+ virtual ~SendExceptionFunctor() { }
+ virtual void operator() (const Exception& e) = 0;
};
class SecurityToken
{
public:
- static void CloseAllSessions () throw ();
- static void CloseLibrary ();
- static void CreateKeyfile (CK_SLOT_ID slotId, vector <byte> &keyfileData, const string &name);
- static void DeleteKeyfile (const SecurityTokenKeyfile &keyfile);
- static vector <SecurityTokenKeyfile> GetAvailableKeyfiles (CK_SLOT_ID *slotIdFilter = nullptr, const wstring keyfileIdFilter = wstring());
- static void GetKeyfileData (const SecurityTokenKeyfile &keyfile, vector <byte> &keyfileData);
- static list <SecurityTokenInfo> GetAvailableTokens ();
- static SecurityTokenInfo GetTokenInfo (CK_SLOT_ID slotId);
+ static void CloseAllSessions() throw ();
+ static void CloseLibrary();
+ static void CreateKeyfile(CK_SLOT_ID slotId, vector <byte>& keyfileData, const string& name);
+ static void DeleteKeyfile(const SecurityTokenKeyfile& keyfile);
+ static vector <SecurityTokenKeyfile> GetAvailableKeyfiles(CK_SLOT_ID* slotIdFilter = nullptr, const wstring keyfileIdFilter = wstring());
+ static list <SecurityTokenInfo> GetAvailableTokens();
+ static SecurityTokenInfo GetTokenInfo(CK_SLOT_ID slotId);
#ifdef TC_WINDOWS
- static void InitLibrary (const wstring &pkcs11LibraryPath, unique_ptr <GetPinFunctor> pinCallback, unique_ptr <SendExceptionFunctor> warningCallback);
+ static void InitLibrary(const wstring& pkcs11LibraryPath, unique_ptr <GetPinFunctor> pinCallback, unique_ptr <SendExceptionFunctor> warningCallback);
#else
- static void InitLibrary (const string &pkcs11LibraryPath, unique_ptr <GetPinFunctor> pinCallback, unique_ptr <SendExceptionFunctor> warningCallback);
+ static void InitLibrary(const string& pkcs11LibraryPath, unique_ptr <GetPinFunctor> pinCallback, unique_ptr <SendExceptionFunctor> warningCallback);
#endif
- static bool IsInitialized () { return Initialized; }
- static bool IsKeyfilePathValid (const wstring &securityTokenKeyfilePath);
+ static bool IsInitialized() { return Initialized; }
+ static bool IsKeyfilePathValid(const wstring& securityTokenKeyfilePath);
static const size_t MaxPasswordLength = 128;
protected:
- static void CloseSession (CK_SLOT_ID slotId);
- static vector <CK_OBJECT_HANDLE> GetObjects (CK_SLOT_ID slotId, CK_ATTRIBUTE_TYPE objectClass);
- static void GetObjectAttribute (CK_SLOT_ID slotId, CK_OBJECT_HANDLE tokenObject, CK_ATTRIBUTE_TYPE attributeType, vector <byte> &attributeValue);
- static list <CK_SLOT_ID> GetTokenSlots ();
- static void Login (CK_SLOT_ID slotId, const char* pin);
- static void LoginUserIfRequired (CK_SLOT_ID slotId);
- static void OpenSession (CK_SLOT_ID slotId);
- static void CheckLibraryStatus ();
+ static void CloseSession(CK_SLOT_ID slotId);
+ static vector <CK_OBJECT_HANDLE> GetObjects(CK_SLOT_ID slotId, CK_ATTRIBUTE_TYPE objectClass);
+ static void GetObjectAttribute(CK_SLOT_ID slotId, CK_OBJECT_HANDLE tokenObject, CK_ATTRIBUTE_TYPE attributeType, vector <byte>& attributeValue);
+ static list <CK_SLOT_ID> GetTokenSlots();
+ static void Login(CK_SLOT_ID slotId, const char* pin);
+ static void LoginUserIfRequired(CK_SLOT_ID slotId);
+ static void OpenSession(CK_SLOT_ID slotId);
+ static void CheckLibraryStatus();
static bool Initialized;
static unique_ptr <GetPinFunctor> PinCallback;
@@ -216,10 +212,12 @@ namespace VeraCrypt
#ifdef TC_WINDOWS
static HMODULE Pkcs11LibraryHandle;
#else
- static void *Pkcs11LibraryHandle;
+ static void* Pkcs11LibraryHandle;
#endif
static map <CK_SLOT_ID, Pkcs11Session> Sessions;
static unique_ptr <SendExceptionFunctor> WarningCallback;
+
+ friend void SecurityTokenKeyfile::GetKeyfileData(vector <byte>& keyfileData) const;
};
}
diff --git a/src/Common/TLVParser.cpp b/src/Common/TLVParser.cpp
new file mode 100644
index 00000000..9a177007
--- /dev/null
+++ b/src/Common/TLVParser.cpp
@@ -0,0 +1,187 @@
+#include "TLVParser.h"
+#include <string.h>
+
+using namespace std;
+
+namespace VeraCrypt
+{
+ /* TLV node structure creation */
+ shared_ptr<TLVNode> TLVParser::TLV_CreateNode()
+ {
+ shared_ptr<TLVNode> node = shared_ptr<TLVNode>(new TLVNode());
+ return node;
+ }
+
+ /* Check if the bit is correct */
+ uint16 TLVParser::CheckBit(byte value, int bit)
+ {
+ unsigned char bitvalue[8] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};
+
+ if ((bit >= 1) && (bit <= 8))
+ {
+ if (value & bitvalue[bit-1])
+ {
+ return (1);
+ }
+ else
+ {
+ return (0);
+ }
+ }
+ else
+ {
+ throw TLVException("FILE:"+string(__FILE__)+"LINE: "+to_string(static_cast<long long>((__LINE__)))+" fonction parameter incorrect! bit=["+to_string(static_cast<long long>(bit)));
+ //return(2);
+ }
+ }
+
+ /* Parsing one TLV node */
+ shared_ptr<TLVNode> TLVParser::TLV_Parse_One(byte* buf, size_t size)
+ {
+ size_t index = 0;
+ size_t i = 0;
+ byte tag1, tag2, tagsize;
+ byte len, lensize;
+ shared_ptr<vector<byte>> value = make_shared<vector<byte>>();
+ shared_ptr<TLVNode> node = TLV_CreateNode();
+
+ tag1 = tag2 = 0;
+ tagsize = 1;
+ tag1 = buf[index++];
+ if ((tag1 & 0x1f) == 0x1f)
+ {
+ tagsize++;
+ tag2 = buf[index++];
+ //tag2 b8 must be 0!
+ }
+ if (tagsize == 1)
+ {
+ node->Tag = tag1;
+ }
+ else
+ {
+ node->Tag = (tag1 << 8) + tag2;
+ }
+ node->TagSize = tagsize;
+
+ //SubFlag
+ node->SubFlag = CheckBit(tag1,6);
+
+ //L zone
+ len = 0;
+ lensize = 1;
+ len = buf[index++];
+ if (CheckBit(len,8) == 0)
+ {
+ node->Length = len;
+ }
+ else
+ {
+ lensize = len & 0x7f;
+ len = 0;
+ for (i = 0; i < lensize; i++)
+ {
+ len += (uint16)buf[index++] << (i*8);
+ }
+ lensize++;
+ }
+ node->Length = len;
+ node->LengthSize = lensize;
+
+ //V zone
+ value->resize(len);
+ memcpy(value->data(), buf + index, len);
+ node->Value = value;
+ index += len;
+
+ if (index < size)
+ {
+ node->MoreFlag = 1;
+ }
+ else if(index == size)
+ {
+ node->MoreFlag = 0;
+ }
+ else
+ {
+ throw TLVException("Parse Error! index="+to_string(static_cast<long long>(index))+"size="+to_string(static_cast<long long>(size)));
+ }
+
+ return node;
+ }
+
+ /* Parsing all sub-nodes (in width not in depth) of a given parent node */
+ int TLVParser::TLV_Parse_SubNodes(shared_ptr<TLVNode> parent)
+ {
+ uint16 sublen = 0;
+ size_t i;
+
+ //No sub-nodes
+ if (parent->SubFlag == 0)
+ return 0;
+
+ for (i = 0; i < parent->Subs->size(); i++)
+ {
+ sublen += (parent->Subs->at(i)->TagSize + parent->Subs->at(i)->Length + parent->Subs->at(i)->LengthSize);
+ }
+
+ if (sublen < parent->Value->size())
+ {
+ shared_ptr<TLVNode> subnode = TLV_Parse_One(parent->Value->data() + sublen, parent->Value->size() - sublen);
+ parent->Subs->push_back(subnode);
+ return subnode->MoreFlag;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ /* Recursive function to parse all nodes starting from a root parent node */
+ void TLVParser::TLV_Parse_Sub(shared_ptr<TLVNode> parent)
+ {
+ size_t i;
+ if (parent->SubFlag != 0)
+ {
+ // Parse all sub nodes.
+ while (TLV_Parse_SubNodes(parent) != 0);
+
+ for (i = 0; i < parent->Subs->size(); i++)
+ {
+ if (parent->Subs->at(i)->SubFlag != 0)
+ {
+ TLV_Parse_Sub(parent->Subs->at(i));
+ }
+ }
+ }
+ }
+
+ /* Parsing TLV from a buffer and constructing TLV structure */
+ shared_ptr<TLVNode> TLVParser::TLV_Parse(byte* buf, size_t size)
+ {
+ shared_ptr<TLVNode> node = TLV_Parse_One(buf, size);
+ TLV_Parse_Sub(node);
+
+ return node;
+ }
+
+ /* Finding a TLV node with a particular tag */
+ shared_ptr<TLVNode> TLVParser::TLV_Find(shared_ptr<TLVNode> node, uint16 tag)
+ {
+ size_t i = 0;
+ shared_ptr<TLVNode> tmpnode = NULL;
+ if (node->Tag == tag)
+ {
+ return node;
+ }
+ for (i = 0; i < node->Subs->size(); i++)
+ {
+ tmpnode = TLV_Find(node->Subs->at(i),tag);
+ if (tmpnode != NULL)
+ {
+ return tmpnode;
+ }
+ }
+ return NULL;
+ }
+} \ No newline at end of file
diff --git a/src/Common/TLVParser.h b/src/Common/TLVParser.h
new file mode 100644
index 00000000..b989ca41
--- /dev/null
+++ b/src/Common/TLVParser.h
@@ -0,0 +1,80 @@
+#ifndef TC_HEADER_Common_TLVPARSER
+#define TC_HEADER_Common_TLVPARSER
+
+#include "Platform/PlatformBase.h"
+#include "Tcdefs.h"
+
+namespace VeraCrypt
+{
+ struct TLVNode
+ {
+ uint16 Tag; /* T */
+ uint16 Length; /* L */
+ shared_ptr<vector<byte>> Value; /* V */
+ byte TagSize;
+ byte LengthSize;
+ uint16 MoreFlag; /* Used In Sub */
+ uint16 SubFlag; /* Does it have sub-nodes? */
+ shared_ptr<vector<shared_ptr<TLVNode>>> Subs;
+
+ TLVNode() : Tag(0), Length(0), TagSize(0), LengthSize(0), MoreFlag(0), SubFlag(0)
+ {
+ Value = make_shared<vector<byte>>();
+ Subs = make_shared<vector<shared_ptr<TLVNode>>>();
+ }
+
+ ~TLVNode()
+ {
+ burn(Value->data(), Value->size());
+ }
+ };
+
+ class TLVParser
+ {
+ private :
+
+ /* TLV node structure creation */
+ static shared_ptr<TLVNode> TLV_CreateNode();
+
+ /* Check if the bit is correct */
+ static uint16 CheckBit(byte value, int bit);
+
+ /* Parsing one TLV node */
+ static shared_ptr<TLVNode> TLV_Parse_One(byte* buf, size_t size);
+
+ /* Parsing all TLV nodes */
+ static int TLV_Parse_SubNodes(shared_ptr<TLVNode> parent);
+
+ /* Parsing all sub-nodes (in width not in depth) of a given parent node */
+ static int TLV_Parse_All(shared_ptr<TLVNode> parent);
+
+ /* Recursive function to parse all nodes starting from a root parent node */
+ static void TLV_Parse_Sub(shared_ptr<TLVNode> parent);
+
+ public:
+
+ /* Parsing TLV from a buffer and constructing TLV structure */
+ static shared_ptr<TLVNode> TLV_Parse(byte* buf, size_t size);
+
+ /* Finding a TLV node with a particular tag */
+ static shared_ptr<TLVNode> TLV_Find(shared_ptr<TLVNode> node, uint16 tag);
+ };
+
+ /* The definition of the exception class related to the TLV parsing */
+ class TLVException
+ {
+ public:
+ TLVException(std::string errormessage): m_errormessage(errormessage){}
+
+ /* Get the error message */
+ inline std::string ErrorMessage() const
+ {
+ return m_errormessage;
+ }
+
+ protected:
+ std::string m_errormessage;
+ };
+}
+
+#endif //TC_HEADER_Common_TLVPARSER
diff --git a/src/Common/Tcdefs.h b/src/Common/Tcdefs.h
index eb8fefdc..1118e522 100644
--- a/src/Common/Tcdefs.h
+++ b/src/Common/Tcdefs.h
@@ -59,7 +59,7 @@ extern unsigned short _rotl16(unsigned short value, unsigned char shift);
#define TC_APP_NAME "VeraCrypt"
// Version displayed to user
-#define VERSION_STRING "1.26"
+#define VERSION_STRING "1.26.10"
#ifdef VC_EFI_CUSTOM_MODE
#define VERSION_STRING_SUFFIX "-CustomEFI"
@@ -73,9 +73,9 @@ extern unsigned short _rotl16(unsigned short value, unsigned char shift);
#define VERSION_NUM 0x0126
// Release date
-#define TC_STR_RELEASE_DATE L"March 21, 2022"
-#define TC_RELEASE_DATE_YEAR 2022
-#define TC_RELEASE_DATE_MONTH 03
+#define TC_STR_RELEASE_DATE L"November 8, 2023"
+#define TC_RELEASE_DATE_YEAR 2023
+#define TC_RELEASE_DATE_MONTH 11
#define BYTES_PER_KB 1024LL
#define BYTES_PER_MB 1048576LL
@@ -305,6 +305,10 @@ typedef NTSTATUS (NTAPI *ExGetFirmwareEnvironmentVariableFn) (
PULONG Attributes
);
+typedef ULONG64 (NTAPI *KeQueryInterruptTimePreciseFn)(
+ PULONG64 QpcTimeStamp
+);
+
typedef BOOLEAN (NTAPI *KeAreAllApcsDisabledFn) ();
typedef void (NTAPI *KeSetSystemGroupAffinityThreadFn)(
@@ -344,7 +348,11 @@ extern BOOLEAN VC_KeAreAllApcsDisabled (VOID);
#ifndef TC_LOCAL_WIN32_WINNT_OVERRIDE
# undef _WIN32_WINNT
-# define _WIN32_WINNT 0x0501 /* Does not apply to the driver */
+#ifdef _M_ARM64
+# define _WIN32_WINNT 0x0A00
+#else
+# define _WIN32_WINNT 0x0601 /* Does not apply to the driver */
+#endif
#endif
#include <windows.h> /* Windows header */
@@ -487,9 +495,8 @@ enum
ERR_SYS_HIDVOL_HEAD_REENC_MODE_WRONG = 31,
ERR_NONSYS_INPLACE_ENC_INCOMPLETE = 32,
ERR_USER_ABORT = 33,
- ERR_UNSUPPORTED_TRUECRYPT_FORMAT = 34,
- ERR_RAND_INIT_FAILED = 35,
- ERR_CAPI_INIT_FAILED = 36
+ ERR_RAND_INIT_FAILED = 34,
+ ERR_CAPI_INIT_FAILED = 35
};
#endif // #ifndef TCDEFS_H
diff --git a/src/Common/Tests.c b/src/Common/Tests.c
index 4f53d4ed..82564a84 100644
--- a/src/Common/Tests.c
+++ b/src/Common/Tests.c
@@ -311,6 +311,9 @@ AES_TEST aes_ecb_vectors[AES_TEST_COUNT] = {
0x8e,0xa2,0xb7,0xca,0x51,0x67,0x45,0xbf,0xea,0xfc,0x49,0x90,0x4b,0x49,0x60,0x89
};
+
+#ifndef WOLFCRYPT_BACKEND
+
// Serpent ECB test vectors
#define SERPENT_TEST_COUNT 1
@@ -419,6 +422,7 @@ KUZNYECHIK_TEST kuznyechik_vectors[KUZNYECHIK_TEST_COUNT] = {
}
};
+#endif
/* Test vectors from FIPS 198a, RFC 4231, RFC 2104, RFC 2202, and other sources. */
@@ -784,6 +788,7 @@ BOOL TestSectorBufEncryption (PCRYPTO_INFO ci)
break;
}
}
+ #ifndef WOLFCRYPT_BACKEND
else if (wcscmp (name, L"Serpent") == 0)
{
switch (testCase)
@@ -1148,7 +1153,7 @@ BOOL TestSectorBufEncryption (PCRYPTO_INFO ci)
break;
}
}
-
+ #endif
if (crc == 0x9f5edd58)
return FALSE;
@@ -1200,6 +1205,7 @@ BOOL TestSectorBufEncryption (PCRYPTO_INFO ci)
return FALSE;
nTestsPerformed++;
}
+ #ifndef WOLFCRYPT_BACKEND
else if (wcscmp (name, L"Serpent") == 0)
{
if (crc != 0x3494d480)
@@ -1284,7 +1290,7 @@ BOOL TestSectorBufEncryption (PCRYPTO_INFO ci)
return FALSE;
nTestsPerformed++;
}
-
+ #endif
if (crc == 0x9f5edd58)
return FALSE;
@@ -1357,6 +1363,7 @@ static BOOL DoAutoTestAlgorithms (void)
bFailed = TRUE;
}
+ #ifndef WOLFCRYPT_BACKEND
/* Serpent */
for (i = 0; i < SERPENT_TEST_COUNT; i++)
@@ -1437,6 +1444,7 @@ static BOOL DoAutoTestAlgorithms (void)
}
if (i != KUZNYECHIK_TEST_COUNT)
bFailed = TRUE;
+ #endif
/* PKCS #5 and HMACs */
if (!test_pkcs5 ())
@@ -1565,6 +1573,7 @@ BOOL test_hmac_sha512 ()
return (nTestsPerformed == 6);
}
+#ifndef WOLFCRYPT_BACKEND
BOOL test_hmac_blake2s ()
{
unsigned int i;
@@ -1609,6 +1618,7 @@ BOOL test_hmac_whirlpool ()
return TRUE;
}
+#endif
/* http://www.tc26.ru/methods/recommendation/%D0%A2%D0%9A26%D0%90%D0%9B%D0%93.pdf */
/* https://tools.ietf.org/html/draft-smyshlyaev-gost-usage-00 */
@@ -1633,6 +1643,7 @@ static const unsigned char gost3411_2012_hmac_r1[] = {
};
+#ifndef WOLFCRYPT_BACKEND
BOOL test_hmac_streebog ()
{
CRYPTOPP_ALIGN_DATA(16) char digest[64]; /* large enough to hold digets and test vector inputs */
@@ -1653,6 +1664,7 @@ int __cdecl StreebogHash (unsigned char* input, unsigned long inputLen, unsigned
STREEBOG_finalize (&ctx, output);
return STREEBOG_DIGESTSIZE;
}
+#endif
BOOL test_pkcs5 ()
{
@@ -1666,6 +1678,7 @@ BOOL test_pkcs5 ()
if (!test_hmac_sha512())
return FALSE;
+#ifndef WOLFCRYPT_BACKEND
/* HMAC-BLAKE2s tests */
if (test_hmac_blake2s() == FALSE)
return FALSE;
@@ -1685,7 +1698,7 @@ BOOL test_pkcs5 ()
/* STREEBOG hash tests */
if (RunHashTest (StreebogHash, Streebog512TestVectors, (HasSSE2() || HasSSE41())? TRUE : FALSE) == FALSE)
return FALSE;
-
+#endif
/* PKCS-5 test 1 with HMAC-SHA-256 used as the PRF (https://tools.ietf.org/html/draft-josefsson-scrypt-kdf-00) */
derive_key_sha256 ("passwd", 6, "\x73\x61\x6C\x74", 4, 1, dk, 64);
if (memcmp (dk, "\x55\xac\x04\x6e\x56\xe3\x08\x9f\xec\x16\x91\xc2\x25\x44\xb6\x05\xf9\x41\x85\x21\x6d\xde\x04\x65\xe6\x8b\x9d\x57\xc2\x0d\xac\xbc\x49\xca\x9c\xcc\xf1\x79\xb6\x45\x99\x16\x64\xb3\x9d\x77\xef\x31\x7c\x71\xb8\x45\xb1\xe3\x0b\xd5\x09\x11\x20\x41\xd3\xa1\x97\x83", 64) != 0)
@@ -1717,6 +1730,7 @@ BOOL test_pkcs5 ()
if (memcmp (dk, "\x13\x64\xae\xf8\x0d\xf5\x57\x6c\x30\xd5\x71\x4c\xa7\x75\x3f\xfd\x00\xe5\x25\x8b\x39\xc7\x44\x7f\xce\x23\x3d\x08\x75\xe0\x2f\x48\xd6\x30\xd7\x00\xb6\x24\xdb\xe0\x5a\xd7\x47\xef\x52\xca\xa6\x34\x83\x47\xe5\xcb\xe9\x87\xf1\x20\x59\x6a\xe6\xa9\xcf\x51\x78\xc6\xb6\x23\xa6\x74\x0d\xe8\x91\xbe\x1a\xd0\x28\xcc\xce\x16\x98\x9a\xbe\xfb\xdc\x78\xc9\xe1\x7d\x72\x67\xce\xe1\x61\x56\x5f\x96\x68\xe6\xe1\xdd\xf4\xbf\x1b\x80\xe0\x19\x1c\xf4\xc4\xd3\xdd\xd5\xd5\x57\x2d\x83\xc7\xa3\x37\x87\xf4\x4e\xe0\xf6\xd8\x6d\x65\xdc\xa0\x52\xa3\x13\xbe\x81\xfc\x30\xbe\x7d\x69\x58\x34\xb6\xdd\x41\xc6", 144) != 0)
return FALSE;
+#ifndef WOLFCRYPT_BACKEND
/* PKCS-5 test 1 with HMAC-BLAKE2s used as the PRF */
derive_key_blake2s ("password", 8, "\x12\x34\x56\x78", 4, 5, dk, 4);
if (memcmp (dk, "\x8d\x51\xfa\x31", 4) != 0)
@@ -1746,6 +1760,6 @@ BOOL test_pkcs5 ()
derive_key_streebog ("password", 8, "\x12\x34\x56\x78", 4, 5, dk, 96);
if (memcmp (dk, "\xd0\x53\xa2\x30\x6f\x45\x81\xeb\xbc\x06\x81\xc5\xe7\x53\xa8\x5d\xc7\xf1\x23\x33\x1e\xbe\x64\x2c\x3b\x0f\x26\xd7\x00\xe1\x95\xc9\x65\x26\xb1\x85\xbe\x1e\xe2\xf4\x9b\xfc\x6b\x14\x84\xda\x24\x61\xa0\x1b\x9e\x79\x5c\xee\x69\x6e\xf9\x25\xb1\x1d\xca\xa0\x31\xba\x02\x6f\x9e\x99\x0f\xdb\x25\x01\x5b\xf1\xc7\x10\x19\x53\x3b\x29\x3f\x18\x00\xd6\xfc\x85\x03\xdc\xf2\xe5\xe9\x5a\xb1\x1e\x61\xde", 96) != 0)
return FALSE;
-
+#endif
return TRUE;
}
diff --git a/src/Common/Token.cpp b/src/Common/Token.cpp
new file mode 100644
index 00000000..17fce78b
--- /dev/null
+++ b/src/Common/Token.cpp
@@ -0,0 +1,114 @@
+#include "Token.h"
+#include "Platform/Finally.h"
+#include "Platform/ForEach.h"
+
+#if !defined(TC_WINDOWS) || defined(TC_PROTOTYPE)
+#include "Platform/SerializerFactory.h"
+#include "Platform/StringConverter.h"
+#include "Platform/SystemException.h"
+#else
+#include "Dictionary.h"
+#include "Language.h"
+#endif
+
+#include <vector>
+#include <algorithm>
+#include <memory>
+
+#include "SecurityToken.h"
+#include "EMVToken.h"
+#include "PCSCException.h"
+#include "iostream"
+
+using namespace std;
+
+namespace VeraCrypt
+{
+ vector<shared_ptr<TokenKeyfile>> Token::GetAvailableKeyfiles(bool isEMVSupportEnabled)
+ {
+ vector<shared_ptr<TokenKeyfile>> availableKeyfiles;
+ bool securityTokenLibraryInitialized = true;
+ bool scardLibraryInitialized = true;
+
+ try
+ {
+ foreach (SecurityTokenKeyfile k, SecurityToken::GetAvailableKeyfiles())
+ {
+ availableKeyfiles.push_back(shared_ptr<TokenKeyfile>(new SecurityTokenKeyfile(k)));
+ }
+ }
+ catch (SecurityTokenLibraryNotInitialized&)
+ {
+ securityTokenLibraryInitialized = false;
+ }
+
+ if (isEMVSupportEnabled)
+ {
+ try
+ {
+ foreach (EMVTokenKeyfile k, EMVToken::GetAvailableKeyfiles())
+ {
+ availableKeyfiles.push_back(shared_ptr<TokenKeyfile>(new EMVTokenKeyfile(k)));
+ }
+ }
+ catch (ScardLibraryInitializationFailed&)
+ {
+ scardLibraryInitialized = false;
+ }
+ }
+
+ if (availableKeyfiles.size() == 0)
+ {
+ if (!securityTokenLibraryInitialized)
+ {
+ throw SecurityTokenLibraryNotInitialized();
+ }
+ else if (!scardLibraryInitialized)
+ {
+ throw ScardLibraryInitializationFailed();
+ }
+ }
+
+ return availableKeyfiles;
+ }
+
+ bool Token::IsKeyfilePathValid(const wstring& tokenKeyfilePath, bool isEMVSupportEnabled)
+ {
+ if (isEMVSupportEnabled)
+ {
+ return SecurityToken::IsKeyfilePathValid(tokenKeyfilePath) || EMVToken::IsKeyfilePathValid(tokenKeyfilePath);
+ }
+ return SecurityToken::IsKeyfilePathValid(tokenKeyfilePath);
+ }
+
+ list <shared_ptr<TokenInfo>> Token::GetAvailableTokens()
+ {
+ list <shared_ptr<TokenInfo>> availableTokens;
+
+ foreach(SecurityTokenInfo securityToken, SecurityToken::GetAvailableTokens())
+ {
+ availableTokens.push_back(shared_ptr<TokenInfo>(new SecurityTokenInfo(std::move(securityToken))));
+ }
+
+ return availableTokens ;
+ }
+
+ shared_ptr<TokenKeyfile> Token::getTokenKeyfile(const TokenKeyfilePath& path)
+ {
+ shared_ptr<TokenKeyfile> tokenKeyfile;
+
+ if (SecurityToken::IsKeyfilePathValid(path))
+ {
+ tokenKeyfile = shared_ptr<TokenKeyfile>(new SecurityTokenKeyfile(path));
+ }
+ else
+ {
+ if (EMVToken::IsKeyfilePathValid(path))
+ {
+ tokenKeyfile = shared_ptr<TokenKeyfile>(new EMVTokenKeyfile(path));
+ }
+ }
+
+ return tokenKeyfile;
+ }
+} \ No newline at end of file
diff --git a/src/Common/Token.h b/src/Common/Token.h
new file mode 100644
index 00000000..754e2830
--- /dev/null
+++ b/src/Common/Token.h
@@ -0,0 +1,61 @@
+#ifndef TC_HEADER_Common_Token
+#define TC_HEADER_Common_Token
+
+#include "Platform/PlatformBase.h"
+
+#if defined (TC_WINDOWS) && !defined (TC_PROTOTYPE)
+# include "Exception.h"
+#else
+
+# include "Platform/Exception.h"
+
+#endif
+
+#include <string>
+
+#define UNAVAILABLE_SLOT ~0UL
+
+namespace VeraCrypt
+{
+ struct TokenKeyfilePath
+ {
+ virtual ~TokenKeyfilePath() {};
+ TokenKeyfilePath(const wstring& path): Path(path) { }
+ operator wstring () const { return Path; }
+
+ wstring Path; // Complete path
+ };
+
+ struct TokenInfo
+ {
+ TokenInfo(): SlotId(0), Label(L"") {}
+ virtual ~TokenInfo() {}
+
+ virtual BOOL isEditable() const = 0;
+
+ unsigned long int SlotId;
+ wstring Label; // Card name
+ };
+
+ struct TokenKeyfile
+ {
+ virtual ~TokenKeyfile() {}
+ virtual operator TokenKeyfilePath () const = 0;
+ virtual void GetKeyfileData(vector <byte>& keyfileData) const = 0;
+
+ shared_ptr<TokenInfo> Token;
+ wstring Id;
+ };
+
+ class Token
+ {
+ public:
+ static vector< shared_ptr<TokenKeyfile> > GetAvailableKeyfiles(bool isEMVSupportEnabled);
+ static bool IsKeyfilePathValid(const wstring& tokenKeyfilePath, bool isEMVSupportEnabled);
+ static list < shared_ptr<TokenInfo> > GetAvailableTokens();
+ static shared_ptr<TokenKeyfile> getTokenKeyfile(const TokenKeyfilePath& path);
+ };
+};
+
+
+#endif //TC_HEADER_Common_Token
diff --git a/src/Common/Volumes.c b/src/Common/Volumes.c
index 9590715e..989b2d14 100644
--- a/src/Common/Volumes.c
+++ b/src/Common/Volumes.c
@@ -169,7 +169,7 @@ typedef struct
BOOL ReadVolumeHeaderRecoveryMode = FALSE;
-int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int selected_pkcs5_prf, int pim, BOOL truecryptMode, PCRYPTO_INFO *retInfo, CRYPTO_INFO *retHeaderCryptoInfo)
+int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int selected_pkcs5_prf, int pim, PCRYPTO_INFO *retInfo, CRYPTO_INFO *retHeaderCryptoInfo)
{
char header[TC_VOLUME_HEADER_EFFECTIVE_SIZE];
unsigned char* keyInfoBuffer = NULL;
@@ -210,14 +210,6 @@ int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int
if (pim < 0)
pim = 0;
- if (truecryptMode)
- {
- // SHA-256 not supported in TrueCrypt mode
- if (selected_pkcs5_prf == SHA256)
- return ERR_PARAMETER_INCORRECT;
- pkcs5PrfCount--; // don't count SHA-256 in case of TrueCrypt mode
- }
-
if (retHeaderCryptoInfo != NULL)
{
cryptoInfo = retHeaderCryptoInfo;
@@ -315,9 +307,6 @@ int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int
if (selected_pkcs5_prf != 0 && enqPkcs5Prf != selected_pkcs5_prf)
continue;
- // skip SHA-256 in case of TrueCrypt mode
- if (truecryptMode && (enqPkcs5Prf == SHA256))
- continue;
#if !defined(_UEFI)
if ((selected_pkcs5_prf == 0) && (encryptionThreadCount > 1))
{
@@ -335,7 +324,7 @@ int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int
EncryptionThreadPoolBeginKeyDerivation (keyDerivationCompletedEvent, noOutstandingWorkItemEvent,
&item->KeyReady, outstandingWorkItemCount, enqPkcs5Prf, keyInfo->userKey,
- keyInfo->keyLength, keyInfo->salt, get_pkcs5_iteration_count (enqPkcs5Prf, pim, truecryptMode, bBoot), item->DerivedKey);
+ keyInfo->keyLength, keyInfo->salt, get_pkcs5_iteration_count (enqPkcs5Prf, pim, bBoot), item->DerivedKey);
++queuedWorkItems;
break;
@@ -357,7 +346,7 @@ int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int
if (!item->Free && InterlockedExchangeAdd (&item->KeyReady, 0) == TRUE)
{
pkcs5_prf = item->Pkcs5Prf;
- keyInfo->noIterations = get_pkcs5_iteration_count (pkcs5_prf, pim, truecryptMode, bBoot);
+ keyInfo->noIterations = get_pkcs5_iteration_count (pkcs5_prf, pim, bBoot);
memcpy (dk, item->DerivedKey, sizeof (dk));
item->Free = TRUE;
@@ -376,35 +365,38 @@ KeyReady: ;
#endif // !defined(_UEFI)
{
pkcs5_prf = enqPkcs5Prf;
- keyInfo->noIterations = get_pkcs5_iteration_count (enqPkcs5Prf, pim, truecryptMode, bBoot);
+ keyInfo->noIterations = get_pkcs5_iteration_count (enqPkcs5Prf, pim, bBoot);
switch (pkcs5_prf)
{
- case BLAKE2S:
- derive_key_blake2s (keyInfo->userKey, keyInfo->keyLength, keyInfo->salt,
+ case SHA512:
+ derive_key_sha512 (keyInfo->userKey, keyInfo->keyLength, keyInfo->salt,
PKCS5_SALT_SIZE, keyInfo->noIterations, dk, GetMaxPkcs5OutSize());
break;
- case SHA512:
- derive_key_sha512 (keyInfo->userKey, keyInfo->keyLength, keyInfo->salt,
+ case SHA256:
+ derive_key_sha256 (keyInfo->userKey, keyInfo->keyLength, keyInfo->salt,
PKCS5_SALT_SIZE, keyInfo->noIterations, dk, GetMaxPkcs5OutSize());
break;
- case WHIRLPOOL:
- derive_key_whirlpool (keyInfo->userKey, keyInfo->keyLength, keyInfo->salt,
+ #ifndef WOLFCRYPT_BACKEND
+ case BLAKE2S:
+ derive_key_blake2s (keyInfo->userKey, keyInfo->keyLength, keyInfo->salt,
PKCS5_SALT_SIZE, keyInfo->noIterations, dk, GetMaxPkcs5OutSize());
break;
- case SHA256:
- derive_key_sha256 (keyInfo->userKey, keyInfo->keyLength, keyInfo->salt,
+ case WHIRLPOOL:
+ derive_key_whirlpool (keyInfo->userKey, keyInfo->keyLength, keyInfo->salt,
PKCS5_SALT_SIZE, keyInfo->noIterations, dk, GetMaxPkcs5OutSize());
break;
- case STREEBOG:
+
+ case STREEBOG:
derive_key_streebog(keyInfo->userKey, keyInfo->keyLength, keyInfo->salt,
PKCS5_SALT_SIZE, keyInfo->noIterations, dk, GetMaxPkcs5OutSize());
break;
- default:
+ #endif
+ default:
// Unknown/wrong ID
TC_THROW_FATAL_EXCEPTION;
}
@@ -465,10 +457,8 @@ KeyReady: ;
DecryptBuffer (header + HEADER_ENCRYPTED_DATA_OFFSET, HEADER_ENCRYPTED_DATA_SIZE, cryptoInfo);
- // Magic 'VERA' or 'TRUE' depending if we are in TrueCrypt mode or not
- if ((truecryptMode && GetHeaderField32 (header, TC_HEADER_OFFSET_MAGIC) != 0x54525545)
- || (!truecryptMode && GetHeaderField32 (header, TC_HEADER_OFFSET_MAGIC) != 0x56455241)
- )
+ // Magic 'VERA'
+ if (GetHeaderField32 (header, TC_HEADER_OFFSET_MAGIC) != 0x56455241)
continue;
// Header version
@@ -488,17 +478,7 @@ KeyReady: ;
// Required program version
cryptoInfo->RequiredProgramVersion = GetHeaderField16 (header, TC_HEADER_OFFSET_REQUIRED_VERSION);
- if (truecryptMode)
- {
- if (cryptoInfo->RequiredProgramVersion < 0x600 || cryptoInfo->RequiredProgramVersion > 0x71a)
- {
- status = ERR_UNSUPPORTED_TRUECRYPT_FORMAT | (((int)cryptoInfo->RequiredProgramVersion) << 16);
- goto err;
- }
- cryptoInfo->LegacyVolume = FALSE;
- }
- else
- cryptoInfo->LegacyVolume = cryptoInfo->RequiredProgramVersion < 0x10b;
+ cryptoInfo->LegacyVolume = cryptoInfo->RequiredProgramVersion < 0x10b;
// Check CRC of the key set
if (!ReadVolumeHeaderRecoveryMode
@@ -508,7 +488,7 @@ KeyReady: ;
// Now we have the correct password, cipher, hash algorithm, and volume type
// Check the version required to handle this volume
- if (!truecryptMode && (cryptoInfo->RequiredProgramVersion > VERSION_NUM))
+ if (cryptoInfo->RequiredProgramVersion > VERSION_NUM)
{
status = ERR_NEW_VERSION_REQUIRED;
goto err;
@@ -560,7 +540,6 @@ KeyReady: ;
{
cryptoInfo->pkcs5 = pkcs5_prf;
cryptoInfo->noIterations = keyInfo->noIterations;
- cryptoInfo->bTrueCryptMode = truecryptMode;
cryptoInfo->volumePim = pim;
goto ret;
}
@@ -602,7 +581,6 @@ KeyReady: ;
// PKCS #5
cryptoInfo->pkcs5 = pkcs5_prf;
cryptoInfo->noIterations = keyInfo->noIterations;
- cryptoInfo->bTrueCryptMode = truecryptMode;
cryptoInfo->volumePim = pim;
// Init the cipher with the decrypted master key
@@ -675,7 +653,8 @@ void ComputeBootloaderFingerprint (byte *bootLoaderBuf, unsigned int bootLoaderS
//
// we have: TC_BOOT_SECTOR_USER_MESSAGE_OFFSET = TC_BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_OFFSET + TC_BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_SIZE
- WHIRLPOOL_CTX whirlpool;
+#ifndef WOLFCRYPT_BACKEND
+ WHIRLPOOL_CTX whirlpool;
sha512_ctx sha2;
WHIRLPOOL_init (&whirlpool);
@@ -692,6 +671,26 @@ void ComputeBootloaderFingerprint (byte *bootLoaderBuf, unsigned int bootLoaderS
WHIRLPOOL_finalize (&whirlpool, fingerprint);
sha512_end (&fingerprint [WHIRLPOOL_DIGESTSIZE], &sha2);
+#else
+ sha512_ctx sha2_512;
+ sha256_ctx sha2_256;
+
+ sha512_begin (&sha2_512);
+ sha256_begin (&sha2_256);
+
+ sha512_hash (bootLoaderBuf, TC_BOOT_SECTOR_PIM_VALUE_OFFSET, &sha2_512);
+ sha256_hash (bootLoaderBuf, TC_BOOT_SECTOR_PIM_VALUE_OFFSET, &sha2_256);
+
+ sha512_hash (bootLoaderBuf + TC_BOOT_SECTOR_USER_MESSAGE_OFFSET + TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH, (TC_BOOT_SECTOR_USER_CONFIG_OFFSET - (TC_BOOT_SECTOR_USER_MESSAGE_OFFSET + TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH)), &sha2_512);
+ sha256_hash (bootLoaderBuf + TC_BOOT_SECTOR_USER_MESSAGE_OFFSET + TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH, (TC_BOOT_SECTOR_USER_CONFIG_OFFSET - (TC_BOOT_SECTOR_USER_MESSAGE_OFFSET + TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH)), &sha2_256);
+
+ sha512_hash (bootLoaderBuf + TC_SECTOR_SIZE_BIOS, (bootLoaderSize - TC_SECTOR_SIZE_BIOS), &sha2_512);
+ sha256_hash (bootLoaderBuf + TC_SECTOR_SIZE_BIOS, (bootLoaderSize - TC_SECTOR_SIZE_BIOS), &sha2_256);
+
+ sha512_end (&fingerprint, &sha2_512);
+ sha256_end (&fingerprint [SHA512_DIGESTSIZE], &sha2_256);
+ sha256_end (&fingerprint [SHA512_DIGESTSIZE + SHA256_DIGESTSIZE], &sha2_256);
+#endif
}
#endif
@@ -736,11 +735,11 @@ int ReadVolumeHeader (BOOL bBoot, char *header, Password *password, int pim, PCR
#endif
{
#ifdef TC_WINDOWS_BOOT_SINGLE_CIPHER_MODE
- #if defined (TC_WINDOWS_BOOT_SERPENT)
+ #if defined (TC_WINDOWS_BOOT_SERPENT) && !defined (WOLFCRYPT_BACKEND)
serpent_set_key (dk, cryptoInfo->ks);
- #elif defined (TC_WINDOWS_BOOT_TWOFISH)
+ #elif defined (TC_WINDOWS_BOOT_TWOFISH) && !defined (WOLFCRYPT_BACKEND)
twofish_set_key ((TwofishInstance *) cryptoInfo->ks, (const u4byte *) dk);
- #elif defined (TC_WINDOWS_BOOT_CAMELLIA)
+ #elif defined (TC_WINDOWS_BOOT_CAMELLIA) && !defined (WOLFCRYPT_BACKEND)
camellia_set_key (dk, cryptoInfo->ks);
#else
status = EAInit (dk, cryptoInfo->ks);
@@ -754,11 +753,11 @@ int ReadVolumeHeader (BOOL bBoot, char *header, Password *password, int pim, PCR
#endif
// Secondary key schedule
#ifdef TC_WINDOWS_BOOT_SINGLE_CIPHER_MODE
- #if defined (TC_WINDOWS_BOOT_SERPENT)
+ #if defined (TC_WINDOWS_BOOT_SERPENT) && !defined (WOLFCRYPT_BACKEND)
serpent_set_key (dk + 32, cryptoInfo->ks2);
- #elif defined (TC_WINDOWS_BOOT_TWOFISH)
+ #elif defined (TC_WINDOWS_BOOT_TWOFISH) && !defined (WOLFCRYPT_BACKEND)
twofish_set_key ((TwofishInstance *)cryptoInfo->ks2, (const u4byte *) (dk + 32));
- #elif defined (TC_WINDOWS_BOOT_CAMELLIA)
+ #elif defined (TC_WINDOWS_BOOT_CAMELLIA) && !defined (WOLFCRYPT_BACKEND)
camellia_set_key (dk + 32, cryptoInfo->ks2);
#else
EAInit (dk + 32, cryptoInfo->ks2);
@@ -815,11 +814,11 @@ int ReadVolumeHeader (BOOL bBoot, char *header, Password *password, int pim, PCR
// Init the encryption algorithm with the decrypted master key
#ifdef TC_WINDOWS_BOOT_SINGLE_CIPHER_MODE
- #if defined (TC_WINDOWS_BOOT_SERPENT)
+ #if defined (TC_WINDOWS_BOOT_SERPENT) && !defined (WOLFCRYPT_BACKEND)
serpent_set_key (dk, cryptoInfo->ks);
- #elif defined (TC_WINDOWS_BOOT_TWOFISH)
+ #elif defined (TC_WINDOWS_BOOT_TWOFISH) && !defined (WOLFCRYPT_BACKEND)
twofish_set_key ((TwofishInstance *) cryptoInfo->ks, (const u4byte *) dk);
- #elif defined (TC_WINDOWS_BOOT_CAMELLIA)
+ #elif defined (TC_WINDOWS_BOOT_CAMELLIA) && !defined (WOLFCRYPT_BACKEND)
camellia_set_key (dk, cryptoInfo->ks);
#else
status = EAInit (dk, cryptoInfo->ks);
@@ -834,11 +833,11 @@ int ReadVolumeHeader (BOOL bBoot, char *header, Password *password, int pim, PCR
// The secondary master key (if cascade, multiple concatenated)
#ifdef TC_WINDOWS_BOOT_SINGLE_CIPHER_MODE
- #if defined (TC_WINDOWS_BOOT_SERPENT)
+ #if defined (TC_WINDOWS_BOOT_SERPENT) && !defined (WOLFCRYPT_BACKEND)
serpent_set_key (dk + 32, cryptoInfo->ks2);
- #elif defined (TC_WINDOWS_BOOT_TWOFISH)
+ #elif defined (TC_WINDOWS_BOOT_TWOFISH) && !defined (WOLFCRYPT_BACKEND)
twofish_set_key ((TwofishInstance *)cryptoInfo->ks2, (const u4byte *) (dk + 32));
- #elif defined (TC_WINDOWS_BOOT_CAMELLIA)
+ #elif defined (TC_WINDOWS_BOOT_CAMELLIA) && !defined (WOLFCRYPT_BACKEND)
camellia_set_key (dk + 32, cryptoInfo->ks2);
#else
EAInit (dk + 32, cryptoInfo->ks2);
@@ -934,6 +933,15 @@ int CreateVolumeHeaderInMemory (HWND hwndDlg, BOOL bBoot, char *header, int ea,
retVal = ERR_CIPHER_INIT_WEAK_KEY;
goto err;
}
+
+ // check that first half of keyInfo.master_keydata is different from the second half. If they are the same return error
+ // cf CCSS,NSA comment at page 3: https://csrc.nist.gov/csrc/media/Projects/crypto-publication-review-project/documents/initial-comments/sp800-38e-initial-public-comments-2021.pdf
+ if (memcmp (keyInfo.master_keydata, &keyInfo.master_keydata[bytesNeeded/2], bytesNeeded/2) == 0)
+ {
+ crypto_close (cryptoInfo);
+ retVal = ERR_CIPHER_INIT_WEAK_KEY;
+ goto err;
+ }
}
else
{
@@ -946,7 +954,7 @@ int CreateVolumeHeaderInMemory (HWND hwndDlg, BOOL bBoot, char *header, int ea,
{
memcpy (keyInfo.userKey, password->Text, nUserKeyLen);
keyInfo.keyLength = nUserKeyLen;
- keyInfo.noIterations = get_pkcs5_iteration_count (pkcs5_prf, pim, FALSE, bBoot);
+ keyInfo.noIterations = get_pkcs5_iteration_count (pkcs5_prf, pim, bBoot);
}
else
{
@@ -959,7 +967,6 @@ int CreateVolumeHeaderInMemory (HWND hwndDlg, BOOL bBoot, char *header, int ea,
// User selected PRF
cryptoInfo->pkcs5 = pkcs5_prf;
- cryptoInfo->bTrueCryptMode = FALSE;
cryptoInfo->noIterations = keyInfo.noIterations;
cryptoInfo->volumePim = pim;
@@ -993,6 +1000,7 @@ int CreateVolumeHeaderInMemory (HWND hwndDlg, BOOL bBoot, char *header, int ea,
PKCS5_SALT_SIZE, keyInfo.noIterations, dk, GetMaxPkcs5OutSize());
break;
+ #ifndef WOLFCRYPT_BACKEND
case BLAKE2S:
derive_key_blake2s (keyInfo.userKey, keyInfo.keyLength, keyInfo.salt,
PKCS5_SALT_SIZE, keyInfo.noIterations, dk, GetMaxPkcs5OutSize());
@@ -1007,7 +1015,7 @@ int CreateVolumeHeaderInMemory (HWND hwndDlg, BOOL bBoot, char *header, int ea,
derive_key_streebog(keyInfo.userKey, keyInfo.keyLength, keyInfo.salt,
PKCS5_SALT_SIZE, keyInfo.noIterations, dk, GetMaxPkcs5OutSize());
break;
-
+ #endif
default:
// Unknown/wrong ID
crypto_close (cryptoInfo);
diff --git a/src/Common/Volumes.h b/src/Common/Volumes.h
index 08776711..1c9981c2 100644
--- a/src/Common/Volumes.h
+++ b/src/Common/Volumes.h
@@ -135,11 +135,11 @@ UINT64_STRUCT GetHeaderField64 (byte *header, int offset);
#if defined(TC_WINDOWS_BOOT)
int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int pim, PCRYPTO_INFO *retInfo, CRYPTO_INFO *retHeaderCryptoInfo);
#elif defined(_UEFI)
-int ReadVolumeHeader(BOOL bBoot, char *encryptedHeader, Password *password, int pkcs5_prf, int pim, BOOL truecryptMode, PCRYPTO_INFO *retInfo, CRYPTO_INFO *retHeaderCryptoInfo);
+int ReadVolumeHeader(BOOL bBoot, char *encryptedHeader, Password *password, int pkcs5_prf, int pim, PCRYPTO_INFO *retInfo, CRYPTO_INFO *retHeaderCryptoInfo);
int CreateVolumeHeaderInMemory(BOOL bBoot, char *encryptedHeader, int ea, int mode, Password *password, int pkcs5_prf, int pim, char *masterKeydata, PCRYPTO_INFO *retInfo, unsigned __int64 volumeSize, unsigned __int64 hiddenVolumeSize, unsigned __int64 encryptedAreaStart, unsigned __int64 encryptedAreaLength, uint16 requiredProgramVersion, uint32 headerFlags, uint32 sectorSize, BOOL bWipeMode);
BOOL RandgetBytes(unsigned char *buf, int len, BOOL forceSlowPoll);
#else
-int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int pkcs5_prf, int pim, BOOL truecryptMode, PCRYPTO_INFO *retInfo, CRYPTO_INFO *retHeaderCryptoInfo);
+int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int pkcs5_prf, int pim, PCRYPTO_INFO *retInfo, CRYPTO_INFO *retHeaderCryptoInfo);
#if defined(_WIN32) && !defined(_UEFI)
void ComputeBootloaderFingerprint (byte *bootLoaderBuf, unsigned int bootLoaderSize, byte* fingerprint);
#endif
diff --git a/src/Common/Xts.c b/src/Common/Xts.c
index 390eb31e..4a62aaf3 100644
--- a/src/Common/Xts.c
+++ b/src/Common/Xts.c
@@ -54,10 +54,14 @@ void EncryptBufferXTS (unsigned __int8 *buffer,
unsigned __int8 *ks2,
int cipher)
{
- if (CipherSupportsIntraDataUnitParallelization (cipher))
+ #ifndef WOLFCRYPT_BACKEND
+ if (CipherSupportsIntraDataUnitParallelization (cipher))
EncryptBufferXTSParallel (buffer, length, startDataUnitNo, startCipherBlockNo, ks, ks2, cipher);
else
EncryptBufferXTSNonParallel (buffer, length, startDataUnitNo, startCipherBlockNo, ks, ks2, cipher);
+ #else
+ xts_encrypt(buffer, buffer, length, startDataUnitNo, ks);
+ #endif
}
#if (CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE && CRYPTOPP_BOOL_X64)
@@ -380,10 +384,14 @@ void DecryptBufferXTS (unsigned __int8 *buffer,
unsigned __int8 *ks2,
int cipher)
{
+ #ifndef WOLFCRYPT_BACKEND
if (CipherSupportsIntraDataUnitParallelization (cipher))
DecryptBufferXTSParallel (buffer, length, startDataUnitNo, startCipherBlockNo, ks, ks2, cipher);
else
DecryptBufferXTSNonParallel (buffer, length, startDataUnitNo, startCipherBlockNo, ks, ks2, cipher);
+ #else
+ xts_decrypt(buffer, buffer, length, startDataUnitNo, ks);
+ #endif
}
diff --git a/src/Common/Zip.vcxproj b/src/Common/Zip.vcxproj
index ec907d94..11a971b2 100644
--- a/src/Common/Zip.vcxproj
+++ b/src/Common/Zip.vcxproj
@@ -25,6 +25,7 @@
<ClCompile Include="libzip\zip_algorithm_deflate.c" />
<ClCompile Include="libzip\zip_buffer.c" />
<ClCompile Include="libzip\zip_close.c" />
+ <ClCompile Include="libzip\zip_crypto_win.c" />
<ClCompile Include="libzip\zip_delete.c" />
<ClCompile Include="libzip\zip_dirent.c" />
<ClCompile Include="libzip\zip_dir_add.c" />
@@ -35,12 +36,12 @@
<ClCompile Include="libzip\zip_error_get.c" />
<ClCompile Include="libzip\zip_error_get_sys_type.c" />
<ClCompile Include="libzip\zip_error_strerror.c" />
+ <ClCompile Include="libzip\zip_error_to_str.c" />
<ClCompile Include="libzip\zip_err_str.c" />
<ClCompile Include="libzip\zip_extra_field.c" />
<ClCompile Include="libzip\zip_extra_field_api.c" />
<ClCompile Include="libzip\zip_fclose.c" />
<ClCompile Include="libzip\zip_fdopen.c" />
- <ClCompile Include="libzip\zip_filerange_crc.c" />
<ClCompile Include="libzip\zip_file_add.c" />
<ClCompile Include="libzip\zip_file_error_clear.c" />
<ClCompile Include="libzip\zip_file_error_get.c" />
@@ -50,6 +51,7 @@
<ClCompile Include="libzip\zip_file_rename.c" />
<ClCompile Include="libzip\zip_file_replace.c" />
<ClCompile Include="libzip\zip_file_set_comment.c" />
+ <ClCompile Include="libzip\zip_file_set_encryption.c" />
<ClCompile Include="libzip\zip_file_set_external_attributes.c" />
<ClCompile Include="libzip\zip_file_set_mtime.c" />
<ClCompile Include="libzip\zip_file_strerror.c" />
@@ -58,6 +60,8 @@
<ClCompile Include="libzip\zip_fopen_index.c" />
<ClCompile Include="libzip\zip_fopen_index_encrypted.c" />
<ClCompile Include="libzip\zip_fread.c" />
+ <ClCompile Include="libzip\zip_fseek.c" />
+ <ClCompile Include="libzip\zip_ftell.c" />
<ClCompile Include="libzip\zip_get_archive_comment.c" />
<ClCompile Include="libzip\zip_get_archive_flag.c" />
<ClCompile Include="libzip\zip_get_encryption_implementation.c" />
@@ -67,12 +71,14 @@
<ClCompile Include="libzip\zip_get_num_files.c" />
<ClCompile Include="libzip\zip_hash.c" />
<ClCompile Include="libzip\zip_io_util.c" />
+ <ClCompile Include="libzip\zip_libzip_version.c" />
<ClCompile Include="libzip\zip_memdup.c" />
<ClCompile Include="libzip\zip_name_locate.c" />
<ClCompile Include="libzip\zip_new.c" />
<ClCompile Include="libzip\zip_open.c" />
<ClCompile Include="libzip\zip_pkware.c" />
<ClCompile Include="libzip\zip_progress.c" />
+ <ClCompile Include="libzip\zip_random_win32.c" />
<ClCompile Include="libzip\zip_rename.c" />
<ClCompile Include="libzip\zip_replace.c" />
<ClCompile Include="libzip\zip_set_archive_comment.c" />
@@ -94,6 +100,7 @@
<ClCompile Include="libzip\zip_source_file_common.c" />
<ClCompile Include="libzip\zip_source_file_stdio.c" />
<ClCompile Include="libzip\zip_source_file_win32.c" />
+ <ClCompile Include="libzip\zip_source_file_win32_ansi.c" />
<ClCompile Include="libzip\zip_source_file_win32_named.c" />
<ClCompile Include="libzip\zip_source_file_win32_utf16.c" />
<ClCompile Include="libzip\zip_source_file_win32_utf8.c" />
@@ -103,6 +110,7 @@
<ClCompile Include="libzip\zip_source_is_deleted.c" />
<ClCompile Include="libzip\zip_source_layered.c" />
<ClCompile Include="libzip\zip_source_open.c" />
+ <ClCompile Include="libzip\zip_source_pass_to_lower_layer.c" />
<ClCompile Include="libzip\zip_source_pkware_decode.c" />
<ClCompile Include="libzip\zip_source_pkware_encode.c" />
<ClCompile Include="libzip\zip_source_read.c" />
@@ -115,6 +123,8 @@
<ClCompile Include="libzip\zip_source_tell.c" />
<ClCompile Include="libzip\zip_source_tell_write.c" />
<ClCompile Include="libzip\zip_source_window.c" />
+ <ClCompile Include="libzip\zip_source_winzip_aes_decode.c" />
+ <ClCompile Include="libzip\zip_source_winzip_aes_encode.c" />
<ClCompile Include="libzip\zip_source_write.c" />
<ClCompile Include="libzip\zip_source_zip.c" />
<ClCompile Include="libzip\zip_source_zip_new.c" />
@@ -128,6 +138,7 @@
<ClCompile Include="libzip\zip_unchange_archive.c" />
<ClCompile Include="libzip\zip_unchange_data.c" />
<ClCompile Include="libzip\zip_utf-8.c" />
+ <ClCompile Include="libzip\zip_winzip_aes.c" />
<ClCompile Include="zlib\adler32.c" />
<ClCompile Include="zlib\compress.c" />
<ClCompile Include="zlib\crc32.c" />
diff --git a/src/Common/Zip.vcxproj.filters b/src/Common/Zip.vcxproj.filters
index 88c8ff6f..92bcf493 100644
--- a/src/Common/Zip.vcxproj.filters
+++ b/src/Common/Zip.vcxproj.filters
@@ -66,9 +66,6 @@
<ClCompile Include="libzip\zip_fdopen.c">
<Filter>libzip</Filter>
</ClCompile>
- <ClCompile Include="libzip\zip_filerange_crc.c">
- <Filter>libzip</Filter>
- </ClCompile>
<ClCompile Include="libzip\zip_file_add.c">
<Filter>libzip</Filter>
</ClCompile>
@@ -366,6 +363,42 @@
<ClCompile Include="libzip\zip_err_str.c">
<Filter>libzip</Filter>
</ClCompile>
+ <ClCompile Include="libzip\zip_source_winzip_aes_decode.c">
+ <Filter>libzip</Filter>
+ </ClCompile>
+ <ClCompile Include="libzip\zip_source_winzip_aes_encode.c">
+ <Filter>libzip</Filter>
+ </ClCompile>
+ <ClCompile Include="libzip\zip_crypto_win.c">
+ <Filter>libzip</Filter>
+ </ClCompile>
+ <ClCompile Include="libzip\zip_error_to_str.c">
+ <Filter>libzip</Filter>
+ </ClCompile>
+ <ClCompile Include="libzip\zip_file_set_encryption.c">
+ <Filter>libzip</Filter>
+ </ClCompile>
+ <ClCompile Include="libzip\zip_fseek.c">
+ <Filter>libzip</Filter>
+ </ClCompile>
+ <ClCompile Include="libzip\zip_ftell.c">
+ <Filter>libzip</Filter>
+ </ClCompile>
+ <ClCompile Include="libzip\zip_libzip_version.c">
+ <Filter>libzip</Filter>
+ </ClCompile>
+ <ClCompile Include="libzip\zip_random_win32.c">
+ <Filter>libzip</Filter>
+ </ClCompile>
+ <ClCompile Include="libzip\zip_source_file_win32_ansi.c">
+ <Filter>libzip</Filter>
+ </ClCompile>
+ <ClCompile Include="libzip\zip_winzip_aes.c">
+ <Filter>libzip</Filter>
+ </ClCompile>
+ <ClCompile Include="libzip\zip_source_pass_to_lower_layer.c">
+ <Filter>zlib</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="libzip\compat.h">
diff --git a/src/Common/Zip_vs2019.vcxproj b/src/Common/Zip_vs2019.vcxproj
index f9bb543f..26ab3310 100644
--- a/src/Common/Zip_vs2019.vcxproj
+++ b/src/Common/Zip_vs2019.vcxproj
@@ -33,6 +33,7 @@
<ClCompile Include="libzip\zip_algorithm_deflate.c" />
<ClCompile Include="libzip\zip_buffer.c" />
<ClCompile Include="libzip\zip_close.c" />
+ <ClCompile Include="libzip\zip_crypto_win.c" />
<ClCompile Include="libzip\zip_delete.c" />
<ClCompile Include="libzip\zip_dirent.c" />
<ClCompile Include="libzip\zip_dir_add.c" />
@@ -43,12 +44,12 @@
<ClCompile Include="libzip\zip_error_get.c" />
<ClCompile Include="libzip\zip_error_get_sys_type.c" />
<ClCompile Include="libzip\zip_error_strerror.c" />
+ <ClCompile Include="libzip\zip_error_to_str.c" />
<ClCompile Include="libzip\zip_err_str.c" />
<ClCompile Include="libzip\zip_extra_field.c" />
<ClCompile Include="libzip\zip_extra_field_api.c" />
<ClCompile Include="libzip\zip_fclose.c" />
<ClCompile Include="libzip\zip_fdopen.c" />
- <ClCompile Include="libzip\zip_filerange_crc.c" />
<ClCompile Include="libzip\zip_file_add.c" />
<ClCompile Include="libzip\zip_file_error_clear.c" />
<ClCompile Include="libzip\zip_file_error_get.c" />
@@ -58,6 +59,7 @@
<ClCompile Include="libzip\zip_file_rename.c" />
<ClCompile Include="libzip\zip_file_replace.c" />
<ClCompile Include="libzip\zip_file_set_comment.c" />
+ <ClCompile Include="libzip\zip_file_set_encryption.c" />
<ClCompile Include="libzip\zip_file_set_external_attributes.c" />
<ClCompile Include="libzip\zip_file_set_mtime.c" />
<ClCompile Include="libzip\zip_file_strerror.c" />
@@ -66,6 +68,8 @@
<ClCompile Include="libzip\zip_fopen_index.c" />
<ClCompile Include="libzip\zip_fopen_index_encrypted.c" />
<ClCompile Include="libzip\zip_fread.c" />
+ <ClCompile Include="libzip\zip_fseek.c" />
+ <ClCompile Include="libzip\zip_ftell.c" />
<ClCompile Include="libzip\zip_get_archive_comment.c" />
<ClCompile Include="libzip\zip_get_archive_flag.c" />
<ClCompile Include="libzip\zip_get_encryption_implementation.c" />
@@ -75,12 +79,14 @@
<ClCompile Include="libzip\zip_get_num_files.c" />
<ClCompile Include="libzip\zip_hash.c" />
<ClCompile Include="libzip\zip_io_util.c" />
+ <ClCompile Include="libzip\zip_libzip_version.c" />
<ClCompile Include="libzip\zip_memdup.c" />
<ClCompile Include="libzip\zip_name_locate.c" />
<ClCompile Include="libzip\zip_new.c" />
<ClCompile Include="libzip\zip_open.c" />
<ClCompile Include="libzip\zip_pkware.c" />
<ClCompile Include="libzip\zip_progress.c" />
+ <ClCompile Include="libzip\zip_random_win32.c" />
<ClCompile Include="libzip\zip_rename.c" />
<ClCompile Include="libzip\zip_replace.c" />
<ClCompile Include="libzip\zip_set_archive_comment.c" />
@@ -102,6 +108,7 @@
<ClCompile Include="libzip\zip_source_file_common.c" />
<ClCompile Include="libzip\zip_source_file_stdio.c" />
<ClCompile Include="libzip\zip_source_file_win32.c" />
+ <ClCompile Include="libzip\zip_source_file_win32_ansi.c" />
<ClCompile Include="libzip\zip_source_file_win32_named.c" />
<ClCompile Include="libzip\zip_source_file_win32_utf16.c" />
<ClCompile Include="libzip\zip_source_file_win32_utf8.c" />
@@ -111,6 +118,7 @@
<ClCompile Include="libzip\zip_source_is_deleted.c" />
<ClCompile Include="libzip\zip_source_layered.c" />
<ClCompile Include="libzip\zip_source_open.c" />
+ <ClCompile Include="libzip\zip_source_pass_to_lower_layer.c" />
<ClCompile Include="libzip\zip_source_pkware_decode.c" />
<ClCompile Include="libzip\zip_source_pkware_encode.c" />
<ClCompile Include="libzip\zip_source_read.c" />
@@ -123,6 +131,8 @@
<ClCompile Include="libzip\zip_source_tell.c" />
<ClCompile Include="libzip\zip_source_tell_write.c" />
<ClCompile Include="libzip\zip_source_window.c" />
+ <ClCompile Include="libzip\zip_source_winzip_aes_decode.c" />
+ <ClCompile Include="libzip\zip_source_winzip_aes_encode.c" />
<ClCompile Include="libzip\zip_source_write.c" />
<ClCompile Include="libzip\zip_source_zip.c" />
<ClCompile Include="libzip\zip_source_zip_new.c" />
@@ -136,6 +146,7 @@
<ClCompile Include="libzip\zip_unchange_archive.c" />
<ClCompile Include="libzip\zip_unchange_data.c" />
<ClCompile Include="libzip\zip_utf-8.c" />
+ <ClCompile Include="libzip\zip_winzip_aes.c" />
<ClCompile Include="zlib\adler32.c" />
<ClCompile Include="zlib\compress.c" />
<ClCompile Include="zlib\crc32.c" />
@@ -272,6 +283,10 @@
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
+ <Lib>
+ <AdditionalDependencies>
+ </AdditionalDependencies>
+ </Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
<ClCompile>
@@ -287,6 +302,10 @@
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
+ <Lib>
+ <AdditionalDependencies>
+ </AdditionalDependencies>
+ </Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
@@ -302,6 +321,10 @@
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
+ <Lib>
+ <AdditionalDependencies>
+ </AdditionalDependencies>
+ </Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
@@ -321,6 +344,10 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
+ <Lib>
+ <AdditionalDependencies>
+ </AdditionalDependencies>
+ </Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<ClCompile>
@@ -340,6 +367,10 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
+ <Lib>
+ <AdditionalDependencies>
+ </AdditionalDependencies>
+ </Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
@@ -359,6 +390,10 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
+ <Lib>
+ <AdditionalDependencies>
+ </AdditionalDependencies>
+ </Lib>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
diff --git a/src/Common/libzip/LICENSE b/src/Common/libzip/LICENSE
index 573d5d94..fa706096 100644
--- a/src/Common/libzip/LICENSE
+++ b/src/Common/libzip/LICENSE
@@ -1,6 +1,6 @@
Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner
-The authors can be contacted at <libzip@nih.at>
+The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
diff --git a/src/Common/libzip/NEWS.md b/src/Common/libzip/NEWS.md
index d48b59ac..e117422d 100644
--- a/src/Common/libzip/NEWS.md
+++ b/src/Common/libzip/NEWS.md
@@ -1,26 +1,81 @@
-1.7.3 [2020-07-15]
-==================
+# 1.10.1 [2023-08-23]
+
+* Add `ZIP_LENGTH_TO_END` and `ZIP_LENGTH_UNCHECKED`. Unless `ZIP_LENGTH_UNCHECKED` is used as `length`, it is an error for a file to shrink between the time when the source is created and when its data is read.
+* Fix test on Windows.
+
+# 1.10.0 [2023-06-23]
+
+* Make support for layered sources public.
+* Add `zip_source_zip_file` and `zip_source_zip_file_create`, deprecate `zip_source_zip` and `zip_source_zip_create`.
+* Allow reading changed file data.
+* Fix handling of files of size 4294967295.
+* `zipmerge`: copy extra fields.
+* `zipmerge`: add option to keep files uncompressed.
+* Switch test framework to use nihtest instead of Perl.
+* Fix reading/writing compressed data with buffers > 4GiB.
+* Restore support for torrentzip.
+* Add warnings when using deprecated functions.
+* Allow keeping files for empty archives.
+* Support mbedTLS>=3.3.0.
+* Support OpenSSL 3.
+* Use ISO C secure library functions, if available.
+
+
+# 1.9.2 [2022-06-28]
+
+* Fix version number in header file.
+
+
+# 1.9.1 [2022-06-28]
+
+* Fix `zip_file_is_seekable()`.
+
+
+# 1.9.0 [2022-06-13]
+
+* Add `zip_file_is_seekable()`.
+* Improve compatibility with WinAES.
+* Fix encoding handling in `zip_name_locate()`.
+* Add option to `zipcmp` to output summary of changes.
+* Various bug fixes and documentation improvements.
+
+
+# 1.8.0 [2021-06-18]
+
+* Add support for zstd (Zstandard) compression.
+* Add support for lzma (ID 14) compression.
+* Add `zip_source_window_create()`.
+* Add `zip_source_zip_create()` variant to `zip_source_zip()`.
+* Allow method specific `comp_flags` in `zip_set_file_compression()`.
+* Allow `zip_source_tell()` on sources that don't support seeking and `zip_ftell()` on compressed data.
+* Provide more details for consistency check errors.
+* Improve output of `zipcmp`.
+* In `zipcmp`, don’t ignore empty directories when comparing directory listing.
+* Treat empty string as no password given in `zip_file_set_encryption()`, `zip_fopen_encrypted()`, and `zip_set_default_password()`.
+
+
+# 1.7.3 [2020-07-15]
* Support cmake < 3.17 again.
* Fix pkgconfig file (regression in 1.7.2).
-1.7.2 [2020-07-11]
-==================
+
+# 1.7.2 [2020-07-11]
* Fixes for the CMake `find_project()` files.
* libzip moved to the CMake `libzip::` `NAMESPACE`.
* CMake usage best practice cleanups.
-1.7.1 [2020-06-13]
-==================
+
+# 1.7.1 [2020-06-13]
* Restore `LIBZIP_VERSION_{MAJOR,MINOR,MICRO}` symbols.
* Fixes warnings reported by PVS-Studio.
* Add `LIBZIP_DO_INSTALL` build setting to make it easier to use
libzip as subproject.
-1.7.0 [2020-06-05]
-==================
+
+# 1.7.0 [2020-06-05]
* Add support for encrypting using traditional PKWare encryption.
* Add `zip_compression_method_supported()`.
@@ -29,13 +84,13 @@
* Refactor stdio file backend.
* Add CMake find_project() support.
-1.6.1 [2020-02-03]
-==================
+
+# 1.6.1 [2020-02-03]
* Bugfix for double-free in `zipcmp(1)` during cleanup.
-1.6.0 [2020-01-24]
-==================
+
+# 1.6.0 [2020-01-24]
* Avoid using `umask()` since it's not thread-safe.
* Set close-on-exec flag when opening files.
@@ -44,8 +99,8 @@
* Add support for cancelling while closing zip archives.
* Add support for setting the time in the on-disk format.
-1.5.2 [2019-03-12]
-==================
+
+# 1.5.2 [2019-03-12]
* Fix bug in AES encryption affecting certain file sizes
* Keep file permissions when modifying zip archives
@@ -53,8 +108,8 @@
* Support mbed TLS as crypto backend.
* Add nullability annotations.
-1.5.1 [2018-04-11]
-==================
+
+# 1.5.1 [2018-04-11]
* Choose format of installed documentation based on available tools.
* Fix visibility of symbols.
@@ -64,16 +119,16 @@
* Fix build with LibreSSL.
* Various bugfixes.
-1.5.0 [2018-03-11]
-==================
+
+# 1.5.0 [2018-03-11]
* Use standard cryptographic library instead of custom AES implementation.
This also simplifies the license.
* Use `clang-format` to format the source code.
* More Windows improvements.
-1.4.0 [2017-12-29]
-==================
+
+# 1.4.0 [2017-12-29]
* Improve build with cmake
* Retire autoconf/automake build system
@@ -82,20 +137,20 @@
Supported for buffer sources and on Apple File System.
* Add support for Microsoft Universal Windows Platform.
-1.3.2 [2017-11-20]
-==================
+
+# 1.3.2 [2017-11-20]
* Fix bug introduced in last: zip_t was erroneously freed if zip_close() failed.
-1.3.1 [2017-11-19]
-==================
+
+# 1.3.1 [2017-11-19]
* Install zipconf.h into ${PREFIX}/include
* Add zip_libzip_version()
* Fix AES tests on Linux
-1.3.0 [2017-09-02]
-==================
+
+# 1.3.0 [2017-09-02]
* Support bzip2 compressed zip archives
* Improve file progress callback code
@@ -103,8 +158,8 @@
* CVE-2017-12858: Fix double free()
* CVE-2017-14107: Improve EOCD64 parsing
-1.2.0 [2017-02-19]
-==================
+
+# 1.2.0 [2017-02-19]
* Support for AES encryption (Winzip version), both encryption
and decryption
@@ -114,24 +169,24 @@
* Add zip_ftell() for telling position in uncompressed data
* Add zip_register_progress_callback() for UI updates during zip_close()
-1.1.3 [2016-05-28]
-==================
+
+# 1.1.3 [2016-05-28]
* Fix build on Windows when using autoconf
-1.1.2 [2016-02-19]
-==================
+
+# 1.1.2 [2016-02-19]
* Improve support for 3MF files
-1.1.1 [2016-02-07]
-==================
+
+# 1.1.1 [2016-02-07]
* Build fixes for Linux
* Fix some warnings reported by PVS-Studio
-1.1 [2016-01-26]
-================
+
+# 1.1 [2016-01-26]
* ziptool(1): command line tool to modify zip archives
* Speedups for archives with many entries
@@ -142,13 +197,13 @@
* Portability fixes
* Documentation improvements
-1.0.1 [2015-05-04]
-==================
+
+# 1.0.1 [2015-05-04]
* Build fixes for Windows
-1.0 [2015-05-03]
-================
+
+# 1.0 [2015-05-03]
* Implemented an I/O abstraction layer
* Added support for native Windows API for files
@@ -159,22 +214,22 @@
* CVE-2015-2331 was fixed
* Addressed all Coverity CIDs
-0.11.2 [2013-12-19]
-===================
+
+# 0.11.2 [2013-12-19]
* Support querying/setting operating system and external attributes
* For newly added files, set operating system to UNIX, permissions
to 0666 (0777 for directories)
* Fix bug when writing zip archives containing files bigger than 4GB
-0.11.1 [2013-04-27]
-===================
+
+# 0.11.1 [2013-04-27]
* Fix bugs in zip_set_file_compression()
* Include Xcode build infrastructure
-0.11 [2013-03-23]
-=================
+
+# 0.11 [2013-03-23]
* Added Zip64 support (large file support)
* Added UTF-8 support for file names, file comments, and archive comments
@@ -188,14 +243,14 @@
* More changes for Windows support
* Additional test cases
-0.10.1 [2012-03-20]
-===================
+
+# 0.10.1 [2012-03-20]
* Fixed CVE-2012-1162
* Fixed CVE-2012-1163
-0.10 [2010-03-18]
-=================
+
+# 0.10 [2010-03-18]
* Added zip_get_num_entries(), deprecated zip_get_num_files()
* Better windows support
@@ -207,27 +262,27 @@
* Fixed CVE-2011-0421 (no security implications though)
* More documentation
-0.9.3 [2010-02-01]
-==================
+
+# 0.9.3 [2010-02-01]
* Include m4/ directory in distribution; some packagers need it
-0.9.2 [2010-01-31]
-==================
+
+# 0.9.2 [2010-01-31]
* Avoid passing uninitialized data to deflate()
* Fix memory leak when closing zip archives
-0.9.1 [2010-01-24]
-==================
+
+# 0.9.1 [2010-01-24]
* Fix infinite loop on reading some broken files
* Optimization in time conversion (don't call localtime())
* Clear data descriptor flag in central directory, fixing Open Office files
* Allow more than 64k entries
-0.9 [2008-07-25]
-==================
+
+# 0.9 [2008-07-25]
* on Windows, explicitly set dllimport/dllexport
* remove erroneous references to GPL
@@ -236,8 +291,8 @@
* zip_source_zip: add flag to force recompression
* zip_sorce_file: only keep file open while reading from it
-0.8 [2007-06-06]
-==================
+
+# 0.8 [2007-06-06]
* fix for zip archives larger than 2GiB
* fix zip_error_strerror to include libzip error string
@@ -245,13 +300,13 @@
* new functions: zip_add_dir, zip_error_clear, zip_file_error_clear
* add basic support for building with CMake (incomplete)
-0.7.1 [2006-05-18]
-==================
+
+# 0.7.1 [2006-05-18]
* bugfix for zip_close
-0.7 [2006-05-06]
-================
+
+# 0.7 [2006-05-06]
* struct zip_stat increased for future encryption support
* zip_add return value changed (now returns new index of added file)
@@ -260,13 +315,13 @@
New functions: zip_get_archive_comment, zip_get_file_comment,
zip_set_archive_comment, zip_set_file_comment, zip_unchange_archive
-0.6.1 [2005-07-14]
-==================
+
+# 0.6.1 [2005-07-14]
* various bug fixes
-0.6 [2005-06-09]
-================
+
+# 0.6 [2005-06-09]
* first standalone release
* changed license to three-clause BSD
diff --git a/src/Common/libzip/compat.h b/src/Common/libzip/compat.h
index fb2c56e1..296ee59e 100644
--- a/src/Common/libzip/compat.h
+++ b/src/Common/libzip/compat.h
@@ -3,10 +3,10 @@
/*
compat.h -- compatibility defines.
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -41,27 +41,29 @@
/* to have *_MAX definitions for all types when compiling with g++ */
#define __STDC_LIMIT_MACROS
-#ifdef _WIN32
-#ifndef ZIP_EXTERN
-#ifndef ZIP_STATIC
+/* to have ISO C secure library functions */
+#define __STDC_WANT_LIB_EXT1__ 1
+
+#if defined(_WIN32) && defined(ZIP_DLL) && !defined(ZIP_STATIC)
+#ifdef BUILDING_LIBZIP
#define ZIP_EXTERN __declspec(dllexport)
#else
-#define ZIP_EXTERN
+#define ZIP_EXTERN __declspec(dllimport)
#endif
#endif
+
+#ifdef _WIN32
/* for dup(), close(), etc. */
#include <io.h>
#endif
#ifdef HAVE_STDBOOL_H
#include <stdbool.h>
-#else
-#ifndef __cplusplus
+#elif !defined(__BOOL_DEFINED)
typedef char bool;
#define true 1
#define false 0
#endif
-#endif
#include <errno.h>
@@ -85,9 +87,6 @@ typedef char bool;
#endif
#ifdef _WIN32
-#if defined(HAVE__CHMOD)
-#define chmod _chmod
-#endif
#if defined(HAVE__CLOSE)
#define close _close
#endif
@@ -101,9 +100,12 @@ typedef char bool;
#if !defined(HAVE_FILENO) && defined(HAVE__FILENO)
#define fileno _fileno
#endif
-#if defined(HAVE__SNPRINTF)
+#if !defined(HAVE_SNPRINTF) && defined(HAVE__SNPRINTF)
#define snprintf _snprintf
#endif
+#if !defined(HAVE__SNWPRINTF_S)
+#define _snwprintf_s(buf, bufsz, len, fmt, ...) (_snwprintf((buf), (len), (fmt), __VA_ARGS__))
+#endif
#if defined(HAVE__STRDUP)
#if !defined(HAVE_STRDUP) || defined(_WIN32)
#undef strdup
@@ -132,6 +134,33 @@ typedef char bool;
#define ftello(s) ((long)ftell((s)))
#endif
+#ifdef HAVE_LOCALTIME_S
+#ifdef _WIN32
+/* Windows is incompatible to the C11 standard, hurray! */
+#define zip_localtime(t, tm) (localtime_s((tm), (t)) == 0 ? tm : NULL)
+#else
+#define zip_localtime localtime_s
+#endif
+#else
+#ifdef HAVE_LOCALTIME_R
+#define zip_localtime localtime_r
+#else
+#define zip_localtime(t, tm) (localtime(t))
+#endif
+#endif
+
+#ifndef HAVE_MEMCPY_S
+#define memcpy_s(dest, destsz, src, count) (memcpy((dest), (src), (count)) == NULL)
+#endif
+
+#ifndef HAVE_SNPRINTF_S
+#ifdef HAVE__SNPRINTF_S
+#define snprintf_s(buf, bufsz, fmt, ...) (_snprintf_s((buf), (bufsz), (bufsz), (fmt), __VA_ARGS__))
+#else
+#define snprintf_s snprintf
+#endif
+#endif
+
#if !defined(HAVE_STRCASECMP)
#if defined(HAVE__STRICMP)
#define strcasecmp _stricmp
@@ -140,6 +169,19 @@ typedef char bool;
#endif
#endif
+#ifndef HAVE_STRNCPY_S
+#define strncpy_s(dest, destsz, src, count) (strncpy((dest), (src), (count)), 0)
+#endif
+
+#ifndef HAVE_STRERROR_S
+#define strerrorlen_s(errnum) (strlen(strerror(errnum)))
+#define strerror_s(buf, bufsz, errnum) ((void)strncpy_s((buf), (bufsz), strerror(errnum), (bufsz)), (buf)[(bufsz)-1] = '\0', strerrorlen_s(errnum) >= (bufsz))
+#else
+#ifndef HAVE_STRERRORLEN_S
+#define strerrorlen_s(errnum) 8192
+#endif
+#endif
+
#if SIZEOF_OFF_T == 8
#define ZIP_OFF_MAX ZIP_INT64_MAX
#define ZIP_OFF_MIN ZIP_INT64_MIN
diff --git a/src/Common/libzip/config.h b/src/Common/libzip/config.h
index 1edd29ba..2976249c 100644
--- a/src/Common/libzip/config.h
+++ b/src/Common/libzip/config.h
@@ -4,69 +4,81 @@
#include "zipconf.h"
#endif
/* BEGIN DEFINES */
+#define ENABLE_FDOPEN
/* #undef HAVE___PROGNAME */
-#define HAVE__CHMOD
#define HAVE__CLOSE
#define HAVE__DUP
#define HAVE__FDOPEN
#define HAVE__FILENO
-#define HAVE__OPEN
#define HAVE__SETMODE
+#if defined(_MSC_VER) && _MSC_VER < 1900
+#define HAVE__SNPRINTF
+#else
/* #undef HAVE__SNPRINTF */
+#endif
+#define HAVE__SNPRINTF_S
+#define HAVE__SNWPRINTF_S
#define HAVE__STRDUP
#define HAVE__STRICMP
#define HAVE__STRTOI64
#define HAVE__STRTOUI64
-#define HAVE__UMASK
#define HAVE__UNLINK
+/* #undef HAVE_ARC4RANDOM */
/* #undef HAVE_CLONEFILE */
/* #undef HAVE_COMMONCRYPTO */
-/* #undef HAVE_CRYPTO */
+#define HAVE_CRYPTO
/* #undef HAVE_FICLONERANGE */
#define HAVE_FILENO
+/* #undef HAVE_FCHMOD */
/* #undef HAVE_FSEEKO */
/* #undef HAVE_FTELLO */
/* #undef HAVE_GETPROGNAME */
/* #undef HAVE_GNUTLS */
/* #undef HAVE_LIBBZ2 */
-#define HAVE_OPEN
-/* #undef HAVE_OPENSSL */
+/* #undef HAVE_LIBLZMA */
+/* #undef HAVE_LIBZSTD */
+/* #undef HAVE_LOCALTIME_R */
+#define HAVE_LOCALTIME_S
+#define HAVE_MEMCPY_S
+/* #undef HAVE_MBEDTLS */
/* #undef HAVE_MKSTEMP */
+/* #undef HAVE_NULLABLE */
+/* #undef HAVE_OPENSSL */
#define HAVE_SETMODE
+#if defined(_MSC_VER) && _MSC_VER < 1900
/* #undef HAVE_SNPRINTF */
-/* #undef HAVE_SSIZE_T_LIBZIP */
+#else
+#define HAVE_SNPRINTF
+#endif
+/* #undef HAVE_SNPRINTF_S */
/* #undef HAVE_STRCASECMP */
#define HAVE_STRDUP
+#define HAVE_STRERROR_S
+/* #undef HAVE_STRERRORLEN_S */
#define HAVE_STRICMP
+#define HAVE_STRNCPY_S
+#if defined(_MSC_VER) && _MSC_VER < 1800
/* #undef HAVE_STRTOLL */
/* #undef HAVE_STRTOULL */
+#else
+#define HAVE_STRTOLL
+#define HAVE_STRTOULL
+#endif
/* #undef HAVE_STRUCT_TM_TM_ZONE */
+#if defined(_MSC_VER) && _MSC_VER < 1800
/* #undef HAVE_STDBOOL_H */
+#else
+#define HAVE_STDBOOL_H
+#endif
/* #undef HAVE_STRINGS_H */
/* #undef HAVE_UNISTD_H */
-#define __INT8_LIBZIP 1
-#define INT8_T_LIBZIP 1
-#define UINT8_T_LIBZIP 1
-#define __INT16_LIBZIP 2
-#define INT16_T_LIBZIP 2
-#define UINT16_T_LIBZIP 2
-#define __INT32_LIBZIP 4
-#define INT32_T_LIBZIP 4
-#define UINT32_T_LIBZIP 4
-#define __INT64_LIBZIP 8
-#define INT64_T_LIBZIP 8
-#define UINT64_T_LIBZIP 8
-#define SHORT_LIBZIP 2
-#define INT_LIBZIP 4
-#define LONG_LIBZIP 4
-#define LONG_LONG_LIBZIP 8
+#define HAVE_WINDOWS_CRYPTO
#define SIZEOF_OFF_T 4
#ifdef _WIN64
-#define SIZE_T_LIBZIP 8
+#define SIZEOF_SIZE_T 8
#else
-#define SIZE_T_LIBZIP 4
+#define SIZEOF_SIZE_T 4
#endif
-/* #undef SSIZE_T_LIBZIP */
/* #undef HAVE_DIRENT_H */
/* #undef HAVE_FTS_H */
/* #undef HAVE_NDIR_H */
@@ -76,18 +88,6 @@
#define HAVE_SHARED
/* END DEFINES */
#define PACKAGE "libzip"
-#define VERSION "1.7.3"
-
-#ifndef HAVE_SSIZE_T_LIBZIP
-# if SIZE_T_LIBZIP == INT_LIBZIP
-typedef int ssize_t;
-# elif SIZE_T_LIBZIP == LONG_LIBZIP
-typedef long ssize_t;
-# elif SIZE_T_LIBZIP == LONG_LONG_LIBZIP
-typedef long long ssize_t;
-# else
-#error no suitable type for ssize_t found
-# endif
-#endif
+#define VERSION "1.10.1"
#endif /* HAD_CONFIG_H */
diff --git a/src/Common/libzip/zip.h b/src/Common/libzip/zip.h
index ba0b6ba2..dc3751c8 100644
--- a/src/Common/libzip/zip.h
+++ b/src/Common/libzip/zip.h
@@ -3,10 +3,10 @@
/*
zip.h -- exported declarations.
- Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -45,9 +45,13 @@ extern "C" {
#include <zipconf.h>
#ifndef ZIP_EXTERN
-#ifndef ZIP_STATIC
+#if defined(ZIP_DLL) && !defined(ZIP_STATIC)
#ifdef _WIN32
+#ifdef BUILDING_LIBZIP
+#define ZIP_EXTERN __declspec(dllexport)
+#else
#define ZIP_EXTERN __declspec(dllimport)
+#endif
#elif defined(__GNUC__) && __GNUC__ >= 4
#define ZIP_EXTERN __attribute__((visibility("default")))
#else
@@ -58,8 +62,15 @@ extern "C" {
#endif
#endif
-#define _Nullable
-#define _Nonnull
+#ifndef ZIP_DEPRECATED
+#if defined(__GNUC__) || defined(__clang__)
+#define ZIP_DEPRECATED(x) __attribute__((deprecated(x)))
+#elif defined(_MSC_VER)
+#define ZIP_DEPRECATED(x) __declspec(deprecated(x))
+#else
+#define ZIP_DEPRECATED(x)
+#endif
+#endif
#include <stdio.h>
#include <sys/types.h>
@@ -80,7 +91,7 @@ extern "C" {
#define ZIP_FL_NODIR 2u /* ignore directory component */
#define ZIP_FL_COMPRESSED 4u /* read compressed data */
#define ZIP_FL_UNCHANGED 8u /* use original data, ignoring changes */
-#define ZIP_FL_RECOMPRESS 16u /* force recompression of data */
+/* 16u was ZIP_FL_RECOMPRESS, which is deprecated */
#define ZIP_FL_ENCRYPTED 32u /* read encrypted data (implies ZIP_FL_COMPRESSED) */
#define ZIP_FL_ENC_GUESS 0u /* guess string encoding (is default) */
#define ZIP_FL_ENC_RAW 64u /* get unmodified string */
@@ -94,7 +105,10 @@ extern "C" {
/* archive global flags flags */
-#define ZIP_AFL_RDONLY 2u /* read only -- cannot be cleared */
+#define ZIP_AFL_RDONLY 2u /* read only -- cannot be cleared */
+#define ZIP_AFL_IS_TORRENTZIP 4u /* current archive is torrentzipped */
+#define ZIP_AFL_WANT_TORRENTZIP 8u /* write archive in torrentzip format */
+#define ZIP_AFL_CREATE_OR_KEEP_FILE_FOR_EMPTY_ARCHIVE 16u /* don't remove file if archive is empty */
/* create a new extra field */
@@ -102,6 +116,10 @@ extern "C" {
#define ZIP_EXTRA_FIELD_ALL ZIP_UINT16_MAX
#define ZIP_EXTRA_FIELD_NEW ZIP_UINT16_MAX
+/* length parameter to various functions */
+
+#define ZIP_LENGTH_TO_END 0
+#define ZIP_LENGTH_UNCHECKED (-2) /* only supported by zip_source_file and its variants */
/* libzip error codes */
@@ -126,7 +144,7 @@ extern "C" {
#define ZIP_ER_INVAL 18 /* N Invalid argument */
#define ZIP_ER_NOZIP 19 /* N Not a zip archive */
#define ZIP_ER_INTERNAL 20 /* N Internal error */
-#define ZIP_ER_INCONS 21 /* N Zip archive inconsistent */
+#define ZIP_ER_INCONS 21 /* L Zip archive inconsistent */
#define ZIP_ER_REMOVE 22 /* S Can't remove file */
#define ZIP_ER_DELETED 23 /* N Entry has been deleted */
#define ZIP_ER_ENCRNOTSUPP 24 /* N Encryption method not supported */
@@ -138,12 +156,15 @@ extern "C" {
#define ZIP_ER_TELL 30 /* S Tell error */
#define ZIP_ER_COMPRESSED_DATA 31 /* N Compressed data invalid */
#define ZIP_ER_CANCELLED 32 /* N Operation cancelled */
+#define ZIP_ER_DATA_LENGTH 33 /* N Unexpected length of data */
+#define ZIP_ER_NOT_ALLOWED 34 /* N Not allowed in torrentzip */
/* type of system error value */
-#define ZIP_ET_NONE 0 /* sys_err unused */
-#define ZIP_ET_SYS 1 /* sys_err is errno */
-#define ZIP_ET_ZLIB 2 /* sys_err is zlib error code */
+#define ZIP_ET_NONE 0 /* sys_err unused */
+#define ZIP_ET_SYS 1 /* sys_err is errno */
+#define ZIP_ET_ZLIB 2 /* sys_err is zlib error code */
+#define ZIP_ET_LIBZIP 3 /* sys_err is libzip error code */
/* compression methods */
@@ -166,7 +187,9 @@ extern "C" {
/* 15-17 - Reserved by PKWARE */
#define ZIP_CM_TERSE 18 /* compressed using IBM TERSE (new) */
#define ZIP_CM_LZ77 19 /* IBM LZ77 z Architecture (PFS) */
+/* 20 - old value for Zstandard */
#define ZIP_CM_LZMA2 33
+#define ZIP_CM_ZSTD 93 /* Zstandard compressed data */
#define ZIP_CM_XZ 95 /* XZ compressed data */
#define ZIP_CM_JPEG 96 /* Compressed Jpeg data */
#define ZIP_CM_WAVPACK 97 /* WavPack compressed data */
@@ -236,12 +259,15 @@ enum zip_source_cmd {
ZIP_SOURCE_RESERVED_1, /* previously used internally */
ZIP_SOURCE_BEGIN_WRITE_CLONING, /* like ZIP_SOURCE_BEGIN_WRITE, but keep part of original file */
ZIP_SOURCE_ACCEPT_EMPTY, /* whether empty files are valid archives */
- ZIP_SOURCE_GET_FILE_ATTRIBUTES /* get additional file attributes */
+ ZIP_SOURCE_GET_FILE_ATTRIBUTES, /* get additional file attributes */
+ ZIP_SOURCE_SUPPORTS_REOPEN /* allow reading from changed entry */
};
typedef enum zip_source_cmd zip_source_cmd_t;
#define ZIP_SOURCE_MAKE_COMMAND_BITMASK(cmd) (((zip_int64_t)1) << (cmd))
+#define ZIP_SOURCE_CHECK_SUPPORTED(supported, cmd) (((supported) & ZIP_SOURCE_MAKE_COMMAND_BITMASK(cmd)) != 0)
+
/* clang-format off */
#define ZIP_SOURCE_SUPPORTS_READABLE (ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_OPEN) \
@@ -345,24 +371,29 @@ typedef struct zip_buffer_fragment zip_buffer_fragment_t;
typedef zip_uint32_t zip_flags_t;
typedef zip_int64_t (*zip_source_callback)(void *_Nullable, void *_Nullable, zip_uint64_t, zip_source_cmd_t);
+typedef zip_int64_t (*zip_source_layered_callback)(zip_source_t *_Nonnull, void *_Nullable, void *_Nullable, zip_uint64_t, enum zip_source_cmd);
typedef void (*zip_progress_callback)(zip_t *_Nonnull, double, void *_Nullable);
typedef int (*zip_cancel_callback)(zip_t *_Nonnull, void *_Nullable);
#ifndef ZIP_DISABLE_DEPRECATED
+#define ZIP_FL_RECOMPRESS 16u /* force recompression of data */
+
typedef void (*zip_progress_callback_t)(double);
-ZIP_EXTERN void zip_register_progress_callback(zip_t *_Nonnull, zip_progress_callback_t _Nullable); /* use zip_register_progress_callback_with_state */
-
-ZIP_EXTERN zip_int64_t zip_add(zip_t *_Nonnull, const char *_Nonnull, zip_source_t *_Nonnull); /* use zip_file_add */
-ZIP_EXTERN zip_int64_t zip_add_dir(zip_t *_Nonnull, const char *_Nonnull); /* use zip_dir_add */
-ZIP_EXTERN const char *_Nullable zip_get_file_comment(zip_t *_Nonnull, zip_uint64_t, int *_Nullable, int); /* use zip_file_get_comment */
-ZIP_EXTERN int zip_get_num_files(zip_t *_Nonnull); /* use zip_get_num_entries instead */
-ZIP_EXTERN int zip_rename(zip_t *_Nonnull, zip_uint64_t, const char *_Nonnull); /* use zip_file_rename */
-ZIP_EXTERN int zip_replace(zip_t *_Nonnull, zip_uint64_t, zip_source_t *_Nonnull); /* use zip_file_replace */
-ZIP_EXTERN int zip_set_file_comment(zip_t *_Nonnull, zip_uint64_t, const char *_Nullable, int); /* use zip_file_set_comment */
-ZIP_EXTERN int zip_error_get_sys_type(int); /* use zip_error_system_type */
-ZIP_EXTERN void zip_error_get(zip_t *_Nonnull, int *_Nullable, int *_Nullable); /* use zip_get_error, zip_error_code_zip / zip_error_code_system */
-ZIP_EXTERN int zip_error_to_str(char *_Nonnull, zip_uint64_t, int, int); /* use zip_error_init_with_code / zip_error_strerror */
-ZIP_EXTERN void zip_file_error_get(zip_file_t *_Nonnull, int *_Nullable, int *_Nullable); /* use zip_file_get_error, zip_error_code_zip / zip_error_code_system */
+ZIP_DEPRECATED("use 'zip_register_progress_callback_with_state' instead") ZIP_EXTERN void zip_register_progress_callback(zip_t *_Nonnull, zip_progress_callback_t _Nullable);
+
+ZIP_DEPRECATED("use 'zip_file_add' instead") ZIP_EXTERN zip_int64_t zip_add(zip_t *_Nonnull, const char *_Nonnull, zip_source_t *_Nonnull);
+ZIP_DEPRECATED("use 'zip_dir_add' instead") ZIP_EXTERN zip_int64_t zip_add_dir(zip_t *_Nonnull, const char *_Nonnull);
+ZIP_DEPRECATED("use 'zip_file_get_comment' instead") ZIP_EXTERN const char *_Nullable zip_get_file_comment(zip_t *_Nonnull, zip_uint64_t, int *_Nullable, int);
+ZIP_DEPRECATED("use 'zip_get_num_entries' instead") ZIP_EXTERN int zip_get_num_files(zip_t *_Nonnull);
+ZIP_DEPRECATED("use 'zip_file_rename' instead") ZIP_EXTERN int zip_rename(zip_t *_Nonnull, zip_uint64_t, const char *_Nonnull);
+ZIP_DEPRECATED("use 'zip_file_replace' instead") ZIP_EXTERN int zip_replace(zip_t *_Nonnull, zip_uint64_t, zip_source_t *_Nonnull);
+ZIP_DEPRECATED("use 'zip_file_set_comment' instead") ZIP_EXTERN int zip_set_file_comment(zip_t *_Nonnull, zip_uint64_t, const char *_Nullable, int);
+ZIP_DEPRECATED("use 'zip_error_init_with_code' and 'zip_error_system_type' instead") ZIP_EXTERN int zip_error_get_sys_type(int);
+ZIP_DEPRECATED("use 'zip_get_error' instead") ZIP_EXTERN void zip_error_get(zip_t *_Nonnull, int *_Nullable, int *_Nullable);
+ZIP_DEPRECATED("use 'zip_error_strerror' instead") ZIP_EXTERN int zip_error_to_str(char *_Nonnull, zip_uint64_t, int, int);
+ZIP_DEPRECATED("use 'zip_file_get_error' instead") ZIP_EXTERN void zip_file_error_get(zip_file_t *_Nonnull, int *_Nullable, int *_Nullable);
+ZIP_DEPRECATED("use 'zip_source_zip_file' instead") ZIP_EXTERN zip_source_t *_Nullable zip_source_zip(zip_t *_Nonnull, zip_t *_Nonnull, zip_uint64_t, zip_flags_t, zip_uint64_t, zip_int64_t);
+ZIP_DEPRECATED("use 'zip_source_zip_file_create' instead") ZIP_EXTERN zip_source_t *_Nullable zip_source_zip_create(zip_t *_Nonnull, zip_uint64_t, zip_flags_t, zip_uint64_t, zip_int64_t, zip_error_t *_Nullable);
#endif
ZIP_EXTERN int zip_close(zip_t *_Nonnull);
@@ -378,6 +409,7 @@ ZIP_EXTERN void zip_error_fini(zip_error_t *_Nonnull);
ZIP_EXTERN void zip_error_init(zip_error_t *_Nonnull);
ZIP_EXTERN void zip_error_init_with_code(zip_error_t *_Nonnull, int);
ZIP_EXTERN void zip_error_set(zip_error_t *_Nullable, int, int);
+ZIP_EXTERN void zip_error_set_from_source(zip_error_t *_Nonnull, zip_source_t *_Nullable);
ZIP_EXTERN const char *_Nonnull zip_error_strerror(zip_error_t *_Nonnull);
ZIP_EXTERN int zip_error_system_type(const zip_error_t *_Nonnull);
ZIP_EXTERN zip_int64_t zip_error_to_data(const zip_error_t *_Nonnull, void *_Nonnull, zip_uint64_t);
@@ -397,6 +429,7 @@ ZIP_EXTERN const zip_uint8_t *_Nullable zip_file_extra_field_get_by_id(zip_t *_N
ZIP_EXTERN const char *_Nullable zip_file_get_comment(zip_t *_Nonnull, zip_uint64_t, zip_uint32_t *_Nullable, zip_flags_t);
ZIP_EXTERN zip_error_t *_Nonnull zip_file_get_error(zip_file_t *_Nonnull);
ZIP_EXTERN int zip_file_get_external_attributes(zip_t *_Nonnull, zip_uint64_t, zip_flags_t, zip_uint8_t *_Nullable, zip_uint32_t *_Nullable);
+ZIP_EXTERN int zip_file_is_seekable(zip_file_t *_Nonnull);
ZIP_EXTERN int zip_file_rename(zip_t *_Nonnull, zip_uint64_t, const char *_Nonnull, zip_flags_t);
ZIP_EXTERN int zip_file_replace(zip_t *_Nonnull, zip_uint64_t, zip_source_t *_Nonnull, zip_flags_t);
ZIP_EXTERN int zip_file_set_comment(zip_t *_Nonnull, zip_uint64_t, const char *_Nullable, zip_uint16_t, zip_flags_t);
@@ -444,9 +477,13 @@ ZIP_EXTERN zip_source_t *_Nullable zip_source_function(zip_t *_Nonnull, zip_sour
ZIP_EXTERN zip_source_t *_Nullable zip_source_function_create(zip_source_callback _Nonnull, void *_Nullable, zip_error_t *_Nullable);
ZIP_EXTERN int zip_source_get_file_attributes(zip_source_t *_Nonnull, zip_file_attributes_t *_Nonnull);
ZIP_EXTERN int zip_source_is_deleted(zip_source_t *_Nonnull);
+ZIP_EXTERN int zip_source_is_seekable(zip_source_t *_Nonnull);
ZIP_EXTERN void zip_source_keep(zip_source_t *_Nonnull);
+ZIP_EXTERN zip_source_t *_Nullable zip_source_layered(zip_t *_Nullable, zip_source_t *_Nonnull, zip_source_layered_callback _Nonnull, void *_Nullable);
+ZIP_EXTERN zip_source_t *_Nullable zip_source_layered_create(zip_source_t *_Nonnull, zip_source_layered_callback _Nonnull, void *_Nullable, zip_error_t *_Nullable);
ZIP_EXTERN zip_int64_t zip_source_make_command_bitmap(zip_source_cmd_t, ...);
ZIP_EXTERN int zip_source_open(zip_source_t *_Nonnull);
+ZIP_EXTERN zip_int64_t zip_source_pass_to_lower_layer(zip_source_t *_Nonnull, void *_Nullable, zip_uint64_t, zip_source_cmd_t);
ZIP_EXTERN zip_int64_t zip_source_read(zip_source_t *_Nonnull, void *_Nonnull, zip_uint64_t);
ZIP_EXTERN void zip_source_rollback_write(zip_source_t *_Nonnull);
ZIP_EXTERN int zip_source_seek(zip_source_t *_Nonnull, zip_int64_t, int);
@@ -456,15 +493,17 @@ ZIP_EXTERN int zip_source_stat(zip_source_t *_Nonnull, zip_stat_t *_Nonnull);
ZIP_EXTERN zip_int64_t zip_source_tell(zip_source_t *_Nonnull);
ZIP_EXTERN zip_int64_t zip_source_tell_write(zip_source_t *_Nonnull);
#ifdef _WIN32
-ZIP_EXTERN zip_source_t *zip_source_win32a(zip_t *, const char *, zip_uint64_t, zip_int64_t);
-ZIP_EXTERN zip_source_t *zip_source_win32a_create(const char *, zip_uint64_t, zip_int64_t, zip_error_t *);
-ZIP_EXTERN zip_source_t *zip_source_win32handle(zip_t *, void *, zip_uint64_t, zip_int64_t);
-ZIP_EXTERN zip_source_t *zip_source_win32handle_create(void *, zip_uint64_t, zip_int64_t, zip_error_t *);
-ZIP_EXTERN zip_source_t *zip_source_win32w(zip_t *, const wchar_t *, zip_uint64_t, zip_int64_t);
-ZIP_EXTERN zip_source_t *zip_source_win32w_create(const wchar_t *, zip_uint64_t, zip_int64_t, zip_error_t *);
+ZIP_EXTERN zip_source_t *_Nullable zip_source_win32a(zip_t *_Nonnull, const char *_Nonnull, zip_uint64_t, zip_int64_t);
+ZIP_EXTERN zip_source_t *_Nullable zip_source_win32a_create(const char *_Nonnull, zip_uint64_t, zip_int64_t, zip_error_t *_Nullable);
+ZIP_EXTERN zip_source_t *_Nullable zip_source_win32handle(zip_t *_Nonnull, void *_Nonnull, zip_uint64_t, zip_int64_t);
+ZIP_EXTERN zip_source_t *_Nullable zip_source_win32handle_create(void *_Nonnull, zip_uint64_t, zip_int64_t, zip_error_t *_Nullable);
+ZIP_EXTERN zip_source_t *_Nullable zip_source_win32w(zip_t *_Nonnull, const wchar_t *_Nonnull, zip_uint64_t, zip_int64_t);
+ZIP_EXTERN zip_source_t *_Nullable zip_source_win32w_create(const wchar_t *_Nonnull, zip_uint64_t, zip_int64_t, zip_error_t *_Nullable);
#endif
+ZIP_EXTERN zip_source_t *_Nullable zip_source_window_create(zip_source_t *_Nonnull, zip_uint64_t, zip_int64_t, zip_error_t *_Nullable);
ZIP_EXTERN zip_int64_t zip_source_write(zip_source_t *_Nonnull, const void *_Nullable, zip_uint64_t);
-ZIP_EXTERN zip_source_t *_Nullable zip_source_zip(zip_t *_Nonnull, zip_t *_Nonnull, zip_uint64_t, zip_flags_t, zip_uint64_t, zip_int64_t);
+ZIP_EXTERN zip_source_t *_Nullable zip_source_zip_file(zip_t *_Nonnull, zip_t *_Nonnull, zip_uint64_t, zip_flags_t, zip_uint64_t, zip_int64_t, const char *_Nullable);
+ZIP_EXTERN zip_source_t *_Nullable zip_source_zip_file_create(zip_t *_Nonnull, zip_uint64_t, zip_flags_t, zip_uint64_t, zip_int64_t, const char *_Nullable, zip_error_t *_Nullable);
ZIP_EXTERN int zip_stat(zip_t *_Nonnull, const char *_Nonnull, zip_flags_t, zip_stat_t *_Nonnull);
ZIP_EXTERN int zip_stat_index(zip_t *_Nonnull, zip_uint64_t, zip_flags_t, zip_stat_t *_Nonnull);
ZIP_EXTERN void zip_stat_init(zip_stat_t *_Nonnull);
diff --git a/src/Common/libzip/zip_add.c b/src/Common/libzip/zip_add.c
index 19542357..9770139d 100644
--- a/src/Common/libzip/zip_add.c
+++ b/src/Common/libzip/zip_add.c
@@ -1,9 +1,9 @@
/*
zip_add.c -- add file via callback function
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -38,9 +38,9 @@
/*
NOTE: Return type is signed so we can return -1 on error.
- The index can not be larger than ZIP_INT64_MAX since the size
- of the central directory cannot be larger than
- ZIP_UINT64_MAX, and each entry is larger than 2 bytes.
+ The index can not be larger than ZIP_INT64_MAX since the size
+ of the central directory cannot be larger than
+ ZIP_UINT64_MAX, and each entry is larger than 2 bytes.
*/
ZIP_EXTERN zip_int64_t
diff --git a/src/Common/libzip/zip_add_dir.c b/src/Common/libzip/zip_add_dir.c
index 88fcf53a..c31fea36 100644
--- a/src/Common/libzip/zip_add_dir.c
+++ b/src/Common/libzip/zip_add_dir.c
@@ -1,9 +1,9 @@
/*
zip_add_dir.c -- add directory
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
diff --git a/src/Common/libzip/zip_add_entry.c b/src/Common/libzip/zip_add_entry.c
index f52e0b5c..bf12dd54 100644
--- a/src/Common/libzip/zip_add_entry.c
+++ b/src/Common/libzip/zip_add_entry.c
@@ -1,9 +1,9 @@
/*
zip_add_entry.c -- create and init struct zip_entry
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -44,32 +44,32 @@ _zip_add_entry(zip_t *za) {
zip_uint64_t idx;
if (za->nentry + 1 >= za->nentry_alloc) {
- zip_entry_t *rentries;
- zip_uint64_t nalloc = za->nentry_alloc;
- zip_uint64_t additional_entries = 2 * nalloc;
- zip_uint64_t realloc_size;
+ zip_entry_t *rentries;
+ zip_uint64_t nalloc = za->nentry_alloc;
+ zip_uint64_t additional_entries = 2 * nalloc;
+ zip_uint64_t realloc_size;
- if (additional_entries < 16) {
- additional_entries = 16;
- }
- else if (additional_entries > 1024) {
- additional_entries = 1024;
- }
- /* neither + nor * overflows can happen: nentry_alloc * sizeof(struct zip_entry) < UINT64_MAX */
- nalloc += additional_entries;
- realloc_size = sizeof(struct zip_entry) * (size_t)nalloc;
+ if (additional_entries < 16) {
+ additional_entries = 16;
+ }
+ else if (additional_entries > 1024) {
+ additional_entries = 1024;
+ }
+ /* neither + nor * overflows can happen: nentry_alloc * sizeof(struct zip_entry) < UINT64_MAX */
+ nalloc += additional_entries;
+ realloc_size = sizeof(struct zip_entry) * (size_t)nalloc;
- if (sizeof(struct zip_entry) * (size_t)za->nentry_alloc > realloc_size) {
- zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
- return -1;
- }
- rentries = (zip_entry_t *)realloc(za->entry, sizeof(struct zip_entry) * (size_t)nalloc);
- if (!rentries) {
- zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
- return -1;
- }
- za->entry = rentries;
- za->nentry_alloc = nalloc;
+ if (sizeof(struct zip_entry) * (size_t)za->nentry_alloc > realloc_size) {
+ zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
+ return -1;
+ }
+ rentries = (zip_entry_t *)realloc(za->entry, sizeof(struct zip_entry) * (size_t)nalloc);
+ if (!rentries) {
+ zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
+ return -1;
+ }
+ za->entry = rentries;
+ za->nentry_alloc = nalloc;
}
idx = za->nentry++;
diff --git a/src/Common/libzip/zip_algorithm_bzip2.c b/src/Common/libzip/zip_algorithm_bzip2.c
new file mode 100644
index 00000000..f25be143
--- /dev/null
+++ b/src/Common/libzip/zip_algorithm_bzip2.c
@@ -0,0 +1,293 @@
+/*
+ zip_algorithm_bzip2.c -- bzip2 (de)compression routines
+ Copyright (C) 2017-2021 Dieter Baron and Thomas Klausner
+
+ This file is part of libzip, a library to manipulate ZIP archives.
+ The authors can be contacted at <info@libzip.org>
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ 3. The names of the authors may not be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "zipint.h"
+
+#include <bzlib.h>
+#include <limits.h>
+#include <stdlib.h>
+
+struct ctx {
+ zip_error_t *error;
+ bool compress;
+ int compression_flags;
+ bool end_of_input;
+ bz_stream zstr;
+};
+
+
+static zip_uint64_t
+maximum_compressed_size(zip_uint64_t uncompressed_size) {
+ zip_uint64_t compressed_size = (zip_uint64_t)((double)uncompressed_size * 1.006);
+
+ if (compressed_size < uncompressed_size) {
+ return ZIP_UINT64_MAX;
+ }
+ return compressed_size;
+}
+
+
+static void *
+allocate(bool compress, zip_uint32_t compression_flags, zip_error_t *error) {
+ struct ctx *ctx;
+
+ if ((ctx = (struct ctx *)malloc(sizeof(*ctx))) == NULL) {
+ return NULL;
+ }
+
+ ctx->error = error;
+ ctx->compress = compress;
+ if (compression_flags >= 1 && compression_flags <= 9) {
+ ctx->compression_flags = (int)compression_flags;
+ }
+ else {
+ ctx->compression_flags = 9;
+ }
+ ctx->end_of_input = false;
+
+ ctx->zstr.bzalloc = NULL;
+ ctx->zstr.bzfree = NULL;
+ ctx->zstr.opaque = NULL;
+
+ return ctx;
+}
+
+
+static void *
+compress_allocate(zip_uint16_t method, zip_uint32_t compression_flags, zip_error_t *error) {
+ (void)method;
+ return allocate(true, compression_flags, error);
+}
+
+
+static void *
+decompress_allocate(zip_uint16_t method, zip_uint32_t compression_flags, zip_error_t *error) {
+ (void)method;
+ return allocate(false, compression_flags, error);
+}
+
+
+static void
+deallocate(void *ud) {
+ struct ctx *ctx = (struct ctx *)ud;
+
+ free(ctx);
+}
+
+
+static zip_uint16_t
+general_purpose_bit_flags(void *ud) {
+ (void)ud;
+ return 0;
+}
+
+
+static int
+map_error(int ret) {
+ switch (ret) {
+ case BZ_FINISH_OK:
+ case BZ_FLUSH_OK:
+ case BZ_OK:
+ case BZ_RUN_OK:
+ case BZ_STREAM_END:
+ return ZIP_ER_OK;
+
+ case BZ_DATA_ERROR:
+ case BZ_DATA_ERROR_MAGIC:
+ case BZ_UNEXPECTED_EOF:
+ return ZIP_ER_COMPRESSED_DATA;
+
+ case BZ_MEM_ERROR:
+ return ZIP_ER_MEMORY;
+
+ case BZ_PARAM_ERROR:
+ return ZIP_ER_INVAL;
+
+ case BZ_CONFIG_ERROR: /* actually, bzip2 miscompiled */
+ case BZ_IO_ERROR:
+ case BZ_OUTBUFF_FULL:
+ case BZ_SEQUENCE_ERROR:
+ default:
+ return ZIP_ER_INTERNAL;
+ }
+}
+
+static bool
+start(void *ud, zip_stat_t *st, zip_file_attributes_t *attributes) {
+ struct ctx *ctx = (struct ctx *)ud;
+ int ret;
+
+ (void)st;
+ (void)attributes;
+
+ ctx->zstr.avail_in = 0;
+ ctx->zstr.next_in = NULL;
+ ctx->zstr.avail_out = 0;
+ ctx->zstr.next_out = NULL;
+
+ if (ctx->compress) {
+ ret = BZ2_bzCompressInit(&ctx->zstr, ctx->compression_flags, 0, 30);
+ }
+ else {
+ ret = BZ2_bzDecompressInit(&ctx->zstr, 0, 0);
+ }
+
+ if (ret != BZ_OK) {
+ zip_error_set(ctx->error, map_error(ret), 0);
+ return false;
+ }
+
+ return true;
+}
+
+
+static bool
+end(void *ud) {
+ struct ctx *ctx = (struct ctx *)ud;
+ int err;
+
+ if (ctx->compress) {
+ err = BZ2_bzCompressEnd(&ctx->zstr);
+ }
+ else {
+ err = BZ2_bzDecompressEnd(&ctx->zstr);
+ }
+
+ if (err != BZ_OK) {
+ zip_error_set(ctx->error, map_error(err), 0);
+ return false;
+ }
+
+ return true;
+}
+
+
+static bool
+input(void *ud, zip_uint8_t *data, zip_uint64_t length) {
+ struct ctx *ctx = (struct ctx *)ud;
+
+ if (length > UINT_MAX || ctx->zstr.avail_in > 0) {
+ zip_error_set(ctx->error, ZIP_ER_INVAL, 0);
+ return false;
+ }
+
+ ctx->zstr.avail_in = (unsigned int)length;
+ ctx->zstr.next_in = (char *)data;
+
+ return true;
+}
+
+
+static void
+end_of_input(void *ud) {
+ struct ctx *ctx = (struct ctx *)ud;
+
+ ctx->end_of_input = true;
+}
+
+
+static zip_compression_status_t
+process(void *ud, zip_uint8_t *data, zip_uint64_t *length) {
+ struct ctx *ctx = (struct ctx *)ud;
+ unsigned int avail_out;
+
+ int ret;
+
+ if (ctx->zstr.avail_in == 0 && !ctx->end_of_input) {
+ *length = 0;
+ return ZIP_COMPRESSION_NEED_DATA;
+ }
+
+ avail_out = (unsigned int)ZIP_MIN(UINT_MAX, *length);
+ ctx->zstr.avail_out = avail_out;
+ ctx->zstr.next_out = (char *)data;
+
+ if (ctx->compress) {
+ ret = BZ2_bzCompress(&ctx->zstr, ctx->end_of_input ? BZ_FINISH : BZ_RUN);
+ }
+ else {
+ ret = BZ2_bzDecompress(&ctx->zstr);
+ }
+
+ *length = avail_out - ctx->zstr.avail_out;
+
+ switch (ret) {
+ case BZ_FINISH_OK: /* compression */
+ return ZIP_COMPRESSION_OK;
+
+ case BZ_OK: /* decompression */
+ case BZ_RUN_OK: /* compression */
+ if (ctx->zstr.avail_in == 0) {
+ return ZIP_COMPRESSION_NEED_DATA;
+ }
+ return ZIP_COMPRESSION_OK;
+
+ case BZ_STREAM_END:
+ return ZIP_COMPRESSION_END;
+
+ default:
+ zip_error_set(ctx->error, map_error(ret), 0);
+ return ZIP_COMPRESSION_ERROR;
+ }
+}
+
+/* clang-format off */
+
+zip_compression_algorithm_t zip_algorithm_bzip2_compress = {
+ maximum_compressed_size,
+ compress_allocate,
+ deallocate,
+ general_purpose_bit_flags,
+ 46,
+ start,
+ end,
+ input,
+ end_of_input,
+ process
+};
+
+
+zip_compression_algorithm_t zip_algorithm_bzip2_decompress = {
+ maximum_compressed_size,
+ decompress_allocate,
+ deallocate,
+ general_purpose_bit_flags,
+ 46,
+ start,
+ end,
+ input,
+ end_of_input,
+ process
+};
+
+/* clang-format on */
diff --git a/src/Common/libzip/zip_algorithm_deflate.c b/src/Common/libzip/zip_algorithm_deflate.c
index d28a1ac5..3c85e204 100644
--- a/src/Common/libzip/zip_algorithm_deflate.c
+++ b/src/Common/libzip/zip_algorithm_deflate.c
@@ -1,9 +1,9 @@
/*
zip_algorithm_deflate.c -- deflate (de)compression routines
- Copyright (C) 2017-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2017-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -40,27 +40,44 @@
struct ctx {
zip_error_t *error;
bool compress;
- int compression_flags;
+ int level;
+ int mem_level;
bool end_of_input;
z_stream zstr;
};
+static zip_uint64_t
+maximum_compressed_size(zip_uint64_t uncompressed_size) {
+ /* max deflate size increase: size + ceil(size/16k)*5+6 */
+
+ zip_uint64_t compressed_size = uncompressed_size + (uncompressed_size + 16383) / 16384 * 5 + 6;
+
+ if (compressed_size < uncompressed_size) {
+ return ZIP_UINT64_MAX;
+ }
+ return compressed_size;
+}
+
+
static void *
-allocate(bool compress, int compression_flags, zip_error_t *error) {
+allocate(bool compress, zip_uint32_t compression_flags, zip_error_t *error) {
struct ctx *ctx;
if ((ctx = (struct ctx *)malloc(sizeof(*ctx))) == NULL) {
- zip_error_set(error, ZIP_ET_SYS, errno);
- return NULL;
+ zip_error_set(error, ZIP_ET_SYS, errno);
+ return NULL;
}
ctx->error = error;
ctx->compress = compress;
- ctx->compression_flags = compression_flags;
- if (ctx->compression_flags < 1 || ctx->compression_flags > 9) {
- ctx->compression_flags = Z_BEST_COMPRESSION;
+ if (compression_flags >= 1 && compression_flags <= 9) {
+ ctx->level = (int)compression_flags;
+ }
+ else {
+ ctx->level = Z_BEST_COMPRESSION;
}
+ ctx->mem_level = compression_flags == TORRENTZIP_COMPRESSION_FLAGS ? TORRENTZIP_MEM_LEVEL : MAX_MEM_LEVEL;
ctx->end_of_input = false;
ctx->zstr.zalloc = Z_NULL;
@@ -72,13 +89,15 @@ allocate(bool compress, int compression_flags, zip_error_t *error) {
static void *
-compress_allocate(zip_uint16_t method, int compression_flags, zip_error_t *error) {
+compress_allocate(zip_uint16_t method, zip_uint32_t compression_flags, zip_error_t *error) {
+ (void)method;
return allocate(true, compression_flags, error);
}
static void *
-decompress_allocate(zip_uint16_t method, int compression_flags, zip_error_t *error) {
+decompress_allocate(zip_uint16_t method, zip_uint32_t compression_flags, zip_error_t *error) {
+ (void)method;
return allocate(false, compression_flags, error);
}
@@ -96,40 +115,43 @@ general_purpose_bit_flags(void *ud) {
struct ctx *ctx = (struct ctx *)ud;
if (!ctx->compress) {
- return 0;
+ return 0;
}
- if (ctx->compression_flags < 3) {
- return 2 << 1;
+ if (ctx->level < 3) {
+ return 2 << 1;
}
- else if (ctx->compression_flags > 7) {
- return 1 << 1;
+ else if (ctx->level > 7) {
+ return 1 << 1;
}
return 0;
}
static bool
-start(void *ud) {
+start(void *ud, zip_stat_t *st, zip_file_attributes_t *attributes) {
struct ctx *ctx = (struct ctx *)ud;
int ret;
+ (void)st;
+ (void)attributes;
+
ctx->zstr.avail_in = 0;
ctx->zstr.next_in = NULL;
ctx->zstr.avail_out = 0;
ctx->zstr.next_out = NULL;
if (ctx->compress) {
- /* negative value to tell zlib not to write a header */
- ret = deflateInit2(&ctx->zstr, ctx->compression_flags, Z_DEFLATED, -MAX_WBITS, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY);
+ /* negative value to tell zlib not to write a header */
+ ret = deflateInit2(&ctx->zstr, ctx->level, Z_DEFLATED, -MAX_WBITS, ctx->mem_level, Z_DEFAULT_STRATEGY);
}
else {
- ret = inflateInit2(&ctx->zstr, -MAX_WBITS);
+ ret = inflateInit2(&ctx->zstr, -MAX_WBITS);
}
if (ret != Z_OK) {
- zip_error_set(ctx->error, ZIP_ER_ZLIB, ret);
- return false;
+ zip_error_set(ctx->error, ZIP_ER_ZLIB, ret);
+ return false;
}
@@ -143,15 +165,15 @@ end(void *ud) {
int err;
if (ctx->compress) {
- err = deflateEnd(&ctx->zstr);
+ err = deflateEnd(&ctx->zstr);
}
else {
- err = inflateEnd(&ctx->zstr);
+ err = inflateEnd(&ctx->zstr);
}
if (err != Z_OK) {
- zip_error_set(ctx->error, ZIP_ER_ZLIB, err);
- return false;
+ zip_error_set(ctx->error, ZIP_ER_ZLIB, err);
+ return false;
}
return true;
@@ -163,8 +185,8 @@ input(void *ud, zip_uint8_t *data, zip_uint64_t length) {
struct ctx *ctx = (struct ctx *)ud;
if (length > UINT_MAX || ctx->zstr.avail_in > 0) {
- zip_error_set(ctx->error, ZIP_ER_INVAL, 0);
- return false;
+ zip_error_set(ctx->error, ZIP_ER_INVAL, 0);
+ return false;
}
ctx->zstr.avail_in = (uInt)length;
@@ -185,44 +207,47 @@ end_of_input(void *ud) {
static zip_compression_status_t
process(void *ud, zip_uint8_t *data, zip_uint64_t *length) {
struct ctx *ctx = (struct ctx *)ud;
+ uInt avail_out;
int ret;
- ctx->zstr.avail_out = (uInt)ZIP_MIN(UINT_MAX, *length);
+ avail_out = (uInt)ZIP_MIN(UINT_MAX, *length);
+ ctx->zstr.avail_out = avail_out;
ctx->zstr.next_out = (Bytef *)data;
if (ctx->compress) {
- ret = deflate(&ctx->zstr, ctx->end_of_input ? Z_FINISH : 0);
+ ret = deflate(&ctx->zstr, ctx->end_of_input ? Z_FINISH : 0);
}
else {
- ret = inflate(&ctx->zstr, Z_SYNC_FLUSH);
+ ret = inflate(&ctx->zstr, Z_SYNC_FLUSH);
}
- *length = *length - ctx->zstr.avail_out;
+ *length = avail_out - ctx->zstr.avail_out;
switch (ret) {
case Z_OK:
- return ZIP_COMPRESSION_OK;
+ return ZIP_COMPRESSION_OK;
case Z_STREAM_END:
- return ZIP_COMPRESSION_END;
+ return ZIP_COMPRESSION_END;
case Z_BUF_ERROR:
- if (ctx->zstr.avail_in == 0) {
- return ZIP_COMPRESSION_NEED_DATA;
- }
+ if (ctx->zstr.avail_in == 0) {
+ return ZIP_COMPRESSION_NEED_DATA;
+ }
- /* fallthrough */
+ /* fallthrough */
default:
- zip_error_set(ctx->error, ZIP_ER_ZLIB, ret);
- return ZIP_COMPRESSION_ERROR;
+ zip_error_set(ctx->error, ZIP_ER_ZLIB, ret);
+ return ZIP_COMPRESSION_ERROR;
}
}
/* clang-format off */
zip_compression_algorithm_t zip_algorithm_deflate_compress = {
+ maximum_compressed_size,
compress_allocate,
deallocate,
general_purpose_bit_flags,
@@ -236,6 +261,7 @@ zip_compression_algorithm_t zip_algorithm_deflate_compress = {
zip_compression_algorithm_t zip_algorithm_deflate_decompress = {
+ maximum_compressed_size,
decompress_allocate,
deallocate,
general_purpose_bit_flags,
diff --git a/src/Common/libzip/zip_algorithm_xz.c b/src/Common/libzip/zip_algorithm_xz.c
new file mode 100644
index 00000000..d7a7142d
--- /dev/null
+++ b/src/Common/libzip/zip_algorithm_xz.c
@@ -0,0 +1,408 @@
+/*
+ zip_algorithm_xz.c -- LZMA/XZ (de)compression routines
+ Bazed on zip_algorithm_deflate.c -- deflate (de)compression routines
+ Copyright (C) 2017-2021 Dieter Baron and Thomas Klausner
+
+ This file is part of libzip, a library to manipulate ZIP archives.
+ The authors can be contacted at <info@libzip.org>
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ 3. The names of the authors may not be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "zipint.h"
+
+#include <limits.h>
+#include <lzma.h>
+#include <stdlib.h>
+#include <zlib.h>
+
+enum header_state { INCOMPLETE, OUTPUT, DONE };
+
+#define HEADER_BYTES_ZIP 9
+#define HEADER_MAGIC_LENGTH 4
+#define HEADER_MAGIC1_OFFSET 0
+#define HEADER_MAGIC2_OFFSET 2
+#define HEADER_SIZE_OFFSET 9
+#define HEADER_SIZE_LENGTH 8
+#define HEADER_PARAMETERS_LENGTH 5
+#define HEADER_LZMA_ALONE_LENGTH (HEADER_PARAMETERS_LENGTH + HEADER_SIZE_LENGTH)
+
+struct ctx {
+ zip_error_t *error;
+ bool compress;
+ zip_uint32_t compression_flags;
+ bool end_of_input;
+ lzma_stream zstr;
+ zip_uint16_t method;
+ /* header member is used for converting from zip to "lzma alone"
+ * format
+ *
+ * "lzma alone" file format starts with:
+ * 5 bytes lzma parameters
+ * 8 bytes uncompressed size
+ * compressed data
+ *
+ * zip archive on-disk format starts with
+ * 4 bytes magic (first two bytes vary, e.g. 0x0914 or 0x1002, next bytes are 0x0500)
+ * 5 bytes lzma parameters
+ * compressed data
+ *
+ * we read the data into a header of the form
+ * 4 bytes magic
+ * 5 bytes lzma parameters
+ * 8 bytes uncompressed size
+ */
+ zip_uint8_t header[HEADER_MAGIC_LENGTH + HEADER_LZMA_ALONE_LENGTH];
+ zip_uint8_t header_bytes_offset;
+ enum header_state header_state;
+ zip_uint64_t uncompresssed_size;
+};
+
+
+static zip_uint64_t
+maximum_compressed_size(zip_uint64_t uncompressed_size) {
+ /*
+ According to https://sourceforge.net/p/sevenzip/discussion/45797/thread/b6bd62f8/
+
+ 1) you can use
+ outSize = 1.10 * originalSize + 64 KB.
+ in most cases outSize is less then 1.02 from originalSize.
+ 2) You can try LZMA2, where
+ outSize can be = 1.001 * originalSize + 1 KB.
+ */
+ /* 13 bytes added for lzma alone header */
+ zip_uint64_t compressed_size = (zip_uint64_t)((double)uncompressed_size * 1.1) + 64 * 1024 + 13;
+
+ if (compressed_size < uncompressed_size) {
+ return ZIP_UINT64_MAX;
+ }
+ return compressed_size;
+}
+
+
+static void *
+allocate(bool compress, zip_uint32_t compression_flags, zip_error_t *error, zip_uint16_t method) {
+ struct ctx *ctx;
+
+ if ((ctx = (struct ctx *)malloc(sizeof(*ctx))) == NULL) {
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
+ }
+
+ ctx->error = error;
+ ctx->compress = compress;
+ if (compression_flags <= 9) {
+ ctx->compression_flags = compression_flags;
+ } else {
+ ctx->compression_flags = 6; /* default value */
+ }
+ ctx->compression_flags |= LZMA_PRESET_EXTREME;
+ ctx->end_of_input = false;
+ memset(ctx->header, 0, sizeof(ctx->header));
+ ctx->header_bytes_offset = 0;
+ if (method == ZIP_CM_LZMA) {
+ ctx->header_state = INCOMPLETE;
+ }
+ else {
+ ctx->header_state = DONE;
+ }
+ memset(&ctx->zstr, 0, sizeof(ctx->zstr));
+ ctx->method = method;
+ return ctx;
+}
+
+
+static void *
+compress_allocate(zip_uint16_t method, zip_uint32_t compression_flags, zip_error_t *error) {
+ return allocate(true, compression_flags, error, method);
+}
+
+
+static void *
+decompress_allocate(zip_uint16_t method, zip_uint32_t compression_flags, zip_error_t *error) {
+ return allocate(false, compression_flags, error, method);
+}
+
+
+static void
+deallocate(void *ud) {
+ struct ctx *ctx = (struct ctx *)ud;
+ free(ctx);
+}
+
+
+static zip_uint16_t
+general_purpose_bit_flags(void *ud) {
+ struct ctx *ctx = (struct ctx *)ud;
+
+ if (!ctx->compress) {
+ return 0;
+ }
+
+ if (ctx->method == ZIP_CM_LZMA) {
+ /* liblzma always returns an EOS/EOPM marker, see
+ * https://sourceforge.net/p/lzmautils/discussion/708858/thread/84c5dbb9/#a5e4/3764 */
+ return 1 << 1;
+ }
+ return 0;
+}
+
+static int
+map_error(lzma_ret ret) {
+ switch (ret) {
+ case LZMA_DATA_ERROR:
+ case LZMA_UNSUPPORTED_CHECK:
+ return ZIP_ER_COMPRESSED_DATA;
+
+ case LZMA_MEM_ERROR:
+ return ZIP_ER_MEMORY;
+
+ case LZMA_OPTIONS_ERROR:
+ return ZIP_ER_INVAL;
+
+ default:
+ return ZIP_ER_INTERNAL;
+ }
+}
+
+
+static bool
+start(void *ud, zip_stat_t *st, zip_file_attributes_t *attributes) {
+ struct ctx *ctx = (struct ctx *)ud;
+ lzma_ret ret;
+
+ lzma_options_lzma opt_lzma;
+ lzma_lzma_preset(&opt_lzma, ctx->compression_flags);
+ lzma_filter filters[] = {
+ {.id = (ctx->method == ZIP_CM_LZMA ? LZMA_FILTER_LZMA1 : LZMA_FILTER_LZMA2), .options = &opt_lzma},
+ {.id = LZMA_VLI_UNKNOWN, .options = NULL},
+ };
+
+ ctx->zstr.avail_in = 0;
+ ctx->zstr.next_in = NULL;
+ ctx->zstr.avail_out = 0;
+ ctx->zstr.next_out = NULL;
+
+ if (ctx->compress) {
+ if (ctx->method == ZIP_CM_LZMA)
+ ret = lzma_alone_encoder(&ctx->zstr, filters[0].options);
+ else
+ ret = lzma_stream_encoder(&ctx->zstr, filters, LZMA_CHECK_CRC64);
+ }
+ else {
+ if (ctx->method == ZIP_CM_LZMA)
+ ret = lzma_alone_decoder(&ctx->zstr, UINT64_MAX);
+ else
+ ret = lzma_stream_decoder(&ctx->zstr, UINT64_MAX, LZMA_CONCATENATED);
+ }
+
+ if (ret != LZMA_OK) {
+ zip_error_set(ctx->error, map_error(ret), 0);
+ return false;
+ }
+
+ /* If general purpose bits 1 & 2 are both zero, write real uncompressed size in header. */
+ if ((attributes->valid & ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS) && (attributes->general_purpose_bit_mask & 0x6) == 0x6 && (attributes->general_purpose_bit_flags & 0x06) == 0 && (st->valid & ZIP_STAT_SIZE)) {
+ ctx->uncompresssed_size = st->size;
+ }
+ else {
+ ctx->uncompresssed_size = ZIP_UINT64_MAX;
+ }
+
+ return true;
+}
+
+
+static bool
+end(void *ud) {
+ struct ctx *ctx = (struct ctx *)ud;
+
+ lzma_end(&ctx->zstr);
+ return true;
+}
+
+
+static bool
+input(void *ud, zip_uint8_t *data, zip_uint64_t length) {
+ struct ctx *ctx = (struct ctx *)ud;
+
+ if (length > UINT_MAX || ctx->zstr.avail_in > 0) {
+ zip_error_set(ctx->error, ZIP_ER_INVAL, 0);
+ return false;
+ }
+
+ /* For decompression of LZMA1: Have we read the full "lzma alone" header yet? */
+ if (ctx->method == ZIP_CM_LZMA && !ctx->compress && ctx->header_state == INCOMPLETE) {
+ /* if not, get more of the data */
+ zip_uint8_t got = (zip_uint8_t)ZIP_MIN(HEADER_BYTES_ZIP - ctx->header_bytes_offset, length);
+ (void)memcpy_s(ctx->header + ctx->header_bytes_offset, sizeof(ctx->header) - ctx->header_bytes_offset, data, got);
+ ctx->header_bytes_offset += got;
+ length -= got;
+ data += got;
+ /* Do we have a complete header now? */
+ if (ctx->header_bytes_offset == HEADER_BYTES_ZIP) {
+ Bytef empty_buffer[1];
+ zip_buffer_t *buffer;
+ /* check magic */
+ if (ctx->header[HEADER_MAGIC2_OFFSET] != 0x05 || ctx->header[HEADER_MAGIC2_OFFSET + 1] != 0x00) {
+ /* magic does not match */
+ zip_error_set(ctx->error, ZIP_ER_COMPRESSED_DATA, 0);
+ return false;
+ }
+ /* set size of uncompressed data in "lzma alone" header to "unknown" */
+ if ((buffer = _zip_buffer_new(ctx->header + HEADER_SIZE_OFFSET, HEADER_SIZE_LENGTH)) == NULL) {
+ zip_error_set(ctx->error, ZIP_ER_MEMORY, 0);
+ return false;
+ }
+ _zip_buffer_put_64(buffer, ctx->uncompresssed_size);
+ _zip_buffer_free(buffer);
+ /* Feed header into "lzma alone" decoder, for
+ * initialization; this should not produce output. */
+ ctx->zstr.next_in = (void *)(ctx->header + HEADER_MAGIC_LENGTH);
+ ctx->zstr.avail_in = HEADER_LZMA_ALONE_LENGTH;
+ ctx->zstr.total_in = 0;
+ ctx->zstr.next_out = empty_buffer;
+ ctx->zstr.avail_out = sizeof(*empty_buffer);
+ ctx->zstr.total_out = 0;
+ /* this just initializes the decoder and does not produce output, so it consumes the complete header */
+ if (lzma_code(&ctx->zstr, LZMA_RUN) != LZMA_OK || ctx->zstr.total_out > 0) {
+ zip_error_set(ctx->error, ZIP_ER_COMPRESSED_DATA, 0);
+ return false;
+ }
+ ctx->header_state = DONE;
+ }
+ }
+ ctx->zstr.avail_in = (uInt)length;
+ ctx->zstr.next_in = (Bytef *)data;
+
+ return true;
+}
+
+
+static void
+end_of_input(void *ud) {
+ struct ctx *ctx = (struct ctx *)ud;
+
+ ctx->end_of_input = true;
+}
+
+
+static zip_compression_status_t
+process(void *ud, zip_uint8_t *data, zip_uint64_t *length) {
+ struct ctx *ctx = (struct ctx *)ud;
+ uInt avail_out;
+ lzma_ret ret;
+ /* for compression of LZMA1 */
+ if (ctx->method == ZIP_CM_LZMA && ctx->compress) {
+ if (ctx->header_state == INCOMPLETE) {
+ /* write magic to output buffer */
+ ctx->header[0] = 0x09;
+ ctx->header[1] = 0x14;
+ ctx->header[2] = 0x05;
+ ctx->header[3] = 0x00;
+ /* generate lzma parameters into output buffer */
+ ctx->zstr.avail_out = HEADER_LZMA_ALONE_LENGTH;
+ ctx->zstr.next_out = ctx->header + HEADER_MAGIC_LENGTH;
+ ret = lzma_code(&ctx->zstr, LZMA_RUN);
+ if (ret != LZMA_OK || ctx->zstr.avail_out != 0) {
+ /* assume that the whole header will be provided with the first call to lzma_code */
+ return ZIP_COMPRESSION_ERROR;
+ }
+ ctx->header_state = OUTPUT;
+ }
+ if (ctx->header_state == OUTPUT) {
+ /* write header */
+ zip_uint8_t write_len = (zip_uint8_t)ZIP_MIN(HEADER_BYTES_ZIP - ctx->header_bytes_offset, *length);
+ (void)memcpy_s(data, *length, ctx->header + ctx->header_bytes_offset, write_len);
+ ctx->header_bytes_offset += write_len;
+ *length = write_len;
+ if (ctx->header_bytes_offset == HEADER_BYTES_ZIP) {
+ ctx->header_state = DONE;
+ }
+ return ZIP_COMPRESSION_OK;
+ }
+ }
+
+ avail_out = (uInt)ZIP_MIN(UINT_MAX, *length);
+ ctx->zstr.avail_out = avail_out;
+ ctx->zstr.next_out = (Bytef *)data;
+
+ ret = lzma_code(&ctx->zstr, ctx->end_of_input ? LZMA_FINISH : LZMA_RUN);
+ *length = avail_out - ctx->zstr.avail_out;
+
+ switch (ret) {
+ case LZMA_OK:
+ return ZIP_COMPRESSION_OK;
+
+ case LZMA_STREAM_END:
+ return ZIP_COMPRESSION_END;
+
+ case LZMA_BUF_ERROR:
+ if (ctx->zstr.avail_in == 0) {
+ return ZIP_COMPRESSION_NEED_DATA;
+ }
+
+ /* fallthrough */
+ default:
+ zip_error_set(ctx->error, map_error(ret), 0);
+ return ZIP_COMPRESSION_ERROR;
+ }
+}
+
+/* Version Required should be set to 63 (6.3) because this compression
+ method was only defined in appnote.txt version 6.3.8, but Winzip
+ does not unpack it if the value is not 20. */
+
+/* clang-format off */
+
+zip_compression_algorithm_t zip_algorithm_xz_compress = {
+ maximum_compressed_size,
+ compress_allocate,
+ deallocate,
+ general_purpose_bit_flags,
+ 20,
+ start,
+ end,
+ input,
+ end_of_input,
+ process
+};
+
+
+zip_compression_algorithm_t zip_algorithm_xz_decompress = {
+ maximum_compressed_size,
+ decompress_allocate,
+ deallocate,
+ general_purpose_bit_flags,
+ 20,
+ start,
+ end,
+ input,
+ end_of_input,
+ process
+};
+
+/* clang-format on */
diff --git a/src/Common/libzip/zip_algorithm_zstd.c b/src/Common/libzip/zip_algorithm_zstd.c
new file mode 100644
index 00000000..d005da9d
--- /dev/null
+++ b/src/Common/libzip/zip_algorithm_zstd.c
@@ -0,0 +1,298 @@
+/*
+ zip_algorithm_zstd.c -- zstd (de)compression routines
+ Copyright (C) 2020-2021 Dieter Baron and Thomas Klausner
+
+ This file is part of libzip, a library to manipulate ZIP archives.
+ The authors can be contacted at <info@libzip.org>
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ 3. The names of the authors may not be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "zipint.h"
+
+#include <stdlib.h>
+#include <zstd.h>
+#include <zstd_errors.h>
+
+struct ctx {
+ zip_error_t *error;
+ bool compress;
+ int compression_flags;
+ bool end_of_input;
+ ZSTD_DStream *zdstream;
+ ZSTD_CStream *zcstream;
+ ZSTD_outBuffer out;
+ ZSTD_inBuffer in;
+};
+
+static zip_uint64_t
+maximum_compressed_size(zip_uint64_t uncompressed_size) {
+ return ZSTD_compressBound(uncompressed_size);
+}
+
+
+static void *
+allocate(bool compress, zip_uint32_t compression_flags, zip_error_t *error) {
+ struct ctx *ctx;
+
+ if ((ctx = (struct ctx *)malloc(sizeof(*ctx))) == NULL) {
+ return NULL;
+ }
+
+ ctx->compression_flags = (zip_int32_t)compression_flags;
+ if (ctx->compression_flags < ZSTD_minCLevel() || ctx->compression_flags > ZSTD_maxCLevel()) {
+ ctx->compression_flags = 0; /* let zstd choose */
+ }
+
+ ctx->error = error;
+ ctx->compress = compress;
+ ctx->end_of_input = false;
+
+ ctx->zdstream = NULL;
+ ctx->zcstream = NULL;
+ ctx->in.src = NULL;
+ ctx->in.pos = 0;
+ ctx->in.size = 0;
+ ctx->out.dst = NULL;
+ ctx->out.pos = 0;
+ ctx->out.size = 0;
+
+ return ctx;
+}
+
+
+static void *
+compress_allocate(zip_uint16_t method, zip_uint32_t compression_flags, zip_error_t *error) {
+ (void)method;
+ return allocate(true, compression_flags, error);
+}
+
+
+static void *
+decompress_allocate(zip_uint16_t method, zip_uint32_t compression_flags, zip_error_t *error) {
+ (void)method;
+ return allocate(false, compression_flags, error);
+}
+
+
+static void
+deallocate(void *ud) {
+ struct ctx *ctx = (struct ctx *)ud;
+ free(ctx);
+}
+
+
+static zip_uint16_t
+general_purpose_bit_flags(void *ud) {
+ (void)ud;
+ return 0;
+}
+
+static int
+map_error(size_t ret) {
+ switch (ret) {
+ case ZSTD_error_no_error:
+ return ZIP_ER_OK;
+
+ case ZSTD_error_corruption_detected:
+ case ZSTD_error_checksum_wrong:
+ case ZSTD_error_dictionary_corrupted:
+ case ZSTD_error_dictionary_wrong:
+ return ZIP_ER_COMPRESSED_DATA;
+
+ case ZSTD_error_memory_allocation:
+ return ZIP_ER_MEMORY;
+
+ case ZSTD_error_parameter_unsupported:
+ case ZSTD_error_parameter_outOfBound:
+ return ZIP_ER_INVAL;
+
+ default:
+ return ZIP_ER_INTERNAL;
+ }
+}
+
+
+static bool
+start(void *ud, zip_stat_t *st, zip_file_attributes_t *attributes) {
+ struct ctx *ctx = (struct ctx *)ud;
+
+ (void)st;
+ (void)attributes;
+
+ ctx->in.src = NULL;
+ ctx->in.pos = 0;
+ ctx->in.size = 0;
+ ctx->out.dst = NULL;
+ ctx->out.pos = 0;
+ ctx->out.size = 0;
+ if (ctx->compress) {
+ size_t ret;
+ ctx->zcstream = ZSTD_createCStream();
+ if (ctx->zcstream == NULL) {
+ zip_error_set(ctx->error, ZIP_ER_MEMORY, 0);
+ return false;
+ }
+ ret = ZSTD_initCStream(ctx->zcstream, ctx->compression_flags);
+ if (ZSTD_isError(ret)) {
+ zip_error_set(ctx->error, ZIP_ER_ZLIB, map_error(ret));
+ return false;
+ }
+ }
+ else {
+ ctx->zdstream = ZSTD_createDStream();
+ if (ctx->zdstream == NULL) {
+ zip_error_set(ctx->error, ZIP_ER_MEMORY, 0);
+ return false;
+ }
+ }
+
+ return true;
+}
+
+
+static bool
+end(void *ud) {
+ struct ctx *ctx = (struct ctx *)ud;
+ size_t ret;
+
+ if (ctx->compress) {
+ ret = ZSTD_freeCStream(ctx->zcstream);
+ ctx->zcstream = NULL;
+ }
+ else {
+ ret = ZSTD_freeDStream(ctx->zdstream);
+ ctx->zdstream = NULL;
+ }
+
+ if (ZSTD_isError(ret)) {
+ zip_error_set(ctx->error, map_error(ret), 0);
+ return false;
+ }
+
+ return true;
+}
+
+
+static bool
+input(void *ud, zip_uint8_t *data, zip_uint64_t length) {
+ struct ctx *ctx = (struct ctx *)ud;
+ if (length > SIZE_MAX || ctx->in.pos != ctx->in.size) {
+ zip_error_set(ctx->error, ZIP_ER_INVAL, 0);
+ return false;
+ }
+ ctx->in.src = (const void *)data;
+ ctx->in.size = (size_t)length;
+ ctx->in.pos = 0;
+ return true;
+}
+
+
+static void
+end_of_input(void *ud) {
+ struct ctx *ctx = (struct ctx *)ud;
+
+ ctx->end_of_input = true;
+}
+
+
+static zip_compression_status_t
+process(void *ud, zip_uint8_t *data, zip_uint64_t *length) {
+ struct ctx *ctx = (struct ctx *)ud;
+
+ size_t ret;
+
+ if (ctx->in.pos == ctx->in.size && !ctx->end_of_input) {
+ *length = 0;
+ return ZIP_COMPRESSION_NEED_DATA;
+ }
+
+ ctx->out.dst = data;
+ ctx->out.pos = 0;
+ ctx->out.size = ZIP_MIN(SIZE_MAX, *length);
+
+ if (ctx->compress) {
+ if (ctx->in.pos == ctx->in.size && ctx->end_of_input) {
+ ret = ZSTD_endStream(ctx->zcstream, &ctx->out);
+ if (ret == 0) {
+ *length = ctx->out.pos;
+ return ZIP_COMPRESSION_END;
+ }
+ }
+ else {
+ ret = ZSTD_compressStream(ctx->zcstream, &ctx->out, &ctx->in);
+ }
+ }
+ else {
+ ret = ZSTD_decompressStream(ctx->zdstream, &ctx->out, &ctx->in);
+ }
+ if (ZSTD_isError(ret)) {
+ zip_error_set(ctx->error, map_error(ret), 0);
+ return ZIP_COMPRESSION_ERROR;
+ }
+
+ *length = ctx->out.pos;
+ if (ctx->in.pos == ctx->in.size) {
+ return ZIP_COMPRESSION_NEED_DATA;
+ }
+
+ return ZIP_COMPRESSION_OK;
+}
+
+/* Version Required should be set to 63 (6.3) because this compression
+ method was only defined in appnote.txt version 6.3.7, but Winzip
+ does not unpack it if the value is not 20. */
+
+/* clang-format off */
+
+zip_compression_algorithm_t zip_algorithm_zstd_compress = {
+ maximum_compressed_size,
+ compress_allocate,
+ deallocate,
+ general_purpose_bit_flags,
+ 20,
+ start,
+ end,
+ input,
+ end_of_input,
+ process
+};
+
+
+zip_compression_algorithm_t zip_algorithm_zstd_decompress = {
+ maximum_compressed_size,
+ decompress_allocate,
+ deallocate,
+ general_purpose_bit_flags,
+ 20,
+ start,
+ end,
+ input,
+ end_of_input,
+ process
+};
+
+/* clang-format on */
diff --git a/src/Common/libzip/zip_buffer.c b/src/Common/libzip/zip_buffer.c
index 8c24b27e..e2103f04 100644
--- a/src/Common/libzip/zip_buffer.c
+++ b/src/Common/libzip/zip_buffer.c
@@ -1,9 +1,9 @@
/*
zip_buffer.c -- bounds checked access to memory buffer
- Copyright (C) 2014-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -45,11 +45,11 @@ _zip_buffer_data(zip_buffer_t *buffer) {
void
_zip_buffer_free(zip_buffer_t *buffer) {
if (buffer == NULL) {
- return;
+ return;
}
if (buffer->free_data) {
- free(buffer->data);
+ free(buffer->data);
}
free(buffer);
@@ -69,7 +69,7 @@ _zip_buffer_get(zip_buffer_t *buffer, zip_uint64_t length) {
data = _zip_buffer_peek(buffer, length);
if (data != NULL) {
- buffer->offset += length;
+ buffer->offset += length;
}
return data;
@@ -81,7 +81,7 @@ _zip_buffer_get_16(zip_buffer_t *buffer) {
zip_uint8_t *data = _zip_buffer_get(buffer, 2);
if (data == NULL) {
- return 0;
+ return 0;
}
return (zip_uint16_t)(data[0] + (data[1] << 8));
@@ -93,7 +93,7 @@ _zip_buffer_get_32(zip_buffer_t *buffer) {
zip_uint8_t *data = _zip_buffer_get(buffer, 4);
if (data == NULL) {
- return 0;
+ return 0;
}
return ((((((zip_uint32_t)data[3] << 8) + data[2]) << 8) + data[1]) << 8) + data[0];
@@ -105,7 +105,7 @@ _zip_buffer_get_64(zip_buffer_t *buffer) {
zip_uint8_t *data = _zip_buffer_get(buffer, 8);
if (data == NULL) {
- return 0;
+ return 0;
}
return ((zip_uint64_t)data[7] << 56) + ((zip_uint64_t)data[6] << 48) + ((zip_uint64_t)data[5] << 40) + ((zip_uint64_t)data[4] << 32) + ((zip_uint64_t)data[3] << 24) + ((zip_uint64_t)data[2] << 16) + ((zip_uint64_t)data[1] << 8) + (zip_uint64_t)data[0];
@@ -117,7 +117,7 @@ _zip_buffer_get_8(zip_buffer_t *buffer) {
zip_uint8_t *data = _zip_buffer_get(buffer, 1);
if (data == NULL) {
- return 0;
+ return 0;
}
return data[0];
@@ -132,13 +132,20 @@ _zip_buffer_left(zip_buffer_t *buffer) {
zip_uint64_t
_zip_buffer_read(zip_buffer_t *buffer, zip_uint8_t *data, zip_uint64_t length) {
+ zip_uint64_t copied;
+
if (_zip_buffer_left(buffer) < length) {
- length = _zip_buffer_left(buffer);
+ length = _zip_buffer_left(buffer);
}
- memcpy(data, _zip_buffer_get(buffer, length), length);
+ copied = 0;
+ while (copied < length) {
+ size_t n = ZIP_MIN(length - copied, SIZE_MAX);
+ (void)memcpy_s(data + copied, n, _zip_buffer_get(buffer, n), n);
+ copied += n;
+ }
- return length;
+ return copied;
}
@@ -147,17 +154,23 @@ _zip_buffer_new(zip_uint8_t *data, zip_uint64_t size) {
bool free_data = (data == NULL);
zip_buffer_t *buffer;
+#if ZIP_UINT64_MAX > SIZE_MAX
+ if (size > SIZE_MAX) {
+ return NULL;
+ }
+#endif
+
if (data == NULL) {
- if ((data = (zip_uint8_t *)malloc(size)) == NULL) {
- return NULL;
- }
+ if ((data = (zip_uint8_t *)malloc((size_t)size)) == NULL) {
+ return NULL;
+ }
}
if ((buffer = (zip_buffer_t *)malloc(sizeof(*buffer))) == NULL) {
- if (free_data) {
- free(data);
- }
- return NULL;
+ if (free_data) {
+ free(data);
+ }
+ return NULL;
}
buffer->ok = true;
@@ -175,13 +188,13 @@ _zip_buffer_new_from_source(zip_source_t *src, zip_uint64_t size, zip_uint8_t *b
zip_buffer_t *buffer;
if ((buffer = _zip_buffer_new(buf, size)) == NULL) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
}
if (_zip_read(src, buffer->data, size, error) < 0) {
- _zip_buffer_free(buffer);
- return NULL;
+ _zip_buffer_free(buffer);
+ return NULL;
}
return buffer;
@@ -205,8 +218,8 @@ _zip_buffer_peek(zip_buffer_t *buffer, zip_uint64_t length) {
zip_uint8_t *data;
if (!buffer->ok || buffer->offset + length < length || buffer->offset + length > buffer->size) {
- buffer->ok = false;
- return NULL;
+ buffer->ok = false;
+ return NULL;
}
data = buffer->data + buffer->offset;
@@ -218,10 +231,10 @@ _zip_buffer_put(zip_buffer_t *buffer, const void *src, size_t length) {
zip_uint8_t *dst = _zip_buffer_get(buffer, length);
if (dst == NULL) {
- return -1;
+ return -1;
}
- memcpy(dst, src, length);
+ (void)memcpy_s(dst, length, src, length);
return 0;
}
@@ -231,7 +244,7 @@ _zip_buffer_put_16(zip_buffer_t *buffer, zip_uint16_t i) {
zip_uint8_t *data = _zip_buffer_get(buffer, 2);
if (data == NULL) {
- return -1;
+ return -1;
}
data[0] = (zip_uint8_t)(i & 0xff);
@@ -246,7 +259,7 @@ _zip_buffer_put_32(zip_buffer_t *buffer, zip_uint32_t i) {
zip_uint8_t *data = _zip_buffer_get(buffer, 4);
if (data == NULL) {
- return -1;
+ return -1;
}
data[0] = (zip_uint8_t)(i & 0xff);
@@ -263,7 +276,7 @@ _zip_buffer_put_64(zip_buffer_t *buffer, zip_uint64_t i) {
zip_uint8_t *data = _zip_buffer_get(buffer, 8);
if (data == NULL) {
- return -1;
+ return -1;
}
data[0] = (zip_uint8_t)(i & 0xff);
@@ -284,7 +297,7 @@ _zip_buffer_put_8(zip_buffer_t *buffer, zip_uint8_t i) {
zip_uint8_t *data = _zip_buffer_get(buffer, 1);
if (data == NULL) {
- return -1;
+ return -1;
}
data[0] = i;
@@ -296,8 +309,8 @@ _zip_buffer_put_8(zip_buffer_t *buffer, zip_uint8_t i) {
int
_zip_buffer_set_offset(zip_buffer_t *buffer, zip_uint64_t offset) {
if (offset > buffer->size) {
- buffer->ok = false;
- return -1;
+ buffer->ok = false;
+ return -1;
}
buffer->ok = true;
@@ -312,8 +325,8 @@ _zip_buffer_skip(zip_buffer_t *buffer, zip_uint64_t length) {
zip_uint64_t offset = buffer->offset + length;
if (offset < buffer->offset) {
- buffer->ok = false;
- return -1;
+ buffer->ok = false;
+ return -1;
}
return _zip_buffer_set_offset(buffer, offset);
}
diff --git a/src/Common/libzip/zip_close.c b/src/Common/libzip/zip_close.c
index 816fcefa..ddc2c245 100644
--- a/src/Common/libzip/zip_close.c
+++ b/src/Common/libzip/zip_close.c
@@ -1,9 +1,9 @@
/*
zip_close.c -- close zip archive and update changes
- Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -45,6 +45,7 @@
static int add_data(zip_t *, zip_source_t *, zip_dirent_t *, zip_uint32_t);
static int copy_data(zip_t *, zip_uint64_t);
static int copy_source(zip_t *, zip_source_t *, zip_int64_t);
+static int torrentzip_compare_names(const void *a, const void *b);
static int write_cdir(zip_t *, const zip_filelist_t *, zip_uint64_t);
static int write_data_descriptor(zip_t *za, const zip_dirent_t *dirent, int is_zip64);
@@ -57,225 +58,235 @@ zip_close(zip_t *za) {
int changed;
if (za == NULL)
- return -1;
+ return -1;
changed = _zip_changed(za, &survivors);
- /* don't create zip files with no entries */
- if (survivors == 0) {
- if ((za->open_flags & ZIP_TRUNCATE) || changed) {
- if (zip_source_remove(za->src) < 0) {
- if (!((zip_error_code_zip(zip_source_error(za->src)) == ZIP_ER_REMOVE) && (zip_error_code_system(zip_source_error(za->src)) == ENOENT))) {
- _zip_error_set_from_source(&za->error, za->src);
- return -1;
- }
- }
- }
- zip_discard(za);
- return 0;
+ if (survivors == 0 && !(za->ch_flags & ZIP_AFL_CREATE_OR_KEEP_FILE_FOR_EMPTY_ARCHIVE)) {
+ /* don't create zip files with no entries */
+ if ((za->open_flags & ZIP_TRUNCATE) || changed) {
+ if (zip_source_remove(za->src) < 0) {
+ if (!((zip_error_code_zip(zip_source_error(za->src)) == ZIP_ER_REMOVE) && (zip_error_code_system(zip_source_error(za->src)) == ENOENT))) {
+ zip_error_set_from_source(&za->error, za->src);
+ return -1;
+ }
+ }
+ }
+ zip_discard(za);
+ return 0;
}
- if (!changed) {
- zip_discard(za);
- return 0;
+ /* Always write empty archive if we are told to keep it, otherwise it wouldn't be created if the file doesn't already exist. */
+ if (!changed && survivors > 0) {
+ zip_discard(za);
+ return 0;
}
if (survivors > za->nentry) {
- zip_error_set(&za->error, ZIP_ER_INTERNAL, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_INTERNAL, 0);
+ return -1;
}
if ((filelist = (zip_filelist_t *)malloc(sizeof(filelist[0]) * (size_t)survivors)) == NULL)
- return -1;
+ return -1;
unchanged_offset = ZIP_UINT64_MAX;
/* create list of files with index into original archive */
for (i = j = 0; i < za->nentry; i++) {
- if (za->entry[i].orig != NULL && ZIP_ENTRY_HAS_CHANGES(&za->entry[i])) {
- unchanged_offset = ZIP_MIN(unchanged_offset, za->entry[i].orig->offset);
- }
- if (za->entry[i].deleted) {
- continue;
- }
-
- if (j >= survivors) {
- free(filelist);
- zip_error_set(&za->error, ZIP_ER_INTERNAL, 0);
- return -1;
- }
-
- filelist[j].idx = i;
- j++;
+ if (za->entry[i].orig != NULL && ZIP_ENTRY_HAS_CHANGES(&za->entry[i])) {
+ unchanged_offset = ZIP_MIN(unchanged_offset, za->entry[i].orig->offset);
+ }
+ if (za->entry[i].deleted) {
+ continue;
+ }
+
+ if (j >= survivors) {
+ free(filelist);
+ zip_error_set(&za->error, ZIP_ER_INTERNAL, 0);
+ return -1;
+ }
+
+ filelist[j].idx = i;
+ filelist[j].name = zip_get_name(za, i, 0);
+ j++;
}
if (j < survivors) {
- free(filelist);
- zip_error_set(&za->error, ZIP_ER_INTERNAL, 0);
- return -1;
+ free(filelist);
+ zip_error_set(&za->error, ZIP_ER_INTERNAL, 0);
+ return -1;
}
- if ((zip_source_supports(za->src) & ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_BEGIN_WRITE_CLONING)) == 0) {
- unchanged_offset = 0;
+ if (ZIP_WANT_TORRENTZIP(za)) {
+ qsort(filelist, (size_t)survivors, sizeof(filelist[0]), torrentzip_compare_names);
+ }
+
+ if (ZIP_WANT_TORRENTZIP(za) || (zip_source_supports(za->src) & ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_BEGIN_WRITE_CLONING)) == 0) {
+ unchanged_offset = 0;
}
else {
- if (unchanged_offset == ZIP_UINT64_MAX) {
- /* we're keeping all file data, find the end of the last one */
- zip_uint64_t last_index = ZIP_UINT64_MAX;
- unchanged_offset = 0;
-
- for (i = 0; i < za->nentry; i++) {
- if (za->entry[i].orig != NULL) {
- if (za->entry[i].orig->offset >= unchanged_offset) {
- unchanged_offset = za->entry[i].orig->offset;
- last_index = i;
- }
- }
- }
- if (last_index != ZIP_UINT64_MAX) {
- if ((unchanged_offset = _zip_file_get_end(za, last_index, &za->error)) == 0) {
- free(filelist);
- return -1;
- }
- }
- }
- if (unchanged_offset > 0) {
- if (zip_source_begin_write_cloning(za->src, unchanged_offset) < 0) {
- /* cloning not supported, need to copy everything */
- unchanged_offset = 0;
- }
- }
+ if (unchanged_offset == ZIP_UINT64_MAX) {
+ /* we're keeping all file data, find the end of the last one */
+ zip_uint64_t last_index = ZIP_UINT64_MAX;
+ unchanged_offset = 0;
+
+ for (i = 0; i < za->nentry; i++) {
+ if (za->entry[i].orig != NULL) {
+ if (za->entry[i].orig->offset >= unchanged_offset) {
+ unchanged_offset = za->entry[i].orig->offset;
+ last_index = i;
+ }
+ }
+ }
+ if (last_index != ZIP_UINT64_MAX) {
+ if ((unchanged_offset = _zip_file_get_end(za, last_index, &za->error)) == 0) {
+ free(filelist);
+ return -1;
+ }
+ }
+ }
+ if (unchanged_offset > 0) {
+ if (zip_source_begin_write_cloning(za->src, unchanged_offset) < 0) {
+ /* cloning not supported, need to copy everything */
+ unchanged_offset = 0;
+ }
+ }
}
if (unchanged_offset == 0) {
- if (zip_source_begin_write(za->src) < 0) {
- _zip_error_set_from_source(&za->error, za->src);
- free(filelist);
- return -1;
- }
+ if (zip_source_begin_write(za->src) < 0) {
+ zip_error_set_from_source(&za->error, za->src);
+ free(filelist);
+ return -1;
+ }
}
if (_zip_progress_start(za->progress) != 0) {
- zip_error_set(&za->error, ZIP_ER_CANCELLED, 0);
- zip_source_rollback_write(za->src);
- free(filelist);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_CANCELLED, 0);
+ zip_source_rollback_write(za->src);
+ free(filelist);
+ return -1;
}
error = 0;
for (j = 0; j < survivors; j++) {
- int new_data;
- zip_entry_t *entry;
- zip_dirent_t *de;
-
- if (_zip_progress_subrange(za->progress, (double)j / (double)survivors, (double)(j + 1) / (double)survivors) != 0) {
- zip_error_set(&za->error, ZIP_ER_CANCELLED, 0);
- error = 1;
- break;
- }
-
- i = filelist[j].idx;
- entry = za->entry + i;
-
- if (entry->orig != NULL && entry->orig->offset < unchanged_offset) {
- /* already implicitly copied by cloning */
- continue;
- }
-
- new_data = (ZIP_ENTRY_DATA_CHANGED(entry) || ZIP_ENTRY_CHANGED(entry, ZIP_DIRENT_COMP_METHOD) || ZIP_ENTRY_CHANGED(entry, ZIP_DIRENT_ENCRYPTION_METHOD));
-
- /* create new local directory entry */
- if (entry->changes == NULL) {
- if ((entry->changes = _zip_dirent_clone(entry->orig)) == NULL) {
- zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
- error = 1;
- break;
- }
- }
- de = entry->changes;
-
- if (_zip_read_local_ef(za, i) < 0) {
- error = 1;
- break;
- }
-
- if ((off = zip_source_tell_write(za->src)) < 0) {
- _zip_error_set_from_source(&za->error, za->src);
- error = 1;
- break;
- }
- de->offset = (zip_uint64_t)off;
-
- if (new_data) {
- zip_source_t *zs;
-
- zs = NULL;
- if (!ZIP_ENTRY_DATA_CHANGED(entry)) {
- if ((zs = _zip_source_zip_new(za, za, i, ZIP_FL_UNCHANGED, 0, 0, NULL)) == NULL) {
- error = 1;
- break;
- }
- }
-
- /* add_data writes dirent */
- if (add_data(za, zs ? zs : entry->source, de, entry->changes ? entry->changes->changed : 0) < 0) {
- error = 1;
- if (zs)
- zip_source_free(zs);
- break;
- }
- if (zs)
- zip_source_free(zs);
- }
- else {
- zip_uint64_t offset;
-
- if (de->encryption_method != ZIP_EM_TRAD_PKWARE) {
- /* when copying data, all sizes are known -> no data descriptor needed */
- /* except for PKWare encryption, where removing the data descriptor breaks password validation */
- de->bitflags &= (zip_uint16_t)~ZIP_GPBF_DATA_DESCRIPTOR;
- }
- if (_zip_dirent_write(za, de, ZIP_FL_LOCAL) < 0) {
- error = 1;
- break;
- }
- if ((offset = _zip_file_get_offset(za, i, &za->error)) == 0) {
- error = 1;
- break;
- }
- if (zip_source_seek(za->src, (zip_int64_t)offset, SEEK_SET) < 0) {
- _zip_error_set_from_source(&za->error, za->src);
+ int new_data;
+ zip_entry_t *entry;
+ zip_dirent_t *de;
+
+ if (_zip_progress_subrange(za->progress, (double)j / (double)survivors, (double)(j + 1) / (double)survivors) != 0) {
+ zip_error_set(&za->error, ZIP_ER_CANCELLED, 0);
+ error = 1;
+ break;
+ }
+
+ i = filelist[j].idx;
+ entry = za->entry + i;
+
+ if (entry->orig != NULL && entry->orig->offset < unchanged_offset) {
+ /* already implicitly copied by cloning */
+ continue;
+ }
+
+ new_data = (ZIP_ENTRY_DATA_CHANGED(entry) || ZIP_ENTRY_CHANGED(entry, ZIP_DIRENT_COMP_METHOD) || ZIP_ENTRY_CHANGED(entry, ZIP_DIRENT_ENCRYPTION_METHOD)) || (ZIP_WANT_TORRENTZIP(za) && !ZIP_IS_TORRENTZIP(za));
+
+ /* create new local directory entry */
+ if (entry->changes == NULL) {
+ if ((entry->changes = _zip_dirent_clone(entry->orig)) == NULL) {
+ zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
+ error = 1;
+ break;
+ }
+ }
+ de = entry->changes;
+
+ if (_zip_read_local_ef(za, i) < 0) {
+ error = 1;
+ break;
+ }
+
+ if (ZIP_WANT_TORRENTZIP(za)) {
+ zip_dirent_torrentzip_normalize(entry->changes);
+ }
+
+ if ((off = zip_source_tell_write(za->src)) < 0) {
+ zip_error_set_from_source(&za->error, za->src);
+ error = 1;
+ break;
+ }
+ de->offset = (zip_uint64_t)off;
+
+ if (new_data) {
+ zip_source_t *zs;
+
+ zs = NULL;
+ if (!ZIP_ENTRY_DATA_CHANGED(entry)) {
+ if ((zs = zip_source_zip_file_create(za, i, ZIP_FL_UNCHANGED, 0, -1, NULL, &za->error)) == NULL) {
+ error = 1;
+ break;
+ }
+ }
+
+ /* add_data writes dirent */
+ if (add_data(za, zs ? zs : entry->source, de, entry->changes ? entry->changes->changed : 0) < 0) {
+ error = 1;
+ if (zs)
+ zip_source_free(zs);
+ break;
+ }
+ if (zs)
+ zip_source_free(zs);
+ }
+ else {
+ zip_uint64_t offset;
+
+ if (de->encryption_method != ZIP_EM_TRAD_PKWARE) {
+ /* when copying data, all sizes are known -> no data descriptor needed */
+ /* except for PKWare encryption, where removing the data descriptor breaks password validation */
+ de->bitflags &= (zip_uint16_t)~ZIP_GPBF_DATA_DESCRIPTOR;
+ }
+ if (_zip_dirent_write(za, de, ZIP_FL_LOCAL) < 0) {
+ error = 1;
+ break;
+ }
+ if ((offset = _zip_file_get_offset(za, i, &za->error)) == 0) {
+ error = 1;
+ break;
+ }
+ if (zip_source_seek(za->src, (zip_int64_t)offset, SEEK_SET) < 0) {
+ zip_error_set_from_source(&za->error, za->src);
+ error = 1;
+ break;
+ }
+ if (copy_data(za, de->comp_size) < 0) {
error = 1;
- break;
- }
- if (copy_data(za, de->comp_size) < 0) {
- error = 1;
- break;
- }
-
- if (de->bitflags & ZIP_GPBF_DATA_DESCRIPTOR) {
- if (write_data_descriptor(za, de, _zip_dirent_needs_zip64(de, 0)) < 0) {
- error = 1;
- break;
- }
- }
- }
+ break;
+ }
+
+ if (de->bitflags & ZIP_GPBF_DATA_DESCRIPTOR) {
+ if (write_data_descriptor(za, de, _zip_dirent_needs_zip64(de, 0)) < 0) {
+ error = 1;
+ break;
+ }
+ }
+ }
}
if (!error) {
- if (write_cdir(za, filelist, survivors) < 0)
- error = 1;
+ if (write_cdir(za, filelist, survivors) < 0)
+ error = 1;
}
free(filelist);
if (!error) {
- if (zip_source_commit_write(za->src) != 0) {
- _zip_error_set_from_source(&za->error, za->src);
- error = 1;
- }
- _zip_progress_end(za->progress);
+ if (zip_source_commit_write(za->src) != 0) {
+ zip_error_set_from_source(&za->error, za->src);
+ error = 1;
+ }
+ _zip_progress_end(za->progress);
}
if (error) {
- zip_source_rollback_write(za->src);
- return -1;
+ zip_source_rollback_write(za->src);
+ return -1;
}
zip_discard(za);
@@ -296,86 +307,85 @@ add_data(zip_t *za, zip_source_t *src, zip_dirent_t *de, zip_uint32_t changed) {
bool needs_recompress, needs_decompress, needs_crc, needs_compress, needs_reencrypt, needs_decrypt, needs_encrypt;
if (zip_source_stat(src, &st) < 0) {
- _zip_error_set_from_source(&za->error, src);
- return -1;
+ zip_error_set_from_source(&za->error, src);
+ return -1;
}
if ((st.valid & ZIP_STAT_COMP_METHOD) == 0) {
- st.valid |= ZIP_STAT_COMP_METHOD;
- st.comp_method = ZIP_CM_STORE;
+ st.valid |= ZIP_STAT_COMP_METHOD;
+ st.comp_method = ZIP_CM_STORE;
}
if (ZIP_CM_IS_DEFAULT(de->comp_method) && st.comp_method != ZIP_CM_STORE)
- de->comp_method = st.comp_method;
+ de->comp_method = st.comp_method;
else if (de->comp_method == ZIP_CM_STORE && (st.valid & ZIP_STAT_SIZE)) {
- st.valid |= ZIP_STAT_COMP_SIZE;
- st.comp_size = st.size;
+ st.valid |= ZIP_STAT_COMP_SIZE;
+ st.comp_size = st.size;
}
else {
- /* we'll recompress */
- st.valid &= ~ZIP_STAT_COMP_SIZE;
+ /* we'll recompress */
+ st.valid &= ~ZIP_STAT_COMP_SIZE;
}
if ((st.valid & ZIP_STAT_ENCRYPTION_METHOD) == 0) {
- st.valid |= ZIP_STAT_ENCRYPTION_METHOD;
- st.encryption_method = ZIP_EM_NONE;
+ st.valid |= ZIP_STAT_ENCRYPTION_METHOD;
+ st.encryption_method = ZIP_EM_NONE;
}
flags = ZIP_EF_LOCAL;
if ((st.valid & ZIP_STAT_SIZE) == 0) {
- flags |= ZIP_FL_FORCE_ZIP64;
- data_length = -1;
+ /* TODO: not valid for torrentzip */
+ flags |= ZIP_FL_FORCE_ZIP64;
+ data_length = -1;
}
else {
- de->uncomp_size = st.size;
- /* this is technically incorrect (copy_source counts compressed data), but it's the best we have */
- data_length = (zip_int64_t)st.size;
-
- if ((st.valid & ZIP_STAT_COMP_SIZE) == 0) {
- zip_uint64_t max_size;
-
- switch (ZIP_CM_ACTUAL(de->comp_method)) {
- case ZIP_CM_BZIP2:
- /* computed by looking at increase of 10 random files of size 1MB when
- * compressed with bzip2, rounded up: 1.006 */
- max_size = 4269351188u;
- break;
-
- case ZIP_CM_DEFLATE:
- /* max deflate size increase: size + ceil(size/16k)*5+6 */
- max_size = 4293656963u;
- break;
-
- case ZIP_CM_STORE:
- max_size = 0xffffffffu;
- break;
-
- default:
- max_size = 0;
- }
-
- if (st.size > max_size) {
- flags |= ZIP_FL_FORCE_ZIP64;
- }
- }
- else
- de->comp_size = st.comp_size;
+ de->uncomp_size = st.size;
+ /* this is technically incorrect (copy_source counts compressed data), but it's the best we have */
+ data_length = (zip_int64_t)st.size;
+
+ if ((st.valid & ZIP_STAT_COMP_SIZE) == 0) {
+ zip_uint64_t max_compressed_size;
+ zip_uint16_t compression_method = ZIP_CM_ACTUAL(de->comp_method);
+
+ if (compression_method == ZIP_CM_STORE) {
+ max_compressed_size = st.size;
+ }
+ else {
+ zip_compression_algorithm_t *algorithm = _zip_get_compression_algorithm(compression_method, true);
+ if (algorithm == NULL) {
+ max_compressed_size = ZIP_UINT64_MAX;
+ }
+ else {
+ max_compressed_size = algorithm->maximum_compressed_size(st.size);
+ }
+ }
+
+ if (max_compressed_size > 0xffffffffu) {
+ /* TODO: not valid for torrentzip */
+ flags |= ZIP_FL_FORCE_ZIP64;
+ }
+ }
+ else {
+ de->comp_size = st.comp_size;
+ data_length = (zip_int64_t)st.comp_size;
+ }
}
if ((offstart = zip_source_tell_write(za->src)) < 0) {
- _zip_error_set_from_source(&za->error, za->src);
- return -1;
+ zip_error_set_from_source(&za->error, za->src);
+ return -1;
}
/* as long as we don't support non-seekable output, clear data descriptor bit */
de->bitflags &= (zip_uint16_t)~ZIP_GPBF_DATA_DESCRIPTOR;
if ((is_zip64 = _zip_dirent_write(za, de, flags)) < 0) {
- return -1;
+ return -1;
}
- needs_recompress = st.comp_method != ZIP_CM_ACTUAL(de->comp_method);
+ needs_recompress = ZIP_WANT_TORRENTZIP(za) || st.comp_method != ZIP_CM_ACTUAL(de->comp_method);
needs_decompress = needs_recompress && (st.comp_method != ZIP_CM_STORE);
+ /* in these cases we can compute the CRC ourselves, so we do */
needs_crc = (st.comp_method == ZIP_CM_STORE) || needs_decompress;
needs_compress = needs_recompress && (de->comp_method != ZIP_CM_STORE);
@@ -386,128 +396,143 @@ add_data(zip_t *za, zip_source_t *src, zip_dirent_t *de, zip_uint32_t changed) {
src_final = src;
zip_source_keep(src_final);
+ if (!needs_decrypt && st.encryption_method == ZIP_EM_TRAD_PKWARE && (de->changed & ZIP_DIRENT_LAST_MOD)) {
+ /* PKWare encryption uses the last modification time for password verification, therefore we can't change it without re-encrypting. Ignoring the requested modification time change seems more sensible than failing to close the archive. */
+ de->changed &= ~ZIP_DIRENT_LAST_MOD;
+ }
+
if (needs_decrypt) {
- zip_encryption_implementation impl;
+ zip_encryption_implementation impl;
- if ((impl = _zip_get_encryption_implementation(st.encryption_method, ZIP_CODEC_DECODE)) == NULL) {
- zip_error_set(&za->error, ZIP_ER_ENCRNOTSUPP, 0);
- zip_source_free(src_final);
- return -1;
- }
- if ((src_tmp = impl(za, src_final, st.encryption_method, ZIP_CODEC_DECODE, za->default_password)) == NULL) {
- /* error set by impl */
- zip_source_free(src_final);
- return -1;
- }
+ if ((impl = _zip_get_encryption_implementation(st.encryption_method, ZIP_CODEC_DECODE)) == NULL) {
+ zip_error_set(&za->error, ZIP_ER_ENCRNOTSUPP, 0);
+ zip_source_free(src_final);
+ return -1;
+ }
+ if ((src_tmp = impl(za, src_final, st.encryption_method, ZIP_CODEC_DECODE, za->default_password)) == NULL) {
+ /* error set by impl */
+ zip_source_free(src_final);
+ return -1;
+ }
- zip_source_free(src_final);
- src_final = src_tmp;
+ src_final = src_tmp;
}
if (needs_decompress) {
- if ((src_tmp = zip_source_decompress(za, src_final, st.comp_method)) == NULL) {
- zip_source_free(src_final);
- return -1;
- }
+ if ((src_tmp = zip_source_decompress(za, src_final, st.comp_method)) == NULL) {
+ zip_source_free(src_final);
+ return -1;
+ }
- zip_source_free(src_final);
- src_final = src_tmp;
+ src_final = src_tmp;
}
if (needs_crc) {
- if ((src_tmp = zip_source_crc(za, src_final, 0)) == NULL) {
- zip_source_free(src_final);
- return -1;
- }
+ if ((src_tmp = zip_source_crc_create(src_final, 0, &za->error)) == NULL) {
+ zip_source_free(src_final);
+ return -1;
+ }
- zip_source_free(src_final);
- src_final = src_tmp;
+ src_final = src_tmp;
}
if (needs_compress) {
- if ((src_tmp = zip_source_compress(za, src_final, de->comp_method, de->compression_level)) == NULL) {
- zip_source_free(src_final);
- return -1;
- }
+ if ((src_tmp = zip_source_compress(za, src_final, de->comp_method, de->compression_level)) == NULL) {
+ zip_source_free(src_final);
+ return -1;
+ }
- zip_source_free(src_final);
- src_final = src_tmp;
+ src_final = src_tmp;
}
if (needs_encrypt) {
- zip_encryption_implementation impl;
- const char *password = NULL;
-
- if (de->password) {
- password = de->password;
- }
- else if (za->default_password) {
- password = za->default_password;
- }
-
- if ((impl = _zip_get_encryption_implementation(de->encryption_method, ZIP_CODEC_ENCODE)) == NULL) {
- zip_error_set(&za->error, ZIP_ER_ENCRNOTSUPP, 0);
- zip_source_free(src_final);
- return -1;
- }
- if ((src_tmp = impl(za, src_final, de->encryption_method, ZIP_CODEC_ENCODE, password)) == NULL) {
- /* error set by impl */
- zip_source_free(src_final);
- return -1;
- }
- if (de->encryption_method == ZIP_EM_TRAD_PKWARE) {
- de->bitflags |= ZIP_GPBF_DATA_DESCRIPTOR;
- }
-
- zip_source_free(src_final);
- src_final = src_tmp;
+ zip_encryption_implementation impl;
+ const char *password = NULL;
+
+ if (de->password) {
+ password = de->password;
+ }
+ else if (za->default_password) {
+ password = za->default_password;
+ }
+
+ if ((impl = _zip_get_encryption_implementation(de->encryption_method, ZIP_CODEC_ENCODE)) == NULL) {
+ zip_error_set(&za->error, ZIP_ER_ENCRNOTSUPP, 0);
+ zip_source_free(src_final);
+ return -1;
+ }
+
+ if (de->encryption_method == ZIP_EM_TRAD_PKWARE) {
+ de->bitflags |= ZIP_GPBF_DATA_DESCRIPTOR;
+
+ /* PKWare encryption uses last_mod, make sure it gets the right value. */
+ if (de->changed & ZIP_DIRENT_LAST_MOD) {
+ zip_stat_t st_mtime;
+ zip_stat_init(&st_mtime);
+ st_mtime.valid = ZIP_STAT_MTIME;
+ st_mtime.mtime = de->last_mod;
+ if ((src_tmp = _zip_source_window_new(src_final, 0, -1, &st_mtime, 0, NULL, NULL, 0, true, &za->error)) == NULL) {
+ zip_source_free(src_final);
+ return -1;
+ }
+ src_final = src_tmp;
+ }
+ }
+
+ if ((src_tmp = impl(za, src_final, de->encryption_method, ZIP_CODEC_ENCODE, password)) == NULL) {
+ /* error set by impl */
+ zip_source_free(src_final);
+ return -1;
+ }
+
+ src_final = src_tmp;
}
if ((offdata = zip_source_tell_write(za->src)) < 0) {
- _zip_error_set_from_source(&za->error, za->src);
- return -1;
+ zip_error_set_from_source(&za->error, za->src);
+ return -1;
}
ret = copy_source(za, src_final, data_length);
if (zip_source_stat(src_final, &st) < 0) {
- _zip_error_set_from_source(&za->error, src_final);
- ret = -1;
+ zip_error_set_from_source(&za->error, src_final);
+ ret = -1;
}
if (zip_source_get_file_attributes(src_final, &attributes) != 0) {
- _zip_error_set_from_source(&za->error, src_final);
- ret = -1;
+ zip_error_set_from_source(&za->error, src_final);
+ ret = -1;
}
zip_source_free(src_final);
if (ret < 0) {
- return -1;
+ return -1;
}
if ((offend = zip_source_tell_write(za->src)) < 0) {
- _zip_error_set_from_source(&za->error, za->src);
- return -1;
+ zip_error_set_from_source(&za->error, za->src);
+ return -1;
}
if (zip_source_seek_write(za->src, offstart, SEEK_SET) < 0) {
- _zip_error_set_from_source(&za->error, za->src);
- return -1;
+ zip_error_set_from_source(&za->error, za->src);
+ return -1;
}
if ((st.valid & (ZIP_STAT_COMP_METHOD | ZIP_STAT_CRC | ZIP_STAT_SIZE)) != (ZIP_STAT_COMP_METHOD | ZIP_STAT_CRC | ZIP_STAT_SIZE)) {
- zip_error_set(&za->error, ZIP_ER_INTERNAL, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_INTERNAL, 0);
+ return -1;
}
if ((de->changed & ZIP_DIRENT_LAST_MOD) == 0) {
- if (st.valid & ZIP_STAT_MTIME)
- de->last_mod = st.mtime;
- else
- time(&de->last_mod);
+ if (st.valid & ZIP_STAT_MTIME)
+ de->last_mod = st.mtime;
+ else
+ time(&de->last_mod);
}
de->comp_method = st.comp_method;
de->crc = st.crc;
@@ -515,24 +540,28 @@ add_data(zip_t *za, zip_source_t *src, zip_dirent_t *de, zip_uint32_t changed) {
de->comp_size = (zip_uint64_t)(offend - offdata);
_zip_dirent_apply_attributes(de, &attributes, (flags & ZIP_FL_FORCE_ZIP64) != 0, changed);
+ if (ZIP_WANT_TORRENTZIP(za)) {
+ zip_dirent_torrentzip_normalize(de);
+ }
+
if ((ret = _zip_dirent_write(za, de, flags)) < 0)
- return -1;
+ return -1;
if (is_zip64 != ret) {
- /* Zip64 mismatch between preliminary file header written before data and final file header written afterwards */
- zip_error_set(&za->error, ZIP_ER_INTERNAL, 0);
- return -1;
+ /* Zip64 mismatch between preliminary file header written before data and final file header written afterwards */
+ zip_error_set(&za->error, ZIP_ER_INTERNAL, 0);
+ return -1;
}
if (zip_source_seek_write(za->src, offend, SEEK_SET) < 0) {
- _zip_error_set_from_source(&za->error, za->src);
- return -1;
+ zip_error_set_from_source(&za->error, za->src);
+ return -1;
}
if (de->bitflags & ZIP_GPBF_DATA_DESCRIPTOR) {
- if (write_data_descriptor(za, de, is_zip64) < 0) {
- return -1;
- }
+ if (write_data_descriptor(za, de, is_zip64) < 0) {
+ return -1;
+ }
}
return 0;
@@ -542,32 +571,32 @@ add_data(zip_t *za, zip_source_t *src, zip_dirent_t *de, zip_uint32_t changed) {
static int
copy_data(zip_t *za, zip_uint64_t len) {
DEFINE_BYTE_ARRAY(buf, BUFSIZE);
- size_t n;
double total = (double)len;
if (!byte_array_init(buf, BUFSIZE)) {
- zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
+ return -1;
}
while (len > 0) {
- n = len > BUFSIZE ? BUFSIZE : len;
- if (_zip_read(za->src, buf, n, &za->error) < 0) {
- byte_array_fini(buf);
- return -1;
- }
+ zip_uint64_t n = ZIP_MIN(len, BUFSIZE);
+
+ if (_zip_read(za->src, buf, n, &za->error) < 0) {
+ byte_array_fini(buf);
+ return -1;
+ }
- if (_zip_write(za, buf, n) < 0) {
- byte_array_fini(buf);
- return -1;
- }
+ if (_zip_write(za, buf, n) < 0) {
+ byte_array_fini(buf);
+ return -1;
+ }
- len -= n;
+ len -= n;
- if (_zip_progress_update(za->progress, (total - (double)len) / total) != 0) {
- zip_error_set(&za->error, ZIP_ER_CANCELLED, 0);
- return -1;
- }
+ if (_zip_progress_update(za->progress, (total - (double)len) / total) != 0) {
+ zip_error_set(&za->error, ZIP_ER_CANCELLED, 0);
+ return -1;
+ }
}
byte_array_fini(buf);
@@ -582,35 +611,35 @@ copy_source(zip_t *za, zip_source_t *src, zip_int64_t data_length) {
int ret;
if (zip_source_open(src) < 0) {
- _zip_error_set_from_source(&za->error, src);
- return -1;
+ zip_error_set_from_source(&za->error, src);
+ return -1;
}
if (!byte_array_init(buf, BUFSIZE)) {
- zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
+ return -1;
}
ret = 0;
current = 0;
while ((n = zip_source_read(src, buf, BUFSIZE)) > 0) {
- if (_zip_write(za, buf, (zip_uint64_t)n) < 0) {
- ret = -1;
- break;
- }
- if (n == BUFSIZE && za->progress && data_length > 0) {
- current += n;
- if (_zip_progress_update(za->progress, (double)current / (double)data_length) != 0) {
- zip_error_set(&za->error, ZIP_ER_CANCELLED, 0);
- ret = -1;
- break;
- }
- }
+ if (_zip_write(za, buf, (zip_uint64_t)n) < 0) {
+ ret = -1;
+ break;
+ }
+ if (n == BUFSIZE && za->progress && data_length > 0) {
+ current += n;
+ if (_zip_progress_update(za->progress, (double)current / (double)data_length) != 0) {
+ zip_error_set(&za->error, ZIP_ER_CANCELLED, 0);
+ ret = -1;
+ break;
+ }
+ }
}
if (n < 0) {
- _zip_error_set_from_source(&za->error, src);
- ret = -1;
+ zip_error_set_from_source(&za->error, src);
+ ret = -1;
}
byte_array_fini(buf);
@@ -622,18 +651,16 @@ copy_source(zip_t *za, zip_source_t *src, zip_int64_t data_length) {
static int
write_cdir(zip_t *za, const zip_filelist_t *filelist, zip_uint64_t survivors) {
- zip_int64_t cd_start, end, size;
-
- if ((cd_start = zip_source_tell_write(za->src)) < 0) {
- return -1;
+ if (zip_source_tell_write(za->src) < 0) {
+ return -1;
}
- if ((size = _zip_cdir_write(za, filelist, survivors)) < 0) {
- return -1;
+ if (_zip_cdir_write(za, filelist, survivors) < 0) {
+ return -1;
}
- if ((end = zip_source_tell_write(za->src)) < 0) {
- return -1;
+ if (zip_source_tell_write(za->src) < 0) {
+ return -1;
}
return 0;
@@ -648,21 +675,21 @@ _zip_changed(const zip_t *za, zip_uint64_t *survivorsp) {
changed = 0;
survivors = 0;
- if (za->comment_changed || za->ch_flags != za->flags) {
- changed = 1;
+ if (za->comment_changed || (ZIP_WANT_TORRENTZIP(za) && !ZIP_IS_TORRENTZIP(za))) {
+ changed = 1;
}
for (i = 0; i < za->nentry; i++) {
- if (ZIP_ENTRY_HAS_CHANGES(&za->entry[i])) {
- changed = 1;
- }
- if (!za->entry[i].deleted) {
- survivors++;
- }
+ if (ZIP_ENTRY_HAS_CHANGES(&za->entry[i])) {
+ changed = 1;
+ }
+ if (!za->entry[i].deleted) {
+ survivors++;
+ }
}
if (survivorsp) {
- *survivorsp = survivors;
+ *survivorsp = survivors;
}
return changed;
@@ -674,30 +701,45 @@ write_data_descriptor(zip_t *za, const zip_dirent_t *de, int is_zip64) {
int ret = 0;
if (buffer == NULL) {
- zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
+ return -1;
}
_zip_buffer_put(buffer, DATADES_MAGIC, 4);
_zip_buffer_put_32(buffer, de->crc);
if (is_zip64) {
- _zip_buffer_put_64(buffer, de->comp_size);
- _zip_buffer_put_64(buffer, de->uncomp_size);
+ _zip_buffer_put_64(buffer, de->comp_size);
+ _zip_buffer_put_64(buffer, de->uncomp_size);
}
else {
- _zip_buffer_put_32(buffer, (zip_uint32_t)de->comp_size);
- _zip_buffer_put_32(buffer, (zip_uint32_t)de->uncomp_size);
+ _zip_buffer_put_32(buffer, (zip_uint32_t)de->comp_size);
+ _zip_buffer_put_32(buffer, (zip_uint32_t)de->uncomp_size);
}
if (!_zip_buffer_ok(buffer)) {
- zip_error_set(&za->error, ZIP_ER_INTERNAL, 0);
- ret = -1;
+ zip_error_set(&za->error, ZIP_ER_INTERNAL, 0);
+ ret = -1;
}
else {
- ret = _zip_write(za, _zip_buffer_data(buffer), _zip_buffer_offset(buffer));
+ ret = _zip_write(za, _zip_buffer_data(buffer), _zip_buffer_offset(buffer));
}
_zip_buffer_free(buffer);
return ret;
}
+
+
+static int torrentzip_compare_names(const void *a, const void *b) {
+ const char *aname = ((const zip_filelist_t *)a)->name;
+ const char *bname = ((const zip_filelist_t *)b)->name;
+
+ if (aname == NULL) {
+ return (bname != NULL) * -1;
+ }
+ else if (bname == NULL) {
+ return 1;
+ }
+
+ return strcasecmp(aname, bname);
+} \ No newline at end of file
diff --git a/src/Common/libzip/zip_crypto.h b/src/Common/libzip/zip_crypto.h
new file mode 100644
index 00000000..0d74d1a4
--- /dev/null
+++ b/src/Common/libzip/zip_crypto.h
@@ -0,0 +1,54 @@
+/*
+ zip_crypto.h -- crypto definitions
+ Copyright (C) 2017-2021 Dieter Baron and Thomas Klausner
+
+ This file is part of libzip, a library to manipulate ZIP archives.
+ The authors can be contacted at <info@libzip.org>
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ 3. The names of the authors may not be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef HAD_ZIP_CRYPTO_H
+#define HAD_ZIP_CRYPTO_H
+
+#define ZIP_CRYPTO_SHA1_LENGTH 20
+#define ZIP_CRYPTO_AES_BLOCK_LENGTH 16
+
+#if defined(HAVE_WINDOWS_CRYPTO)
+#include "zip_crypto_win.h"
+#elif defined(HAVE_COMMONCRYPTO)
+#include "zip_crypto_commoncrypto.h"
+#elif defined(HAVE_GNUTLS)
+#include "zip_crypto_gnutls.h"
+#elif defined(HAVE_OPENSSL)
+#include "zip_crypto_openssl.h"
+#elif defined(HAVE_MBEDTLS)
+#include "zip_crypto_mbedtls.h"
+#else
+#error "no crypto backend found"
+#endif
+
+#endif /* HAD_ZIP_CRYPTO_H */
diff --git a/src/Common/libzip/zip_crypto_commoncrypto.c b/src/Common/libzip/zip_crypto_commoncrypto.c
new file mode 100644
index 00000000..b198be56
--- /dev/null
+++ b/src/Common/libzip/zip_crypto_commoncrypto.c
@@ -0,0 +1,110 @@
+/*
+ zip_crypto_commoncrypto.c -- CommonCrypto wrapper.
+ Copyright (C) 2018-2021 Dieter Baron and Thomas Klausner
+
+ This file is part of libzip, a library to manipulate ZIP archives.
+ The authors can be contacted at <info@libzip.org>
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ 3. The names of the authors may not be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <stdlib.h>
+
+#include "zipint.h"
+
+#include "zip_crypto.h"
+
+#include <fcntl.h>
+#include <unistd.h>
+
+void
+_zip_crypto_aes_free(_zip_crypto_aes_t *aes) {
+ if (aes == NULL) {
+ return;
+ }
+
+ CCCryptorRelease(aes);
+}
+
+
+bool
+_zip_crypto_aes_encrypt_block(_zip_crypto_aes_t *aes, const zip_uint8_t *in, zip_uint8_t *out) {
+ size_t len;
+ CCCryptorUpdate(aes, in, ZIP_CRYPTO_AES_BLOCK_LENGTH, out, ZIP_CRYPTO_AES_BLOCK_LENGTH, &len);
+ return true;
+}
+
+
+_zip_crypto_aes_t *
+_zip_crypto_aes_new(const zip_uint8_t *key, zip_uint16_t key_size, zip_error_t *error) {
+ _zip_crypto_aes_t *aes;
+ CCCryptorStatus ret;
+
+ ret = CCCryptorCreate(kCCEncrypt, kCCAlgorithmAES, kCCOptionECBMode, key, key_size / 8, NULL, &aes);
+
+ switch (ret) {
+ case kCCSuccess:
+ return aes;
+
+ case kCCMemoryFailure:
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
+
+ case kCCParamError:
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return NULL;
+
+ default:
+ zip_error_set(error, ZIP_ER_INTERNAL, 0);
+ return NULL;
+ }
+}
+
+
+void
+_zip_crypto_hmac_free(_zip_crypto_hmac_t *hmac) {
+ if (hmac == NULL) {
+ return;
+ }
+
+ _zip_crypto_clear(hmac, sizeof(*hmac));
+ free(hmac);
+}
+
+
+_zip_crypto_hmac_t *
+_zip_crypto_hmac_new(const zip_uint8_t *secret, zip_uint64_t secret_length, zip_error_t *error) {
+ _zip_crypto_hmac_t *hmac;
+
+ if ((hmac = (_zip_crypto_hmac_t *)malloc(sizeof(*hmac))) == NULL) {
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
+ }
+
+ CCHmacInit(hmac, kCCHmacAlgSHA1, secret, secret_length);
+
+ return hmac;
+}
diff --git a/src/Common/libzip/zip_crypto_commoncrypto.h b/src/Common/libzip/zip_crypto_commoncrypto.h
new file mode 100644
index 00000000..01828cc6
--- /dev/null
+++ b/src/Common/libzip/zip_crypto_commoncrypto.h
@@ -0,0 +1,53 @@
+/*
+ zip_crypto_commoncrypto.h -- definitions for CommonCrypto wrapper.
+ Copyright (C) 2018 Dieter Baron and Thomas Klausner
+
+ This file is part of libzip, a library to manipulate ZIP archives.
+ The authors can be contacted at <info@libzip.org>
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ 3. The names of the authors may not be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef HAD_ZIP_CRYPTO_COMMONCRYPTO_H
+#define HAD_ZIP_CRYPTO_COMMONCRYPTO_H
+
+#include <CommonCrypto/CommonCrypto.h>
+
+#define _zip_crypto_aes_t struct _CCCryptor
+#define _zip_crypto_hmac_t CCHmacContext
+
+void _zip_crypto_aes_free(_zip_crypto_aes_t *aes);
+bool _zip_crypto_aes_encrypt_block(_zip_crypto_aes_t *aes, const zip_uint8_t *in, zip_uint8_t *out);
+_zip_crypto_aes_t *_zip_crypto_aes_new(const zip_uint8_t *key, zip_uint16_t key_size, zip_error_t *error);
+
+#define _zip_crypto_hmac(hmac, data, length) (CCHmacUpdate((hmac), (data), (length)), true)
+void _zip_crypto_hmac_free(_zip_crypto_hmac_t *hmac);
+_zip_crypto_hmac_t *_zip_crypto_hmac_new(const zip_uint8_t *secret, zip_uint64_t secret_length, zip_error_t *error);
+#define _zip_crypto_hmac_output(hmac, data) (CCHmacFinal((hmac), (data)), true)
+
+#define _zip_crypto_pbkdf2(key, key_length, salt, salt_length, iterations, output, output_length) (CCKeyDerivationPBKDF(kCCPBKDF2, (const char *)(key), (key_length), (salt), (salt_length), kCCPRFHmacAlgSHA1, (iterations), (output), (output_length)) == kCCSuccess)
+
+#endif /* HAD_ZIP_CRYPTO_COMMONCRYPTO_H */
diff --git a/src/Common/libzip/zip_crypto_gnutls.c b/src/Common/libzip/zip_crypto_gnutls.c
new file mode 100644
index 00000000..1a25aa12
--- /dev/null
+++ b/src/Common/libzip/zip_crypto_gnutls.c
@@ -0,0 +1,134 @@
+/*
+ zip_crypto_gnutls.c -- GnuTLS wrapper.
+ Copyright (C) 2018-2021 Dieter Baron and Thomas Klausner
+
+ This file is part of libzip, a library to manipulate ZIP archives.
+ The authors can be contacted at <info@libzip.org>
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ 3. The names of the authors may not be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <stdlib.h>
+
+#include "zipint.h"
+
+#include "zip_crypto.h"
+
+_zip_crypto_aes_t *
+_zip_crypto_aes_new(const zip_uint8_t *key, zip_uint16_t key_size, zip_error_t *error) {
+ _zip_crypto_aes_t *aes;
+
+ if ((aes = (_zip_crypto_aes_t *)malloc(sizeof(*aes))) == NULL) {
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
+ }
+
+ aes->key_size = key_size;
+
+ switch (aes->key_size) {
+ case 128:
+ nettle_aes128_set_encrypt_key(&aes->ctx.ctx_128, key);
+ break;
+ case 192:
+ nettle_aes192_set_encrypt_key(&aes->ctx.ctx_192, key);
+ break;
+ case 256:
+ nettle_aes256_set_encrypt_key(&aes->ctx.ctx_256, key);
+ break;
+ default:
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ free(aes);
+ return NULL;
+ }
+
+ return aes;
+}
+
+bool
+_zip_crypto_aes_encrypt_block(_zip_crypto_aes_t *aes, const zip_uint8_t *in, zip_uint8_t *out) {
+ switch (aes->key_size) {
+ case 128:
+ nettle_aes128_encrypt(&aes->ctx.ctx_128, ZIP_CRYPTO_AES_BLOCK_LENGTH, out, in);
+ break;
+ case 192:
+ nettle_aes192_encrypt(&aes->ctx.ctx_192, ZIP_CRYPTO_AES_BLOCK_LENGTH, out, in);
+ break;
+ case 256:
+ nettle_aes256_encrypt(&aes->ctx.ctx_256, ZIP_CRYPTO_AES_BLOCK_LENGTH, out, in);
+ break;
+ }
+
+ return true;
+}
+
+void
+_zip_crypto_aes_free(_zip_crypto_aes_t *aes) {
+ if (aes == NULL) {
+ return;
+ }
+
+ _zip_crypto_clear(aes, sizeof(*aes));
+ free(aes);
+}
+
+
+_zip_crypto_hmac_t *
+_zip_crypto_hmac_new(const zip_uint8_t *secret, zip_uint64_t secret_length, zip_error_t *error) {
+ _zip_crypto_hmac_t *hmac;
+
+ if ((hmac = (_zip_crypto_hmac_t *)malloc(sizeof(*hmac))) == NULL) {
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
+ }
+
+ if (gnutls_hmac_init(hmac, GNUTLS_MAC_SHA1, secret, secret_length) < 0) {
+ zip_error_set(error, ZIP_ER_INTERNAL, 0);
+ free(hmac);
+ return NULL;
+ }
+
+ return hmac;
+}
+
+
+void
+_zip_crypto_hmac_free(_zip_crypto_hmac_t *hmac) {
+ zip_uint8_t buf[ZIP_CRYPTO_SHA1_LENGTH];
+
+ if (hmac == NULL) {
+ return;
+ }
+
+ gnutls_hmac_deinit(*hmac, buf);
+ _zip_crypto_clear(hmac, sizeof(*hmac));
+ free(hmac);
+}
+
+
+ZIP_EXTERN bool
+zip_secure_random(zip_uint8_t *buffer, zip_uint16_t length) {
+ return gnutls_rnd(GNUTLS_RND_KEY, buffer, length) == 0;
+}
diff --git a/src/Common/libzip/zip_crypto_gnutls.h b/src/Common/libzip/zip_crypto_gnutls.h
new file mode 100644
index 00000000..dc8b97a4
--- /dev/null
+++ b/src/Common/libzip/zip_crypto_gnutls.h
@@ -0,0 +1,68 @@
+/*
+ zip_crypto_gnutls.h -- definitions for GnuTLS wrapper.
+ Copyright (C) 2018-2021 Dieter Baron and Thomas Klausner
+
+ This file is part of libzip, a library to manipulate ZIP archives.
+ The authors can be contacted at <info@libzip.org>
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ 3. The names of the authors may not be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef HAD_ZIP_CRYPTO_GNUTLS_H
+#define HAD_ZIP_CRYPTO_GNUTLS_H
+
+#define HAVE_SECURE_RANDOM
+
+#include <nettle/aes.h>
+#include <nettle/pbkdf2.h>
+
+#include <gnutls/gnutls.h>
+
+#include <gnutls/crypto.h>
+
+typedef struct {
+ union {
+ struct aes128_ctx ctx_128;
+ struct aes192_ctx ctx_192;
+ struct aes256_ctx ctx_256;
+ } ctx;
+ zip_uint16_t key_size;
+} _zip_crypto_aes_t;
+
+#define _zip_crypto_hmac_t gnutls_hmac_hd_t
+
+void _zip_crypto_aes_free(_zip_crypto_aes_t *aes);
+bool _zip_crypto_aes_encrypt_block(_zip_crypto_aes_t *aes, const zip_uint8_t *in, zip_uint8_t *out);
+_zip_crypto_aes_t *_zip_crypto_aes_new(const zip_uint8_t *key, zip_uint16_t key_size, zip_error_t *error);
+
+#define _zip_crypto_hmac(hmac, data, length) (gnutls_hmac(*(hmac), (data), (length)) == 0)
+void _zip_crypto_hmac_free(_zip_crypto_hmac_t *hmac);
+_zip_crypto_hmac_t *_zip_crypto_hmac_new(const zip_uint8_t *secret, zip_uint64_t secret_length, zip_error_t *error);
+#define _zip_crypto_hmac_output(hmac, data) (gnutls_hmac_output(*(hmac), (data)), true)
+
+#define _zip_crypto_pbkdf2(key, key_length, salt, salt_length, iterations, output, output_length) (pbkdf2_hmac_sha1((key_length), (key), (iterations), (salt_length), (salt), (output_length), (output)), true)
+
+#endif /* HAD_ZIP_CRYPTO_GNUTLS_H */
diff --git a/src/Common/libzip/zip_crypto_mbedtls.c b/src/Common/libzip/zip_crypto_mbedtls.c
new file mode 100644
index 00000000..84544a82
--- /dev/null
+++ b/src/Common/libzip/zip_crypto_mbedtls.c
@@ -0,0 +1,171 @@
+/*
+ zip_crypto_mbedtls.c -- mbed TLS wrapper
+ Copyright (C) 2018-2021 Dieter Baron and Thomas Klausner
+
+ This file is part of libzip, a library to manipulate ZIP archives.
+ The authors can be contacted at <info@libzip.org>
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ 3. The names of the authors may not be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <stdlib.h>
+
+#include "zipint.h"
+
+#include "zip_crypto.h"
+
+#include <mbedtls/ctr_drbg.h>
+#include <mbedtls/entropy.h>
+#include <mbedtls/pkcs5.h>
+
+#include <limits.h>
+
+_zip_crypto_aes_t *
+_zip_crypto_aes_new(const zip_uint8_t *key, zip_uint16_t key_size, zip_error_t *error) {
+ _zip_crypto_aes_t *aes;
+
+ if ((aes = (_zip_crypto_aes_t *)malloc(sizeof(*aes))) == NULL) {
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
+ }
+
+ mbedtls_aes_init(aes);
+ mbedtls_aes_setkey_enc(aes, (const unsigned char *)key, (unsigned int)key_size);
+
+ return aes;
+}
+
+void
+_zip_crypto_aes_free(_zip_crypto_aes_t *aes) {
+ if (aes == NULL) {
+ return;
+ }
+
+ mbedtls_aes_free(aes);
+ free(aes);
+}
+
+
+_zip_crypto_hmac_t *
+_zip_crypto_hmac_new(const zip_uint8_t *secret, zip_uint64_t secret_length, zip_error_t *error) {
+ _zip_crypto_hmac_t *hmac;
+
+ if (secret_length > INT_MAX) {
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return NULL;
+ }
+
+ if ((hmac = (_zip_crypto_hmac_t *)malloc(sizeof(*hmac))) == NULL) {
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
+ }
+
+ mbedtls_md_init(hmac);
+
+ if (mbedtls_md_setup(hmac, mbedtls_md_info_from_type(MBEDTLS_MD_SHA1), 1) != 0) {
+ zip_error_set(error, ZIP_ER_INTERNAL, 0);
+ free(hmac);
+ return NULL;
+ }
+
+ if (mbedtls_md_hmac_starts(hmac, (const unsigned char *)secret, (size_t)secret_length) != 0) {
+ zip_error_set(error, ZIP_ER_INTERNAL, 0);
+ free(hmac);
+ return NULL;
+ }
+
+ return hmac;
+}
+
+
+void
+_zip_crypto_hmac_free(_zip_crypto_hmac_t *hmac) {
+ if (hmac == NULL) {
+ return;
+ }
+
+ mbedtls_md_free(hmac);
+ free(hmac);
+}
+
+
+bool
+_zip_crypto_pbkdf2(const zip_uint8_t *key, zip_uint64_t key_length, const zip_uint8_t *salt, zip_uint16_t salt_length, int iterations, zip_uint8_t *output, zip_uint64_t output_length) {
+ mbedtls_md_context_t sha1_ctx;
+ bool ok = true;
+
+#if MBEDTLS_VERSION_NUMBER < 0x03030000
+
+ mbedtls_md_init(&sha1_ctx);
+
+ if (mbedtls_md_setup(&sha1_ctx, mbedtls_md_info_from_type(MBEDTLS_MD_SHA1), 1) != 0) {
+ ok = false;
+ }
+
+ if (ok && mbedtls_pkcs5_pbkdf2_hmac(&sha1_ctx, (const unsigned char *)key, (size_t)key_length, (const unsigned char *)salt, (size_t)salt_length, (unsigned int)iterations, (uint32_t)output_length, (unsigned char *)output) != 0) {
+ ok = false;
+ }
+
+ mbedtls_md_free(&sha1_ctx);
+
+#else
+
+ ok = mbedtls_pkcs5_pbkdf2_hmac_ext(MBEDTLS_MD_SHA1, (const unsigned char *)key, (size_t)key_length, (const unsigned char *)salt, (size_t)salt_length, (unsigned int)iterations, (uint32_t)output_length, (unsigned char *)output) == 0;
+
+#endif // !defined(MBEDTLS_DEPRECATED_REMOVED) || MBEDTLS_VERSION_NUMBER < 0x03030000
+
+ return ok;
+}
+
+
+typedef struct {
+ mbedtls_entropy_context entropy;
+ mbedtls_ctr_drbg_context ctr_drbg;
+} zip_random_context_t;
+
+ZIP_EXTERN bool
+zip_secure_random(zip_uint8_t *buffer, zip_uint16_t length) {
+ static zip_random_context_t *ctx = NULL;
+ const unsigned char *pers = "zip_crypto_mbedtls";
+
+ if (!ctx) {
+ ctx = (zip_random_context_t *)malloc(sizeof(zip_random_context_t));
+ if (!ctx) {
+ return false;
+ }
+ mbedtls_entropy_init(&ctx->entropy);
+ mbedtls_ctr_drbg_init(&ctx->ctr_drbg);
+ if (mbedtls_ctr_drbg_seed(&ctx->ctr_drbg, mbedtls_entropy_func, &ctx->entropy, pers, strlen(pers)) != 0) {
+ mbedtls_ctr_drbg_free(&ctx->ctr_drbg);
+ mbedtls_entropy_free(&ctx->entropy);
+ free(ctx);
+ ctx = NULL;
+ return false;
+ }
+ }
+
+ return mbedtls_ctr_drbg_random(&ctx->ctr_drbg, (unsigned char *)buffer, (size_t)length) == 0;
+}
diff --git a/src/Common/libzip/zip_crypto_mbedtls.h b/src/Common/libzip/zip_crypto_mbedtls.h
new file mode 100644
index 00000000..1151fff7
--- /dev/null
+++ b/src/Common/libzip/zip_crypto_mbedtls.h
@@ -0,0 +1,56 @@
+/*
+ zip_crypto_mbedtls.h -- definitions for mbedtls wrapper
+ Copyright (C) 2018-2021 Dieter Baron and Thomas Klausner
+
+ This file is part of libzip, a library to manipulate ZIP archives.
+ The authors can be contacted at <info@libzip.org>
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ 3. The names of the authors may not be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef HAD_ZIP_CRYPTO_MBEDTLS_H
+#define HAD_ZIP_CRYPTO_MBEDTLS_H
+
+#define HAVE_SECURE_RANDOM
+
+#include <mbedtls/aes.h>
+#include <mbedtls/md.h>
+
+#define _zip_crypto_aes_t mbedtls_aes_context
+#define _zip_crypto_hmac_t mbedtls_md_context_t
+
+_zip_crypto_aes_t *_zip_crypto_aes_new(const zip_uint8_t *key, zip_uint16_t key_size, zip_error_t *error);
+#define _zip_crypto_aes_encrypt_block(aes, in, out) (mbedtls_aes_crypt_ecb((aes), MBEDTLS_AES_ENCRYPT, (in), (out)) == 0)
+void _zip_crypto_aes_free(_zip_crypto_aes_t *aes);
+
+_zip_crypto_hmac_t *_zip_crypto_hmac_new(const zip_uint8_t *secret, zip_uint64_t secret_length, zip_error_t *error);
+#define _zip_crypto_hmac(hmac, data, length) (mbedtls_md_hmac_update((hmac), (data), (length)) == 0)
+#define _zip_crypto_hmac_output(hmac, data) (mbedtls_md_hmac_finish((hmac), (data)) == 0)
+void _zip_crypto_hmac_free(_zip_crypto_hmac_t *hmac);
+
+bool _zip_crypto_pbkdf2(const zip_uint8_t *key, zip_uint64_t key_length, const zip_uint8_t *salt, zip_uint16_t salt_length, int iterations, zip_uint8_t *output, zip_uint64_t output_length);
+
+#endif /* HAD_ZIP_CRYPTO_MBEDTLS_H */
diff --git a/src/Common/libzip/zip_crypto_openssl.c b/src/Common/libzip/zip_crypto_openssl.c
new file mode 100644
index 00000000..7f1da10e
--- /dev/null
+++ b/src/Common/libzip/zip_crypto_openssl.c
@@ -0,0 +1,229 @@
+/*
+ zip_crypto_openssl.c -- OpenSSL wrapper.
+ Copyright (C) 2018-2021 Dieter Baron and Thomas Klausner
+
+ This file is part of libzip, a library to manipulate ZIP archives.
+ The authors can be contacted at <info@libzip.org>
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ 3. The names of the authors may not be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <stdlib.h>
+
+#include "zipint.h"
+
+#include "zip_crypto.h"
+
+#include <limits.h>
+#include <openssl/rand.h>
+
+#ifdef USE_OPENSSL_3_API
+static _zip_crypto_hmac_t* hmac_new() {
+ _zip_crypto_hmac_t *hmac = (_zip_crypto_hmac_t*)malloc(sizeof(*hmac));
+ if (hmac != NULL) {
+ hmac->mac = NULL;
+ hmac->ctx = NULL;
+ }
+ return hmac;
+}
+static void hmac_free(_zip_crypto_hmac_t* hmac) {
+ if (hmac != NULL) {
+ if (hmac->ctx != NULL) {
+ EVP_MAC_CTX_free(hmac->ctx);
+ }
+ if (hmac->mac != NULL) {
+ EVP_MAC_free(hmac->mac);
+ }
+ free(hmac);
+ }
+}
+#endif
+
+_zip_crypto_aes_t *
+_zip_crypto_aes_new(const zip_uint8_t *key, zip_uint16_t key_size, zip_error_t *error) {
+ _zip_crypto_aes_t *aes;
+ const EVP_CIPHER* cipher_type;
+
+ switch (key_size) {
+ case 128:
+ cipher_type = EVP_aes_128_ecb();
+ break;
+ case 192:
+ cipher_type = EVP_aes_192_ecb();
+ break;
+ case 256:
+ cipher_type = EVP_aes_256_ecb();
+ break;
+ default:
+ zip_error_set(error, ZIP_ER_INTERNAL, 0);
+ return NULL;
+ }
+
+#ifdef USE_OPENSSL_1_0_API
+ if ((aes = (_zip_crypto_aes_t *)malloc(sizeof(*aes))) == NULL) {
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
+ }
+ memset(aes, 0, sizeof(*aes));
+#else
+ if ((aes = EVP_CIPHER_CTX_new()) == NULL) {
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
+ }
+#endif
+
+ if (EVP_EncryptInit_ex(aes, cipher_type, NULL, key, NULL) != 1) {
+#ifdef USE_OPENSSL_1_0_API
+ free(aes);
+#else
+ EVP_CIPHER_CTX_free(aes);
+#endif
+ zip_error_set(error, ZIP_ER_INTERNAL, 0);
+ return NULL;
+ }
+
+ return aes;
+}
+
+void
+_zip_crypto_aes_free(_zip_crypto_aes_t *aes) {
+ if (aes == NULL) {
+ return;
+ }
+
+#ifdef USE_OPENSSL_1_0_API
+ EVP_CIPHER_CTX_cleanup(aes);
+ _zip_crypto_clear(aes, sizeof(*aes));
+ free(aes);
+#else
+ EVP_CIPHER_CTX_free(aes);
+#endif
+}
+
+
+bool
+_zip_crypto_aes_encrypt_block(_zip_crypto_aes_t *aes, const zip_uint8_t *in, zip_uint8_t *out) {
+ int len;
+ if (EVP_EncryptUpdate(aes, out, &len, in, ZIP_CRYPTO_AES_BLOCK_LENGTH) != 1) {
+ return false;
+ }
+ return true;
+}
+
+
+_zip_crypto_hmac_t *
+_zip_crypto_hmac_new(const zip_uint8_t *secret, zip_uint64_t secret_length, zip_error_t *error) {
+ _zip_crypto_hmac_t *hmac;
+
+ if (secret_length > INT_MAX) {
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return NULL;
+ }
+
+#ifdef USE_OPENSSL_3_API
+ if ((hmac = hmac_new()) == NULL
+ || (hmac->mac = EVP_MAC_fetch(NULL, "HMAC", "provider=default")) == NULL
+ || (hmac->ctx = EVP_MAC_CTX_new(hmac->mac)) == NULL) {
+ hmac_free(hmac);
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
+ }
+
+ {
+ OSSL_PARAM params[2];
+ params[0] = OSSL_PARAM_construct_utf8_string("digest", "SHA1", 0);
+ params[1] = OSSL_PARAM_construct_end();
+
+ if (!EVP_MAC_init(hmac->ctx, (const unsigned char *)secret, secret_length, params)) {
+ zip_error_set(error, ZIP_ER_INTERNAL, 0);
+ hmac_free(hmac);
+ return NULL;
+ }
+ }
+#else
+#ifdef USE_OPENSSL_1_0_API
+ if ((hmac = (_zip_crypto_hmac_t *)malloc(sizeof(*hmac))) == NULL) {
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
+ }
+
+ HMAC_CTX_init(hmac);
+#else
+ if ((hmac = HMAC_CTX_new()) == NULL) {
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
+ }
+#endif
+
+ if (HMAC_Init_ex(hmac, secret, (int)secret_length, EVP_sha1(), NULL) != 1) {
+ zip_error_set(error, ZIP_ER_INTERNAL, 0);
+#ifdef USE_OPENSSL_1_0_API
+ free(hmac);
+#else
+ HMAC_CTX_free(hmac);
+#endif
+ return NULL;
+ }
+#endif
+
+ return hmac;
+}
+
+
+void
+_zip_crypto_hmac_free(_zip_crypto_hmac_t *hmac) {
+ if (hmac == NULL) {
+ return;
+ }
+
+#if defined(USE_OPENSSL_3_API)
+ hmac_free(hmac);
+#elif defined(USE_OPENSSL_1_0_API)
+ HMAC_CTX_cleanup(hmac);
+ _zip_crypto_clear(hmac, sizeof(*hmac));
+ free(hmac);
+#else
+ HMAC_CTX_free(hmac);
+#endif
+}
+
+
+bool
+_zip_crypto_hmac_output(_zip_crypto_hmac_t *hmac, zip_uint8_t *data) {
+#ifdef USE_OPENSSL_3_API
+ size_t length;
+ return EVP_MAC_final(hmac->ctx, data, &length, ZIP_CRYPTO_SHA1_LENGTH) == 1 && length == ZIP_CRYPTO_SHA1_LENGTH;
+#else
+ unsigned int length;
+ return HMAC_Final(hmac, data, &length) == 1;
+#endif
+}
+
+
+ZIP_EXTERN bool
+zip_secure_random(zip_uint8_t *buffer, zip_uint16_t length) {
+ return RAND_bytes(buffer, length) == 1;
+}
diff --git a/src/Common/libzip/zip_crypto_openssl.h b/src/Common/libzip/zip_crypto_openssl.h
new file mode 100644
index 00000000..198a9071
--- /dev/null
+++ b/src/Common/libzip/zip_crypto_openssl.h
@@ -0,0 +1,73 @@
+/*
+ zip_crypto_openssl.h -- definitions for OpenSSL wrapper.
+ Copyright (C) 2018-2021 Dieter Baron and Thomas Klausner
+
+ This file is part of libzip, a library to manipulate ZIP archives.
+ The authors can be contacted at <info@libzip.org>
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ 3. The names of the authors may not be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef HAD_ZIP_CRYPTO_OPENSSL_H
+#define HAD_ZIP_CRYPTO_OPENSSL_H
+
+#define HAVE_SECURE_RANDOM
+
+#include <openssl/evp.h>
+#include <openssl/hmac.h>
+
+#if OPENSSL_VERSION_NUMBER < 0x1010000fL || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x02070000fL)
+#define USE_OPENSSL_1_0_API
+#elif OPENSSL_VERSION_NUMBER < 0x3000000fL
+#define USE_OPENSSL_1_1_API
+#else
+#define USE_OPENSSL_3_API
+#endif
+
+#define _zip_crypto_aes_t EVP_CIPHER_CTX
+#ifdef USE_OPENSSL_3_API
+struct _zip_crypto_hmac_t {
+ EVP_MAC *mac;
+ EVP_MAC_CTX *ctx;
+};
+typedef struct _zip_crypto_hmac_t _zip_crypto_hmac_t;
+#define _zip_crypto_hmac(hmac, data, length) (EVP_MAC_update((hmac->ctx), (data), (length)) == 1)
+#else
+#define _zip_crypto_hmac_t HMAC_CTX
+#define _zip_crypto_hmac(hmac, data, length) (HMAC_Update((hmac), (data), (length)) == 1)
+#endif
+
+void _zip_crypto_aes_free(_zip_crypto_aes_t *aes);
+bool _zip_crypto_aes_encrypt_block(_zip_crypto_aes_t *aes, const zip_uint8_t *in, zip_uint8_t *out);
+_zip_crypto_aes_t *_zip_crypto_aes_new(const zip_uint8_t *key, zip_uint16_t key_size, zip_error_t *error);
+
+void _zip_crypto_hmac_free(_zip_crypto_hmac_t *hmac);
+_zip_crypto_hmac_t *_zip_crypto_hmac_new(const zip_uint8_t *secret, zip_uint64_t secret_length, zip_error_t *error);
+bool _zip_crypto_hmac_output(_zip_crypto_hmac_t *hmac, zip_uint8_t *data);
+
+#define _zip_crypto_pbkdf2(key, key_length, salt, salt_length, iterations, output, output_length) (PKCS5_PBKDF2_HMAC_SHA1((const char *)(key), (key_length), (salt), (salt_length), (iterations), (output_length), (output)))
+
+#endif /* HAD_ZIP_CRYPTO_OPENSSL_H */
diff --git a/src/Common/libzip/zip_crypto_win.c b/src/Common/libzip/zip_crypto_win.c
new file mode 100644
index 00000000..ee3ccc30
--- /dev/null
+++ b/src/Common/libzip/zip_crypto_win.c
@@ -0,0 +1,495 @@
+/*
+ zip_crypto_win.c -- Windows Crypto API wrapper.
+ Copyright (C) 2018-2021 Dieter Baron and Thomas Klausner
+
+ This file is part of libzip, a library to manipulate ZIP archives.
+ The authors can be contacted at <info@libzip.org>
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ 3. The names of the authors may not be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#include <stdlib.h>
+#include <limits.h>
+
+#include "zipint.h"
+
+#include "zip_crypto.h"
+
+#define WIN32_LEAN_AND_MEAN
+#define NOCRYPT
+
+#include <windows.h>
+
+#include <bcrypt.h>
+
+#pragma comment(lib, "bcrypt.lib")
+
+/*
+
+This code is using the Cryptography API: Next Generation (CNG)
+https://docs.microsoft.com/en-us/windows/desktop/seccng/cng-portal
+
+This API is supported on
+ - Windows Vista or later (client OS)
+ - Windows Server 2008 (server OS)
+ - Windows Embedded Compact 2013 (don't know about Windows Embedded Compact 7)
+
+The code was developed for Windows Embedded Compact 2013 (WEC2013),
+but should be working for all of the above mentioned OSes.
+
+There are 2 restrictions for WEC2013, Windows Vista and Windows Server 2008:
+
+1.) The function "BCryptDeriveKeyPBKDF2" is not available
+
+I found some code which is implementing this function using the deprecated Crypto API here:
+https://www.idrix.fr/Root/content/view/37/54/
+
+I took this code and converted it to the newer CNG API. The original code was more
+flexible, but this is not needed here so i refactored it a bit and just kept what is needed.
+
+The define "HAS_BCRYPTDERIVEKEYPBKDF2" controls whether "BCryptDeriveKeyPBKDF2"
+of the CNG API is used or not. This define must not be set if you are compiling for WEC2013 or Windows Vista.
+
+
+2.) "BCryptCreateHash" can't manage the memory needed for the hash object internally
+
+On Windows 7 or later it is possible to pass NULL for the hash object buffer.
+This is not supported on WEC2013, so we have to handle the memory allocation/deallocation ourselves.
+There is no #ifdef to control that, because this is working for all supported OSes.
+
+*/
+
+#if !defined(WINCE) && !defined(__MINGW32__)
+#define HAS_BCRYPTDERIVEKEYPBKDF2
+#endif
+
+#ifdef HAS_BCRYPTDERIVEKEYPBKDF2
+
+bool
+_zip_crypto_pbkdf2(const zip_uint8_t *key, zip_uint64_t key_length, const zip_uint8_t *salt, zip_uint16_t salt_length, zip_uint16_t iterations, zip_uint8_t *output, zip_uint16_t output_length) {
+ BCRYPT_ALG_HANDLE hAlgorithm = NULL;
+ bool result;
+
+ if (!BCRYPT_SUCCESS(BCryptOpenAlgorithmProvider(&hAlgorithm, BCRYPT_SHA1_ALGORITHM, NULL, BCRYPT_ALG_HANDLE_HMAC_FLAG))) {
+ return false;
+ }
+
+ result = BCRYPT_SUCCESS(BCryptDeriveKeyPBKDF2(hAlgorithm, (PUCHAR)key, (ULONG)key_length, (PUCHAR)salt, salt_length, iterations, output, output_length, 0));
+
+ BCryptCloseAlgorithmProvider(hAlgorithm, 0);
+
+ return result;
+}
+
+#else
+
+#include <math.h>
+
+#define DIGEST_SIZE 20
+#define BLOCK_SIZE 64
+
+typedef struct {
+ BCRYPT_ALG_HANDLE hAlgorithm;
+ BCRYPT_HASH_HANDLE hInnerHash;
+ BCRYPT_HASH_HANDLE hOuterHash;
+ ULONG cbHashObject;
+ PUCHAR pbInnerHash;
+ PUCHAR pbOuterHash;
+} PRF_CTX;
+
+static void
+hmacFree(PRF_CTX *pContext) {
+ if (pContext->hOuterHash)
+ BCryptDestroyHash(pContext->hOuterHash);
+ if (pContext->hInnerHash)
+ BCryptDestroyHash(pContext->hInnerHash);
+ free(pContext->pbOuterHash);
+ free(pContext->pbInnerHash);
+ if (pContext->hAlgorithm)
+ BCryptCloseAlgorithmProvider(pContext->hAlgorithm, 0);
+}
+
+static BOOL
+hmacPrecomputeDigest(BCRYPT_HASH_HANDLE hHash, PUCHAR pbPassword, DWORD cbPassword, BYTE mask) {
+ BYTE buffer[BLOCK_SIZE];
+ DWORD i;
+
+ if (cbPassword > BLOCK_SIZE) {
+ return FALSE;
+ }
+
+ memset(buffer, mask, sizeof(buffer));
+
+ for (i = 0; i < cbPassword; ++i) {
+ buffer[i] = (char)(pbPassword[i] ^ mask);
+ }
+
+ return BCRYPT_SUCCESS(BCryptHashData(hHash, buffer, sizeof(buffer), 0));
+}
+
+static BOOL
+hmacInit(PRF_CTX *pContext, PUCHAR pbPassword, DWORD cbPassword) {
+ BOOL bStatus = FALSE;
+ ULONG cbResult;
+ BYTE key[DIGEST_SIZE];
+
+ if (!BCRYPT_SUCCESS(BCryptOpenAlgorithmProvider(&pContext->hAlgorithm, BCRYPT_SHA1_ALGORITHM, NULL, 0)) || !BCRYPT_SUCCESS(BCryptGetProperty(pContext->hAlgorithm, BCRYPT_OBJECT_LENGTH, (PUCHAR)&pContext->cbHashObject, sizeof(pContext->cbHashObject), &cbResult, 0)) || ((pContext->pbInnerHash = malloc(pContext->cbHashObject)) == NULL) || ((pContext->pbOuterHash = malloc(pContext->cbHashObject)) == NULL) || !BCRYPT_SUCCESS(BCryptCreateHash(pContext->hAlgorithm, &pContext->hInnerHash, pContext->pbInnerHash, pContext->cbHashObject, NULL, 0, 0)) || !BCRYPT_SUCCESS(BCryptCreateHash(pContext->hAlgorithm, &pContext->hOuterHash, pContext->pbOuterHash, pContext->cbHashObject, NULL, 0, 0))) {
+ goto hmacInit_end;
+ }
+
+ if (cbPassword > BLOCK_SIZE) {
+ BCRYPT_HASH_HANDLE hHash = NULL;
+ PUCHAR pbHashObject = malloc(pContext->cbHashObject);
+ if (pbHashObject == NULL) {
+ goto hmacInit_end;
+ }
+
+ bStatus = BCRYPT_SUCCESS(BCryptCreateHash(pContext->hAlgorithm, &hHash, pbHashObject, pContext->cbHashObject, NULL, 0, 0)) && BCRYPT_SUCCESS(BCryptHashData(hHash, pbPassword, cbPassword, 0)) && BCRYPT_SUCCESS(BCryptGetProperty(hHash, BCRYPT_HASH_LENGTH, (PUCHAR)&cbPassword, sizeof(cbPassword), &cbResult, 0)) && BCRYPT_SUCCESS(BCryptFinishHash(hHash, key, cbPassword, 0));
+
+ if (hHash)
+ BCryptDestroyHash(hHash);
+ free(pbHashObject);
+
+ if (!bStatus) {
+ goto hmacInit_end;
+ }
+
+ pbPassword = key;
+ }
+
+ bStatus = hmacPrecomputeDigest(pContext->hInnerHash, pbPassword, cbPassword, 0x36) && hmacPrecomputeDigest(pContext->hOuterHash, pbPassword, cbPassword, 0x5C);
+
+hmacInit_end:
+
+ if (bStatus == FALSE)
+ hmacFree(pContext);
+
+ return bStatus;
+}
+
+static BOOL
+hmacCalculateInternal(BCRYPT_HASH_HANDLE hHashTemplate, PUCHAR pbData, DWORD cbData, PUCHAR pbOutput, DWORD cbOutput, DWORD cbHashObject) {
+ BOOL success = FALSE;
+ BCRYPT_HASH_HANDLE hHash = NULL;
+ PUCHAR pbHashObject = malloc(cbHashObject);
+
+ if (pbHashObject == NULL) {
+ return FALSE;
+ }
+
+ if (BCRYPT_SUCCESS(BCryptDuplicateHash(hHashTemplate, &hHash, pbHashObject, cbHashObject, 0))) {
+ success = BCRYPT_SUCCESS(BCryptHashData(hHash, pbData, cbData, 0)) && BCRYPT_SUCCESS(BCryptFinishHash(hHash, pbOutput, cbOutput, 0));
+
+ BCryptDestroyHash(hHash);
+ }
+
+ free(pbHashObject);
+
+ return success;
+}
+
+static BOOL
+hmacCalculate(PRF_CTX *pContext, PUCHAR pbData, DWORD cbData, PUCHAR pbDigest) {
+ DWORD cbResult;
+ DWORD cbHashObject;
+
+ return BCRYPT_SUCCESS(BCryptGetProperty(pContext->hAlgorithm, BCRYPT_OBJECT_LENGTH, (PUCHAR)&cbHashObject, sizeof(cbHashObject), &cbResult, 0)) && hmacCalculateInternal(pContext->hInnerHash, pbData, cbData, pbDigest, DIGEST_SIZE, cbHashObject) && hmacCalculateInternal(pContext->hOuterHash, pbDigest, DIGEST_SIZE, pbDigest, DIGEST_SIZE, cbHashObject);
+}
+
+static void
+myxor(LPBYTE ptr1, LPBYTE ptr2, DWORD dwLen) {
+ while (dwLen--)
+ *ptr1++ ^= *ptr2++;
+}
+
+BOOL
+pbkdf2(PUCHAR pbPassword, ULONG cbPassword, PUCHAR pbSalt, ULONG cbSalt, DWORD cIterations, PUCHAR pbDerivedKey, ULONG cbDerivedKey) {
+ BOOL bStatus = FALSE;
+ DWORD l, r, dwULen, i, j;
+ BYTE Ti[DIGEST_SIZE];
+ BYTE V[DIGEST_SIZE];
+ LPBYTE U = malloc(max((cbSalt + 4), DIGEST_SIZE));
+ PRF_CTX prfCtx = {0};
+
+ if (U == NULL) {
+ return FALSE;
+ }
+
+ if (pbPassword == NULL || cbPassword == 0 || pbSalt == NULL || cbSalt == 0 || cIterations == 0 || pbDerivedKey == NULL || cbDerivedKey == 0) {
+ free(U);
+ return FALSE;
+ }
+
+ if (!hmacInit(&prfCtx, pbPassword, cbPassword)) {
+ goto PBKDF2_end;
+ }
+
+ l = (DWORD)ceil((double)cbDerivedKey / (double)DIGEST_SIZE);
+ r = cbDerivedKey - (l - 1) * DIGEST_SIZE;
+
+ for (i = 1; i <= l; i++) {
+ ZeroMemory(Ti, DIGEST_SIZE);
+ for (j = 0; j < cIterations; j++) {
+ if (j == 0) {
+ /* construct first input for PRF */
+ (void)memcpy_s(U, cbSalt, pbSalt, cbSalt);
+ U[cbSalt] = (BYTE)((i & 0xFF000000) >> 24);
+ U[cbSalt + 1] = (BYTE)((i & 0x00FF0000) >> 16);
+ U[cbSalt + 2] = (BYTE)((i & 0x0000FF00) >> 8);
+ U[cbSalt + 3] = (BYTE)((i & 0x000000FF));
+ dwULen = cbSalt + 4;
+ }
+ else {
+ (void)memcpy_s(U, DIGEST_SIZE, V, DIGEST_SIZE);
+ dwULen = DIGEST_SIZE;
+ }
+
+ if (!hmacCalculate(&prfCtx, U, dwULen, V)) {
+ goto PBKDF2_end;
+ }
+
+ myxor(Ti, V, DIGEST_SIZE);
+ }
+
+ if (i != l) {
+ (void)memcpy_s(&pbDerivedKey[(i - 1) * DIGEST_SIZE], cbDerivedKey - (i - 1) * DIGEST_SIZE, Ti, DIGEST_SIZE);
+ }
+ else {
+ /* Take only the first r bytes */
+ (void)memcpy_s(&pbDerivedKey[(i - 1) * DIGEST_SIZE], cbDerivedKey - (i - 1) * DIGEST_SIZE, Ti, r);
+ }
+ }
+
+ bStatus = TRUE;
+
+PBKDF2_end:
+
+ hmacFree(&prfCtx);
+ free(U);
+ return bStatus;
+}
+
+bool
+_zip_crypto_pbkdf2(const zip_uint8_t *key, zip_uint64_t key_length, const zip_uint8_t *salt, zip_uint16_t salt_length, zip_uint16_t iterations, zip_uint8_t *output, zip_uint16_t output_length) {
+ return (key_length <= ZIP_UINT32_MAX) && pbkdf2((PUCHAR)key, (ULONG)key_length, (PUCHAR)salt, salt_length, iterations, output, output_length);
+}
+
+#endif
+
+
+struct _zip_crypto_aes_s {
+ BCRYPT_ALG_HANDLE hAlgorithm;
+ BCRYPT_KEY_HANDLE hKey;
+ ULONG cbKeyObject;
+ PUCHAR pbKeyObject;
+};
+
+_zip_crypto_aes_t *
+_zip_crypto_aes_new(const zip_uint8_t *key, zip_uint16_t key_size, zip_error_t *error) {
+ _zip_crypto_aes_t *aes = (_zip_crypto_aes_t *)calloc(1, sizeof(*aes));
+
+ ULONG cbResult;
+ ULONG key_length = key_size / 8;
+
+ if (aes == NULL) {
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
+ }
+
+ if (!BCRYPT_SUCCESS(BCryptOpenAlgorithmProvider(&aes->hAlgorithm, BCRYPT_AES_ALGORITHM, NULL, 0))) {
+ _zip_crypto_aes_free(aes);
+ return NULL;
+ }
+
+ if (!BCRYPT_SUCCESS(BCryptSetProperty(aes->hAlgorithm, BCRYPT_CHAINING_MODE, (PUCHAR)BCRYPT_CHAIN_MODE_ECB, sizeof(BCRYPT_CHAIN_MODE_ECB), 0))) {
+ _zip_crypto_aes_free(aes);
+ return NULL;
+ }
+
+ if (!BCRYPT_SUCCESS(BCryptGetProperty(aes->hAlgorithm, BCRYPT_OBJECT_LENGTH, (PUCHAR)&aes->cbKeyObject, sizeof(aes->cbKeyObject), &cbResult, 0))) {
+ _zip_crypto_aes_free(aes);
+ return NULL;
+ }
+
+ aes->pbKeyObject = malloc(aes->cbKeyObject);
+ if (aes->pbKeyObject == NULL) {
+ _zip_crypto_aes_free(aes);
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
+ }
+
+ if (!BCRYPT_SUCCESS(BCryptGenerateSymmetricKey(aes->hAlgorithm, &aes->hKey, aes->pbKeyObject, aes->cbKeyObject, (PUCHAR)key, key_length, 0))) {
+ _zip_crypto_aes_free(aes);
+ return NULL;
+ }
+
+ return aes;
+}
+
+void
+_zip_crypto_aes_free(_zip_crypto_aes_t *aes) {
+ if (aes == NULL) {
+ return;
+ }
+
+ if (aes->hKey != NULL) {
+ BCryptDestroyKey(aes->hKey);
+ }
+
+ if (aes->pbKeyObject != NULL) {
+ free(aes->pbKeyObject);
+ }
+
+ if (aes->hAlgorithm != NULL) {
+ BCryptCloseAlgorithmProvider(aes->hAlgorithm, 0);
+ }
+
+ free(aes);
+}
+
+bool
+_zip_crypto_aes_encrypt_block(_zip_crypto_aes_t *aes, const zip_uint8_t *in, zip_uint8_t *out) {
+ ULONG cbResult;
+ NTSTATUS status = BCryptEncrypt(aes->hKey, (PUCHAR)in, ZIP_CRYPTO_AES_BLOCK_LENGTH, NULL, NULL, 0, (PUCHAR)out, ZIP_CRYPTO_AES_BLOCK_LENGTH, &cbResult, 0);
+ return BCRYPT_SUCCESS(status);
+}
+
+struct _zip_crypto_hmac_s {
+ BCRYPT_ALG_HANDLE hAlgorithm;
+ BCRYPT_HASH_HANDLE hHash;
+ DWORD cbHashObject;
+ PUCHAR pbHashObject;
+ DWORD cbHash;
+ PUCHAR pbHash;
+};
+
+/* https://code.msdn.microsoft.com/windowsdesktop/Hmac-Computation-Sample-11fe8ec1/sourcecode?fileId=42820&pathId=283874677 */
+
+_zip_crypto_hmac_t *
+_zip_crypto_hmac_new(const zip_uint8_t *secret, zip_uint64_t secret_length, zip_error_t *error) {
+ NTSTATUS status;
+ ULONG cbResult;
+ _zip_crypto_hmac_t *hmac;
+
+ if (secret_length > INT_MAX) {
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return NULL;
+ }
+
+ hmac = (_zip_crypto_hmac_t *)calloc(1, sizeof(*hmac));
+
+ if (hmac == NULL) {
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
+ }
+
+ status = BCryptOpenAlgorithmProvider(&hmac->hAlgorithm, BCRYPT_SHA1_ALGORITHM, NULL, BCRYPT_ALG_HANDLE_HMAC_FLAG);
+ if (!BCRYPT_SUCCESS(status)) {
+ _zip_crypto_hmac_free(hmac);
+ return NULL;
+ }
+
+ status = BCryptGetProperty(hmac->hAlgorithm, BCRYPT_OBJECT_LENGTH, (PUCHAR)&hmac->cbHashObject, sizeof(hmac->cbHashObject), &cbResult, 0);
+ if (!BCRYPT_SUCCESS(status)) {
+ _zip_crypto_hmac_free(hmac);
+ return NULL;
+ }
+
+ hmac->pbHashObject = malloc(hmac->cbHashObject);
+ if (hmac->pbHashObject == NULL) {
+ _zip_crypto_hmac_free(hmac);
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
+ }
+
+ status = BCryptGetProperty(hmac->hAlgorithm, BCRYPT_HASH_LENGTH, (PUCHAR)&hmac->cbHash, sizeof(hmac->cbHash), &cbResult, 0);
+ if (!BCRYPT_SUCCESS(status)) {
+ _zip_crypto_hmac_free(hmac);
+ return NULL;
+ }
+
+ hmac->pbHash = malloc(hmac->cbHash);
+ if (hmac->pbHash == NULL) {
+ _zip_crypto_hmac_free(hmac);
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
+ }
+
+ status = BCryptCreateHash(hmac->hAlgorithm, &hmac->hHash, hmac->pbHashObject, hmac->cbHashObject, (PUCHAR)secret, (ULONG)secret_length, 0);
+ if (!BCRYPT_SUCCESS(status)) {
+ _zip_crypto_hmac_free(hmac);
+ return NULL;
+ }
+
+ return hmac;
+}
+
+void
+_zip_crypto_hmac_free(_zip_crypto_hmac_t *hmac) {
+ if (hmac == NULL) {
+ return;
+ }
+
+ if (hmac->hHash != NULL) {
+ BCryptDestroyHash(hmac->hHash);
+ }
+
+ if (hmac->pbHash != NULL) {
+ free(hmac->pbHash);
+ }
+
+ if (hmac->pbHashObject != NULL) {
+ free(hmac->pbHashObject);
+ }
+
+ if (hmac->hAlgorithm) {
+ BCryptCloseAlgorithmProvider(hmac->hAlgorithm, 0);
+ }
+
+ free(hmac);
+}
+
+bool
+_zip_crypto_hmac(_zip_crypto_hmac_t *hmac, zip_uint8_t *data, zip_uint64_t length) {
+ if (hmac == NULL || length > ULONG_MAX) {
+ return false;
+ }
+
+ return BCRYPT_SUCCESS(BCryptHashData(hmac->hHash, data, (ULONG)length, 0));
+}
+
+bool
+_zip_crypto_hmac_output(_zip_crypto_hmac_t *hmac, zip_uint8_t *data) {
+ if (hmac == NULL) {
+ return false;
+ }
+
+ return BCRYPT_SUCCESS(BCryptFinishHash(hmac->hHash, data, hmac->cbHash, 0));
+}
+
+ZIP_EXTERN bool
+zip_secure_random(zip_uint8_t *buffer, zip_uint16_t length) {
+ return BCRYPT_SUCCESS(BCryptGenRandom(NULL, buffer, length, BCRYPT_USE_SYSTEM_PREFERRED_RNG));
+}
diff --git a/src/Common/libzip/zip_crypto_win.h b/src/Common/libzip/zip_crypto_win.h
new file mode 100644
index 00000000..a533fe2d
--- /dev/null
+++ b/src/Common/libzip/zip_crypto_win.h
@@ -0,0 +1,53 @@
+/*
+ zip_crypto_win.h -- Windows Crypto API wrapper.
+ Copyright (C) 2018-2021 Dieter Baron and Thomas Klausner
+
+ This file is part of libzip, a library to manipulate ZIP archives.
+ The authors can be contacted at <info@libzip.org>
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ 3. The names of the authors may not be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef HAD_ZIP_CRYPTO_WIN_H
+#define HAD_ZIP_CRYPTO_WIN_H
+
+#define HAVE_SECURE_RANDOM
+
+typedef struct _zip_crypto_aes_s _zip_crypto_aes_t;
+typedef struct _zip_crypto_hmac_s _zip_crypto_hmac_t;
+
+void _zip_crypto_aes_free(_zip_crypto_aes_t *aes);
+_zip_crypto_aes_t *_zip_crypto_aes_new(const zip_uint8_t *key, zip_uint16_t key_size, zip_error_t *error);
+bool _zip_crypto_aes_encrypt_block(_zip_crypto_aes_t *aes, const zip_uint8_t *in, zip_uint8_t *out);
+
+bool _zip_crypto_pbkdf2(const zip_uint8_t *key, zip_uint64_t key_length, const zip_uint8_t *salt, zip_uint16_t salt_length, zip_uint16_t iterations, zip_uint8_t *output, zip_uint16_t output_length);
+
+_zip_crypto_hmac_t *_zip_crypto_hmac_new(const zip_uint8_t *secret, zip_uint64_t secret_length, zip_error_t *error);
+void _zip_crypto_hmac_free(_zip_crypto_hmac_t *hmac);
+bool _zip_crypto_hmac(_zip_crypto_hmac_t *hmac, zip_uint8_t *data, zip_uint64_t length);
+bool _zip_crypto_hmac_output(_zip_crypto_hmac_t *hmac, zip_uint8_t *data);
+
+#endif /* HAD_ZIP_CRYPTO_WIN_H */
diff --git a/src/Common/libzip/zip_delete.c b/src/Common/libzip/zip_delete.c
index 97701a01..676c16bf 100644
--- a/src/Common/libzip/zip_delete.c
+++ b/src/Common/libzip/zip_delete.c
@@ -1,9 +1,9 @@
/*
zip_delete.c -- delete file from zip archive
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -40,27 +40,27 @@ zip_delete(zip_t *za, zip_uint64_t idx) {
const char *name;
if (idx >= za->nentry) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return -1;
}
if (ZIP_IS_RDONLY(za)) {
- zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
+ return -1;
}
if ((name = _zip_get_name(za, idx, 0, &za->error)) == NULL) {
- return -1;
+ return -1;
}
if (!_zip_hash_delete(za->names, (const zip_uint8_t *)name, &za->error)) {
- return -1;
+ return -1;
}
/* allow duplicate file names, because the file will
* be removed directly afterwards */
if (_zip_unchange(za, idx, 1) != 0)
- return -1;
+ return -1;
za->entry[idx].deleted = 1;
diff --git a/src/Common/libzip/zip_dir_add.c b/src/Common/libzip/zip_dir_add.c
index c40b1cb9..c0108191 100644
--- a/src/Common/libzip/zip_dir_add.c
+++ b/src/Common/libzip/zip_dir_add.c
@@ -1,9 +1,9 @@
/*
zip_dir_add.c -- add directory
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -48,31 +48,31 @@ zip_dir_add(zip_t *za, const char *name, zip_flags_t flags) {
zip_source_t *source;
if (ZIP_IS_RDONLY(za)) {
- zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
+ return -1;
}
if (name == NULL) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return -1;
}
s = NULL;
len = strlen(name);
if (name[len - 1] != '/') {
- if ((s = (char *)malloc(len + 2)) == NULL) {
- zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
- return -1;
- }
- strcpy(s, name);
- s[len] = '/';
- s[len + 1] = '\0';
+ if (len > SIZE_MAX - 2 || (s = (char *)malloc(len + 2)) == NULL) {
+ zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
+ return -1;
+ }
+ (void)strncpy_s(s, len + 2, name, len);
+ s[len] = '/';
+ s[len + 1] = '\0';
}
if ((source = zip_source_buffer(za, NULL, 0, 0)) == NULL) {
- free(s);
- return -1;
+ free(s);
+ return -1;
}
idx = _zip_file_replace(za, ZIP_UINT64_MAX, s ? s : name, source, flags);
@@ -80,12 +80,12 @@ zip_dir_add(zip_t *za, const char *name, zip_flags_t flags) {
free(s);
if (idx < 0)
- zip_source_free(source);
+ zip_source_free(source);
else {
- if (zip_file_set_external_attributes(za, (zip_uint64_t)idx, 0, ZIP_OPSYS_DEFAULT, ZIP_EXT_ATTRIB_DEFAULT_DIR) < 0) {
- zip_delete(za, (zip_uint64_t)idx);
- return -1;
- }
+ if (zip_file_set_external_attributes(za, (zip_uint64_t)idx, 0, ZIP_OPSYS_DEFAULT, ZIP_EXT_ATTRIB_DEFAULT_DIR) < 0) {
+ zip_delete(za, (zip_uint64_t)idx);
+ return -1;
+ }
}
return idx;
diff --git a/src/Common/libzip/zip_dirent.c b/src/Common/libzip/zip_dirent.c
index 1691071f..45a2a6a2 100644
--- a/src/Common/libzip/zip_dirent.c
+++ b/src/Common/libzip/zip_dirent.c
@@ -1,9 +1,9 @@
/*
zip_dirent.c -- read directory entry (local or central), clean dirent
- Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -37,6 +37,7 @@
#include <string.h>
#include <sys/types.h>
#include <time.h>
+#include <zlib.h>
#include "zipint.h"
@@ -50,10 +51,10 @@ _zip_cdir_free(zip_cdir_t *cd) {
zip_uint64_t i;
if (!cd)
- return;
+ return;
for (i = 0; i < cd->nentry; i++)
- _zip_entry_finalize(cd->entry + i);
+ _zip_entry_finalize(cd->entry + i);
free(cd->entry);
_zip_string_free(cd->comment);
free(cd);
@@ -65,8 +66,8 @@ _zip_cdir_new(zip_uint64_t nentry, zip_error_t *error) {
zip_cdir_t *cd;
if ((cd = (zip_cdir_t *)malloc(sizeof(*cd))) == NULL) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
}
cd->entry = NULL;
@@ -76,8 +77,8 @@ _zip_cdir_new(zip_uint64_t nentry, zip_error_t *error) {
cd->is_zip64 = false;
if (!_zip_cdir_grow(cd, nentry, error)) {
- _zip_cdir_free(cd);
- return NULL;
+ _zip_cdir_free(cd);
+ return NULL;
}
return cd;
@@ -90,25 +91,25 @@ _zip_cdir_grow(zip_cdir_t *cd, zip_uint64_t additional_entries, zip_error_t *err
zip_entry_t *new_entry;
if (additional_entries == 0) {
- return true;
+ return true;
}
new_alloc = cd->nentry_alloc + additional_entries;
if (new_alloc < additional_entries || new_alloc > SIZE_MAX / sizeof(*(cd->entry))) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- return false;
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return false;
}
if ((new_entry = (zip_entry_t *)realloc(cd->entry, sizeof(*(cd->entry)) * (size_t)new_alloc)) == NULL) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- return false;
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return false;
}
cd->entry = new_entry;
for (i = cd->nentry; i < new_alloc; i++) {
- _zip_entry_init(cd->entry + i);
+ _zip_entry_init(cd->entry + i);
}
cd->nentry = cd->nentry_alloc = new_alloc;
@@ -127,54 +128,62 @@ _zip_cdir_write(zip_t *za, const zip_filelist_t *filelist, zip_uint64_t survivor
zip_uint64_t i;
bool is_zip64;
int ret;
+ zip_uint32_t cdir_crc;
if ((off = zip_source_tell_write(za->src)) < 0) {
- _zip_error_set_from_source(&za->error, za->src);
- return -1;
+ zip_error_set_from_source(&za->error, za->src);
+ return -1;
}
offset = (zip_uint64_t)off;
is_zip64 = false;
+ if (ZIP_WANT_TORRENTZIP(za)) {
+ cdir_crc = (zip_uint32_t)crc32(0, NULL, 0);
+ za->write_crc = &cdir_crc;
+ }
+
for (i = 0; i < survivors; i++) {
- zip_entry_t *entry = za->entry + filelist[i].idx;
+ zip_entry_t *entry = za->entry + filelist[i].idx;
- if ((ret = _zip_dirent_write(za, entry->changes ? entry->changes : entry->orig, ZIP_FL_CENTRAL)) < 0)
- return -1;
- if (ret)
- is_zip64 = true;
+ if ((ret = _zip_dirent_write(za, entry->changes ? entry->changes : entry->orig, ZIP_FL_CENTRAL)) < 0)
+ return -1;
+ if (ret)
+ is_zip64 = true;
}
+ za->write_crc = NULL;
+
if ((off = zip_source_tell_write(za->src)) < 0) {
- _zip_error_set_from_source(&za->error, za->src);
- return -1;
+ zip_error_set_from_source(&za->error, za->src);
+ return -1;
}
size = (zip_uint64_t)off - offset;
- if (offset > ZIP_UINT32_MAX || survivors > ZIP_UINT16_MAX)
- is_zip64 = true;
-
+ if (offset > ZIP_UINT32_MAX || survivors > ZIP_UINT16_MAX) {
+ is_zip64 = true;
+ }
if ((buffer = _zip_buffer_new(buf, sizeof(buf))) == NULL) {
- zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
+ return -1;
}
if (is_zip64) {
- _zip_buffer_put(buffer, EOCD64_MAGIC, 4);
- _zip_buffer_put_64(buffer, EOCD64LEN - 12);
- _zip_buffer_put_16(buffer, 45);
- _zip_buffer_put_16(buffer, 45);
- _zip_buffer_put_32(buffer, 0);
- _zip_buffer_put_32(buffer, 0);
- _zip_buffer_put_64(buffer, survivors);
- _zip_buffer_put_64(buffer, survivors);
- _zip_buffer_put_64(buffer, size);
- _zip_buffer_put_64(buffer, offset);
- _zip_buffer_put(buffer, EOCD64LOC_MAGIC, 4);
- _zip_buffer_put_32(buffer, 0);
- _zip_buffer_put_64(buffer, offset + size);
- _zip_buffer_put_32(buffer, 1);
+ _zip_buffer_put(buffer, EOCD64_MAGIC, 4);
+ _zip_buffer_put_64(buffer, EOCD64LEN - 12);
+ _zip_buffer_put_16(buffer, 45);
+ _zip_buffer_put_16(buffer, 45);
+ _zip_buffer_put_32(buffer, 0);
+ _zip_buffer_put_32(buffer, 0);
+ _zip_buffer_put_64(buffer, survivors);
+ _zip_buffer_put_64(buffer, survivors);
+ _zip_buffer_put_64(buffer, size);
+ _zip_buffer_put_64(buffer, offset);
+ _zip_buffer_put(buffer, EOCD64LOC_MAGIC, 4);
+ _zip_buffer_put_32(buffer, 0);
+ _zip_buffer_put_64(buffer, offset + size);
+ _zip_buffer_put_32(buffer, 1);
}
_zip_buffer_put(buffer, EOCD_MAGIC, 4);
@@ -186,25 +195,39 @@ _zip_cdir_write(zip_t *za, const zip_filelist_t *filelist, zip_uint64_t survivor
comment = za->comment_changed ? za->comment_changes : za->comment_orig;
- _zip_buffer_put_16(buffer, (zip_uint16_t)(comment ? comment->length : 0));
+ if (ZIP_WANT_TORRENTZIP(za)) {
+ _zip_buffer_put_16(buffer, TORRENTZIP_SIGNATURE_LENGTH + TORRENTZIP_CRC_LENGTH);
+ }
+ else {
+ _zip_buffer_put_16(buffer, (zip_uint16_t)(comment ? comment->length : 0));
+ }
+
if (!_zip_buffer_ok(buffer)) {
- zip_error_set(&za->error, ZIP_ER_INTERNAL, 0);
- _zip_buffer_free(buffer);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_INTERNAL, 0);
+ _zip_buffer_free(buffer);
+ return -1;
}
if (_zip_write(za, _zip_buffer_data(buffer), _zip_buffer_offset(buffer)) < 0) {
- _zip_buffer_free(buffer);
- return -1;
+ _zip_buffer_free(buffer);
+ return -1;
}
_zip_buffer_free(buffer);
- if (comment) {
- if (_zip_write(za, comment->raw, comment->length) < 0) {
- return -1;
- }
+ if (ZIP_WANT_TORRENTZIP(za)) {
+ char torrentzip_comment[TORRENTZIP_SIGNATURE_LENGTH + TORRENTZIP_CRC_LENGTH + 1];
+ snprintf(torrentzip_comment, sizeof(torrentzip_comment), TORRENTZIP_SIGNATURE "%08X", cdir_crc);
+
+ if (_zip_write(za, torrentzip_comment, strlen(torrentzip_comment)) < 0) {
+ return -1;
+ }
+ }
+ else if (comment != NULL) {
+ if (_zip_write(za, comment->raw, comment->length) < 0) {
+ return -1;
+ }
}
return (zip_int64_t)size;
@@ -216,12 +239,12 @@ _zip_dirent_clone(const zip_dirent_t *sde) {
zip_dirent_t *tde;
if ((tde = (zip_dirent_t *)malloc(sizeof(*tde))) == NULL)
- return NULL;
+ return NULL;
if (sde)
- memcpy(tde, sde, sizeof(*sde));
+ (void)memcpy_s(tde, sizeof(*tde), sde, sizeof(*sde));
else
- _zip_dirent_init(tde);
+ _zip_dirent_init(tde);
tde->changed = 0;
tde->cloned = 1;
@@ -233,23 +256,23 @@ _zip_dirent_clone(const zip_dirent_t *sde) {
void
_zip_dirent_finalize(zip_dirent_t *zde) {
if (!zde->cloned || zde->changed & ZIP_DIRENT_FILENAME) {
- _zip_string_free(zde->filename);
- zde->filename = NULL;
+ _zip_string_free(zde->filename);
+ zde->filename = NULL;
}
if (!zde->cloned || zde->changed & ZIP_DIRENT_EXTRA_FIELD) {
- _zip_ef_free(zde->extra_fields);
- zde->extra_fields = NULL;
+ _zip_ef_free(zde->extra_fields);
+ zde->extra_fields = NULL;
}
if (!zde->cloned || zde->changed & ZIP_DIRENT_COMMENT) {
- _zip_string_free(zde->comment);
- zde->comment = NULL;
+ _zip_string_free(zde->comment);
+ zde->comment = NULL;
}
if (!zde->cloned || zde->changed & ZIP_DIRENT_PASSWORD) {
- if (zde->password) {
- _zip_crypto_clear(zde->password, strlen(zde->password));
- }
- free(zde->password);
- zde->password = NULL;
+ if (zde->password) {
+ _zip_crypto_clear(zde->password, strlen(zde->password));
+ }
+ free(zde->password);
+ zde->password = NULL;
}
}
@@ -257,7 +280,7 @@ _zip_dirent_finalize(zip_dirent_t *zde) {
void
_zip_dirent_free(zip_dirent_t *zde) {
if (zde == NULL)
- return;
+ return;
_zip_dirent_finalize(zde);
free(zde);
@@ -295,7 +318,7 @@ _zip_dirent_init(zip_dirent_t *de) {
bool
_zip_dirent_needs_zip64(const zip_dirent_t *de, zip_flags_t flags) {
if (de->uncomp_size >= ZIP_UINT32_MAX || de->comp_size >= ZIP_UINT32_MAX || ((flags & ZIP_FL_CENTRAL) && de->offset >= ZIP_UINT32_MAX))
- return true;
+ return true;
return false;
}
@@ -306,7 +329,7 @@ _zip_dirent_new(void) {
zip_dirent_t *de;
if ((de = (zip_dirent_t *)malloc(sizeof(*de))) == NULL)
- return NULL;
+ return NULL;
_zip_dirent_init(de);
return de;
@@ -335,32 +358,32 @@ _zip_dirent_read(zip_dirent_t *zde, zip_source_t *src, zip_buffer_t *buffer, boo
size = local ? LENTRYSIZE : CDENTRYSIZE;
if (buffer) {
- if (_zip_buffer_left(buffer) < size) {
- zip_error_set(error, ZIP_ER_NOZIP, 0);
- return -1;
- }
+ if (_zip_buffer_left(buffer) < size) {
+ zip_error_set(error, ZIP_ER_NOZIP, 0);
+ return -1;
+ }
}
else {
- if ((buffer = _zip_buffer_new_from_source(src, size, buf, error)) == NULL) {
- return -1;
- }
+ if ((buffer = _zip_buffer_new_from_source(src, size, buf, error)) == NULL) {
+ return -1;
+ }
}
if (memcmp(_zip_buffer_get(buffer, 4), (local ? LOCAL_MAGIC : CENTRAL_MAGIC), 4) != 0) {
- zip_error_set(error, ZIP_ER_NOZIP, 0);
- if (!from_buffer) {
- _zip_buffer_free(buffer);
- }
- return -1;
+ zip_error_set(error, ZIP_ER_NOZIP, 0);
+ if (!from_buffer) {
+ _zip_buffer_free(buffer);
+ }
+ return -1;
}
/* convert buffercontents to zip_dirent */
_zip_dirent_init(zde);
if (!local)
- zde->version_madeby = _zip_buffer_get_16(buffer);
+ zde->version_madeby = _zip_buffer_get_16(buffer);
else
- zde->version_madeby = 0;
+ zde->version_madeby = 0;
zde->version_needed = _zip_buffer_get_16(buffer);
zde->bitflags = _zip_buffer_get_16(buffer);
zde->comp_method = _zip_buffer_get_16(buffer);
@@ -378,39 +401,39 @@ _zip_dirent_read(zip_dirent_t *zde, zip_source_t *src, zip_buffer_t *buffer, boo
ef_len = _zip_buffer_get_16(buffer);
if (local) {
- comment_len = 0;
- zde->disk_number = 0;
- zde->int_attrib = 0;
- zde->ext_attrib = 0;
- zde->offset = 0;
+ comment_len = 0;
+ zde->disk_number = 0;
+ zde->int_attrib = 0;
+ zde->ext_attrib = 0;
+ zde->offset = 0;
}
else {
- comment_len = _zip_buffer_get_16(buffer);
- zde->disk_number = _zip_buffer_get_16(buffer);
- zde->int_attrib = _zip_buffer_get_16(buffer);
- zde->ext_attrib = _zip_buffer_get_32(buffer);
- zde->offset = _zip_buffer_get_32(buffer);
+ comment_len = _zip_buffer_get_16(buffer);
+ zde->disk_number = _zip_buffer_get_16(buffer);
+ zde->int_attrib = _zip_buffer_get_16(buffer);
+ zde->ext_attrib = _zip_buffer_get_32(buffer);
+ zde->offset = _zip_buffer_get_32(buffer);
}
if (!_zip_buffer_ok(buffer)) {
- zip_error_set(error, ZIP_ER_INTERNAL, 0);
- if (!from_buffer) {
- _zip_buffer_free(buffer);
- }
- return -1;
+ zip_error_set(error, ZIP_ER_INTERNAL, 0);
+ if (!from_buffer) {
+ _zip_buffer_free(buffer);
+ }
+ return -1;
}
if (zde->bitflags & ZIP_GPBF_ENCRYPTED) {
- if (zde->bitflags & ZIP_GPBF_STRONG_ENCRYPTION) {
- /* TODO */
- zde->encryption_method = ZIP_EM_UNKNOWN;
- }
- else {
- zde->encryption_method = ZIP_EM_TRAD_PKWARE;
- }
+ if (zde->bitflags & ZIP_GPBF_STRONG_ENCRYPTION) {
+ /* TODO */
+ zde->encryption_method = ZIP_EM_UNKNOWN;
+ }
+ else {
+ zde->encryption_method = ZIP_EM_TRAD_PKWARE;
+ }
}
else {
- zde->encryption_method = ZIP_EM_NONE;
+ zde->encryption_method = ZIP_EM_NONE;
}
zde->filename = NULL;
@@ -420,80 +443,80 @@ _zip_dirent_read(zip_dirent_t *zde, zip_source_t *src, zip_buffer_t *buffer, boo
variable_size = (zip_uint32_t)filename_len + (zip_uint32_t)ef_len + (zip_uint32_t)comment_len;
if (from_buffer) {
- if (_zip_buffer_left(buffer) < variable_size) {
- zip_error_set(error, ZIP_ER_INCONS, 0);
- return -1;
- }
+ if (_zip_buffer_left(buffer) < variable_size) {
+ zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_VARIABLE_SIZE_OVERFLOW);
+ return -1;
+ }
}
else {
- _zip_buffer_free(buffer);
+ _zip_buffer_free(buffer);
- if ((buffer = _zip_buffer_new_from_source(src, variable_size, NULL, error)) == NULL) {
- return -1;
- }
+ if ((buffer = _zip_buffer_new_from_source(src, variable_size, NULL, error)) == NULL) {
+ return -1;
+ }
}
if (filename_len) {
- zde->filename = _zip_read_string(buffer, src, filename_len, 1, error);
- if (!zde->filename) {
- if (zip_error_code_zip(error) == ZIP_ER_EOF) {
- zip_error_set(error, ZIP_ER_INCONS, 0);
- }
- if (!from_buffer) {
- _zip_buffer_free(buffer);
- }
- return -1;
- }
-
- if (zde->bitflags & ZIP_GPBF_ENCODING_UTF_8) {
- if (_zip_guess_encoding(zde->filename, ZIP_ENCODING_UTF8_KNOWN) == ZIP_ENCODING_ERROR) {
- zip_error_set(error, ZIP_ER_INCONS, 0);
- if (!from_buffer) {
- _zip_buffer_free(buffer);
- }
- return -1;
- }
- }
+ zde->filename = _zip_read_string(buffer, src, filename_len, 1, error);
+ if (!zde->filename) {
+ if (zip_error_code_zip(error) == ZIP_ER_EOF) {
+ zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_VARIABLE_SIZE_OVERFLOW);
+ }
+ if (!from_buffer) {
+ _zip_buffer_free(buffer);
+ }
+ return -1;
+ }
+
+ if (zde->bitflags & ZIP_GPBF_ENCODING_UTF_8) {
+ if (_zip_guess_encoding(zde->filename, ZIP_ENCODING_UTF8_KNOWN) == ZIP_ENCODING_ERROR) {
+ zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_INVALID_UTF8_IN_FILENAME);
+ if (!from_buffer) {
+ _zip_buffer_free(buffer);
+ }
+ return -1;
+ }
+ }
}
if (ef_len) {
- zip_uint8_t *ef = _zip_read_data(buffer, src, ef_len, 0, error);
-
- if (ef == NULL) {
- if (!from_buffer) {
- _zip_buffer_free(buffer);
- }
- return -1;
- }
- if (!_zip_ef_parse(ef, ef_len, local ? ZIP_EF_LOCAL : ZIP_EF_CENTRAL, &zde->extra_fields, error)) {
- free(ef);
- if (!from_buffer) {
- _zip_buffer_free(buffer);
- }
- return -1;
- }
- free(ef);
- if (local)
- zde->local_extra_fields_read = 1;
+ zip_uint8_t *ef = _zip_read_data(buffer, src, ef_len, 0, error);
+
+ if (ef == NULL) {
+ if (!from_buffer) {
+ _zip_buffer_free(buffer);
+ }
+ return -1;
+ }
+ if (!_zip_ef_parse(ef, ef_len, local ? ZIP_EF_LOCAL : ZIP_EF_CENTRAL, &zde->extra_fields, error)) {
+ free(ef);
+ if (!from_buffer) {
+ _zip_buffer_free(buffer);
+ }
+ return -1;
+ }
+ free(ef);
+ if (local)
+ zde->local_extra_fields_read = 1;
}
if (comment_len) {
- zde->comment = _zip_read_string(buffer, src, comment_len, 0, error);
- if (!zde->comment) {
- if (!from_buffer) {
- _zip_buffer_free(buffer);
- }
- return -1;
- }
- if (zde->bitflags & ZIP_GPBF_ENCODING_UTF_8) {
- if (_zip_guess_encoding(zde->comment, ZIP_ENCODING_UTF8_KNOWN) == ZIP_ENCODING_ERROR) {
- zip_error_set(error, ZIP_ER_INCONS, 0);
- if (!from_buffer) {
- _zip_buffer_free(buffer);
- }
- return -1;
- }
- }
+ zde->comment = _zip_read_string(buffer, src, comment_len, 0, error);
+ if (!zde->comment) {
+ if (!from_buffer) {
+ _zip_buffer_free(buffer);
+ }
+ return -1;
+ }
+ if (zde->bitflags & ZIP_GPBF_ENCODING_UTF_8) {
+ if (_zip_guess_encoding(zde->comment, ZIP_ENCODING_UTF8_KNOWN) == ZIP_ENCODING_ERROR) {
+ zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_INVALID_UTF8_IN_COMMENT);
+ if (!from_buffer) {
+ _zip_buffer_free(buffer);
+ }
+ return -1;
+ }
+ }
}
zde->filename = _zip_dirent_process_ef_utf_8(zde, ZIP_EF_UTF_8_NAME, zde->filename);
@@ -502,96 +525,38 @@ _zip_dirent_read(zip_dirent_t *zde, zip_source_t *src, zip_buffer_t *buffer, boo
/* Zip64 */
if (zde->uncomp_size == ZIP_UINT32_MAX || zde->comp_size == ZIP_UINT32_MAX || zde->offset == ZIP_UINT32_MAX) {
- zip_uint16_t got_len;
- zip_buffer_t *ef_buffer;
- const zip_uint8_t *ef = _zip_ef_get_by_id(zde->extra_fields, &got_len, ZIP_EF_ZIP64, 0, local ? ZIP_EF_LOCAL : ZIP_EF_CENTRAL, error);
- /* TODO: if got_len == 0 && !ZIP64_EOCD: no error, 0xffffffff is valid value */
- if (ef == NULL) {
- if (!from_buffer) {
- _zip_buffer_free(buffer);
- }
- return -1;
- }
-
- if ((ef_buffer = _zip_buffer_new((zip_uint8_t *)ef, got_len)) == NULL) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- if (!from_buffer) {
- _zip_buffer_free(buffer);
- }
- return -1;
- }
-
- if (zde->uncomp_size == ZIP_UINT32_MAX) {
- zde->uncomp_size = _zip_buffer_get_64(ef_buffer);
- }
- else if (local) {
- /* From appnote.txt: This entry in the Local header MUST
- include BOTH original and compressed file size fields. */
- (void)_zip_buffer_skip(ef_buffer, 8); /* error is caught by _zip_buffer_eof() call */
- }
- if (zde->comp_size == ZIP_UINT32_MAX) {
- zde->comp_size = _zip_buffer_get_64(ef_buffer);
- }
- if (!local) {
- if (zde->offset == ZIP_UINT32_MAX) {
- zde->offset = _zip_buffer_get_64(ef_buffer);
- }
- if (zde->disk_number == ZIP_UINT16_MAX) {
- zde->disk_number = _zip_buffer_get_32(ef_buffer);
- }
- }
-
- if (!_zip_buffer_eof(ef_buffer)) {
- /* accept additional fields if values match */
- bool ok = true;
- switch (got_len) {
- case 28:
- _zip_buffer_set_offset(ef_buffer, 24);
- if (zde->disk_number != _zip_buffer_get_32(ef_buffer)) {
- ok = false;
- }
- /* fallthrough */
- case 24:
- _zip_buffer_set_offset(ef_buffer, 0);
- if ((zde->uncomp_size != _zip_buffer_get_64(ef_buffer)) || (zde->comp_size != _zip_buffer_get_64(ef_buffer)) || (zde->offset != _zip_buffer_get_64(ef_buffer))) {
- ok = false;
- }
- break;
-
- default:
- ok = false;
- }
- if (!ok) {
- zip_error_set(error, ZIP_ER_INCONS, 0);
- _zip_buffer_free(ef_buffer);
- if (!from_buffer) {
- _zip_buffer_free(buffer);
- }
- return -1;
- }
- }
- _zip_buffer_free(ef_buffer);
+ zip_uint16_t got_len;
+ const zip_uint8_t *ef = _zip_ef_get_by_id(zde->extra_fields, &got_len, ZIP_EF_ZIP64, 0, local ? ZIP_EF_LOCAL : ZIP_EF_CENTRAL, error);
+ if (ef != NULL) {
+ if (!zip_dirent_process_ef_zip64(zde, ef, got_len, local, error)) {
+ if (!from_buffer) {
+ _zip_buffer_free(buffer);
+ }
+ return -1;
+ }
+ }
}
+
if (!_zip_buffer_ok(buffer)) {
- zip_error_set(error, ZIP_ER_INTERNAL, 0);
- if (!from_buffer) {
- _zip_buffer_free(buffer);
- }
- return -1;
+ zip_error_set(error, ZIP_ER_INTERNAL, 0);
+ if (!from_buffer) {
+ _zip_buffer_free(buffer);
+ }
+ return -1;
}
if (!from_buffer) {
- _zip_buffer_free(buffer);
+ _zip_buffer_free(buffer);
}
/* zip_source_seek / zip_source_tell don't support values > ZIP_INT64_MAX */
if (zde->offset > ZIP_INT64_MAX) {
- zip_error_set(error, ZIP_ER_SEEK, EFBIG);
- return -1;
+ zip_error_set(error, ZIP_ER_SEEK, EFBIG);
+ return -1;
}
if (!_zip_dirent_process_winzip_aes(zde, error)) {
- return -1;
+ return -1;
}
zde->extra_fields = _zip_ef_remove_internal(zde->extra_fields);
@@ -599,6 +564,65 @@ _zip_dirent_read(zip_dirent_t *zde, zip_source_t *src, zip_buffer_t *buffer, boo
return (zip_int64_t)size + (zip_int64_t)variable_size;
}
+bool zip_dirent_process_ef_zip64(zip_dirent_t* zde, const zip_uint8_t* ef, zip_uint64_t got_len, bool local, zip_error_t* error) {
+ zip_buffer_t *ef_buffer;
+
+ if ((ef_buffer = _zip_buffer_new((zip_uint8_t *)ef, got_len)) == NULL) {
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return false;
+ }
+
+ if (zde->uncomp_size == ZIP_UINT32_MAX) {
+ zde->uncomp_size = _zip_buffer_get_64(ef_buffer);
+ }
+ else if (local) {
+ /* From appnote.txt: This entry in the Local header MUST
+ include BOTH original and compressed file size fields. */
+ (void)_zip_buffer_skip(ef_buffer, 8); /* error is caught by _zip_buffer_eof() call */
+ }
+ if (zde->comp_size == ZIP_UINT32_MAX) {
+ zde->comp_size = _zip_buffer_get_64(ef_buffer);
+ }
+ if (!local) {
+ if (zde->offset == ZIP_UINT32_MAX) {
+ zde->offset = _zip_buffer_get_64(ef_buffer);
+ }
+ if (zde->disk_number == ZIP_UINT16_MAX) {
+ zde->disk_number = _zip_buffer_get_32(ef_buffer);
+ }
+ }
+
+ if (!_zip_buffer_eof(ef_buffer)) {
+ /* accept additional fields if values match */
+ bool ok = true;
+ switch (got_len) {
+ case 28:
+ _zip_buffer_set_offset(ef_buffer, 24);
+ if (zde->disk_number != _zip_buffer_get_32(ef_buffer)) {
+ ok = false;
+ }
+ /* fallthrough */
+ case 24:
+ _zip_buffer_set_offset(ef_buffer, 0);
+ if ((zde->uncomp_size != _zip_buffer_get_64(ef_buffer)) || (zde->comp_size != _zip_buffer_get_64(ef_buffer)) || (zde->offset != _zip_buffer_get_64(ef_buffer))) {
+ ok = false;
+ }
+ break;
+
+ default:
+ ok = false;
+ }
+ if (!ok) {
+ zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_INVALID_ZIP64_EF);
+ _zip_buffer_free(ef_buffer);
+ return false;
+ }
+ }
+ _zip_buffer_free(ef_buffer);
+
+ return true;
+}
+
static zip_string_t *
_zip_dirent_process_ef_utf_8(const zip_dirent_t *de, zip_uint16_t id, zip_string_t *str) {
@@ -609,24 +633,24 @@ _zip_dirent_process_ef_utf_8(const zip_dirent_t *de, zip_uint16_t id, zip_string
const zip_uint8_t *ef = _zip_ef_get_by_id(de->extra_fields, &ef_len, id, 0, ZIP_EF_BOTH, NULL);
if (ef == NULL || ef_len < 5 || ef[0] != 1) {
- return str;
+ return str;
}
if ((buffer = _zip_buffer_new((zip_uint8_t *)ef, ef_len)) == NULL) {
- return str;
+ return str;
}
_zip_buffer_get_8(buffer);
ef_crc = _zip_buffer_get_32(buffer);
if (_zip_string_crc32(str) == ef_crc) {
- zip_uint16_t len = (zip_uint16_t)_zip_buffer_left(buffer);
- zip_string_t *ef_str = _zip_string_new(_zip_buffer_get(buffer, len), len, ZIP_FL_ENC_UTF_8, NULL);
+ zip_uint16_t len = (zip_uint16_t)_zip_buffer_left(buffer);
+ zip_string_t *ef_str = _zip_string_new(_zip_buffer_get(buffer, len), len, ZIP_FL_ENC_UTF_8, NULL);
- if (ef_str != NULL) {
- _zip_string_free(str);
- str = ef_str;
- }
+ if (ef_str != NULL) {
+ _zip_string_free(str);
+ str = ef_str;
+ }
}
_zip_buffer_free(buffer);
@@ -645,68 +669,67 @@ _zip_dirent_process_winzip_aes(zip_dirent_t *de, zip_error_t *error) {
if (de->comp_method != ZIP_CM_WINZIP_AES) {
- return true;
+ return true;
}
ef = _zip_ef_get_by_id(de->extra_fields, &ef_len, ZIP_EF_WINZIP_AES, 0, ZIP_EF_BOTH, NULL);
if (ef == NULL || ef_len < 7) {
- zip_error_set(error, ZIP_ER_INCONS, 0);
- return false;
+ zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_INVALID_WINZIPAES_EF);
+ return false;
}
if ((buffer = _zip_buffer_new((zip_uint8_t *)ef, ef_len)) == NULL) {
- zip_error_set(error, ZIP_ER_INTERNAL, 0);
- return false;
+ zip_error_set(error, ZIP_ER_INTERNAL, 0);
+ return false;
}
/* version */
crc_valid = true;
switch (_zip_buffer_get_16(buffer)) {
- case 1:
- break;
-
- case 2:
- if (de->uncomp_size < 20 /* TODO: constant */) {
- crc_valid = false;
- }
- break;
+ case 1:
+ break;
- default:
- zip_error_set(error, ZIP_ER_ENCRNOTSUPP, 0);
- _zip_buffer_free(buffer);
- return false;
+ case 2:
+ crc_valid = false;
+ /* TODO: When checking consistency, check that crc is 0. */
+ break;
+
+ default:
+ zip_error_set(error, ZIP_ER_ENCRNOTSUPP, 0);
+ _zip_buffer_free(buffer);
+ return false;
}
/* vendor */
if (memcmp(_zip_buffer_get(buffer, 2), "AE", 2) != 0) {
- zip_error_set(error, ZIP_ER_ENCRNOTSUPP, 0);
- _zip_buffer_free(buffer);
- return false;
+ zip_error_set(error, ZIP_ER_ENCRNOTSUPP, 0);
+ _zip_buffer_free(buffer);
+ return false;
}
/* mode */
switch (_zip_buffer_get_8(buffer)) {
case 1:
- enc_method = ZIP_EM_AES_128;
- break;
+ enc_method = ZIP_EM_AES_128;
+ break;
case 2:
- enc_method = ZIP_EM_AES_192;
- break;
+ enc_method = ZIP_EM_AES_192;
+ break;
case 3:
- enc_method = ZIP_EM_AES_256;
- break;
+ enc_method = ZIP_EM_AES_256;
+ break;
default:
- zip_error_set(error, ZIP_ER_ENCRNOTSUPP, 0);
- _zip_buffer_free(buffer);
- return false;
+ zip_error_set(error, ZIP_ER_ENCRNOTSUPP, 0);
+ _zip_buffer_free(buffer);
+ return false;
}
if (ef_len != 7) {
- zip_error_set(error, ZIP_ER_INCONS, 0);
- _zip_buffer_free(buffer);
- return false;
+ zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_INVALID_WINZIPAES_EF);
+ _zip_buffer_free(buffer);
+ return false;
}
de->crc_valid = crc_valid;
@@ -729,22 +752,22 @@ _zip_dirent_size(zip_source_t *src, zip_uint16_t flags, zip_error_t *error) {
size = local ? LENTRYSIZE : CDENTRYSIZE;
if (zip_source_seek(src, local ? 26 : 28, SEEK_CUR) < 0) {
- _zip_error_set_from_source(error, src);
- return -1;
+ zip_error_set_from_source(error, src);
+ return -1;
}
if ((buffer = _zip_buffer_new_from_source(src, local ? 4 : 6, b, error)) == NULL) {
- return -1;
+ return -1;
}
for (i = 0; i < (local ? 2 : 3); i++) {
- size += _zip_buffer_get_16(buffer);
+ size += _zip_buffer_get_16(buffer);
}
if (!_zip_buffer_eof(buffer)) {
- zip_error_set(error, ZIP_ER_INTERNAL, 0);
- _zip_buffer_free(buffer);
- return -1;
+ zip_error_set(error, ZIP_ER_INTERNAL, 0);
+ _zip_buffer_free(buffer);
+ return -1;
}
_zip_buffer_free(buffer);
@@ -781,30 +804,30 @@ _zip_dirent_write(zip_t *za, zip_dirent_t *de, zip_flags_t flags) {
com_enc = _zip_guess_encoding(de->comment, ZIP_ENCODING_UNKNOWN);
if ((name_enc == ZIP_ENCODING_UTF8_KNOWN && com_enc == ZIP_ENCODING_ASCII) || (name_enc == ZIP_ENCODING_ASCII && com_enc == ZIP_ENCODING_UTF8_KNOWN) || (name_enc == ZIP_ENCODING_UTF8_KNOWN && com_enc == ZIP_ENCODING_UTF8_KNOWN))
- de->bitflags |= ZIP_GPBF_ENCODING_UTF_8;
+ de->bitflags |= ZIP_GPBF_ENCODING_UTF_8;
else {
- de->bitflags &= (zip_uint16_t)~ZIP_GPBF_ENCODING_UTF_8;
- if (name_enc == ZIP_ENCODING_UTF8_KNOWN) {
- ef = _zip_ef_utf8(ZIP_EF_UTF_8_NAME, de->filename, &za->error);
- if (ef == NULL)
- return -1;
- }
- if ((flags & ZIP_FL_LOCAL) == 0 && com_enc == ZIP_ENCODING_UTF8_KNOWN) {
- zip_extra_field_t *ef2 = _zip_ef_utf8(ZIP_EF_UTF_8_COMMENT, de->comment, &za->error);
- if (ef2 == NULL) {
- _zip_ef_free(ef);
- return -1;
- }
- ef2->next = ef;
- ef = ef2;
- }
+ de->bitflags &= (zip_uint16_t)~ZIP_GPBF_ENCODING_UTF_8;
+ if (name_enc == ZIP_ENCODING_UTF8_KNOWN) {
+ ef = _zip_ef_utf8(ZIP_EF_UTF_8_NAME, de->filename, &za->error);
+ if (ef == NULL)
+ return -1;
+ }
+ if ((flags & ZIP_FL_LOCAL) == 0 && com_enc == ZIP_ENCODING_UTF8_KNOWN) {
+ zip_extra_field_t *ef2 = _zip_ef_utf8(ZIP_EF_UTF_8_COMMENT, de->comment, &za->error);
+ if (ef2 == NULL) {
+ _zip_ef_free(ef);
+ return -1;
+ }
+ ef2->next = ef;
+ ef = ef2;
+ }
}
if (de->encryption_method == ZIP_EM_NONE) {
- de->bitflags &= (zip_uint16_t)~ZIP_GPBF_ENCRYPTED;
+ de->bitflags &= (zip_uint16_t)~ZIP_GPBF_ENCRYPTED;
}
else {
- de->bitflags |= (zip_uint16_t)ZIP_GPBF_ENCRYPTED;
+ de->bitflags |= (zip_uint16_t)ZIP_GPBF_ENCRYPTED;
}
is_really_zip64 = _zip_dirent_needs_zip64(de, flags);
@@ -812,188 +835,197 @@ _zip_dirent_write(zip_t *za, zip_dirent_t *de, zip_flags_t flags) {
is_winzip_aes = de->encryption_method == ZIP_EM_AES_128 || de->encryption_method == ZIP_EM_AES_192 || de->encryption_method == ZIP_EM_AES_256;
if (is_zip64) {
- zip_uint8_t ef_zip64[EFZIP64SIZE];
- zip_buffer_t *ef_buffer = _zip_buffer_new(ef_zip64, sizeof(ef_zip64));
- if (ef_buffer == NULL) {
- zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
- _zip_ef_free(ef);
- return -1;
- }
-
- if (flags & ZIP_FL_LOCAL) {
- if ((flags & ZIP_FL_FORCE_ZIP64) || de->comp_size > ZIP_UINT32_MAX || de->uncomp_size > ZIP_UINT32_MAX) {
- _zip_buffer_put_64(ef_buffer, de->uncomp_size);
- _zip_buffer_put_64(ef_buffer, de->comp_size);
- }
- }
- else {
- if ((flags & ZIP_FL_FORCE_ZIP64) || de->comp_size > ZIP_UINT32_MAX || de->uncomp_size > ZIP_UINT32_MAX || de->offset > ZIP_UINT32_MAX) {
- if (de->uncomp_size >= ZIP_UINT32_MAX) {
- _zip_buffer_put_64(ef_buffer, de->uncomp_size);
- }
- if (de->comp_size >= ZIP_UINT32_MAX) {
- _zip_buffer_put_64(ef_buffer, de->comp_size);
- }
- if (de->offset >= ZIP_UINT32_MAX) {
- _zip_buffer_put_64(ef_buffer, de->offset);
- }
- }
- }
-
- if (!_zip_buffer_ok(ef_buffer)) {
- zip_error_set(&za->error, ZIP_ER_INTERNAL, 0);
- _zip_buffer_free(ef_buffer);
- _zip_ef_free(ef);
- return -1;
- }
-
- ef64 = _zip_ef_new(ZIP_EF_ZIP64, (zip_uint16_t)(_zip_buffer_offset(ef_buffer)), ef_zip64, ZIP_EF_BOTH);
- _zip_buffer_free(ef_buffer);
- ef64->next = ef;
- ef = ef64;
+ zip_uint8_t ef_zip64[EFZIP64SIZE];
+ zip_buffer_t *ef_buffer = _zip_buffer_new(ef_zip64, sizeof(ef_zip64));
+ if (ef_buffer == NULL) {
+ zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
+ _zip_ef_free(ef);
+ return -1;
+ }
+
+ if (flags & ZIP_FL_LOCAL) {
+ if ((flags & ZIP_FL_FORCE_ZIP64) || de->comp_size > ZIP_UINT32_MAX || de->uncomp_size > ZIP_UINT32_MAX) {
+ _zip_buffer_put_64(ef_buffer, de->uncomp_size);
+ _zip_buffer_put_64(ef_buffer, de->comp_size);
+ }
+ }
+ else {
+ if ((flags & ZIP_FL_FORCE_ZIP64) || de->comp_size > ZIP_UINT32_MAX || de->uncomp_size > ZIP_UINT32_MAX || de->offset > ZIP_UINT32_MAX) {
+ if (de->uncomp_size >= ZIP_UINT32_MAX) {
+ _zip_buffer_put_64(ef_buffer, de->uncomp_size);
+ }
+ if (de->comp_size >= ZIP_UINT32_MAX) {
+ _zip_buffer_put_64(ef_buffer, de->comp_size);
+ }
+ if (de->offset >= ZIP_UINT32_MAX) {
+ _zip_buffer_put_64(ef_buffer, de->offset);
+ }
+ }
+ }
+
+ if (!_zip_buffer_ok(ef_buffer)) {
+ zip_error_set(&za->error, ZIP_ER_INTERNAL, 0);
+ _zip_buffer_free(ef_buffer);
+ _zip_ef_free(ef);
+ return -1;
+ }
+
+ ef64 = _zip_ef_new(ZIP_EF_ZIP64, (zip_uint16_t)(_zip_buffer_offset(ef_buffer)), ef_zip64, ZIP_EF_BOTH);
+ _zip_buffer_free(ef_buffer);
+ ef64->next = ef;
+ ef = ef64;
}
if (is_winzip_aes) {
- zip_uint8_t data[EF_WINZIP_AES_SIZE];
- zip_buffer_t *ef_buffer = _zip_buffer_new(data, sizeof(data));
- zip_extra_field_t *ef_winzip;
-
- if (ef_buffer == NULL) {
- zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
- _zip_ef_free(ef);
- return -1;
- }
-
- _zip_buffer_put_16(ef_buffer, 2);
- _zip_buffer_put(ef_buffer, "AE", 2);
- _zip_buffer_put_8(ef_buffer, (zip_uint8_t)(de->encryption_method & 0xff));
- _zip_buffer_put_16(ef_buffer, (zip_uint16_t)de->comp_method);
-
- if (!_zip_buffer_ok(ef_buffer)) {
- zip_error_set(&za->error, ZIP_ER_INTERNAL, 0);
- _zip_buffer_free(ef_buffer);
- _zip_ef_free(ef);
- return -1;
- }
-
- ef_winzip = _zip_ef_new(ZIP_EF_WINZIP_AES, EF_WINZIP_AES_SIZE, data, ZIP_EF_BOTH);
- _zip_buffer_free(ef_buffer);
- ef_winzip->next = ef;
- ef = ef_winzip;
+ zip_uint8_t data[EF_WINZIP_AES_SIZE];
+ zip_buffer_t *ef_buffer = _zip_buffer_new(data, sizeof(data));
+ zip_extra_field_t *ef_winzip;
+
+ if (ef_buffer == NULL) {
+ zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
+ _zip_ef_free(ef);
+ return -1;
+ }
+
+ _zip_buffer_put_16(ef_buffer, 2);
+ _zip_buffer_put(ef_buffer, "AE", 2);
+ _zip_buffer_put_8(ef_buffer, (zip_uint8_t)(de->encryption_method & 0xff));
+ _zip_buffer_put_16(ef_buffer, (zip_uint16_t)de->comp_method);
+
+ if (!_zip_buffer_ok(ef_buffer)) {
+ zip_error_set(&za->error, ZIP_ER_INTERNAL, 0);
+ _zip_buffer_free(ef_buffer);
+ _zip_ef_free(ef);
+ return -1;
+ }
+
+ ef_winzip = _zip_ef_new(ZIP_EF_WINZIP_AES, EF_WINZIP_AES_SIZE, data, ZIP_EF_BOTH);
+ _zip_buffer_free(ef_buffer);
+ ef_winzip->next = ef;
+ ef = ef_winzip;
}
if ((buffer = _zip_buffer_new(buf, sizeof(buf))) == NULL) {
- zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
- _zip_ef_free(ef);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
+ _zip_ef_free(ef);
+ return -1;
}
_zip_buffer_put(buffer, (flags & ZIP_FL_LOCAL) ? LOCAL_MAGIC : CENTRAL_MAGIC, 4);
if ((flags & ZIP_FL_LOCAL) == 0) {
- _zip_buffer_put_16(buffer, de->version_madeby);
+ _zip_buffer_put_16(buffer, de->version_madeby);
}
_zip_buffer_put_16(buffer, ZIP_MAX(is_really_zip64 ? 45 : 0, de->version_needed));
_zip_buffer_put_16(buffer, de->bitflags);
if (is_winzip_aes) {
- _zip_buffer_put_16(buffer, ZIP_CM_WINZIP_AES);
+ _zip_buffer_put_16(buffer, ZIP_CM_WINZIP_AES);
}
else {
- _zip_buffer_put_16(buffer, (zip_uint16_t)de->comp_method);
+ _zip_buffer_put_16(buffer, (zip_uint16_t)de->comp_method);
}
- _zip_u2d_time(de->last_mod, &dostime, &dosdate);
+ if (ZIP_WANT_TORRENTZIP(za)) {
+ dostime = 0xbc00;
+ dosdate = 0x2198;
+ }
+ else {
+ _zip_u2d_time(de->last_mod, &dostime, &dosdate);
+ }
_zip_buffer_put_16(buffer, dostime);
_zip_buffer_put_16(buffer, dosdate);
if (is_winzip_aes && de->uncomp_size < 20) {
- _zip_buffer_put_32(buffer, 0);
+ _zip_buffer_put_32(buffer, 0);
}
else {
- _zip_buffer_put_32(buffer, de->crc);
+ _zip_buffer_put_32(buffer, de->crc);
}
if (((flags & ZIP_FL_LOCAL) == ZIP_FL_LOCAL) && ((de->comp_size >= ZIP_UINT32_MAX) || (de->uncomp_size >= ZIP_UINT32_MAX))) {
- /* In local headers, if a ZIP64 EF is written, it MUST contain
- * both compressed and uncompressed sizes (even if one of the
- * two is smaller than 0xFFFFFFFF); on the other hand, those
- * may only appear when the corresponding standard entry is
- * 0xFFFFFFFF. (appnote.txt 4.5.3) */
- _zip_buffer_put_32(buffer, ZIP_UINT32_MAX);
- _zip_buffer_put_32(buffer, ZIP_UINT32_MAX);
+ /* In local headers, if a ZIP64 EF is written, it MUST contain
+ * both compressed and uncompressed sizes (even if one of the
+ * two is smaller than 0xFFFFFFFF); on the other hand, those
+ * may only appear when the corresponding standard entry is
+ * 0xFFFFFFFF. (appnote.txt 4.5.3) */
+ _zip_buffer_put_32(buffer, ZIP_UINT32_MAX);
+ _zip_buffer_put_32(buffer, ZIP_UINT32_MAX);
}
else {
- if (de->comp_size < ZIP_UINT32_MAX) {
- _zip_buffer_put_32(buffer, (zip_uint32_t)de->comp_size);
- }
- else {
- _zip_buffer_put_32(buffer, ZIP_UINT32_MAX);
- }
- if (de->uncomp_size < ZIP_UINT32_MAX) {
- _zip_buffer_put_32(buffer, (zip_uint32_t)de->uncomp_size);
- }
- else {
- _zip_buffer_put_32(buffer, ZIP_UINT32_MAX);
- }
+ if (de->comp_size < ZIP_UINT32_MAX) {
+ _zip_buffer_put_32(buffer, (zip_uint32_t)de->comp_size);
+ }
+ else {
+ _zip_buffer_put_32(buffer, ZIP_UINT32_MAX);
+ }
+ if (de->uncomp_size < ZIP_UINT32_MAX) {
+ _zip_buffer_put_32(buffer, (zip_uint32_t)de->uncomp_size);
+ }
+ else {
+ _zip_buffer_put_32(buffer, ZIP_UINT32_MAX);
+ }
}
_zip_buffer_put_16(buffer, _zip_string_length(de->filename));
- /* TODO: check for overflow */
- ef_total_size = (zip_uint32_t)_zip_ef_size(de->extra_fields, flags) + (zip_uint32_t)_zip_ef_size(ef, ZIP_EF_BOTH);
+ ef_total_size = (zip_uint32_t)_zip_ef_size(ef, ZIP_EF_BOTH);
+ if (!ZIP_WANT_TORRENTZIP(za)) {
+ /* TODO: check for overflow */
+ ef_total_size += (zip_uint32_t)_zip_ef_size(de->extra_fields, flags);
+ }
_zip_buffer_put_16(buffer, (zip_uint16_t)ef_total_size);
if ((flags & ZIP_FL_LOCAL) == 0) {
- _zip_buffer_put_16(buffer, _zip_string_length(de->comment));
- _zip_buffer_put_16(buffer, (zip_uint16_t)de->disk_number);
- _zip_buffer_put_16(buffer, de->int_attrib);
- _zip_buffer_put_32(buffer, de->ext_attrib);
- if (de->offset < ZIP_UINT32_MAX)
- _zip_buffer_put_32(buffer, (zip_uint32_t)de->offset);
- else
- _zip_buffer_put_32(buffer, ZIP_UINT32_MAX);
+ _zip_buffer_put_16(buffer, ZIP_WANT_TORRENTZIP(za) ? 0 : _zip_string_length(de->comment));
+ _zip_buffer_put_16(buffer, (zip_uint16_t)de->disk_number);
+ _zip_buffer_put_16(buffer, de->int_attrib);
+ _zip_buffer_put_32(buffer, de->ext_attrib);
+ if (de->offset < ZIP_UINT32_MAX)
+ _zip_buffer_put_32(buffer, (zip_uint32_t)de->offset);
+ else
+ _zip_buffer_put_32(buffer, ZIP_UINT32_MAX);
}
if (!_zip_buffer_ok(buffer)) {
- zip_error_set(&za->error, ZIP_ER_INTERNAL, 0);
- _zip_buffer_free(buffer);
- _zip_ef_free(ef);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_INTERNAL, 0);
+ _zip_buffer_free(buffer);
+ _zip_ef_free(ef);
+ return -1;
}
if (_zip_write(za, buf, _zip_buffer_offset(buffer)) < 0) {
- _zip_buffer_free(buffer);
- _zip_ef_free(ef);
- return -1;
+ _zip_buffer_free(buffer);
+ _zip_ef_free(ef);
+ return -1;
}
_zip_buffer_free(buffer);
if (de->filename) {
- if (_zip_string_write(za, de->filename) < 0) {
- _zip_ef_free(ef);
- return -1;
- }
+ if (_zip_string_write(za, de->filename) < 0) {
+ _zip_ef_free(ef);
+ return -1;
+ }
}
if (ef) {
- if (_zip_ef_write(za, ef, ZIP_EF_BOTH) < 0) {
- _zip_ef_free(ef);
- return -1;
- }
+ if (_zip_ef_write(za, ef, ZIP_EF_BOTH) < 0) {
+ _zip_ef_free(ef);
+ return -1;
+ }
}
_zip_ef_free(ef);
- if (de->extra_fields) {
- if (_zip_ef_write(za, de->extra_fields, flags) < 0) {
- return -1;
- }
+ if (de->extra_fields && !ZIP_WANT_TORRENTZIP(za)) {
+ if (_zip_ef_write(za, de->extra_fields, flags) < 0) {
+ return -1;
+ }
}
- if ((flags & ZIP_FL_LOCAL) == 0) {
- if (de->comment) {
- if (_zip_string_write(za, de->comment) < 0) {
- return -1;
- }
- }
+ if ((flags & ZIP_FL_LOCAL) == 0 && !ZIP_WANT_TORRENTZIP(za)) {
+ if (de->comment) {
+ if (_zip_string_write(za, de->comment) < 0) {
+ return -1;
+ }
+ }
}
@@ -1030,18 +1062,18 @@ _zip_ef_utf8(zip_uint16_t id, zip_string_t *str, zip_error_t *error) {
zip_extra_field_t *ef;
if ((raw = _zip_string_get(str, &len, ZIP_FL_ENC_RAW, NULL)) == NULL) {
- /* error already set */
- return NULL;
+ /* error already set */
+ return NULL;
}
if (len + 5 > ZIP_UINT16_MAX) {
- zip_error_set(error, ZIP_ER_INVAL, 0); /* TODO: better error code? */
- return NULL;
+ zip_error_set(error, ZIP_ER_INVAL, 0); /* TODO: better error code? */
+ return NULL;
}
if ((buffer = _zip_buffer_new(NULL, len + 5)) == NULL) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
}
_zip_buffer_put_8(buffer, 1);
@@ -1049,9 +1081,9 @@ _zip_ef_utf8(zip_uint16_t id, zip_string_t *str, zip_error_t *error) {
_zip_buffer_put(buffer, raw, len);
if (!_zip_buffer_ok(buffer)) {
- zip_error_set(error, ZIP_ER_INTERNAL, 0);
- _zip_buffer_free(buffer);
- return NULL;
+ zip_error_set(error, ZIP_ER_INTERNAL, 0);
+ _zip_buffer_free(buffer);
+ return NULL;
}
ef = _zip_ef_new(id, (zip_uint16_t)(_zip_buffer_offset(buffer)), _zip_buffer_data(buffer), ZIP_EF_BOTH);
@@ -1064,53 +1096,46 @@ _zip_ef_utf8(zip_uint16_t id, zip_string_t *str, zip_error_t *error) {
zip_dirent_t *
_zip_get_dirent(zip_t *za, zip_uint64_t idx, zip_flags_t flags, zip_error_t *error) {
if (error == NULL)
- error = &za->error;
+ error = &za->error;
if (idx >= za->nentry) {
- zip_error_set(error, ZIP_ER_INVAL, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return NULL;
}
if ((flags & ZIP_FL_UNCHANGED) || za->entry[idx].changes == NULL) {
- if (za->entry[idx].orig == NULL) {
- zip_error_set(error, ZIP_ER_INVAL, 0);
- return NULL;
- }
- if (za->entry[idx].deleted && (flags & ZIP_FL_UNCHANGED) == 0) {
- zip_error_set(error, ZIP_ER_DELETED, 0);
- return NULL;
- }
- return za->entry[idx].orig;
+ if (za->entry[idx].orig == NULL) {
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return NULL;
+ }
+ if (za->entry[idx].deleted && (flags & ZIP_FL_UNCHANGED) == 0) {
+ zip_error_set(error, ZIP_ER_DELETED, 0);
+ return NULL;
+ }
+ return za->entry[idx].orig;
}
else
- return za->entry[idx].changes;
+ return za->entry[idx].changes;
}
void
_zip_u2d_time(time_t intime, zip_uint16_t *dtime, zip_uint16_t *ddate) {
struct tm *tpm;
-
-#ifdef HAVE_LOCALTIME_R
struct tm tm;
- tpm = localtime_r(&intime, &tm);
-#else
- tpm = localtime(&intime);
-#endif
+ tpm = zip_localtime(&intime, &tm);
if (tpm == NULL) {
- /* if localtime() fails, return an arbitrary date (1980-01-01 00:00:00) */
- *ddate = (1 << 5) + 1;
- *dtime = 0;
- return;
+ /* if localtime fails, return an arbitrary date (1980-01-01 00:00:00) */
+ *ddate = (1 << 5) + 1;
+ *dtime = 0;
+ return;
}
if (tpm->tm_year < 80) {
- tpm->tm_year = 80;
+ tpm->tm_year = 80;
}
*ddate = (zip_uint16_t)(((tpm->tm_year + 1900 - 1980) << 9) + ((tpm->tm_mon + 1) << 5) + tpm->tm_mday);
*dtime = (zip_uint16_t)(((tpm->tm_hour) << 11) + ((tpm->tm_min) << 5) + ((tpm->tm_sec) >> 1));
-
- return;
}
@@ -1119,45 +1144,64 @@ _zip_dirent_apply_attributes(zip_dirent_t *de, zip_file_attributes_t *attributes
zip_uint16_t length;
if (attributes->valid & ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS) {
- zip_uint16_t mask = attributes->general_purpose_bit_mask & ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS_ALLOWED_MASK;
- de->bitflags = (de->bitflags & ~mask) | (attributes->general_purpose_bit_flags & mask);
+ zip_uint16_t mask = attributes->general_purpose_bit_mask & ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS_ALLOWED_MASK;
+ de->bitflags = (de->bitflags & ~mask) | (attributes->general_purpose_bit_flags & mask);
}
if (attributes->valid & ZIP_FILE_ATTRIBUTES_ASCII) {
- de->int_attrib = (de->int_attrib & ~0x1) | (attributes->ascii ? 1 : 0);
+ de->int_attrib = (de->int_attrib & ~0x1) | (attributes->ascii ? 1 : 0);
}
/* manually set attributes are preferred over attributes provided by source */
if ((changed & ZIP_DIRENT_ATTRIBUTES) == 0 && (attributes->valid & ZIP_FILE_ATTRIBUTES_EXTERNAL_FILE_ATTRIBUTES)) {
- de->ext_attrib = attributes->external_file_attributes;
+ de->ext_attrib = attributes->external_file_attributes;
}
if (de->comp_method == ZIP_CM_LZMA) {
- de->version_needed = 63;
+ de->version_needed = 63;
}
else if (de->encryption_method == ZIP_EM_AES_128 || de->encryption_method == ZIP_EM_AES_192 || de->encryption_method == ZIP_EM_AES_256) {
- de->version_needed = 51;
+ de->version_needed = 51;
}
else if (de->comp_method == ZIP_CM_BZIP2) {
- de->version_needed = 46;
+ de->version_needed = 46;
}
else if (force_zip64 || _zip_dirent_needs_zip64(de, 0)) {
- de->version_needed = 45;
+ de->version_needed = 45;
}
else if (de->comp_method == ZIP_CM_DEFLATE || de->encryption_method == ZIP_EM_TRAD_PKWARE) {
- de->version_needed = 20;
+ de->version_needed = 20;
}
else if ((length = _zip_string_length(de->filename)) > 0 && de->filename->raw[length - 1] == '/') {
- de->version_needed = 20;
+ de->version_needed = 20;
}
else {
- de->version_needed = 10;
+ de->version_needed = 10;
}
if (attributes->valid & ZIP_FILE_ATTRIBUTES_VERSION_NEEDED) {
- de->version_needed = ZIP_MAX(de->version_needed, attributes->version_needed);
+ de->version_needed = ZIP_MAX(de->version_needed, attributes->version_needed);
}
de->version_madeby = 63 | (de->version_madeby & 0xff00);
if ((changed & ZIP_DIRENT_ATTRIBUTES) == 0 && (attributes->valid & ZIP_FILE_ATTRIBUTES_HOST_SYSTEM)) {
- de->version_madeby = (de->version_madeby & 0xff) | (zip_uint16_t)(attributes->host_system << 8);
+ de->version_madeby = (de->version_madeby & 0xff) | (zip_uint16_t)(attributes->host_system << 8);
}
}
+
+
+/* _zip_dirent_torrent_normalize(de);
+ Set values suitable for torrentzip.
+*/
+
+void zip_dirent_torrentzip_normalize(zip_dirent_t *de) {
+ de->version_madeby = 0;
+ de->version_needed = 20; /* 2.0 */
+ de->bitflags = 2; /* maximum compression */
+ de->comp_method = ZIP_CM_DEFLATE;
+ de->compression_level = TORRENTZIP_COMPRESSION_FLAGS;
+ de->disk_number = 0;
+ de->int_attrib = 0;
+ de->ext_attrib = 0;
+
+ /* last_mod, extra_fields, and comment are normalized in zip_dirent_write() directly */
+
+}
diff --git a/src/Common/libzip/zip_discard.c b/src/Common/libzip/zip_discard.c
index 12f06367..d1dc4f8b 100644
--- a/src/Common/libzip/zip_discard.c
+++ b/src/Common/libzip/zip_discard.c
@@ -1,9 +1,9 @@
/*
zip_discard.c -- discard and free struct zip
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -46,11 +46,11 @@ zip_discard(zip_t *za) {
zip_uint64_t i;
if (za == NULL)
- return;
+ return;
if (za->src) {
- zip_source_close(za->src);
- zip_source_free(za->src);
+ zip_source_close(za->src);
+ zip_source_free(za->src);
}
free(za->default_password);
@@ -60,13 +60,13 @@ zip_discard(zip_t *za) {
_zip_hash_free(za->names);
if (za->entry) {
- for (i = 0; i < za->nentry; i++)
- _zip_entry_finalize(za->entry + i);
- free(za->entry);
+ for (i = 0; i < za->nentry; i++)
+ _zip_entry_finalize(za->entry + i);
+ free(za->entry);
}
for (i = 0; i < za->nopen_source; i++) {
- _zip_source_invalidate(za->open_source[i]);
+ _zip_source_invalidate(za->open_source[i]);
}
free(za->open_source);
diff --git a/src/Common/libzip/zip_entry.c b/src/Common/libzip/zip_entry.c
index 52ecaef9..35a36e4a 100644
--- a/src/Common/libzip/zip_entry.c
+++ b/src/Common/libzip/zip_entry.c
@@ -1,9 +1,9 @@
/*
zip_entry.c -- struct zip_entry helper functions
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
diff --git a/src/Common/libzip/zip_err_str.c b/src/Common/libzip/zip_err_str.c
index e0a04a94..28af773b 100644
--- a/src/Common/libzip/zip_err_str.c
+++ b/src/Common/libzip/zip_err_str.c
@@ -1,84 +1,79 @@
/*
- This file was generated automatically by ./make_zip_err_str.sh
- from ./zip.h; make changes there.
- */
+ This file was generated automatically by CMake
+ from zip.h and zipint.h; make changes there.
+*/
#include "zipint.h"
-const char * const _zip_err_str[] = {
- "No error",
- "Multi-disk zip archives not supported",
- "Renaming temporary file failed",
- "Closing zip archive failed",
- "Seek error",
- "Read error",
- "Write error",
- "CRC error",
- "Containing zip archive was closed",
- "No such file",
- "File already exists",
- "Can't open file",
- "Failure to create temporary file",
- "Zlib error",
- "Malloc failure",
- "Entry has been changed",
- "Compression method not supported",
- "Premature end of file",
- "Invalid argument",
- "Not a zip archive",
- "Internal error",
- "Zip archive inconsistent",
- "Can't remove file",
- "Entry has been deleted",
- "Encryption method not supported",
- "Read-only archive",
- "No password provided",
- "Wrong password provided",
- "Operation not supported",
- "Resource still in use",
- "Tell error",
- "Compressed data invalid",
- "Operation cancelled",
-};
-
-const int _zip_nerr_str = sizeof(_zip_err_str)/sizeof(_zip_err_str[0]);
-
+#define L ZIP_ET_LIBZIP
#define N ZIP_ET_NONE
#define S ZIP_ET_SYS
#define Z ZIP_ET_ZLIB
-const int _zip_err_type[] = {
- N,
- N,
- S,
- S,
- S,
- S,
- S,
- N,
- N,
- N,
- N,
- S,
- S,
- Z,
- N,
- N,
- N,
- N,
- N,
- N,
- N,
- N,
- S,
- N,
- N,
- N,
- N,
- N,
- N,
- N,
- S,
- N,
- N,
+#define E ZIP_DETAIL_ET_ENTRY
+#define G ZIP_DETAIL_ET_GLOBAL
+
+const struct _zip_err_info _zip_err_str[] = {
+ { N, "No error" },
+ { N, "Multi-disk zip archives not supported" },
+ { S, "Renaming temporary file failed" },
+ { S, "Closing zip archive failed" },
+ { S, "Seek error" },
+ { S, "Read error" },
+ { S, "Write error" },
+ { N, "CRC error" },
+ { N, "Containing zip archive was closed" },
+ { N, "No such file" },
+ { N, "File already exists" },
+ { S, "Can't open file" },
+ { S, "Failure to create temporary file" },
+ { Z, "Zlib error" },
+ { N, "Malloc failure" },
+ { N, "Entry has been changed" },
+ { N, "Compression method not supported" },
+ { N, "Premature end of file" },
+ { N, "Invalid argument" },
+ { N, "Not a zip archive" },
+ { N, "Internal error" },
+ { L, "Zip archive inconsistent" },
+ { S, "Can't remove file" },
+ { N, "Entry has been deleted" },
+ { N, "Encryption method not supported" },
+ { N, "Read-only archive" },
+ { N, "No password provided" },
+ { N, "Wrong password provided" },
+ { N, "Operation not supported" },
+ { N, "Resource still in use" },
+ { S, "Tell error" },
+ { N, "Compressed data invalid" },
+ { N, "Operation cancelled" },
+ { N, "Unexpected length of data" },
+ { N, "Not allowed in torrentzip" },
};
+
+const int _zip_err_str_count = sizeof(_zip_err_str)/sizeof(_zip_err_str[0]);
+
+const struct _zip_err_info _zip_err_details[] = {
+ { G, "no detail" },
+ { G, "central directory overlaps EOCD, or there is space between them" },
+ { G, "archive comment length incorrect" },
+ { G, "central directory length invalid" },
+ { E, "central header invalid" },
+ { G, "central directory count of entries is incorrect" },
+ { E, "local and central headers do not match" },
+ { G, "wrong EOCD length" },
+ { G, "EOCD64 overlaps EOCD, or there is space between them" },
+ { G, "EOCD64 magic incorrect" },
+ { G, "EOCD64 and EOCD do not match" },
+ { G, "invalid value in central directory" },
+ { E, "variable size fields overflow header" },
+ { E, "invalid UTF-8 in filename" },
+ { E, "invalid UTF-8 in comment" },
+ { E, "invalid Zip64 extra field" },
+ { E, "invalid WinZip AES extra field" },
+ { E, "garbage at end of extra fields" },
+ { E, "extra field length is invalid" },
+ { E, "file length in header doesn't match actual file length" },
+};
+
+const int _zip_err_details_count = sizeof(_zip_err_details)/sizeof(_zip_err_details[0]);
diff --git a/src/Common/libzip/zip_error.c b/src/Common/libzip/zip_error.c
index a0f74f02..c498e086 100644
--- a/src/Common/libzip/zip_error.c
+++ b/src/Common/libzip/zip_error.c
@@ -1,9 +1,9 @@
/*
zip_error.c -- zip_error_t helper functions
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -67,30 +67,31 @@ zip_error_init_with_code(zip_error_t *error, int ze) {
zip_error_init(error);
error->zip_err = ze;
switch (zip_error_system_type(error)) {
- case ZIP_ET_SYS:
- error->sys_err = errno;
- break;
-
- default:
- error->sys_err = 0;
- break;
+ case ZIP_ET_SYS:
+ case ZIP_ET_LIBZIP:
+ error->sys_err = errno;
+ break;
+
+ default:
+ error->sys_err = 0;
+ break;
}
}
ZIP_EXTERN int
zip_error_system_type(const zip_error_t *error) {
- if (error->zip_err < 0 || error->zip_err >= _zip_nerr_str)
- return ZIP_ET_NONE;
+ if (error->zip_err < 0 || error->zip_err >= _zip_err_str_count)
+ return ZIP_ET_NONE;
- return _zip_err_type[error->zip_err];
+ return _zip_err_str[error->zip_err].type;
}
void
_zip_error_clear(zip_error_t *err) {
if (err == NULL)
- return;
+ return;
err->zip_err = ZIP_ER_OK;
err->sys_err = 0;
@@ -100,7 +101,7 @@ _zip_error_clear(zip_error_t *err) {
void
_zip_error_copy(zip_error_t *dst, const zip_error_t *src) {
if (dst == NULL) {
- return;
+ return;
}
dst->zip_err = src->zip_err;
@@ -111,12 +112,12 @@ _zip_error_copy(zip_error_t *dst, const zip_error_t *src) {
void
_zip_error_get(const zip_error_t *err, int *zep, int *sep) {
if (zep)
- *zep = err->zip_err;
+ *zep = err->zip_err;
if (sep) {
- if (zip_error_system_type(err) != ZIP_ET_NONE)
- *sep = err->sys_err;
- else
- *sep = 0;
+ if (zip_error_system_type(err) != ZIP_ET_NONE)
+ *sep = err->sys_err;
+ else
+ *sep = 0;
}
}
@@ -124,14 +125,19 @@ _zip_error_get(const zip_error_t *err, int *zep, int *sep) {
void
zip_error_set(zip_error_t *err, int ze, int se) {
if (err) {
- err->zip_err = ze;
- err->sys_err = se;
+ err->zip_err = ze;
+ err->sys_err = se;
}
}
void
-_zip_error_set_from_source(zip_error_t *err, zip_source_t *src) {
+zip_error_set_from_source(zip_error_t *err, zip_source_t *src) {
+ if (src == NULL) {
+ zip_error_set(err, ZIP_ER_INVAL, 0);
+ return;
+ }
+
_zip_error_copy(err, zip_source_error(src));
}
@@ -141,7 +147,7 @@ zip_error_to_data(const zip_error_t *error, void *data, zip_uint64_t length) {
int *e = (int *)data;
if (length < sizeof(int) * 2) {
- return -1;
+ return -1;
}
e[0] = zip_error_code_zip(error);
diff --git a/src/Common/libzip/zip_error_clear.c b/src/Common/libzip/zip_error_clear.c
index eec1568f..94ff5062 100644
--- a/src/Common/libzip/zip_error_clear.c
+++ b/src/Common/libzip/zip_error_clear.c
@@ -1,9 +1,9 @@
/*
zip_error_clear.c -- clear zip error
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -38,7 +38,7 @@
ZIP_EXTERN void
zip_error_clear(zip_t *za) {
if (za == NULL)
- return;
+ return;
_zip_error_clear(&za->error);
}
diff --git a/src/Common/libzip/zip_error_get.c b/src/Common/libzip/zip_error_get.c
index 9588b4c4..c0418f0d 100644
--- a/src/Common/libzip/zip_error_get.c
+++ b/src/Common/libzip/zip_error_get.c
@@ -1,9 +1,9 @@
/*
zip_error_get.c -- get zip error
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
diff --git a/src/Common/libzip/zip_error_get_sys_type.c b/src/Common/libzip/zip_error_get_sys_type.c
index 3dfe5c26..a22ffb03 100644
--- a/src/Common/libzip/zip_error_get_sys_type.c
+++ b/src/Common/libzip/zip_error_get_sys_type.c
@@ -1,9 +1,9 @@
/*
zip_error_get_sys_type.c -- return type of system error code
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -37,8 +37,9 @@
ZIP_EXTERN int
zip_error_get_sys_type(int ze) {
- if (ze < 0 || ze >= _zip_nerr_str)
- return 0;
+ if (ze < 0 || ze >= _zip_err_str_count) {
+ return 0;
+ }
- return _zip_err_type[ze];
+ return _zip_err_str[ze].type;
}
diff --git a/src/Common/libzip/zip_error_strerror.c b/src/Common/libzip/zip_error_strerror.c
index 93b24eab..fe04cbb4 100644
--- a/src/Common/libzip/zip_error_strerror.c
+++ b/src/Common/libzip/zip_error_strerror.c
@@ -1,9 +1,9 @@
/*
zip_error_sterror.c -- get string representation of struct zip_error
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -39,45 +39,90 @@
#include "zipint.h"
-
ZIP_EXTERN const char *
zip_error_strerror(zip_error_t *err) {
- const char *zs, *ss;
- char buf[128], *s;
+ const char *zip_error_string, *system_error_string;
+ char *s;
+ char *system_error_buffer = NULL;
zip_error_fini(err);
- if (err->zip_err < 0 || err->zip_err >= _zip_nerr_str) {
- sprintf(buf, "Unknown error %d", err->zip_err);
- zs = NULL;
- ss = buf;
+ if (err->zip_err < 0 || err->zip_err >= _zip_err_str_count) {
+ system_error_buffer = (char *)malloc(128);
+ snprintf_s(system_error_buffer, 128, "Unknown error %d", err->zip_err);
+ system_error_buffer[128 - 1] = '\0'; /* make sure string is NUL-terminated */
+ zip_error_string = NULL;
+ system_error_string = system_error_buffer;
}
else {
- zs = _zip_err_str[err->zip_err];
-
- switch (_zip_err_type[err->zip_err]) {
- case ZIP_ET_SYS:
- ss = strerror(err->sys_err);
- break;
-
- case ZIP_ET_ZLIB:
- ss = zError(err->sys_err);
- break;
-
- default:
- ss = NULL;
- }
+ zip_error_string = _zip_err_str[err->zip_err].description;
+
+ switch (_zip_err_str[err->zip_err].type) {
+ case ZIP_ET_SYS: {
+ size_t len = strerrorlen_s(err->sys_err) + 1;
+ system_error_buffer = malloc(len);
+ strerror_s(system_error_buffer, len, err->sys_err);
+ system_error_string = system_error_buffer;
+ break;
+ }
+
+ case ZIP_ET_ZLIB:
+ system_error_string = zError(err->sys_err);
+ break;
+
+ case ZIP_ET_LIBZIP: {
+ zip_uint8_t error = GET_ERROR_FROM_DETAIL(err->sys_err);
+ int index = GET_INDEX_FROM_DETAIL(err->sys_err);
+
+ if (error == 0) {
+ system_error_string = NULL;
+ }
+ else if (error >= _zip_err_details_count) {
+ system_error_buffer = (char *)malloc(128);
+ snprintf_s(system_error_buffer, 128, "invalid detail error %u", error);
+ system_error_buffer[128 - 1] = '\0'; /* make sure string is NUL-terminated */
+ system_error_string = system_error_buffer;
+ }
+ else if (_zip_err_details[error].type == ZIP_DETAIL_ET_ENTRY && index < MAX_DETAIL_INDEX) {
+ system_error_buffer = (char *)malloc(128);
+ snprintf_s(system_error_buffer, 128, "entry %d: %s", index, _zip_err_details[error].description);
+ system_error_buffer[128 - 1] = '\0'; /* make sure string is NUL-terminated */
+ system_error_string = system_error_buffer;
+ }
+ else {
+ system_error_string = _zip_err_details[error].description;
+ }
+ break;
+ }
+
+ default:
+ system_error_string = NULL;
+ }
}
- if (ss == NULL)
- return zs;
+ if (system_error_string == NULL) {
+ free(system_error_buffer);
+ return zip_error_string;
+ }
else {
- if ((s = (char *)malloc(strlen(ss) + (zs ? strlen(zs) + 2 : 0) + 1)) == NULL)
- return _zip_err_str[ZIP_ER_MEMORY];
-
- sprintf(s, "%s%s%s", (zs ? zs : ""), (zs ? ": " : ""), ss);
- err->str = s;
-
- return s;
+ size_t length = strlen(system_error_string);
+ if (zip_error_string) {
+ size_t length_error = strlen(zip_error_string);
+ if (length + length_error + 2 < length) {
+ free(system_error_buffer);
+ return _zip_err_str[ZIP_ER_MEMORY].description;
+ }
+ length += length_error + 2;
+ }
+ if (length == SIZE_MAX || (s = (char *)malloc(length + 1)) == NULL) {
+ free(system_error_buffer);
+ return _zip_err_str[ZIP_ER_MEMORY].description;
+ }
+
+ snprintf_s(s, length + 1, "%s%s%s", (zip_error_string ? zip_error_string : ""), (zip_error_string ? ": " : ""), system_error_string);
+ err->str = s;
+
+ free(system_error_buffer);
+ return s;
}
}
diff --git a/src/Common/libzip/zip_error_to_str.c b/src/Common/libzip/zip_error_to_str.c
index 34a3331f..b60b7881 100644
--- a/src/Common/libzip/zip_error_to_str.c
+++ b/src/Common/libzip/zip_error_to_str.c
@@ -1,9 +1,9 @@
/*
zip_error_to_str.c -- get string representation of zip error code
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -34,7 +34,6 @@
#include <stdio.h>
#include <string.h>
-#include <zlib.h>
#define _ZIP_COMPILING_DEPRECATED
#include "zipint.h"
@@ -42,25 +41,18 @@
ZIP_EXTERN int
zip_error_to_str(char *buf, zip_uint64_t len, int ze, int se) {
- const char *zs, *ss;
+ zip_error_t error;
+ const char *error_string;
+ int ret;
- if (ze < 0 || ze >= _zip_nerr_str)
- return snprintf(buf, len, "Unknown error %d", ze);
+ zip_error_init(&error);
+ zip_error_set(&error, ze, se);
- zs = _zip_err_str[ze];
+ error_string = zip_error_strerror(&error);
- switch (_zip_err_type[ze]) {
- case ZIP_ET_SYS:
- ss = strerror(se);
- break;
+ ret = snprintf_s(buf, ZIP_MIN(len, SIZE_MAX), error_string, strlen(error_string));
- case ZIP_ET_ZLIB:
- ss = zError(se);
- break;
+ zip_error_fini(&error);
- default:
- ss = NULL;
- }
-
- return snprintf(buf, len, "%s%s%s", zs, (ss ? ": " : ""), (ss ? ss : ""));
+ return ret;
}
diff --git a/src/Common/libzip/zip_extra_field.c b/src/Common/libzip/zip_extra_field.c
index 7114a251..7aed12ad 100644
--- a/src/Common/libzip/zip_extra_field.c
+++ b/src/Common/libzip/zip_extra_field.c
@@ -1,9 +1,9 @@
/*
zip_extra_field.c -- manipulate extra fields
- Copyright (C) 2012-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2012-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -44,19 +44,19 @@ _zip_ef_clone(const zip_extra_field_t *ef, zip_error_t *error) {
head = prev = NULL;
while (ef) {
- if ((def = _zip_ef_new(ef->id, ef->size, ef->data, ef->flags)) == NULL) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- _zip_ef_free(head);
- return NULL;
- }
-
- if (head == NULL)
- head = def;
- if (prev)
- prev->next = def;
- prev = def;
-
- ef = ef->next;
+ if ((def = _zip_ef_new(ef->id, ef->size, ef->data, ef->flags)) == NULL) {
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ _zip_ef_free(head);
+ return NULL;
+ }
+
+ if (head == NULL)
+ head = def;
+ if (prev)
+ prev->next = def;
+ prev = def;
+
+ ef = ef->next;
}
return head;
@@ -72,27 +72,27 @@ _zip_ef_delete_by_id(zip_extra_field_t *ef, zip_uint16_t id, zip_uint16_t id_idx
head = ef;
prev = NULL;
for (; ef; ef = (prev ? prev->next : head)) {
- if ((ef->flags & flags & ZIP_EF_BOTH) && ((ef->id == id) || (id == ZIP_EXTRA_FIELD_ALL))) {
- if (id_idx == ZIP_EXTRA_FIELD_ALL || i == id_idx) {
- ef->flags &= ~(flags & ZIP_EF_BOTH);
- if ((ef->flags & ZIP_EF_BOTH) == 0) {
- if (prev)
- prev->next = ef->next;
- else
- head = ef->next;
- ef->next = NULL;
- _zip_ef_free(ef);
-
- if (id_idx == ZIP_EXTRA_FIELD_ALL)
- continue;
- }
- }
-
- i++;
- if (i > id_idx)
- break;
- }
- prev = ef;
+ if ((ef->flags & flags & ZIP_EF_BOTH) && ((ef->id == id) || (id == ZIP_EXTRA_FIELD_ALL))) {
+ if (id_idx == ZIP_EXTRA_FIELD_ALL || i == id_idx) {
+ ef->flags &= ~(flags & ZIP_EF_BOTH);
+ if ((ef->flags & ZIP_EF_BOTH) == 0) {
+ if (prev)
+ prev->next = ef->next;
+ else
+ head = ef->next;
+ ef->next = NULL;
+ _zip_ef_free(ef);
+
+ if (id_idx == ZIP_EXTRA_FIELD_ALL)
+ continue;
+ }
+ }
+
+ i++;
+ if (i > id_idx)
+ break;
+ }
+ prev = ef;
}
return head;
@@ -104,10 +104,10 @@ _zip_ef_free(zip_extra_field_t *ef) {
zip_extra_field_t *ef2;
while (ef) {
- ef2 = ef->next;
- free(ef->data);
- free(ef);
- ef = ef2;
+ ef2 = ef->next;
+ free(ef->data);
+ free(ef);
+ ef = ef2;
}
}
@@ -120,19 +120,19 @@ _zip_ef_get_by_id(const zip_extra_field_t *ef, zip_uint16_t *lenp, zip_uint16_t
i = 0;
for (; ef; ef = ef->next) {
- if (ef->id == id && (ef->flags & flags & ZIP_EF_BOTH)) {
- if (i < id_idx) {
- i++;
- continue;
- }
-
- if (lenp)
- *lenp = ef->size;
- if (ef->size > 0)
- return ef->data;
- else
- return empty;
- }
+ if (ef->id == id && (ef->flags & flags & ZIP_EF_BOTH)) {
+ if (i < id_idx) {
+ i++;
+ continue;
+ }
+
+ if (lenp)
+ *lenp = ef->size;
+ if (ef->size > 0)
+ return ef->data;
+ else
+ return empty;
+ }
}
zip_error_set(error, ZIP_ER_NOENT, 0);
@@ -146,28 +146,28 @@ _zip_ef_merge(zip_extra_field_t *to, zip_extra_field_t *from) {
int duplicate;
if (to == NULL)
- return from;
+ return from;
for (tail = to; tail->next; tail = tail->next)
- ;
+ ;
for (; from; from = ef2) {
- ef2 = from->next;
-
- duplicate = 0;
- for (tt = to; tt; tt = tt->next) {
- if (tt->id == from->id && tt->size == from->size && (tt->size == 0 || memcmp(tt->data, from->data, tt->size) == 0)) {
- tt->flags |= (from->flags & ZIP_EF_BOTH);
- duplicate = 1;
- break;
- }
- }
-
- from->next = NULL;
- if (duplicate)
- _zip_ef_free(from);
- else
- tail = tail->next = from;
+ ef2 = from->next;
+
+ duplicate = 0;
+ for (tt = to; tt; tt = tt->next) {
+ if (tt->id == from->id && tt->size == from->size && (tt->size == 0 || memcmp(tt->data, from->data, tt->size) == 0)) {
+ tt->flags |= (from->flags & ZIP_EF_BOTH);
+ duplicate = 1;
+ break;
+ }
+ }
+
+ from->next = NULL;
+ if (duplicate)
+ _zip_ef_free(from);
+ else
+ tail = tail->next = from;
}
return to;
@@ -179,20 +179,20 @@ _zip_ef_new(zip_uint16_t id, zip_uint16_t size, const zip_uint8_t *data, zip_fla
zip_extra_field_t *ef;
if ((ef = (zip_extra_field_t *)malloc(sizeof(*ef))) == NULL)
- return NULL;
+ return NULL;
ef->next = NULL;
ef->flags = flags;
ef->id = id;
ef->size = size;
if (size > 0) {
- if ((ef->data = (zip_uint8_t *)_zip_memdup(data, size, NULL)) == NULL) {
- free(ef);
- return NULL;
- }
+ if ((ef->data = (zip_uint8_t *)_zip_memdup(data, size, NULL)) == NULL) {
+ free(ef);
+ return NULL;
+ }
}
else
- ef->data = NULL;
+ ef->data = NULL;
return ef;
}
@@ -204,63 +204,64 @@ _zip_ef_parse(const zip_uint8_t *data, zip_uint16_t len, zip_flags_t flags, zip_
zip_extra_field_t *ef, *ef2, *ef_head;
if ((buffer = _zip_buffer_new((zip_uint8_t *)data, len)) == NULL) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- return false;
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return false;
}
ef_head = ef = NULL;
while (_zip_buffer_ok(buffer) && _zip_buffer_left(buffer) >= 4) {
- zip_uint16_t fid, flen;
- zip_uint8_t *ef_data;
-
- fid = _zip_buffer_get_16(buffer);
- flen = _zip_buffer_get_16(buffer);
- ef_data = _zip_buffer_get(buffer, flen);
-
- if (ef_data == NULL) {
- zip_error_set(error, ZIP_ER_INCONS, 0);
- _zip_buffer_free(buffer);
- _zip_ef_free(ef_head);
- return false;
- }
-
- if ((ef2 = _zip_ef_new(fid, flen, ef_data, flags)) == NULL) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- _zip_buffer_free(buffer);
- _zip_ef_free(ef_head);
- return false;
- }
-
- if (ef_head) {
- ef->next = ef2;
- ef = ef2;
- }
- else
- ef_head = ef = ef2;
+ zip_uint16_t fid, flen;
+ zip_uint8_t *ef_data;
+
+ fid = _zip_buffer_get_16(buffer);
+ flen = _zip_buffer_get_16(buffer);
+ ef_data = _zip_buffer_get(buffer, flen);
+
+ if (ef_data == NULL) {
+ zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_INVALID_EF_LENGTH);
+ _zip_buffer_free(buffer);
+ _zip_ef_free(ef_head);
+ return false;
+ }
+
+ if ((ef2 = _zip_ef_new(fid, flen, ef_data, flags)) == NULL) {
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ _zip_buffer_free(buffer);
+ _zip_ef_free(ef_head);
+ return false;
+ }
+
+ if (ef_head) {
+ ef->next = ef2;
+ ef = ef2;
+ }
+ else
+ ef_head = ef = ef2;
}
if (!_zip_buffer_eof(buffer)) {
- /* Android APK files align stored file data with padding in extra fields; ignore. */
- /* see https://android.googlesource.com/platform/build/+/master/tools/zipalign/ZipAlign.cpp */
- size_t glen = _zip_buffer_left(buffer);
- zip_uint8_t *garbage;
- garbage = _zip_buffer_get(buffer, glen);
- if (glen >= 4 || garbage == NULL || memcmp(garbage, "\0\0\0", glen) != 0) {
- zip_error_set(error, ZIP_ER_INCONS, 0);
- _zip_buffer_free(buffer);
- _zip_ef_free(ef_head);
- return false;
- }
+ /* Android APK files align stored file data with padding in extra fields; ignore. */
+ /* see https://android.googlesource.com/platform/build/+/master/tools/zipalign/ZipAlign.cpp */
+ /* buffer is at most 64k long, so this can't overflow. */
+ size_t glen = _zip_buffer_left(buffer);
+ zip_uint8_t *garbage;
+ garbage = _zip_buffer_get(buffer, glen);
+ if (glen >= 4 || garbage == NULL || memcmp(garbage, "\0\0\0", (size_t)glen) != 0) {
+ zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_EF_TRAILING_GARBAGE);
+ _zip_buffer_free(buffer);
+ _zip_ef_free(ef_head);
+ return false;
+ }
}
_zip_buffer_free(buffer);
if (ef_head_p) {
- *ef_head_p = ef_head;
+ *ef_head_p = ef_head;
}
else {
- _zip_ef_free(ef_head);
+ _zip_ef_free(ef_head);
}
return true;
@@ -276,20 +277,20 @@ _zip_ef_remove_internal(zip_extra_field_t *ef) {
prev = NULL;
while (ef) {
- if (ZIP_EF_IS_INTERNAL(ef->id)) {
- next = ef->next;
- if (ef_head == ef)
- ef_head = next;
- ef->next = NULL;
- _zip_ef_free(ef);
- if (prev)
- prev->next = next;
- ef = next;
- }
- else {
- prev = ef;
- ef = ef->next;
- }
+ if (ZIP_EF_IS_INTERNAL(ef->id)) {
+ next = ef->next;
+ if (ef_head == ef)
+ ef_head = next;
+ ef->next = NULL;
+ _zip_ef_free(ef);
+ if (prev)
+ prev->next = next;
+ ef = next;
+ }
+ else {
+ prev = ef;
+ ef = ef->next;
+ }
}
return ef_head;
@@ -302,8 +303,8 @@ _zip_ef_size(const zip_extra_field_t *ef, zip_flags_t flags) {
size = 0;
for (; ef; ef = ef->next) {
- if (ef->flags & flags & ZIP_EF_BOTH)
- size = (zip_uint16_t)(size + 4 + ef->size);
+ if (ef->flags & flags & ZIP_EF_BOTH)
+ size = (zip_uint16_t)(size + 4 + ef->size);
}
return size;
@@ -316,30 +317,30 @@ _zip_ef_write(zip_t *za, const zip_extra_field_t *ef, zip_flags_t flags) {
zip_buffer_t *buffer = _zip_buffer_new(b, sizeof(b));
if (buffer == NULL) {
- return -1;
+ return -1;
}
for (; ef; ef = ef->next) {
- if (ef->flags & flags & ZIP_EF_BOTH) {
- _zip_buffer_set_offset(buffer, 0);
- _zip_buffer_put_16(buffer, ef->id);
- _zip_buffer_put_16(buffer, ef->size);
- if (!_zip_buffer_ok(buffer)) {
- zip_error_set(&za->error, ZIP_ER_INTERNAL, 0);
- _zip_buffer_free(buffer);
- return -1;
- }
- if (_zip_write(za, b, 4) < 0) {
- _zip_buffer_free(buffer);
- return -1;
- }
- if (ef->size > 0) {
- if (_zip_write(za, ef->data, ef->size) < 0) {
- _zip_buffer_free(buffer);
- return -1;
- }
- }
- }
+ if (ef->flags & flags & ZIP_EF_BOTH) {
+ _zip_buffer_set_offset(buffer, 0);
+ _zip_buffer_put_16(buffer, ef->id);
+ _zip_buffer_put_16(buffer, ef->size);
+ if (!_zip_buffer_ok(buffer)) {
+ zip_error_set(&za->error, ZIP_ER_INTERNAL, 0);
+ _zip_buffer_free(buffer);
+ return -1;
+ }
+ if (_zip_write(za, b, 4) < 0) {
+ _zip_buffer_free(buffer);
+ return -1;
+ }
+ if (ef->size > 0) {
+ if (_zip_write(za, ef->data, ef->size) < 0) {
+ _zip_buffer_free(buffer);
+ return -1;
+ }
+ }
+ }
}
_zip_buffer_free(buffer);
@@ -355,71 +356,71 @@ _zip_read_local_ef(zip_t *za, zip_uint64_t idx) {
zip_uint16_t fname_len, ef_len;
if (idx >= za->nentry) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return -1;
}
e = za->entry + idx;
if (e->orig == NULL || e->orig->local_extra_fields_read)
- return 0;
+ return 0;
if (e->orig->offset + 26 > ZIP_INT64_MAX) {
- zip_error_set(&za->error, ZIP_ER_SEEK, EFBIG);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_SEEK, EFBIG);
+ return -1;
}
if (zip_source_seek(za->src, (zip_int64_t)(e->orig->offset + 26), SEEK_SET) < 0) {
- _zip_error_set_from_source(&za->error, za->src);
- return -1;
+ zip_error_set_from_source(&za->error, za->src);
+ return -1;
}
if ((buffer = _zip_buffer_new_from_source(za->src, sizeof(b), b, &za->error)) == NULL) {
- return -1;
+ return -1;
}
fname_len = _zip_buffer_get_16(buffer);
ef_len = _zip_buffer_get_16(buffer);
if (!_zip_buffer_eof(buffer)) {
- _zip_buffer_free(buffer);
- zip_error_set(&za->error, ZIP_ER_INTERNAL, 0);
- return -1;
+ _zip_buffer_free(buffer);
+ zip_error_set(&za->error, ZIP_ER_INTERNAL, 0);
+ return -1;
}
_zip_buffer_free(buffer);
if (ef_len > 0) {
- zip_extra_field_t *ef;
- zip_uint8_t *ef_raw;
+ zip_extra_field_t *ef;
+ zip_uint8_t *ef_raw;
- if (zip_source_seek(za->src, fname_len, SEEK_CUR) < 0) {
- zip_error_set(&za->error, ZIP_ER_SEEK, errno);
- return -1;
- }
+ if (zip_source_seek(za->src, fname_len, SEEK_CUR) < 0) {
+ zip_error_set(&za->error, ZIP_ER_SEEK, errno);
+ return -1;
+ }
- ef_raw = _zip_read_data(NULL, za->src, ef_len, 0, &za->error);
+ ef_raw = _zip_read_data(NULL, za->src, ef_len, 0, &za->error);
- if (ef_raw == NULL)
- return -1;
+ if (ef_raw == NULL)
+ return -1;
- if (!_zip_ef_parse(ef_raw, ef_len, ZIP_EF_LOCAL, &ef, &za->error)) {
- free(ef_raw);
- return -1;
- }
- free(ef_raw);
+ if (!_zip_ef_parse(ef_raw, ef_len, ZIP_EF_LOCAL, &ef, &za->error)) {
+ free(ef_raw);
+ return -1;
+ }
+ free(ef_raw);
- if (ef) {
- ef = _zip_ef_remove_internal(ef);
- e->orig->extra_fields = _zip_ef_merge(e->orig->extra_fields, ef);
- }
+ if (ef) {
+ ef = _zip_ef_remove_internal(ef);
+ e->orig->extra_fields = _zip_ef_merge(e->orig->extra_fields, ef);
+ }
}
e->orig->local_extra_fields_read = 1;
if (e->changes && e->changes->local_extra_fields_read == 0) {
- e->changes->extra_fields = e->orig->extra_fields;
- e->changes->local_extra_fields_read = 1;
+ e->changes->extra_fields = e->orig->extra_fields;
+ e->changes->local_extra_fields_read = 1;
}
return 0;
diff --git a/src/Common/libzip/zip_extra_field_api.c b/src/Common/libzip/zip_extra_field_api.c
index 605f95d0..560c71bb 100644
--- a/src/Common/libzip/zip_extra_field_api.c
+++ b/src/Common/libzip/zip_extra_field_api.c
@@ -1,9 +1,9 @@
/*
zip_extra_field_api.c -- public extra fields API functions
- Copyright (C) 2012-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2012-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -40,25 +40,29 @@ zip_file_extra_field_delete(zip_t *za, zip_uint64_t idx, zip_uint16_t ef_idx, zi
zip_dirent_t *de;
if ((flags & ZIP_EF_BOTH) == 0) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return -1;
}
if (((flags & ZIP_EF_BOTH) == ZIP_EF_BOTH) && (ef_idx != ZIP_EXTRA_FIELD_ALL)) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return -1;
}
if (_zip_get_dirent(za, idx, 0, NULL) == NULL)
- return -1;
+ return -1;
if (ZIP_IS_RDONLY(za)) {
- zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
+ return -1;
+ }
+ if (ZIP_WANT_TORRENTZIP(za)) {
+ zip_error_set(&za->error, ZIP_ER_NOT_ALLOWED, 0);
+ return -1;
}
if (_zip_file_extra_field_prepare_for_change(za, idx) < 0)
- return -1;
+ return -1;
de = za->entry[idx].changes;
@@ -72,25 +76,29 @@ zip_file_extra_field_delete_by_id(zip_t *za, zip_uint64_t idx, zip_uint16_t ef_i
zip_dirent_t *de;
if ((flags & ZIP_EF_BOTH) == 0) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return -1;
}
if (((flags & ZIP_EF_BOTH) == ZIP_EF_BOTH) && (ef_idx != ZIP_EXTRA_FIELD_ALL)) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return -1;
}
if (_zip_get_dirent(za, idx, 0, NULL) == NULL)
- return -1;
+ return -1;
if (ZIP_IS_RDONLY(za)) {
- zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
+ return -1;
+ }
+ if (ZIP_WANT_TORRENTZIP(za)) {
+ zip_error_set(&za->error, ZIP_ER_NOT_ALLOWED, 0);
+ return -1;
}
if (_zip_file_extra_field_prepare_for_change(za, idx) < 0)
- return -1;
+ return -1;
de = za->entry[idx].changes;
@@ -108,34 +116,34 @@ zip_file_extra_field_get(zip_t *za, zip_uint64_t idx, zip_uint16_t ef_idx, zip_u
int i;
if ((flags & ZIP_EF_BOTH) == 0) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return NULL;
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return NULL;
}
if ((de = _zip_get_dirent(za, idx, flags, &za->error)) == NULL)
- return NULL;
+ return NULL;
if (flags & ZIP_FL_LOCAL)
- if (_zip_read_local_ef(za, idx) < 0)
- return NULL;
+ if (_zip_read_local_ef(za, idx) < 0)
+ return NULL;
i = 0;
for (ef = de->extra_fields; ef; ef = ef->next) {
- if (ef->flags & flags & ZIP_EF_BOTH) {
- if (i < ef_idx) {
- i++;
- continue;
- }
-
- if (idp)
- *idp = ef->id;
- if (lenp)
- *lenp = ef->size;
- if (ef->size > 0)
- return ef->data;
- else
- return empty;
- }
+ if (ef->flags & flags & ZIP_EF_BOTH) {
+ if (i < ef_idx) {
+ i++;
+ continue;
+ }
+
+ if (idp)
+ *idp = ef->id;
+ if (lenp)
+ *lenp = ef->size;
+ if (ef->size > 0)
+ return ef->data;
+ else
+ return empty;
+ }
}
zip_error_set(&za->error, ZIP_ER_NOENT, 0);
@@ -148,16 +156,16 @@ zip_file_extra_field_get_by_id(zip_t *za, zip_uint64_t idx, zip_uint16_t ef_id,
zip_dirent_t *de;
if ((flags & ZIP_EF_BOTH) == 0) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return NULL;
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return NULL;
}
if ((de = _zip_get_dirent(za, idx, flags, &za->error)) == NULL)
- return NULL;
+ return NULL;
if (flags & ZIP_FL_LOCAL)
- if (_zip_read_local_ef(za, idx) < 0)
- return NULL;
+ if (_zip_read_local_ef(za, idx) < 0)
+ return NULL;
return _zip_ef_get_by_id(de->extra_fields, lenp, ef_id, ef_idx, flags, &za->error);
}
@@ -170,21 +178,21 @@ zip_file_extra_fields_count(zip_t *za, zip_uint64_t idx, zip_flags_t flags) {
zip_uint16_t n;
if ((flags & ZIP_EF_BOTH) == 0) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return -1;
}
if ((de = _zip_get_dirent(za, idx, flags, &za->error)) == NULL)
- return -1;
+ return -1;
if (flags & ZIP_FL_LOCAL)
- if (_zip_read_local_ef(za, idx) < 0)
- return -1;
+ if (_zip_read_local_ef(za, idx) < 0)
+ return -1;
n = 0;
for (ef = de->extra_fields; ef; ef = ef->next)
- if (ef->flags & flags & ZIP_EF_BOTH)
- n++;
+ if (ef->flags & flags & ZIP_EF_BOTH)
+ n++;
return (zip_int16_t)n;
}
@@ -197,21 +205,21 @@ zip_file_extra_fields_count_by_id(zip_t *za, zip_uint64_t idx, zip_uint16_t ef_i
zip_uint16_t n;
if ((flags & ZIP_EF_BOTH) == 0) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return -1;
}
if ((de = _zip_get_dirent(za, idx, flags, &za->error)) == NULL)
- return -1;
+ return -1;
if (flags & ZIP_FL_LOCAL)
- if (_zip_read_local_ef(za, idx) < 0)
- return -1;
+ if (_zip_read_local_ef(za, idx) < 0)
+ return -1;
n = 0;
for (ef = de->extra_fields; ef; ef = ef->next)
- if (ef->id == ef_id && (ef->flags & flags & ZIP_EF_BOTH))
- n++;
+ if (ef->id == ef_id && (ef->flags & flags & ZIP_EF_BOTH))
+ n++;
return (zip_int16_t)n;
}
@@ -225,25 +233,29 @@ zip_file_extra_field_set(zip_t *za, zip_uint64_t idx, zip_uint16_t ef_id, zip_ui
int i, found, new_len;
if ((flags & ZIP_EF_BOTH) == 0) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return -1;
}
if (_zip_get_dirent(za, idx, 0, NULL) == NULL)
- return -1;
+ return -1;
if (ZIP_IS_RDONLY(za)) {
- zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
+ return -1;
+ }
+ if (ZIP_WANT_TORRENTZIP(za)) {
+ zip_error_set(&za->error, ZIP_ER_NOT_ALLOWED, 0);
+ return -1;
}
if (ZIP_EF_IS_INTERNAL(ef_id)) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return -1;
}
if (_zip_file_extra_field_prepare_for_change(za, idx) < 0)
- return -1;
+ return -1;
de = za->entry[idx].changes;
@@ -253,67 +265,67 @@ zip_file_extra_field_set(zip_t *za, zip_uint64_t idx, zip_uint16_t ef_id, zip_ui
found = 0;
for (; ef; ef = ef->next) {
- if (ef->id == ef_id && (ef->flags & flags & ZIP_EF_BOTH)) {
- if (i == ef_idx) {
- found = 1;
- break;
- }
- i++;
- }
- ef_prev = ef;
+ if (ef->id == ef_id && (ef->flags & flags & ZIP_EF_BOTH)) {
+ if (i == ef_idx) {
+ found = 1;
+ break;
+ }
+ i++;
+ }
+ ef_prev = ef;
}
if (i < ef_idx && ef_idx != ZIP_EXTRA_FIELD_NEW) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return -1;
}
if (flags & ZIP_EF_LOCAL)
- ls = _zip_ef_size(de->extra_fields, ZIP_EF_LOCAL);
+ ls = _zip_ef_size(de->extra_fields, ZIP_EF_LOCAL);
else
- ls = 0;
+ ls = 0;
if (flags & ZIP_EF_CENTRAL)
- cs = _zip_ef_size(de->extra_fields, ZIP_EF_CENTRAL);
+ cs = _zip_ef_size(de->extra_fields, ZIP_EF_CENTRAL);
else
- cs = 0;
+ cs = 0;
new_len = ls > cs ? ls : cs;
if (found)
- new_len -= ef->size + 4;
+ new_len -= ef->size + 4;
new_len += len + 4;
if (new_len > ZIP_UINT16_MAX) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return -1;
}
if ((ef_new = _zip_ef_new(ef_id, len, data, flags)) == NULL) {
- zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
+ return -1;
}
if (found) {
- if ((ef->flags & ZIP_EF_BOTH) == (flags & ZIP_EF_BOTH)) {
- ef_new->next = ef->next;
- ef->next = NULL;
- _zip_ef_free(ef);
- if (ef_prev)
- ef_prev->next = ef_new;
- else
- de->extra_fields = ef_new;
- }
- else {
- ef->flags &= ~(flags & ZIP_EF_BOTH);
- ef_new->next = ef->next;
- ef->next = ef_new;
- }
+ if ((ef->flags & ZIP_EF_BOTH) == (flags & ZIP_EF_BOTH)) {
+ ef_new->next = ef->next;
+ ef->next = NULL;
+ _zip_ef_free(ef);
+ if (ef_prev)
+ ef_prev->next = ef_new;
+ else
+ de->extra_fields = ef_new;
+ }
+ else {
+ ef->flags &= ~(flags & ZIP_EF_BOTH);
+ ef_new->next = ef->next;
+ ef->next = ef_new;
+ }
}
else if (ef_prev) {
- ef_new->next = ef_prev->next;
- ef_prev->next = ef_new;
+ ef_new->next = ef_prev->next;
+ ef_prev->next = ef_new;
}
else
- de->extra_fields = ef_new;
+ de->extra_fields = ef_new;
return 0;
}
@@ -324,30 +336,30 @@ _zip_file_extra_field_prepare_for_change(zip_t *za, zip_uint64_t idx) {
zip_entry_t *e;
if (idx >= za->nentry) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return -1;
}
e = za->entry + idx;
if (e->changes && (e->changes->changed & ZIP_DIRENT_EXTRA_FIELD))
- return 0;
+ return 0;
if (e->orig) {
- if (_zip_read_local_ef(za, idx) < 0)
- return -1;
+ if (_zip_read_local_ef(za, idx) < 0)
+ return -1;
}
if (e->changes == NULL) {
- if ((e->changes = _zip_dirent_clone(e->orig)) == NULL) {
- zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
- return -1;
- }
+ if ((e->changes = _zip_dirent_clone(e->orig)) == NULL) {
+ zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
+ return -1;
+ }
}
if (e->orig && e->orig->extra_fields) {
- if ((e->changes->extra_fields = _zip_ef_clone(e->orig->extra_fields, &za->error)) == NULL)
- return -1;
+ if ((e->changes->extra_fields = _zip_ef_clone(e->orig->extra_fields, &za->error)) == NULL)
+ return -1;
}
e->changes->changed |= ZIP_DIRENT_EXTRA_FIELD;
diff --git a/src/Common/libzip/zip_fclose.c b/src/Common/libzip/zip_fclose.c
index 6eb9dc91..b820d98b 100644
--- a/src/Common/libzip/zip_fclose.c
+++ b/src/Common/libzip/zip_fclose.c
@@ -1,9 +1,9 @@
/*
zip_fclose.c -- close file in zip archive
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -42,11 +42,11 @@ zip_fclose(zip_file_t *zf) {
int ret;
if (zf->src)
- zip_source_free(zf->src);
+ zip_source_free(zf->src);
ret = 0;
if (zf->error.zip_err)
- ret = zf->error.zip_err;
+ ret = zf->error.zip_err;
zip_error_fini(&zf->error);
free(zf);
diff --git a/src/Common/libzip/zip_fdopen.c b/src/Common/libzip/zip_fdopen.c
index 5a732cd4..e72c55dc 100644
--- a/src/Common/libzip/zip_fdopen.c
+++ b/src/Common/libzip/zip_fdopen.c
@@ -1,9 +1,9 @@
/*
zip_fdopen.c -- open read-only archive from file descriptor
- Copyright (C) 2009-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -47,40 +47,45 @@ zip_fdopen(int fd_orig, int _flags, int *zep) {
struct zip_error error;
if (_flags < 0 || (_flags & ~(ZIP_CHECKCONS | ZIP_RDONLY))) {
- _zip_set_open_error(zep, NULL, ZIP_ER_INVAL);
- return NULL;
+ _zip_set_open_error(zep, NULL, ZIP_ER_INVAL);
+ return NULL;
}
+#ifndef ENABLE_FDOPEN
+ _zip_set_open_error(zep, NULL, ZIP_ER_OPNOTSUPP);
+ return NULL;
+#else
/* We dup() here to avoid messing with the passed in fd.
We could not restore it to the original state in case of error. */
if ((fd = dup(fd_orig)) < 0) {
- _zip_set_open_error(zep, NULL, ZIP_ER_OPEN);
- return NULL;
+ _zip_set_open_error(zep, NULL, ZIP_ER_OPEN);
+ return NULL;
}
if ((fp = fdopen(fd, "rb")) == NULL) {
- close(fd);
- _zip_set_open_error(zep, NULL, ZIP_ER_OPEN);
- return NULL;
+ close(fd);
+ _zip_set_open_error(zep, NULL, ZIP_ER_OPEN);
+ return NULL;
}
zip_error_init(&error);
if ((src = zip_source_filep_create(fp, 0, -1, &error)) == NULL) {
- fclose(fp);
- _zip_set_open_error(zep, &error, 0);
- zip_error_fini(&error);
- return NULL;
+ fclose(fp);
+ _zip_set_open_error(zep, &error, 0);
+ zip_error_fini(&error);
+ return NULL;
}
if ((za = zip_open_from_source(src, _flags, &error)) == NULL) {
- zip_source_free(src);
- _zip_set_open_error(zep, &error, 0);
- zip_error_fini(&error);
- return NULL;
+ zip_source_free(src);
+ _zip_set_open_error(zep, &error, 0);
+ zip_error_fini(&error);
+ return NULL;
}
zip_error_fini(&error);
close(fd_orig);
return za;
+#endif
}
diff --git a/src/Common/libzip/zip_file_add.c b/src/Common/libzip/zip_file_add.c
index c019d8dd..c2c41e15 100644
--- a/src/Common/libzip/zip_file_add.c
+++ b/src/Common/libzip/zip_file_add.c
@@ -1,9 +1,9 @@
/*
zip_file_add.c -- add file via callback function
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -36,16 +36,16 @@
/*
NOTE: Return type is signed so we can return -1 on error.
- The index can not be larger than ZIP_INT64_MAX since the size
- of the central directory cannot be larger than
- ZIP_UINT64_MAX, and each entry is larger than 2 bytes.
+ The index can not be larger than ZIP_INT64_MAX since the size
+ of the central directory cannot be larger than
+ ZIP_UINT64_MAX, and each entry is larger than 2 bytes.
*/
ZIP_EXTERN zip_int64_t
zip_file_add(zip_t *za, const char *name, zip_source_t *source, zip_flags_t flags) {
if (name == NULL || source == NULL) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return -1;
}
return _zip_file_replace(za, ZIP_UINT64_MAX, name, source, flags);
diff --git a/src/Common/libzip/zip_file_error_clear.c b/src/Common/libzip/zip_file_error_clear.c
index 47e5da63..a10bff80 100644
--- a/src/Common/libzip/zip_file_error_clear.c
+++ b/src/Common/libzip/zip_file_error_clear.c
@@ -1,9 +1,9 @@
/*
zip_file_error_clear.c -- clear zip file error
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -38,7 +38,7 @@
ZIP_EXTERN void
zip_file_error_clear(zip_file_t *zf) {
if (zf == NULL)
- return;
+ return;
_zip_error_clear(&zf->error);
}
diff --git a/src/Common/libzip/zip_file_error_get.c b/src/Common/libzip/zip_file_error_get.c
index 1ed68df1..b93117bb 100644
--- a/src/Common/libzip/zip_file_error_get.c
+++ b/src/Common/libzip/zip_file_error_get.c
@@ -1,9 +1,9 @@
/*
zip_file_error_get.c -- get zip file error
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
diff --git a/src/Common/libzip/zip_file_get_comment.c b/src/Common/libzip/zip_file_get_comment.c
index 8f68141a..fa998f02 100644
--- a/src/Common/libzip/zip_file_get_comment.c
+++ b/src/Common/libzip/zip_file_get_comment.c
@@ -1,9 +1,9 @@
/*
zip_file_get_comment.c -- get file comment
- Copyright (C) 2006-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -43,13 +43,13 @@ zip_file_get_comment(zip_t *za, zip_uint64_t idx, zip_uint32_t *lenp, zip_flags_
const zip_uint8_t *str;
if ((de = _zip_get_dirent(za, idx, flags, NULL)) == NULL)
- return NULL;
+ return NULL;
if ((str = _zip_string_get(de->comment, &len, flags, &za->error)) == NULL)
- return NULL;
+ return NULL;
if (lenp)
- *lenp = len;
+ *lenp = len;
return (const char *)str;
}
diff --git a/src/Common/libzip/zip_file_get_external_attributes.c b/src/Common/libzip/zip_file_get_external_attributes.c
index ebc20580..a79bb3ed 100644
--- a/src/Common/libzip/zip_file_get_external_attributes.c
+++ b/src/Common/libzip/zip_file_get_external_attributes.c
@@ -1,9 +1,9 @@
/*
zip_file_get_external_attributes.c -- get opsys/external attributes
- Copyright (C) 2013-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2013-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -38,13 +38,13 @@ zip_file_get_external_attributes(zip_t *za, zip_uint64_t idx, zip_flags_t flags,
zip_dirent_t *de;
if ((de = _zip_get_dirent(za, idx, flags, NULL)) == NULL)
- return -1;
+ return -1;
if (opsys)
- *opsys = (zip_uint8_t)((de->version_madeby >> 8) & 0xff);
+ *opsys = (zip_uint8_t)((de->version_madeby >> 8) & 0xff);
if (attributes)
- *attributes = de->ext_attrib;
+ *attributes = de->ext_attrib;
return 0;
}
diff --git a/src/Common/libzip/zip_file_get_offset.c b/src/Common/libzip/zip_file_get_offset.c
index 2cf4480d..72f4880e 100644
--- a/src/Common/libzip/zip_file_get_offset.c
+++ b/src/Common/libzip/zip_file_get_offset.c
@@ -1,9 +1,9 @@
/*
zip_file_get_offset.c -- get offset of file data in archive.
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -50,24 +50,24 @@ _zip_file_get_offset(const zip_t *za, zip_uint64_t idx, zip_error_t *error) {
zip_int32_t size;
if (za->entry[idx].orig == NULL) {
- zip_error_set(error, ZIP_ER_INTERNAL, 0);
- return 0;
+ zip_error_set(error, ZIP_ER_INTERNAL, 0);
+ return 0;
}
offset = za->entry[idx].orig->offset;
if (zip_source_seek(za->src, (zip_int64_t)offset, SEEK_SET) < 0) {
- _zip_error_set_from_source(error, za->src);
- return 0;
+ zip_error_set_from_source(error, za->src);
+ return 0;
}
/* TODO: cache? */
if ((size = _zip_dirent_size(za->src, ZIP_EF_LOCAL, error)) < 0)
- return 0;
+ return 0;
if (offset + (zip_uint32_t)size > ZIP_INT64_MAX) {
- zip_error_set(error, ZIP_ER_SEEK, EFBIG);
- return 0;
+ zip_error_set(error, ZIP_ER_SEEK, EFBIG);
+ return 0;
}
return offset + (zip_uint32_t)size;
@@ -79,38 +79,38 @@ _zip_file_get_end(const zip_t *za, zip_uint64_t index, zip_error_t *error) {
zip_dirent_t *entry;
if ((offset = _zip_file_get_offset(za, index, error)) == 0) {
- return 0;
+ return 0;
}
entry = za->entry[index].orig;
if (offset + entry->comp_size < offset || offset + entry->comp_size > ZIP_INT64_MAX) {
- zip_error_set(error, ZIP_ER_SEEK, EFBIG);
- return 0;
+ zip_error_set(error, ZIP_ER_SEEK, EFBIG);
+ return 0;
}
offset += entry->comp_size;
if (entry->bitflags & ZIP_GPBF_DATA_DESCRIPTOR) {
- zip_uint8_t buf[4];
- if (zip_source_seek(za->src, (zip_int64_t)offset, SEEK_SET) < 0) {
- _zip_error_set_from_source(error, za->src);
- return 0;
- }
- if (zip_source_read(za->src, buf, 4) != 4) {
- _zip_error_set_from_source(error, za->src);
- return 0;
- }
- if (memcmp(buf, DATADES_MAGIC, 4) == 0) {
- offset += 4;
- }
- offset += 12;
- if (_zip_dirent_needs_zip64(entry, 0)) {
- offset += 8;
- }
- if (offset > ZIP_INT64_MAX) {
- zip_error_set(error, ZIP_ER_SEEK, EFBIG);
- return 0;
- }
+ zip_uint8_t buf[4];
+ if (zip_source_seek(za->src, (zip_int64_t)offset, SEEK_SET) < 0) {
+ zip_error_set_from_source(error, za->src);
+ return 0;
+ }
+ if (zip_source_read(za->src, buf, 4) != 4) {
+ zip_error_set_from_source(error, za->src);
+ return 0;
+ }
+ if (memcmp(buf, DATADES_MAGIC, 4) == 0) {
+ offset += 4;
+ }
+ offset += 12;
+ if (_zip_dirent_needs_zip64(entry, 0)) {
+ offset += 8;
+ }
+ if (offset > ZIP_INT64_MAX) {
+ zip_error_set(error, ZIP_ER_SEEK, EFBIG);
+ return 0;
+ }
}
return offset;
diff --git a/src/Common/libzip/zip_file_rename.c b/src/Common/libzip/zip_file_rename.c
index 7ca428c4..9ac25814 100644
--- a/src/Common/libzip/zip_file_rename.c
+++ b/src/Common/libzip/zip_file_rename.c
@@ -1,9 +1,9 @@
/*
zip_file_rename.c -- rename file in zip archive
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -43,24 +43,24 @@ zip_file_rename(zip_t *za, zip_uint64_t idx, const char *name, zip_flags_t flags
int old_is_dir, new_is_dir;
if (idx >= za->nentry || (name != NULL && strlen(name) > ZIP_UINT16_MAX)) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return -1;
}
if (ZIP_IS_RDONLY(za)) {
- zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
+ return -1;
}
if ((old_name = zip_get_name(za, idx, 0)) == NULL)
- return -1;
+ return -1;
new_is_dir = (name != NULL && name[strlen(name) - 1] == '/');
old_is_dir = (old_name[strlen(old_name) - 1] == '/');
if (new_is_dir != old_is_dir) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return -1;
}
return _zip_set_name(za, idx, name, flags);
diff --git a/src/Common/libzip/zip_file_replace.c b/src/Common/libzip/zip_file_replace.c
index 87401f4a..4262d453 100644
--- a/src/Common/libzip/zip_file_replace.c
+++ b/src/Common/libzip/zip_file_replace.c
@@ -1,9 +1,9 @@
/*
zip_file_replace.c -- replace file via callback function
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -38,12 +38,12 @@
ZIP_EXTERN int
zip_file_replace(zip_t *za, zip_uint64_t idx, zip_source_t *source, zip_flags_t flags) {
if (idx >= za->nentry || source == NULL) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return -1;
}
if (_zip_file_replace(za, idx, NULL, source, flags) == -1)
- return -1;
+ return -1;
return 0;
}
@@ -56,31 +56,31 @@ _zip_file_replace(zip_t *za, zip_uint64_t idx, const char *name, zip_source_t *s
zip_uint64_t za_nentry_prev;
if (ZIP_IS_RDONLY(za)) {
- zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
+ return -1;
}
za_nentry_prev = za->nentry;
if (idx == ZIP_UINT64_MAX) {
- zip_int64_t i = -1;
+ zip_int64_t i = -1;
- if (flags & ZIP_FL_OVERWRITE)
- i = _zip_name_locate(za, name, flags, NULL);
+ if (flags & ZIP_FL_OVERWRITE)
+ i = _zip_name_locate(za, name, flags, NULL);
- if (i == -1) {
- /* create and use new entry, used by zip_add */
- if ((i = _zip_add_entry(za)) < 0)
- return -1;
- }
- idx = (zip_uint64_t)i;
+ if (i == -1) {
+ /* create and use new entry, used by zip_add */
+ if ((i = _zip_add_entry(za)) < 0)
+ return -1;
+ }
+ idx = (zip_uint64_t)i;
}
if (name && _zip_set_name(za, idx, name, flags) != 0) {
- if (za->nentry != za_nentry_prev) {
- _zip_entry_finalize(za->entry + idx);
- za->nentry = za_nentry_prev;
- }
- return -1;
+ if (za->nentry != za_nentry_prev) {
+ _zip_entry_finalize(za->entry + idx);
+ za->nentry = za_nentry_prev;
+ }
+ return -1;
}
/* does not change any name related data, so we can do it here;
@@ -88,15 +88,15 @@ _zip_file_replace(zip_t *za, zip_uint64_t idx, const char *name, zip_source_t *s
_zip_unchange_data(za->entry + idx);
if (za->entry[idx].orig != NULL && (za->entry[idx].changes == NULL || (za->entry[idx].changes->changed & ZIP_DIRENT_COMP_METHOD) == 0)) {
- if (za->entry[idx].changes == NULL) {
- if ((za->entry[idx].changes = _zip_dirent_clone(za->entry[idx].orig)) == NULL) {
- zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
- return -1;
- }
- }
-
- za->entry[idx].changes->comp_method = ZIP_CM_REPLACED_DEFAULT;
- za->entry[idx].changes->changed |= ZIP_DIRENT_COMP_METHOD;
+ if (za->entry[idx].changes == NULL) {
+ if ((za->entry[idx].changes = _zip_dirent_clone(za->entry[idx].orig)) == NULL) {
+ zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
+ return -1;
+ }
+ }
+
+ za->entry[idx].changes->comp_method = ZIP_CM_REPLACED_DEFAULT;
+ za->entry[idx].changes->changed |= ZIP_DIRENT_COMP_METHOD;
}
za->entry[idx].source = source;
diff --git a/src/Common/libzip/zip_file_set_comment.c b/src/Common/libzip/zip_file_set_comment.c
index c309db8b..570f8e82 100644
--- a/src/Common/libzip/zip_file_set_comment.c
+++ b/src/Common/libzip/zip_file_set_comment.c
@@ -1,9 +1,9 @@
/*
zip_file_set_comment.c -- set comment for file in archive
- Copyright (C) 2006-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -44,57 +44,61 @@ zip_file_set_comment(zip_t *za, zip_uint64_t idx, const char *comment, zip_uint1
int changed;
if (_zip_get_dirent(za, idx, 0, NULL) == NULL)
- return -1;
+ return -1;
if (ZIP_IS_RDONLY(za)) {
- zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
+ return -1;
+ }
+ if (ZIP_WANT_TORRENTZIP(za)) {
+ zip_error_set(&za->error, ZIP_ER_NOT_ALLOWED, 0);
+ return -1;
}
if (len > 0 && comment == NULL) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return -1;
}
if (len > 0) {
- if ((cstr = _zip_string_new((const zip_uint8_t *)comment, len, flags, &za->error)) == NULL)
- return -1;
- if ((flags & ZIP_FL_ENCODING_ALL) == ZIP_FL_ENC_GUESS && _zip_guess_encoding(cstr, ZIP_ENCODING_UNKNOWN) == ZIP_ENCODING_UTF8_GUESSED)
- cstr->encoding = ZIP_ENCODING_UTF8_KNOWN;
+ if ((cstr = _zip_string_new((const zip_uint8_t *)comment, len, flags, &za->error)) == NULL)
+ return -1;
+ if ((flags & ZIP_FL_ENCODING_ALL) == ZIP_FL_ENC_GUESS && _zip_guess_encoding(cstr, ZIP_ENCODING_UNKNOWN) == ZIP_ENCODING_UTF8_GUESSED)
+ cstr->encoding = ZIP_ENCODING_UTF8_KNOWN;
}
else
- cstr = NULL;
+ cstr = NULL;
e = za->entry + idx;
if (e->changes) {
- _zip_string_free(e->changes->comment);
- e->changes->comment = NULL;
- e->changes->changed &= ~ZIP_DIRENT_COMMENT;
+ _zip_string_free(e->changes->comment);
+ e->changes->comment = NULL;
+ e->changes->changed &= ~ZIP_DIRENT_COMMENT;
}
if (e->orig && e->orig->comment)
- changed = !_zip_string_equal(e->orig->comment, cstr);
+ changed = !_zip_string_equal(e->orig->comment, cstr);
else
- changed = (cstr != NULL);
+ changed = (cstr != NULL);
if (changed) {
- if (e->changes == NULL) {
- if ((e->changes = _zip_dirent_clone(e->orig)) == NULL) {
- zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
- _zip_string_free(cstr);
- return -1;
- }
- }
- e->changes->comment = cstr;
- e->changes->changed |= ZIP_DIRENT_COMMENT;
+ if (e->changes == NULL) {
+ if ((e->changes = _zip_dirent_clone(e->orig)) == NULL) {
+ zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
+ _zip_string_free(cstr);
+ return -1;
+ }
+ }
+ e->changes->comment = cstr;
+ e->changes->changed |= ZIP_DIRENT_COMMENT;
}
else {
- _zip_string_free(cstr);
- if (e->changes && e->changes->changed == 0) {
- _zip_dirent_free(e->changes);
- e->changes = NULL;
- }
+ _zip_string_free(cstr);
+ if (e->changes && e->changes->changed == 0) {
+ _zip_dirent_free(e->changes);
+ e->changes = NULL;
+ }
}
return 0;
diff --git a/src/Common/libzip/zip_file_set_encryption.c b/src/Common/libzip/zip_file_set_encryption.c
new file mode 100644
index 00000000..1cdcd4ab
--- /dev/null
+++ b/src/Common/libzip/zip_file_set_encryption.c
@@ -0,0 +1,120 @@
+/*
+ zip_file_set_encryption.c -- set encryption for file in archive
+ Copyright (C) 2016-2021 Dieter Baron and Thomas Klausner
+
+ This file is part of libzip, a library to manipulate ZIP archives.
+ The authors can be contacted at <info@libzip.org>
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ 3. The names of the authors may not be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "zipint.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+ZIP_EXTERN int
+zip_file_set_encryption(zip_t *za, zip_uint64_t idx, zip_uint16_t method, const char *password) {
+ zip_entry_t *e;
+ zip_uint16_t old_method;
+
+ if (idx >= za->nentry) {
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return -1;
+ }
+
+ if (ZIP_IS_RDONLY(za)) {
+ zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
+ return -1;
+ }
+ if (ZIP_WANT_TORRENTZIP(za)) {
+ zip_error_set(&za->error, ZIP_ER_NOT_ALLOWED, 0);
+ return -1;
+ }
+
+ if (method != ZIP_EM_NONE && _zip_get_encryption_implementation(method, ZIP_CODEC_ENCODE) == NULL) {
+ zip_error_set(&za->error, ZIP_ER_ENCRNOTSUPP, 0);
+ return -1;
+ }
+
+ e = za->entry + idx;
+
+ old_method = (e->orig == NULL ? ZIP_EM_NONE : e->orig->encryption_method);
+
+ if (method == old_method && password == NULL) {
+ if (e->changes) {
+ if (e->changes->changed & ZIP_DIRENT_PASSWORD) {
+ _zip_crypto_clear(e->changes->password, strlen(e->changes->password));
+ free(e->changes->password);
+ e->changes->password = (e->orig == NULL ? NULL : e->orig->password);
+ }
+ e->changes->changed &= ~(ZIP_DIRENT_ENCRYPTION_METHOD | ZIP_DIRENT_PASSWORD);
+ if (e->changes->changed == 0) {
+ _zip_dirent_free(e->changes);
+ e->changes = NULL;
+ }
+ }
+ }
+ else {
+ char *our_password = NULL;
+
+ if (password) {
+ if ((our_password = strdup(password)) == NULL) {
+ zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
+ return -1;
+ }
+ }
+
+ if (e->changes == NULL) {
+ if ((e->changes = _zip_dirent_clone(e->orig)) == NULL) {
+ if (our_password) {
+ _zip_crypto_clear(our_password, strlen(our_password));
+ }
+ free(our_password);
+ zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
+ return -1;
+ }
+ }
+
+ e->changes->encryption_method = method;
+ e->changes->changed |= ZIP_DIRENT_ENCRYPTION_METHOD;
+ if (password) {
+ e->changes->password = our_password;
+ e->changes->changed |= ZIP_DIRENT_PASSWORD;
+ }
+ else {
+ if (e->changes->changed & ZIP_DIRENT_PASSWORD) {
+ _zip_crypto_clear(e->changes->password, strlen(e->changes->password));
+ free(e->changes->password);
+ e->changes->password = e->orig ? e->orig->password : NULL;
+ e->changes->changed &= ~ZIP_DIRENT_PASSWORD;
+ }
+ }
+ }
+
+ return 0;
+}
diff --git a/src/Common/libzip/zip_file_set_external_attributes.c b/src/Common/libzip/zip_file_set_external_attributes.c
index bb2ea614..2e0429b8 100644
--- a/src/Common/libzip/zip_file_set_external_attributes.c
+++ b/src/Common/libzip/zip_file_set_external_attributes.c
@@ -1,9 +1,9 @@
/*
zip_file_set_external_attributes.c -- set external attributes for entry
- Copyright (C) 2013-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2013-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -41,11 +41,15 @@ zip_file_set_external_attributes(zip_t *za, zip_uint64_t idx, zip_flags_t flags,
zip_uint32_t unchanged_attributes;
if (_zip_get_dirent(za, idx, 0, NULL) == NULL)
- return -1;
+ return -1;
if (ZIP_IS_RDONLY(za)) {
- zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
+ return -1;
+ }
+ if (ZIP_WANT_TORRENTZIP(za)) {
+ zip_error_set(&za->error, ZIP_ER_NOT_ALLOWED, 0);
+ return -1;
}
e = za->entry + idx;
@@ -56,26 +60,26 @@ zip_file_set_external_attributes(zip_t *za, zip_uint64_t idx, zip_flags_t flags,
changed = (opsys != unchanged_opsys || attributes != unchanged_attributes);
if (changed) {
- if (e->changes == NULL) {
- if ((e->changes = _zip_dirent_clone(e->orig)) == NULL) {
- zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
- return -1;
- }
- }
- e->changes->version_madeby = (zip_uint16_t)((opsys << 8) | (e->changes->version_madeby & 0xff));
- e->changes->ext_attrib = attributes;
- e->changes->changed |= ZIP_DIRENT_ATTRIBUTES;
+ if (e->changes == NULL) {
+ if ((e->changes = _zip_dirent_clone(e->orig)) == NULL) {
+ zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
+ return -1;
+ }
+ }
+ e->changes->version_madeby = (zip_uint16_t)((opsys << 8) | (e->changes->version_madeby & 0xff));
+ e->changes->ext_attrib = attributes;
+ e->changes->changed |= ZIP_DIRENT_ATTRIBUTES;
}
else if (e->changes) {
- e->changes->changed &= ~ZIP_DIRENT_ATTRIBUTES;
- if (e->changes->changed == 0) {
- _zip_dirent_free(e->changes);
- e->changes = NULL;
- }
- else {
- e->changes->version_madeby = (zip_uint16_t)((unchanged_opsys << 8) | (e->changes->version_madeby & 0xff));
- e->changes->ext_attrib = unchanged_attributes;
- }
+ e->changes->changed &= ~ZIP_DIRENT_ATTRIBUTES;
+ if (e->changes->changed == 0) {
+ _zip_dirent_free(e->changes);
+ e->changes = NULL;
+ }
+ else {
+ e->changes->version_madeby = (zip_uint16_t)((unchanged_opsys << 8) | (e->changes->version_madeby & 0xff));
+ e->changes->ext_attrib = unchanged_attributes;
+ }
}
return 0;
diff --git a/src/Common/libzip/zip_file_set_mtime.c b/src/Common/libzip/zip_file_set_mtime.c
index 838548ef..4126f5a1 100644
--- a/src/Common/libzip/zip_file_set_mtime.c
+++ b/src/Common/libzip/zip_file_set_mtime.c
@@ -1,9 +1,9 @@
/*
zip_file_set_mtime.c -- set modification time of entry.
- Copyright (C) 2014-2020 Dieter Baron and Thomas Klausner
+ Copyright (C) 2014-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -45,20 +45,29 @@ zip_file_set_mtime(zip_t *za, zip_uint64_t idx, time_t mtime, zip_flags_t flags)
zip_entry_t *e;
if (_zip_get_dirent(za, idx, 0, NULL) == NULL)
- return -1;
+ return -1;
if (ZIP_IS_RDONLY(za)) {
- zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
+ return -1;
+ }
+ if (ZIP_WANT_TORRENTZIP(za)) {
+ zip_error_set(&za->error, ZIP_ER_NOT_ALLOWED, 0);
+ return -1;
}
e = za->entry + idx;
+ if (e->orig != NULL && e->orig->encryption_method == ZIP_EM_TRAD_PKWARE && !ZIP_ENTRY_CHANGED(e, ZIP_DIRENT_ENCRYPTION_METHOD) && !ZIP_ENTRY_DATA_CHANGED(e)) {
+ zip_error_set(&za->error, ZIP_ER_OPNOTSUPP, 0);
+ return -1;
+ }
+
if (e->changes == NULL) {
- if ((e->changes = _zip_dirent_clone(e->orig)) == NULL) {
- zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
- return -1;
- }
+ if ((e->changes = _zip_dirent_clone(e->orig)) == NULL) {
+ zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
+ return -1;
+ }
}
e->changes->last_mod = mtime;
diff --git a/src/Common/libzip/zip_file_strerror.c b/src/Common/libzip/zip_file_strerror.c
index 1fa7fffd..5b5a0092 100644
--- a/src/Common/libzip/zip_file_strerror.c
+++ b/src/Common/libzip/zip_file_strerror.c
@@ -1,9 +1,9 @@
/*
zip_file_sterror.c -- get string representation of zip file error
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
diff --git a/src/Common/libzip/zip_fopen.c b/src/Common/libzip/zip_fopen.c
index 4f1a051d..e3cde9be 100644
--- a/src/Common/libzip/zip_fopen.c
+++ b/src/Common/libzip/zip_fopen.c
@@ -1,9 +1,9 @@
/*
zip_fopen.c -- open file in zip archive for reading
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -40,7 +40,7 @@ zip_fopen(zip_t *za, const char *fname, zip_flags_t flags) {
zip_int64_t idx;
if ((idx = zip_name_locate(za, fname, flags)) < 0)
- return NULL;
+ return NULL;
return zip_fopen_index_encrypted(za, (zip_uint64_t)idx, flags, za->default_password);
}
diff --git a/src/Common/libzip/zip_fopen_encrypted.c b/src/Common/libzip/zip_fopen_encrypted.c
index 9e9b13e5..d5880dcb 100644
--- a/src/Common/libzip/zip_fopen_encrypted.c
+++ b/src/Common/libzip/zip_fopen_encrypted.c
@@ -1,9 +1,9 @@
/*
zip_fopen_encrypted.c -- open file for reading with password
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -40,7 +40,7 @@ zip_fopen_encrypted(zip_t *za, const char *fname, zip_flags_t flags, const char
zip_int64_t idx;
if ((idx = zip_name_locate(za, fname, flags)) < 0)
- return NULL;
+ return NULL;
return zip_fopen_index_encrypted(za, (zip_uint64_t)idx, flags, password);
}
diff --git a/src/Common/libzip/zip_fopen_index.c b/src/Common/libzip/zip_fopen_index.c
index e5205b73..a449b83a 100644
--- a/src/Common/libzip/zip_fopen_index.c
+++ b/src/Common/libzip/zip_fopen_index.c
@@ -1,9 +1,9 @@
/*
zip_fopen_index.c -- open file in zip archive for reading by index
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
diff --git a/src/Common/libzip/zip_fopen_index_encrypted.c b/src/Common/libzip/zip_fopen_index_encrypted.c
index 6712c32a..40483709 100644
--- a/src/Common/libzip/zip_fopen_index_encrypted.c
+++ b/src/Common/libzip/zip_fopen_index_encrypted.c
@@ -1,9 +1,9 @@
/*
zip_fopen_index_encrypted.c -- open file for reading by index w/ password
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -45,18 +45,22 @@ zip_fopen_index_encrypted(zip_t *za, zip_uint64_t index, zip_flags_t flags, cons
zip_file_t *zf;
zip_source_t *src;
- if ((src = _zip_source_zip_new(za, za, index, flags, 0, 0, password)) == NULL)
- return NULL;
+ if (password != NULL && password[0] == '\0') {
+ password = NULL;
+ }
+
+ if ((src = zip_source_zip_file_create(za, index, flags, 0, -1, password, &za->error)) == NULL)
+ return NULL;
if (zip_source_open(src) < 0) {
- _zip_error_set_from_source(&za->error, src);
- zip_source_free(src);
- return NULL;
+ zip_error_set_from_source(&za->error, src);
+ zip_source_free(src);
+ return NULL;
}
if ((zf = _zip_file_new(za)) == NULL) {
- zip_source_free(src);
- return NULL;
+ zip_source_free(src);
+ return NULL;
}
zf->src = src;
@@ -70,13 +74,11 @@ _zip_file_new(zip_t *za) {
zip_file_t *zf;
if ((zf = (zip_file_t *)malloc(sizeof(struct zip_file))) == NULL) {
- zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
- return NULL;
+ zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
+ return NULL;
}
- zf->za = za;
zip_error_init(&zf->error);
- zf->eof = 0;
zf->src = NULL;
return zf;
diff --git a/src/Common/libzip/zip_fread.c b/src/Common/libzip/zip_fread.c
index 646d7124..5b7da46a 100644
--- a/src/Common/libzip/zip_fread.c
+++ b/src/Common/libzip/zip_fread.c
@@ -1,9 +1,9 @@
/*
zip_fread.c -- read from file
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -40,22 +40,23 @@ zip_fread(zip_file_t *zf, void *outbuf, zip_uint64_t toread) {
zip_int64_t n;
if (!zf)
- return -1;
+ return -1;
if (zf->error.zip_err != 0)
- return -1;
+ return -1;
if (toread > ZIP_INT64_MAX) {
- zip_error_set(&zf->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&zf->error, ZIP_ER_INVAL, 0);
+ return -1;
}
- if ((zf->eof) || (toread == 0))
- return 0;
+ if (toread == 0) {
+ return 0;
+ }
if ((n = zip_source_read(zf->src, outbuf, toread)) < 0) {
- _zip_error_set_from_source(&zf->error, zf->src);
- return -1;
+ zip_error_set_from_source(&zf->error, zf->src);
+ return -1;
}
return n;
diff --git a/src/Common/libzip/zip_fseek.c b/src/Common/libzip/zip_fseek.c
new file mode 100644
index 00000000..e68ffd36
--- /dev/null
+++ b/src/Common/libzip/zip_fseek.c
@@ -0,0 +1,61 @@
+/*
+ zip_fseek.c -- seek in file
+ Copyright (C) 2016-2021 Dieter Baron and Thomas Klausner
+
+ This file is part of libzip, a library to manipulate ZIP archives.
+ The authors can be contacted at <info@libzip.org>
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ 3. The names of the authors may not be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "zipint.h"
+
+ZIP_EXTERN zip_int8_t
+zip_fseek(zip_file_t *zf, zip_int64_t offset, int whence) {
+ if (!zf)
+ return -1;
+
+ if (zf->error.zip_err != 0)
+ return -1;
+
+ if (zip_source_seek(zf->src, offset, whence) < 0) {
+ zip_error_set_from_source(&zf->error, zf->src);
+ return -1;
+ }
+
+ return 0;
+}
+
+
+ZIP_EXTERN int
+zip_file_is_seekable(zip_file_t *zfile) {
+ if (!zfile) {
+ return -1;
+ }
+
+ return zip_source_is_seekable(zfile->src);
+}
diff --git a/src/Common/libzip/zip_ftell.c b/src/Common/libzip/zip_ftell.c
new file mode 100644
index 00000000..bf3b03d3
--- /dev/null
+++ b/src/Common/libzip/zip_ftell.c
@@ -0,0 +1,54 @@
+/*
+ zip_ftell.c -- tell position in file
+ Copyright (C) 2016-2021 Dieter Baron and Thomas Klausner
+
+ This file is part of libzip, a library to manipulate ZIP archives.
+ The authors can be contacted at <info@libzip.org>
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ 3. The names of the authors may not be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "zipint.h"
+
+ZIP_EXTERN zip_int64_t
+zip_ftell(zip_file_t *zf) {
+ zip_int64_t res;
+
+ if (!zf)
+ return -1;
+
+ if (zf->error.zip_err != 0)
+ return -1;
+
+ res = zip_source_tell(zf->src);
+ if (res < 0) {
+ zip_error_set_from_source(&zf->error, zf->src);
+ return -1;
+ }
+
+ return res;
+}
diff --git a/src/Common/libzip/zip_get_archive_comment.c b/src/Common/libzip/zip_get_archive_comment.c
index 953c6f42..ea9a00ab 100644
--- a/src/Common/libzip/zip_get_archive_comment.c
+++ b/src/Common/libzip/zip_get_archive_comment.c
@@ -1,9 +1,9 @@
/*
zip_get_archive_comment.c -- get archive comment
- Copyright (C) 2006-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -44,15 +44,15 @@ zip_get_archive_comment(zip_t *za, int *lenp, zip_flags_t flags) {
const zip_uint8_t *str;
if ((flags & ZIP_FL_UNCHANGED) || (za->comment_changes == NULL))
- comment = za->comment_orig;
+ comment = za->comment_orig;
else
- comment = za->comment_changes;
+ comment = za->comment_changes;
if ((str = _zip_string_get(comment, &len, flags, &za->error)) == NULL)
- return NULL;
+ return NULL;
if (lenp)
- *lenp = (int)len;
+ *lenp = (int)len;
return (const char *)str;
}
diff --git a/src/Common/libzip/zip_get_archive_flag.c b/src/Common/libzip/zip_get_archive_flag.c
index fa4dd502..fc200bdc 100644
--- a/src/Common/libzip/zip_get_archive_flag.c
+++ b/src/Common/libzip/zip_get_archive_flag.c
@@ -1,9 +1,9 @@
/*
zip_get_archive_flag.c -- get archive global flag
- Copyright (C) 2008-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2008-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
diff --git a/src/Common/libzip/zip_get_encryption_implementation.c b/src/Common/libzip/zip_get_encryption_implementation.c
index 3909e6f6..72e48fe8 100644
--- a/src/Common/libzip/zip_get_encryption_implementation.c
+++ b/src/Common/libzip/zip_get_encryption_implementation.c
@@ -1,9 +1,9 @@
/*
zip_get_encryption_implementation.c -- get encryption implementation
- Copyright (C) 2009-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -39,24 +39,24 @@ zip_encryption_implementation
_zip_get_encryption_implementation(zip_uint16_t em, int operation) {
switch (em) {
case ZIP_EM_TRAD_PKWARE:
- return operation == ZIP_CODEC_DECODE ? zip_source_pkware_decode : zip_source_pkware_encode;
+ return operation == ZIP_CODEC_DECODE ? zip_source_pkware_decode : zip_source_pkware_encode;
#if defined(HAVE_CRYPTO)
case ZIP_EM_AES_128:
case ZIP_EM_AES_192:
case ZIP_EM_AES_256:
- return operation == ZIP_CODEC_DECODE ? zip_source_winzip_aes_decode : zip_source_winzip_aes_encode;
+ return operation == ZIP_CODEC_DECODE ? zip_source_winzip_aes_decode : zip_source_winzip_aes_encode;
#endif
default:
- return NULL;
+ return NULL;
}
}
ZIP_EXTERN int
zip_encryption_method_supported(zip_uint16_t method, int encode) {
if (method == ZIP_EM_NONE) {
- return 1;
+ return 1;
}
return _zip_get_encryption_implementation(method, encode ? ZIP_CODEC_ENCODE : ZIP_CODEC_DECODE) != NULL;
}
diff --git a/src/Common/libzip/zip_get_file_comment.c b/src/Common/libzip/zip_get_file_comment.c
index f8006861..d58e22ba 100644
--- a/src/Common/libzip/zip_get_file_comment.c
+++ b/src/Common/libzip/zip_get_file_comment.c
@@ -1,9 +1,9 @@
/*
zip_get_file_comment.c -- get file comment
- Copyright (C) 2006-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -42,8 +42,8 @@ zip_get_file_comment(zip_t *za, zip_uint64_t idx, int *lenp, int flags) {
const char *s;
if ((s = zip_file_get_comment(za, idx, &len, (zip_flags_t)flags)) != NULL) {
- if (lenp)
- *lenp = (int)len;
+ if (lenp)
+ *lenp = (int)len;
}
return s;
diff --git a/src/Common/libzip/zip_get_name.c b/src/Common/libzip/zip_get_name.c
index 43442093..4828d781 100644
--- a/src/Common/libzip/zip_get_name.c
+++ b/src/Common/libzip/zip_get_name.c
@@ -1,9 +1,9 @@
/*
zip_get_name.c -- get filename for a file in zip file
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -49,10 +49,10 @@ _zip_get_name(zip_t *za, zip_uint64_t idx, zip_flags_t flags, zip_error_t *error
const zip_uint8_t *str;
if ((de = _zip_get_dirent(za, idx, flags, error)) == NULL)
- return NULL;
+ return NULL;
if ((str = _zip_string_get(de->filename, NULL, flags, error)) == NULL)
- return NULL;
+ return NULL;
return (const char *)str;
}
diff --git a/src/Common/libzip/zip_get_num_entries.c b/src/Common/libzip/zip_get_num_entries.c
index 410d26e1..667dc511 100644
--- a/src/Common/libzip/zip_get_num_entries.c
+++ b/src/Common/libzip/zip_get_num_entries.c
@@ -1,9 +1,9 @@
/*
zip_get_num_entries.c -- get number of entries in archive
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -40,13 +40,13 @@ zip_get_num_entries(zip_t *za, zip_flags_t flags) {
zip_uint64_t n;
if (za == NULL)
- return -1;
+ return -1;
if (flags & ZIP_FL_UNCHANGED) {
- n = za->nentry;
- while (n > 0 && za->entry[n - 1].orig == NULL)
- --n;
- return (zip_int64_t)n;
+ n = za->nentry;
+ while (n > 0 && za->entry[n - 1].orig == NULL)
+ --n;
+ return (zip_int64_t)n;
}
return (zip_int64_t)za->nentry;
}
diff --git a/src/Common/libzip/zip_get_num_files.c b/src/Common/libzip/zip_get_num_files.c
index 4895eaab..140e34f9 100644
--- a/src/Common/libzip/zip_get_num_files.c
+++ b/src/Common/libzip/zip_get_num_files.c
@@ -1,9 +1,9 @@
/*
zip_get_num_files.c -- get number of files in archive
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -40,11 +40,11 @@
ZIP_EXTERN int
zip_get_num_files(zip_t *za) {
if (za == NULL)
- return -1;
+ return -1;
if (za->nentry > INT_MAX) {
- zip_error_set(&za->error, ZIP_ER_OPNOTSUPP, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_OPNOTSUPP, 0);
+ return -1;
}
return (int)za->nentry;
diff --git a/src/Common/libzip/zip_hash.c b/src/Common/libzip/zip_hash.c
index 3206dbf7..d3a954ec 100644
--- a/src/Common/libzip/zip_hash.c
+++ b/src/Common/libzip/zip_hash.c
@@ -1,9 +1,9 @@
/*
zip_hash.c -- hash table string -> uint64
- Copyright (C) 2015-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2015-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -67,9 +67,9 @@ struct zip_hash {
static void
free_list(zip_hash_entry_t *entry) {
while (entry != NULL) {
- zip_hash_entry_t *next = entry->next;
- free(entry);
- entry = next;
+ zip_hash_entry_t *next = entry->next;
+ free(entry);
+ entry = next;
}
}
@@ -80,12 +80,12 @@ hash_string(const zip_uint8_t *name) {
zip_uint64_t value = HASH_START;
if (name == NULL) {
- return 0;
+ return 0;
}
while (*name != 0) {
- value = (zip_uint64_t)(((value * HASH_MULTIPLIER) + (zip_uint8_t)*name) % 0x100000000ul);
- name++;
+ value = (zip_uint64_t)(((value * HASH_MULTIPLIER) + (zip_uint8_t)*name) % 0x100000000ul);
+ name++;
}
return (zip_uint32_t)value;
@@ -98,30 +98,30 @@ hash_resize(zip_hash_t *hash, zip_uint32_t new_size, zip_error_t *error) {
zip_hash_entry_t **new_table;
if (new_size == hash->table_size) {
- return true;
+ return true;
}
if ((new_table = (zip_hash_entry_t **)calloc(new_size, sizeof(zip_hash_entry_t *))) == NULL) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- return false;
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return false;
}
if (hash->nentries > 0) {
- zip_uint32_t i;
+ zip_uint32_t i;
- for (i = 0; i < hash->table_size; i++) {
- zip_hash_entry_t *entry = hash->table[i];
- while (entry) {
- zip_hash_entry_t *next = entry->next;
+ for (i = 0; i < hash->table_size; i++) {
+ zip_hash_entry_t *entry = hash->table[i];
+ while (entry) {
+ zip_hash_entry_t *next = entry->next;
- zip_uint32_t new_index = entry->hash_value % new_size;
+ zip_uint32_t new_index = entry->hash_value % new_size;
- entry->next = new_table[new_index];
- new_table[new_index] = entry;
+ entry->next = new_table[new_index];
+ new_table[new_index] = entry;
- entry = next;
- }
- }
+ entry = next;
+ }
+ }
}
free(hash->table);
@@ -138,14 +138,14 @@ size_for_capacity(zip_uint64_t capacity) {
zip_uint32_t v;
if (needed_size > ZIP_UINT32_MAX) {
- v = ZIP_UINT32_MAX;
+ v = ZIP_UINT32_MAX;
}
else {
- v = (zip_uint32_t)needed_size;
+ v = (zip_uint32_t)needed_size;
}
if (v > HASH_MAX_SIZE) {
- return HASH_MAX_SIZE;
+ return HASH_MAX_SIZE;
}
/* From Bit Twiddling Hacks by Sean Eron Anderson <seander@cs.stanford.edu>
@@ -168,8 +168,8 @@ _zip_hash_new(zip_error_t *error) {
zip_hash_t *hash;
if ((hash = (zip_hash_t *)malloc(sizeof(zip_hash_t))) == NULL) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
}
hash->table_size = 0;
@@ -185,16 +185,16 @@ _zip_hash_free(zip_hash_t *hash) {
zip_uint32_t i;
if (hash == NULL) {
- return;
+ return;
}
if (hash->table != NULL) {
- for (i = 0; i < hash->table_size; i++) {
- if (hash->table[i] != NULL) {
- free_list(hash->table[i]);
- }
- }
- free(hash->table);
+ for (i = 0; i < hash->table_size; i++) {
+ if (hash->table[i] != NULL) {
+ free_list(hash->table[i]);
+ }
+ }
+ free(hash->table);
}
free(hash);
}
@@ -207,51 +207,51 @@ _zip_hash_add(zip_hash_t *hash, const zip_uint8_t *name, zip_uint64_t index, zip
zip_hash_entry_t *entry;
if (hash == NULL || name == NULL || index > ZIP_INT64_MAX) {
- zip_error_set(error, ZIP_ER_INVAL, 0);
- return false;
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return false;
}
if (hash->table_size == 0) {
- if (!hash_resize(hash, HASH_MIN_SIZE, error)) {
- return false;
- }
+ if (!hash_resize(hash, HASH_MIN_SIZE, error)) {
+ return false;
+ }
}
hash_value = hash_string(name);
table_index = hash_value % hash->table_size;
for (entry = hash->table[table_index]; entry != NULL; entry = entry->next) {
- if (entry->hash_value == hash_value && strcmp((const char *)name, (const char *)entry->name) == 0) {
- if (((flags & ZIP_FL_UNCHANGED) && entry->orig_index != -1) || entry->current_index != -1) {
- zip_error_set(error, ZIP_ER_EXISTS, 0);
- return false;
- }
- else {
- break;
- }
- }
+ if (entry->hash_value == hash_value && strcmp((const char *)name, (const char *)entry->name) == 0) {
+ if (((flags & ZIP_FL_UNCHANGED) && entry->orig_index != -1) || entry->current_index != -1) {
+ zip_error_set(error, ZIP_ER_EXISTS, 0);
+ return false;
+ }
+ else {
+ break;
+ }
+ }
}
if (entry == NULL) {
- if ((entry = (zip_hash_entry_t *)malloc(sizeof(zip_hash_entry_t))) == NULL) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- return false;
- }
- entry->name = name;
- entry->next = hash->table[table_index];
- hash->table[table_index] = entry;
- entry->hash_value = hash_value;
- entry->orig_index = -1;
- hash->nentries++;
- if (hash->nentries > hash->table_size * HASH_MAX_FILL && hash->table_size < HASH_MAX_SIZE) {
- if (!hash_resize(hash, hash->table_size * 2, error)) {
- return false;
- }
- }
+ if ((entry = (zip_hash_entry_t *)malloc(sizeof(zip_hash_entry_t))) == NULL) {
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return false;
+ }
+ entry->name = name;
+ entry->next = hash->table[table_index];
+ hash->table[table_index] = entry;
+ entry->hash_value = hash_value;
+ entry->orig_index = -1;
+ hash->nentries++;
+ if (hash->nentries > hash->table_size * HASH_MAX_FILL && hash->table_size < HASH_MAX_SIZE) {
+ if (!hash_resize(hash, hash->table_size * 2, error)) {
+ return false;
+ }
+ }
}
if (flags & ZIP_FL_UNCHANGED) {
- entry->orig_index = (zip_int64_t)index;
+ entry->orig_index = (zip_int64_t)index;
}
entry->current_index = (zip_int64_t)index;
@@ -266,40 +266,40 @@ _zip_hash_delete(zip_hash_t *hash, const zip_uint8_t *name, zip_error_t *error)
zip_hash_entry_t *entry, *previous;
if (hash == NULL || name == NULL) {
- zip_error_set(error, ZIP_ER_INVAL, 0);
- return false;
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return false;
}
if (hash->nentries > 0) {
- hash_value = hash_string(name);
- index = hash_value % hash->table_size;
- previous = NULL;
- entry = hash->table[index];
- while (entry) {
- if (entry->hash_value == hash_value && strcmp((const char *)name, (const char *)entry->name) == 0) {
- if (entry->orig_index == -1) {
- if (previous) {
- previous->next = entry->next;
- }
- else {
- hash->table[index] = entry->next;
- }
- free(entry);
- hash->nentries--;
- if (hash->nentries < hash->table_size * HASH_MIN_FILL && hash->table_size > HASH_MIN_SIZE) {
- if (!hash_resize(hash, hash->table_size / 2, error)) {
- return false;
- }
- }
- }
- else {
- entry->current_index = -1;
- }
- return true;
- }
- previous = entry;
- entry = entry->next;
- }
+ hash_value = hash_string(name);
+ index = hash_value % hash->table_size;
+ previous = NULL;
+ entry = hash->table[index];
+ while (entry) {
+ if (entry->hash_value == hash_value && strcmp((const char *)name, (const char *)entry->name) == 0) {
+ if (entry->orig_index == -1) {
+ if (previous) {
+ previous->next = entry->next;
+ }
+ else {
+ hash->table[index] = entry->next;
+ }
+ free(entry);
+ hash->nentries--;
+ if (hash->nentries < hash->table_size * HASH_MIN_FILL && hash->table_size > HASH_MIN_SIZE) {
+ if (!hash_resize(hash, hash->table_size / 2, error)) {
+ return false;
+ }
+ }
+ }
+ else {
+ entry->current_index = -1;
+ }
+ return true;
+ }
+ previous = entry;
+ entry = entry->next;
+ }
}
zip_error_set(error, ZIP_ER_NOENT, 0);
@@ -314,28 +314,28 @@ _zip_hash_lookup(zip_hash_t *hash, const zip_uint8_t *name, zip_flags_t flags, z
zip_hash_entry_t *entry;
if (hash == NULL || name == NULL) {
- zip_error_set(error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return -1;
}
if (hash->nentries > 0) {
- hash_value = hash_string(name);
- index = hash_value % hash->table_size;
- for (entry = hash->table[index]; entry != NULL; entry = entry->next) {
- if (strcmp((const char *)name, (const char *)entry->name) == 0) {
- if (flags & ZIP_FL_UNCHANGED) {
- if (entry->orig_index != -1) {
- return entry->orig_index;
- }
- }
- else {
- if (entry->current_index != -1) {
- return entry->current_index;
- }
- }
- break;
- }
- }
+ hash_value = hash_string(name);
+ index = hash_value % hash->table_size;
+ for (entry = hash->table[index]; entry != NULL; entry = entry->next) {
+ if (strcmp((const char *)name, (const char *)entry->name) == 0) {
+ if (flags & ZIP_FL_UNCHANGED) {
+ if (entry->orig_index != -1) {
+ return entry->orig_index;
+ }
+ }
+ else {
+ if (entry->current_index != -1) {
+ return entry->current_index;
+ }
+ }
+ break;
+ }
+ }
}
zip_error_set(error, ZIP_ER_NOENT, 0);
@@ -348,17 +348,17 @@ _zip_hash_reserve_capacity(zip_hash_t *hash, zip_uint64_t capacity, zip_error_t
zip_uint32_t new_size;
if (capacity == 0) {
- return true;
+ return true;
}
new_size = size_for_capacity(capacity);
if (new_size <= hash->table_size) {
- return true;
+ return true;
}
if (!hash_resize(hash, new_size, error)) {
- return false;
+ return false;
}
return true;
@@ -371,39 +371,39 @@ _zip_hash_revert(zip_hash_t *hash, zip_error_t *error) {
zip_hash_entry_t *entry, *previous;
for (i = 0; i < hash->table_size; i++) {
- previous = NULL;
- entry = hash->table[i];
- while (entry) {
- if (entry->orig_index == -1) {
- zip_hash_entry_t *p;
- if (previous) {
- previous->next = entry->next;
- }
- else {
- hash->table[i] = entry->next;
- }
- p = entry;
- entry = entry->next;
- /* previous does not change */
- free(p);
- hash->nentries--;
- }
- else {
- entry->current_index = entry->orig_index;
- previous = entry;
- entry = entry->next;
- }
- }
+ previous = NULL;
+ entry = hash->table[i];
+ while (entry) {
+ if (entry->orig_index == -1) {
+ zip_hash_entry_t *p;
+ if (previous) {
+ previous->next = entry->next;
+ }
+ else {
+ hash->table[i] = entry->next;
+ }
+ p = entry;
+ entry = entry->next;
+ /* previous does not change */
+ free(p);
+ hash->nentries--;
+ }
+ else {
+ entry->current_index = entry->orig_index;
+ previous = entry;
+ entry = entry->next;
+ }
+ }
}
if (hash->nentries < hash->table_size * HASH_MIN_FILL && hash->table_size > HASH_MIN_SIZE) {
- zip_uint32_t new_size = hash->table_size / 2;
- while (hash->nentries < new_size * HASH_MIN_FILL && new_size > HASH_MIN_SIZE) {
- new_size /= 2;
- }
- if (!hash_resize(hash, new_size, error)) {
- return false;
- }
+ zip_uint32_t new_size = hash->table_size / 2;
+ while (hash->nentries < new_size * HASH_MIN_FILL && new_size > HASH_MIN_SIZE) {
+ new_size /= 2;
+ }
+ if (!hash_resize(hash, new_size, error)) {
+ return false;
+ }
}
return true;
diff --git a/src/Common/libzip/zip_io_util.c b/src/Common/libzip/zip_io_util.c
index dd07cbb9..9fcd10b4 100644
--- a/src/Common/libzip/zip_io_util.c
+++ b/src/Common/libzip/zip_io_util.c
@@ -1,9 +1,9 @@
/*
zip_io_util.c -- I/O helper functions
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -31,8 +31,10 @@
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <limits.h>
#include <stdlib.h>
#include <string.h>
+#include <zlib.h>
#include "zipint.h"
@@ -41,18 +43,18 @@ _zip_read(zip_source_t *src, zip_uint8_t *b, zip_uint64_t length, zip_error_t *e
zip_int64_t n;
if (length > ZIP_INT64_MAX) {
- zip_error_set(error, ZIP_ER_INTERNAL, 0);
- return -1;
+ zip_error_set(error, ZIP_ER_INTERNAL, 0);
+ return -1;
}
if ((n = zip_source_read(src, b, length)) < 0) {
- _zip_error_set_from_source(error, src);
- return -1;
+ zip_error_set_from_source(error, src);
+ return -1;
}
if (n < (zip_int64_t)length) {
- zip_error_set(error, ZIP_ER_EOF, 0);
- return -1;
+ zip_error_set(error, ZIP_ER_EOF, 0);
+ return -1;
}
return 0;
@@ -64,39 +66,39 @@ _zip_read_data(zip_buffer_t *buffer, zip_source_t *src, size_t length, bool nulp
zip_uint8_t *r;
if (length == 0 && !nulp) {
- return NULL;
+ return NULL;
}
r = (zip_uint8_t *)malloc(length + (nulp ? 1 : 0));
if (!r) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
}
if (buffer) {
- zip_uint8_t *data = _zip_buffer_get(buffer, length);
-
- if (data == NULL) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- free(r);
- return NULL;
- }
- memcpy(r, data, length);
+ zip_uint8_t *data = _zip_buffer_get(buffer, length);
+
+ if (data == NULL) {
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ free(r);
+ return NULL;
+ }
+ (void)memcpy_s(r, length, data, length);
}
else {
- if (_zip_read(src, r, length, error) < 0) {
- free(r);
- return NULL;
- }
+ if (_zip_read(src, r, length, error) < 0) {
+ free(r);
+ return NULL;
+ }
}
if (nulp) {
- zip_uint8_t *o;
- /* replace any in-string NUL characters with spaces */
- r[length] = 0;
- for (o = r; o < r + length; o++)
- if (*o == '\0')
- *o = ' ';
+ zip_uint8_t *o;
+ /* replace any in-string NUL characters with spaces */
+ r[length] = 0;
+ for (o = r; o < r + length; o++)
+ if (*o == '\0')
+ *o = ' ';
}
return r;
@@ -109,7 +111,7 @@ _zip_read_string(zip_buffer_t *buffer, zip_source_t *src, zip_uint16_t len, bool
zip_string_t *s;
if ((raw = _zip_read_data(buffer, src, len, nulp, error)) == NULL)
- return NULL;
+ return NULL;
s = _zip_string_new(raw, len, ZIP_FL_ENC_GUESS, error);
free(raw);
@@ -122,12 +124,22 @@ _zip_write(zip_t *za, const void *data, zip_uint64_t length) {
zip_int64_t n;
if ((n = zip_source_write(za->src, data, length)) < 0) {
- _zip_error_set_from_source(&za->error, za->src);
- return -1;
+ zip_error_set_from_source(&za->error, za->src);
+ return -1;
}
if ((zip_uint64_t)n != length) {
- zip_error_set(&za->error, ZIP_ER_WRITE, EINTR);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_WRITE, EINTR);
+ return -1;
+ }
+
+ if (za->write_crc != NULL) {
+ zip_uint64_t position = 0;
+ while (position < length) {
+ zip_uint64_t nn = ZIP_MIN(UINT_MAX, length - position);
+
+ *za->write_crc = (zip_uint32_t)crc32(*za->write_crc, (const Bytef *)data + position, (uInt)nn);
+ position += nn;
+ }
}
return 0;
diff --git a/src/Common/libzip/zip_libzip_version.c b/src/Common/libzip/zip_libzip_version.c
new file mode 100644
index 00000000..4200727f
--- /dev/null
+++ b/src/Common/libzip/zip_libzip_version.c
@@ -0,0 +1,41 @@
+/*
+ zip_libzip_version.c -- return run-time version of library
+ Copyright (C) 2017-2021 Dieter Baron and Thomas Klausner
+
+ This file is part of libzip, a library to manipulate ZIP archives.
+ The authors can be contacted at <info@libzip.org>
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ 3. The names of the authors may not be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "zipint.h"
+
+
+ZIP_EXTERN const char *
+zip_libzip_version(void) {
+ return LIBZIP_VERSION;
+}
diff --git a/src/Common/libzip/zip_memdup.c b/src/Common/libzip/zip_memdup.c
index 05fcb7b7..75d72c61 100644
--- a/src/Common/libzip/zip_memdup.c
+++ b/src/Common/libzip/zip_memdup.c
@@ -1,9 +1,9 @@
/*
zip_memdup.c -- internal zip function, "strdup" with len
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -42,15 +42,15 @@ _zip_memdup(const void *mem, size_t len, zip_error_t *error) {
void *ret;
if (len == 0)
- return NULL;
+ return NULL;
ret = malloc(len);
if (!ret) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
}
- memcpy(ret, mem, len);
+ (void)memcpy_s(ret, len, mem, len);
return ret;
}
diff --git a/src/Common/libzip/zip_name_locate.c b/src/Common/libzip/zip_name_locate.c
index f7318ece..4248dc2d 100644
--- a/src/Common/libzip/zip_name_locate.c
+++ b/src/Common/libzip/zip_name_locate.c
@@ -1,9 +1,9 @@
/*
zip_name_locate.c -- get index by name
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -49,44 +49,68 @@ zip_name_locate(zip_t *za, const char *fname, zip_flags_t flags) {
zip_int64_t
_zip_name_locate(zip_t *za, const char *fname, zip_flags_t flags, zip_error_t *error) {
int (*cmp)(const char *, const char *);
+ size_t fname_length;
+ zip_string_t *str = NULL;
const char *fn, *p;
zip_uint64_t i;
- if (za == NULL)
- return -1;
+ if (za == NULL) {
+ return -1;
+ }
if (fname == NULL) {
- zip_error_set(error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return -1;
}
- if (flags & (ZIP_FL_NOCASE | ZIP_FL_NODIR | ZIP_FL_ENC_CP437)) {
- /* can't use hash table */
- cmp = (flags & ZIP_FL_NOCASE) ? strcasecmp : strcmp;
-
- for (i = 0; i < za->nentry; i++) {
- fn = _zip_get_name(za, i, flags, error);
-
- /* newly added (partially filled) entry or error */
- if (fn == NULL)
- continue;
+ fname_length = strlen(fname);
- if (flags & ZIP_FL_NODIR) {
- p = strrchr(fn, '/');
- if (p)
- fn = p + 1;
- }
+ if (fname_length > ZIP_UINT16_MAX) {
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return -1;
+ }
- if (cmp(fname, fn) == 0) {
- _zip_error_clear(error);
- return (zip_int64_t)i;
- }
- }
+ if ((flags & (ZIP_FL_ENC_UTF_8 | ZIP_FL_ENC_RAW)) == 0 && fname[0] != '\0') {
+ if ((str = _zip_string_new((const zip_uint8_t *)fname, (zip_uint16_t)strlen(fname), flags, error)) == NULL) {
+ return -1;
+ }
+ if ((fname = (const char *)_zip_string_get(str, NULL, 0, error)) == NULL) {
+ _zip_string_free(str);
+ return -1;
+ }
+ }
- zip_error_set(error, ZIP_ER_NOENT, 0);
- return -1;
+ if (flags & (ZIP_FL_NOCASE | ZIP_FL_NODIR | ZIP_FL_ENC_RAW | ZIP_FL_ENC_STRICT)) {
+ /* can't use hash table */
+ cmp = (flags & ZIP_FL_NOCASE) ? strcasecmp : strcmp;
+
+ for (i = 0; i < za->nentry; i++) {
+ fn = _zip_get_name(za, i, flags, error);
+
+ /* newly added (partially filled) entry or error */
+ if (fn == NULL)
+ continue;
+
+ if (flags & ZIP_FL_NODIR) {
+ p = strrchr(fn, '/');
+ if (p)
+ fn = p + 1;
+ }
+
+ if (cmp(fname, fn) == 0) {
+ _zip_error_clear(error);
+ _zip_string_free(str);
+ return (zip_int64_t)i;
+ }
+ }
+
+ zip_error_set(error, ZIP_ER_NOENT, 0);
+ _zip_string_free(str);
+ return -1;
}
else {
- return _zip_hash_lookup(za->names, (const zip_uint8_t *)fname, flags, error);
+ zip_int64_t ret = _zip_hash_lookup(za->names, (const zip_uint8_t *)fname, flags, error);
+ _zip_string_free(str);
+ return ret;
}
}
diff --git a/src/Common/libzip/zip_new.c b/src/Common/libzip/zip_new.c
index 4f58ecc7..4f69c8a2 100644
--- a/src/Common/libzip/zip_new.c
+++ b/src/Common/libzip/zip_new.c
@@ -1,9 +1,9 @@
/*
zip_new.c -- create and init struct zip
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -47,13 +47,13 @@ _zip_new(zip_error_t *error) {
za = (zip_t *)malloc(sizeof(struct zip));
if (!za) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
}
if ((za->names = _zip_hash_new(error)) == NULL) {
- free(za);
- return NULL;
+ free(za);
+ return NULL;
}
za->src = NULL;
diff --git a/src/Common/libzip/zip_open.c b/src/Common/libzip/zip_open.c
index 019cd987..ee7e9dec 100644
--- a/src/Common/libzip/zip_open.c
+++ b/src/Common/libzip/zip_open.c
@@ -1,9 +1,9 @@
/*
zip_open.c -- open zip archive by name
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -32,6 +32,7 @@
*/
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -41,10 +42,11 @@
typedef enum { EXISTS_ERROR = -1, EXISTS_NOT = 0, EXISTS_OK } exists_t;
static zip_t *_zip_allocate_new(zip_source_t *src, unsigned int flags, zip_error_t *error);
static zip_int64_t _zip_checkcons(zip_t *za, zip_cdir_t *cdir, zip_error_t *error);
+static void zip_check_torrentzip(zip_t *za, const zip_cdir_t *cdir);
static zip_cdir_t *_zip_find_central_dir(zip_t *za, zip_uint64_t len);
static exists_t _zip_file_exists(zip_source_t *src, zip_error_t *error);
static int _zip_headercomp(const zip_dirent_t *, const zip_dirent_t *);
-static unsigned char *_zip_memmem(const unsigned char *, size_t, const unsigned char *, size_t);
+static const unsigned char *_zip_memmem(const unsigned char *, size_t, const unsigned char *, size_t);
static zip_cdir_t *_zip_read_cdir(zip_t *za, zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_error_t *error);
static zip_cdir_t *_zip_read_eocd(zip_buffer_t *buffer, zip_uint64_t buf_offset, unsigned int flags, zip_error_t *error);
static zip_cdir_t *_zip_read_eocd64(zip_source_t *src, zip_buffer_t *buffer, zip_uint64_t buf_offset, unsigned int flags, zip_error_t *error);
@@ -58,16 +60,16 @@ zip_open(const char *fn, int _flags, int *zep) {
zip_error_init(&error);
if ((src = zip_source_file_create(fn, 0, -1, &error)) == NULL) {
- _zip_set_open_error(zep, &error, 0);
- zip_error_fini(&error);
- return NULL;
+ _zip_set_open_error(zep, &error, 0);
+ zip_error_fini(&error);
+ return NULL;
}
if ((za = zip_open_from_source(src, _flags, &error)) == NULL) {
- zip_source_free(src);
- _zip_set_open_error(zep, &error, 0);
- zip_error_fini(&error);
- return NULL;
+ zip_source_free(src);
+ _zip_set_open_error(zep, &error, 0);
+ zip_error_fini(&error);
+ return NULL;
}
zip_error_fini(&error);
@@ -77,73 +79,66 @@ zip_open(const char *fn, int _flags, int *zep) {
ZIP_EXTERN zip_t *
zip_open_from_source(zip_source_t *src, int _flags, zip_error_t *error) {
- static zip_int64_t needed_support_read = -1;
- static zip_int64_t needed_support_write = -1;
-
unsigned int flags;
zip_int64_t supported;
exists_t exists;
if (_flags < 0 || src == NULL) {
- zip_error_set(error, ZIP_ER_INVAL, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return NULL;
}
flags = (unsigned int)_flags;
supported = zip_source_supports(src);
- if (needed_support_read == -1) {
- needed_support_read = zip_source_make_command_bitmap(ZIP_SOURCE_OPEN, ZIP_SOURCE_READ, ZIP_SOURCE_CLOSE, ZIP_SOURCE_SEEK, ZIP_SOURCE_TELL, ZIP_SOURCE_STAT, -1);
- needed_support_write = zip_source_make_command_bitmap(ZIP_SOURCE_BEGIN_WRITE, ZIP_SOURCE_COMMIT_WRITE, ZIP_SOURCE_ROLLBACK_WRITE, ZIP_SOURCE_SEEK_WRITE, ZIP_SOURCE_TELL_WRITE, ZIP_SOURCE_REMOVE, -1);
- }
- if ((supported & needed_support_read) != needed_support_read) {
- zip_error_set(error, ZIP_ER_OPNOTSUPP, 0);
- return NULL;
+ if ((supported & ZIP_SOURCE_SUPPORTS_SEEKABLE) != ZIP_SOURCE_SUPPORTS_SEEKABLE) {
+ zip_error_set(error, ZIP_ER_OPNOTSUPP, 0);
+ return NULL;
}
- if ((supported & needed_support_write) != needed_support_write) {
- flags |= ZIP_RDONLY;
+ if ((supported & ZIP_SOURCE_SUPPORTS_WRITABLE) != ZIP_SOURCE_SUPPORTS_WRITABLE) {
+ flags |= ZIP_RDONLY;
}
if ((flags & (ZIP_RDONLY | ZIP_TRUNCATE)) == (ZIP_RDONLY | ZIP_TRUNCATE)) {
- zip_error_set(error, ZIP_ER_RDONLY, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_RDONLY, 0);
+ return NULL;
}
exists = _zip_file_exists(src, error);
switch (exists) {
case EXISTS_ERROR:
- return NULL;
+ return NULL;
case EXISTS_NOT:
- if ((flags & ZIP_CREATE) == 0) {
- zip_error_set(error, ZIP_ER_NOENT, 0);
- return NULL;
- }
- return _zip_allocate_new(src, flags, error);
+ if ((flags & ZIP_CREATE) == 0) {
+ zip_error_set(error, ZIP_ER_NOENT, 0);
+ return NULL;
+ }
+ return _zip_allocate_new(src, flags, error);
default: {
- zip_t *za;
- if (flags & ZIP_EXCL) {
- zip_error_set(error, ZIP_ER_EXISTS, 0);
- return NULL;
- }
- if (zip_source_open(src) < 0) {
- _zip_error_set_from_source(error, src);
- return NULL;
- }
-
- if (flags & ZIP_TRUNCATE) {
- za = _zip_allocate_new(src, flags, error);
- }
- else {
- /* ZIP_CREATE gets ignored if file exists and not ZIP_EXCL, just like open() */
- za = _zip_open(src, flags, error);
- }
-
- if (za == NULL) {
- zip_source_close(src);
- return NULL;
- }
- return za;
+ zip_t *za;
+ if (flags & ZIP_EXCL) {
+ zip_error_set(error, ZIP_ER_EXISTS, 0);
+ return NULL;
+ }
+ if (zip_source_open(src) < 0) {
+ zip_error_set_from_source(error, src);
+ return NULL;
+ }
+
+ if (flags & ZIP_TRUNCATE) {
+ za = _zip_allocate_new(src, flags, error);
+ }
+ else {
+ /* ZIP_CREATE gets ignored if file exists and not ZIP_EXCL, just like open() */
+ za = _zip_open(src, flags, error);
+ }
+
+ if (za == NULL) {
+ zip_source_close(src);
+ return NULL;
+ }
+ return za;
}
}
}
@@ -158,60 +153,69 @@ _zip_open(zip_source_t *src, unsigned int flags, zip_error_t *error) {
zip_stat_init(&st);
if (zip_source_stat(src, &st) < 0) {
- _zip_error_set_from_source(error, src);
- return NULL;
+ zip_error_set_from_source(error, src);
+ return NULL;
}
if ((st.valid & ZIP_STAT_SIZE) == 0) {
- zip_error_set(error, ZIP_ER_SEEK, EOPNOTSUPP);
- return NULL;
+ zip_error_set(error, ZIP_ER_SEEK, EOPNOTSUPP);
+ return NULL;
}
len = st.size;
if ((za = _zip_allocate_new(src, flags, error)) == NULL) {
- return NULL;
+ return NULL;
}
/* treat empty files as empty archives */
if (len == 0 && zip_source_accept_empty(src)) {
- return za;
+ return za;
}
if ((cdir = _zip_find_central_dir(za, len)) == NULL) {
- _zip_error_copy(error, &za->error);
- /* keep src so discard does not get rid of it */
- zip_source_keep(src);
- zip_discard(za);
- return NULL;
+ _zip_error_copy(error, &za->error);
+ /* keep src so discard does not get rid of it */
+ zip_source_keep(src);
+ zip_discard(za);
+ return NULL;
}
za->entry = cdir->entry;
za->nentry = cdir->nentry;
za->nentry_alloc = cdir->nentry_alloc;
- za->comment_orig = cdir->comment;
+
+ zip_check_torrentzip(za, cdir);
+
+ if (ZIP_IS_TORRENTZIP(za)) {
+ /* Torrentzip uses the archive comment to detect changes by tools that are not torrentzip aware. */
+ _zip_string_free(cdir->comment);
+ }
+ else {
+ za->comment_orig = cdir->comment;
+ }
free(cdir);
_zip_hash_reserve_capacity(za->names, za->nentry, &za->error);
for (idx = 0; idx < za->nentry; idx++) {
- const zip_uint8_t *name = _zip_string_get(za->entry[idx].orig->filename, NULL, 0, error);
- if (name == NULL) {
- /* keep src so discard does not get rid of it */
- zip_source_keep(src);
- zip_discard(za);
- return NULL;
- }
-
- if (_zip_hash_add(za->names, name, idx, ZIP_FL_UNCHANGED, &za->error) == false) {
- if (za->error.zip_err != ZIP_ER_EXISTS || (flags & ZIP_CHECKCONS)) {
- _zip_error_copy(error, &za->error);
- /* keep src so discard does not get rid of it */
- zip_source_keep(src);
- zip_discard(za);
- return NULL;
- }
- }
+ const zip_uint8_t *name = _zip_string_get(za->entry[idx].orig->filename, NULL, 0, error);
+ if (name == NULL) {
+ /* keep src so discard does not get rid of it */
+ zip_source_keep(src);
+ zip_discard(za);
+ return NULL;
+ }
+
+ if (_zip_hash_add(za->names, name, idx, ZIP_FL_UNCHANGED, &za->error) == false) {
+ if (za->error.zip_err != ZIP_ER_EXISTS || (flags & ZIP_CHECKCONS)) {
+ _zip_error_copy(error, &za->error);
+ /* keep src so discard does not get rid of it */
+ zip_source_keep(src);
+ zip_discard(za);
+ return NULL;
+ }
+ }
}
za->ch_flags = za->flags;
@@ -223,14 +227,20 @@ _zip_open(zip_source_t *src, unsigned int flags, zip_error_t *error) {
void
_zip_set_open_error(int *zep, const zip_error_t *err, int ze) {
if (err) {
- ze = zip_error_code_zip(err);
- if (zip_error_system_type(err) == ZIP_ET_SYS) {
- errno = zip_error_code_system(err);
- }
+ ze = zip_error_code_zip(err);
+ switch (zip_error_system_type(err)) {
+ case ZIP_ET_SYS:
+ case ZIP_ET_LIBZIP:
+ errno = zip_error_code_system(err);
+ break;
+
+ default:
+ break;
+ }
}
if (zep)
- *zep = ze;
+ *zep = ze;
}
@@ -249,156 +259,159 @@ _zip_read_cdir(zip_t *za, zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_err
zip_buffer_t *cd_buffer;
if (_zip_buffer_left(buffer) < EOCDLEN) {
- /* not enough bytes left for comment */
- zip_error_set(error, ZIP_ER_NOZIP, 0);
- return NULL;
+ /* not enough bytes left for comment */
+ zip_error_set(error, ZIP_ER_NOZIP, 0);
+ return NULL;
}
/* check for end-of-central-dir magic */
if (memcmp(_zip_buffer_get(buffer, 4), EOCD_MAGIC, 4) != 0) {
- zip_error_set(error, ZIP_ER_NOZIP, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_NOZIP, 0);
+ return NULL;
}
if (eocd_offset >= EOCD64LOCLEN && memcmp(_zip_buffer_data(buffer) + eocd_offset - EOCD64LOCLEN, EOCD64LOC_MAGIC, 4) == 0) {
- _zip_buffer_set_offset(buffer, eocd_offset - EOCD64LOCLEN);
- cd = _zip_read_eocd64(za->src, buffer, buf_offset, za->flags, error);
+ _zip_buffer_set_offset(buffer, eocd_offset - EOCD64LOCLEN);
+ cd = _zip_read_eocd64(za->src, buffer, buf_offset, za->flags, error);
}
else {
- _zip_buffer_set_offset(buffer, eocd_offset);
- cd = _zip_read_eocd(buffer, buf_offset, za->flags, error);
+ _zip_buffer_set_offset(buffer, eocd_offset);
+ cd = _zip_read_eocd(buffer, buf_offset, za->flags, error);
}
if (cd == NULL)
- return NULL;
+ return NULL;
_zip_buffer_set_offset(buffer, eocd_offset + 20);
comment_len = _zip_buffer_get_16(buffer);
if (cd->offset + cd->size > buf_offset + eocd_offset) {
- /* cdir spans past EOCD record */
- zip_error_set(error, ZIP_ER_INCONS, 0);
- _zip_cdir_free(cd);
- return NULL;
+ /* cdir spans past EOCD record */
+ zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_CDIR_OVERLAPS_EOCD);
+ _zip_cdir_free(cd);
+ return NULL;
}
if (comment_len || (za->open_flags & ZIP_CHECKCONS)) {
- zip_uint64_t tail_len;
+ zip_uint64_t tail_len;
- _zip_buffer_set_offset(buffer, eocd_offset + EOCDLEN);
- tail_len = _zip_buffer_left(buffer);
+ _zip_buffer_set_offset(buffer, eocd_offset + EOCDLEN);
+ tail_len = _zip_buffer_left(buffer);
- if (tail_len < comment_len || ((za->open_flags & ZIP_CHECKCONS) && tail_len != comment_len)) {
- zip_error_set(error, ZIP_ER_INCONS, 0);
- _zip_cdir_free(cd);
- return NULL;
- }
+ if (tail_len < comment_len || ((za->open_flags & ZIP_CHECKCONS) && tail_len != comment_len)) {
+ zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_COMMENT_LENGTH_INVALID);
+ _zip_cdir_free(cd);
+ return NULL;
+ }
- if (comment_len) {
- if ((cd->comment = _zip_string_new(_zip_buffer_get(buffer, comment_len), comment_len, ZIP_FL_ENC_GUESS, error)) == NULL) {
- _zip_cdir_free(cd);
- return NULL;
- }
- }
+ if (comment_len) {
+ if ((cd->comment = _zip_string_new(_zip_buffer_get(buffer, comment_len), comment_len, ZIP_FL_ENC_GUESS, error)) == NULL) {
+ _zip_cdir_free(cd);
+ return NULL;
+ }
+ }
}
if (cd->offset >= buf_offset) {
- zip_uint8_t *data;
- /* if buffer already read in, use it */
- _zip_buffer_set_offset(buffer, cd->offset - buf_offset);
-
- if ((data = _zip_buffer_get(buffer, cd->size)) == NULL) {
- zip_error_set(error, ZIP_ER_INCONS, 0);
- _zip_cdir_free(cd);
- return NULL;
- }
- if ((cd_buffer = _zip_buffer_new(data, cd->size)) == NULL) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- _zip_cdir_free(cd);
- return NULL;
- }
+ zip_uint8_t *data;
+ /* if buffer already read in, use it */
+ _zip_buffer_set_offset(buffer, cd->offset - buf_offset);
+
+ if ((data = _zip_buffer_get(buffer, cd->size)) == NULL) {
+ zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_CDIR_LENGTH_INVALID);
+ _zip_cdir_free(cd);
+ return NULL;
+ }
+ if ((cd_buffer = _zip_buffer_new(data, cd->size)) == NULL) {
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ _zip_cdir_free(cd);
+ return NULL;
+ }
}
else {
- cd_buffer = NULL;
+ cd_buffer = NULL;
- if (zip_source_seek(za->src, (zip_int64_t)cd->offset, SEEK_SET) < 0) {
- _zip_error_set_from_source(error, za->src);
- _zip_cdir_free(cd);
- return NULL;
- }
+ if (zip_source_seek(za->src, (zip_int64_t)cd->offset, SEEK_SET) < 0) {
+ zip_error_set_from_source(error, za->src);
+ _zip_cdir_free(cd);
+ return NULL;
+ }
- /* possible consistency check: cd->offset = len-(cd->size+cd->comment_len+EOCDLEN) ? */
- if (zip_source_tell(za->src) != (zip_int64_t)cd->offset) {
- zip_error_set(error, ZIP_ER_NOZIP, 0);
- _zip_cdir_free(cd);
- return NULL;
- }
+ /* possible consistency check: cd->offset = len-(cd->size+cd->comment_len+EOCDLEN) ? */
+ if (zip_source_tell(za->src) != (zip_int64_t)cd->offset) {
+ zip_error_set(error, ZIP_ER_NOZIP, 0);
+ _zip_cdir_free(cd);
+ return NULL;
+ }
}
left = (zip_uint64_t)cd->size;
i = 0;
while (left > 0) {
- bool grown = false;
- zip_int64_t entry_size;
-
- if (i == cd->nentry) {
- /* InfoZIP has a hack to avoid using Zip64: it stores nentries % 0x10000 */
- /* This hack isn't applicable if we're using Zip64, or if there is no central directory entry following. */
-
- if (cd->is_zip64 || left < CDENTRYSIZE) {
- break;
- }
-
- if (!_zip_cdir_grow(cd, 0x10000, error)) {
- _zip_cdir_free(cd);
- _zip_buffer_free(cd_buffer);
- return NULL;
- }
- grown = true;
- }
-
- if ((cd->entry[i].orig = _zip_dirent_new()) == NULL || (entry_size = _zip_dirent_read(cd->entry[i].orig, za->src, cd_buffer, false, error)) < 0) {
- if (grown && zip_error_code_zip(error) == ZIP_ER_NOZIP) {
- zip_error_set(error, ZIP_ER_INCONS, 0);
+ bool grown = false;
+ zip_int64_t entry_size;
+
+ if (i == cd->nentry) {
+ /* InfoZIP has a hack to avoid using Zip64: it stores nentries % 0x10000 */
+ /* This hack isn't applicable if we're using Zip64, or if there is no central directory entry following. */
+
+ if (cd->is_zip64 || left < CDENTRYSIZE) {
+ break;
+ }
+
+ if (!_zip_cdir_grow(cd, 0x10000, error)) {
+ _zip_cdir_free(cd);
+ _zip_buffer_free(cd_buffer);
+ return NULL;
+ }
+ grown = true;
+ }
+
+ if ((cd->entry[i].orig = _zip_dirent_new()) == NULL || (entry_size = _zip_dirent_read(cd->entry[i].orig, za->src, cd_buffer, false, error)) < 0) {
+ if (zip_error_code_zip(error) == ZIP_ER_INCONS) {
+ zip_error_set(error, ZIP_ER_INCONS, ADD_INDEX_TO_DETAIL(zip_error_code_system(error), i));
}
- _zip_cdir_free(cd);
- _zip_buffer_free(cd_buffer);
- return NULL;
- }
- i++;
- left -= (zip_uint64_t)entry_size;
+ else if (grown && zip_error_code_zip(error) == ZIP_ER_NOZIP) {
+ zip_error_set(error, ZIP_ER_INCONS, MAKE_DETAIL_WITH_INDEX(ZIP_ER_DETAIL_CDIR_ENTRY_INVALID, i));
+ }
+ _zip_cdir_free(cd);
+ _zip_buffer_free(cd_buffer);
+ return NULL;
+ }
+ i++;
+ left -= (zip_uint64_t)entry_size;
}
if (i != cd->nentry || left > 0) {
- zip_error_set(error, ZIP_ER_INCONS, 0);
- _zip_buffer_free(cd_buffer);
- _zip_cdir_free(cd);
- return NULL;
+ zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_CDIR_WRONG_ENTRIES_COUNT);
+ _zip_buffer_free(cd_buffer);
+ _zip_cdir_free(cd);
+ return NULL;
}
if (za->open_flags & ZIP_CHECKCONS) {
- bool ok;
-
- if (cd_buffer) {
- ok = _zip_buffer_eof(cd_buffer);
- }
- else {
- zip_int64_t offset = zip_source_tell(za->src);
-
- if (offset < 0) {
- _zip_error_set_from_source(error, za->src);
- _zip_cdir_free(cd);
- return NULL;
- }
- ok = ((zip_uint64_t)offset == cd->offset + cd->size);
- }
-
- if (!ok) {
- zip_error_set(error, ZIP_ER_INCONS, 0);
- _zip_buffer_free(cd_buffer);
- _zip_cdir_free(cd);
- return NULL;
- }
+ bool ok;
+
+ if (cd_buffer) {
+ ok = _zip_buffer_eof(cd_buffer);
+ }
+ else {
+ zip_int64_t offset = zip_source_tell(za->src);
+
+ if (offset < 0) {
+ zip_error_set_from_source(error, za->src);
+ _zip_cdir_free(cd);
+ return NULL;
+ }
+ ok = ((zip_uint64_t)offset == cd->offset + cd->size);
+ }
+
+ if (!ok) {
+ zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_CDIR_LENGTH_INVALID);
+ _zip_buffer_free(cd_buffer);
+ _zip_cdir_free(cd);
+ return NULL;
+ }
}
_zip_buffer_free(cd_buffer);
@@ -420,49 +433,52 @@ _zip_checkcons(zip_t *za, zip_cdir_t *cd, zip_error_t *error) {
_zip_dirent_init(&temp);
if (cd->nentry) {
- max = cd->entry[0].orig->offset;
- min = cd->entry[0].orig->offset;
+ max = cd->entry[0].orig->offset;
+ min = cd->entry[0].orig->offset;
}
else
- min = max = 0;
+ min = max = 0;
for (i = 0; i < cd->nentry; i++) {
- if (cd->entry[i].orig->offset < min)
- min = cd->entry[i].orig->offset;
- if (min > (zip_uint64_t)cd->offset) {
- zip_error_set(error, ZIP_ER_NOZIP, 0);
- return -1;
- }
-
- j = cd->entry[i].orig->offset + cd->entry[i].orig->comp_size + _zip_string_length(cd->entry[i].orig->filename) + LENTRYSIZE;
- if (j > max)
- max = j;
- if (max > (zip_uint64_t)cd->offset) {
- zip_error_set(error, ZIP_ER_NOZIP, 0);
- return -1;
- }
-
- if (zip_source_seek(za->src, (zip_int64_t)cd->entry[i].orig->offset, SEEK_SET) < 0) {
- _zip_error_set_from_source(error, za->src);
- return -1;
- }
-
- if (_zip_dirent_read(&temp, za->src, NULL, true, error) == -1) {
- _zip_dirent_finalize(&temp);
- return -1;
- }
+ if (cd->entry[i].orig->offset < min)
+ min = cd->entry[i].orig->offset;
+ if (min > (zip_uint64_t)cd->offset) {
+ zip_error_set(error, ZIP_ER_NOZIP, 0);
+ return -1;
+ }
+
+ j = cd->entry[i].orig->offset + cd->entry[i].orig->comp_size + _zip_string_length(cd->entry[i].orig->filename) + LENTRYSIZE;
+ if (j > max)
+ max = j;
+ if (max > (zip_uint64_t)cd->offset) {
+ zip_error_set(error, ZIP_ER_NOZIP, 0);
+ return -1;
+ }
+
+ if (zip_source_seek(za->src, (zip_int64_t)cd->entry[i].orig->offset, SEEK_SET) < 0) {
+ zip_error_set_from_source(error, za->src);
+ return -1;
+ }
+
+ if (_zip_dirent_read(&temp, za->src, NULL, true, error) == -1) {
+ if (zip_error_code_zip(error) == ZIP_ER_INCONS) {
+ zip_error_set(error, ZIP_ER_INCONS, ADD_INDEX_TO_DETAIL(zip_error_code_system(error), i));
+ }
+ _zip_dirent_finalize(&temp);
+ return -1;
+ }
- if (_zip_headercomp(cd->entry[i].orig, &temp) != 0) {
- zip_error_set(error, ZIP_ER_INCONS, 0);
- _zip_dirent_finalize(&temp);
- return -1;
- }
+ if (_zip_headercomp(cd->entry[i].orig, &temp) != 0) {
+ zip_error_set(error, ZIP_ER_INCONS, MAKE_DETAIL_WITH_INDEX(ZIP_ER_DETAIL_ENTRY_HEADER_MISMATCH, i));
+ _zip_dirent_finalize(&temp);
+ return -1;
+ }
- cd->entry[i].orig->extra_fields = _zip_ef_merge(cd->entry[i].orig->extra_fields, temp.extra_fields);
- cd->entry[i].orig->local_extra_fields_read = 1;
- temp.extra_fields = NULL;
+ cd->entry[i].orig->extra_fields = _zip_ef_merge(cd->entry[i].orig->extra_fields, temp.extra_fields);
+ cd->entry[i].orig->local_extra_fields_read = 1;
+ temp.extra_fields = NULL;
- _zip_dirent_finalize(&temp);
+ _zip_dirent_finalize(&temp);
}
return (max - min) < ZIP_INT64_MAX ? (zip_int64_t)(max - min) : ZIP_INT64_MAX;
@@ -481,14 +497,25 @@ _zip_headercomp(const zip_dirent_t *central, const zip_dirent_t *local) {
and global headers for the bitflags */
|| (central->bitflags != local->bitflags)
#endif
- || (central->comp_method != local->comp_method) || (central->last_mod != local->last_mod) || !_zip_string_equal(central->filename, local->filename))
- return -1;
+ || (central->comp_method != local->comp_method) || (central->last_mod != local->last_mod) || !_zip_string_equal(central->filename, local->filename))
+ return -1;
if ((central->crc != local->crc) || (central->comp_size != local->comp_size) || (central->uncomp_size != local->uncomp_size)) {
- /* InfoZip stores valid values in local header even when data descriptor is used.
- This is in violation of the appnote. */
- if (((local->bitflags & ZIP_GPBF_DATA_DESCRIPTOR) == 0 || local->crc != 0 || local->comp_size != 0 || local->uncomp_size != 0))
+ /* InfoZip stores valid values in local header even when data descriptor is used.
+ This is in violation of the appnote.
+ macOS Archive sets the compressed size even when data descriptor is used ( but not the others),
+ also in violation of the appnote.
+ */
+ /* if data descriptor is not used, the values must match */
+ if ((local->bitflags & ZIP_GPBF_DATA_DESCRIPTOR) == 0) {
+ return -1;
+ }
+ /* when using a data descriptor, the local header value must be zero or match */
+ if ((local->crc != 0 && central->crc != local->crc) ||
+ (local->comp_size != 0 && central->comp_size != local->comp_size) ||
+ (local->uncomp_size != 0 && central->uncomp_size != local->uncomp_size)) {
return -1;
+ }
}
return 0;
@@ -500,15 +527,20 @@ _zip_allocate_new(zip_source_t *src, unsigned int flags, zip_error_t *error) {
zip_t *za;
if ((za = _zip_new(error)) == NULL) {
- return NULL;
+ return NULL;
}
za->src = src;
za->open_flags = flags;
+ za->flags = 0;
+ za->ch_flags = 0;
+ za->write_crc = NULL;
+
if (flags & ZIP_RDONLY) {
- za->flags |= ZIP_AFL_RDONLY;
- za->ch_flags |= ZIP_AFL_RDONLY;
+ za->flags |= ZIP_AFL_RDONLY;
+ za->ch_flags |= ZIP_AFL_RDONLY;
}
+
return za;
}
@@ -522,12 +554,12 @@ _zip_file_exists(zip_source_t *src, zip_error_t *error) {
zip_stat_init(&st);
if (zip_source_stat(src, &st) != 0) {
- zip_error_t *src_error = zip_source_error(src);
- if (zip_error_code_zip(src_error) == ZIP_ER_READ && zip_error_code_system(src_error) == ENOENT) {
- return EXISTS_NOT;
- }
- _zip_error_copy(error, src_error);
- return EXISTS_ERROR;
+ zip_error_t *src_error = zip_source_error(src);
+ if (zip_error_code_zip(src_error) == ZIP_ER_READ && zip_error_code_system(src_error) == ENOENT) {
+ return EXISTS_NOT;
+ }
+ _zip_error_copy(error, src_error);
+ return EXISTS_ERROR;
}
return EXISTS_OK;
@@ -537,7 +569,7 @@ _zip_file_exists(zip_source_t *src, zip_error_t *error) {
static zip_cdir_t *
_zip_find_central_dir(zip_t *za, zip_uint64_t len) {
zip_cdir_t *cdir, *cdirnew;
- zip_uint8_t *match;
+ const zip_uint8_t *match;
zip_int64_t buf_offset;
zip_uint64_t buflen;
zip_int64_t a;
@@ -546,95 +578,105 @@ _zip_find_central_dir(zip_t *za, zip_uint64_t len) {
zip_buffer_t *buffer;
if (len < EOCDLEN) {
- zip_error_set(&za->error, ZIP_ER_NOZIP, 0);
- return NULL;
+ zip_error_set(&za->error, ZIP_ER_NOZIP, 0);
+ return NULL;
}
buflen = (len < CDBUFSIZE ? len : CDBUFSIZE);
if (zip_source_seek(za->src, -(zip_int64_t)buflen, SEEK_END) < 0) {
- zip_error_t *src_error = zip_source_error(za->src);
- if (zip_error_code_zip(src_error) != ZIP_ER_SEEK || zip_error_code_system(src_error) != EFBIG) {
- /* seek before start of file on my machine */
- _zip_error_copy(&za->error, src_error);
- return NULL;
- }
+ zip_error_t *src_error = zip_source_error(za->src);
+ if (zip_error_code_zip(src_error) != ZIP_ER_SEEK || zip_error_code_system(src_error) != EFBIG) {
+ /* seek before start of file on my machine */
+ _zip_error_copy(&za->error, src_error);
+ return NULL;
+ }
}
if ((buf_offset = zip_source_tell(za->src)) < 0) {
- _zip_error_set_from_source(&za->error, za->src);
- return NULL;
+ zip_error_set_from_source(&za->error, za->src);
+ return NULL;
}
if ((buffer = _zip_buffer_new_from_source(za->src, buflen, NULL, &za->error)) == NULL) {
- return NULL;
+ return NULL;
}
best = -1;
cdir = NULL;
if (buflen >= CDBUFSIZE) {
- /* EOCD64 locator is before EOCD, so leave place for it */
- _zip_buffer_set_offset(buffer, EOCD64LOCLEN);
+ /* EOCD64 locator is before EOCD, so leave place for it */
+ _zip_buffer_set_offset(buffer, EOCD64LOCLEN);
}
zip_error_set(&error, ZIP_ER_NOZIP, 0);
match = _zip_buffer_get(buffer, 0);
- while ((match = _zip_memmem(match, _zip_buffer_left(buffer) - (EOCDLEN - 4), (const unsigned char *)EOCD_MAGIC, 4)) != NULL) {
- _zip_buffer_set_offset(buffer, (zip_uint64_t)(match - _zip_buffer_data(buffer)));
- if ((cdirnew = _zip_read_cdir(za, buffer, (zip_uint64_t)buf_offset, &error)) != NULL) {
- if (cdir) {
- if (best <= 0) {
- best = _zip_checkcons(za, cdir, &error);
- }
-
- a = _zip_checkcons(za, cdirnew, &error);
- if (best < a) {
- _zip_cdir_free(cdir);
- cdir = cdirnew;
- best = a;
- }
- else {
- _zip_cdir_free(cdirnew);
- }
- }
- else {
- cdir = cdirnew;
- if (za->open_flags & ZIP_CHECKCONS)
- best = _zip_checkcons(za, cdir, &error);
- else {
- best = 0;
- }
- }
- cdirnew = NULL;
- }
-
- match++;
- _zip_buffer_set_offset(buffer, (zip_uint64_t)(match - _zip_buffer_data(buffer)));
+ /* The size of buffer never greater than CDBUFSIZE. */
+ while (_zip_buffer_left(buffer) >= EOCDLEN && (match = _zip_memmem(match, (size_t)_zip_buffer_left(buffer) - (EOCDLEN - 4), (const unsigned char *)EOCD_MAGIC, 4)) != NULL) {
+ _zip_buffer_set_offset(buffer, (zip_uint64_t)(match - _zip_buffer_data(buffer)));
+ if ((cdirnew = _zip_read_cdir(za, buffer, (zip_uint64_t)buf_offset, &error)) != NULL) {
+ if (cdir) {
+ if (best <= 0) {
+ best = _zip_checkcons(za, cdir, &error);
+ }
+
+ a = _zip_checkcons(za, cdirnew, &error);
+ if (best < a) {
+ _zip_cdir_free(cdir);
+ cdir = cdirnew;
+ best = a;
+ }
+ else {
+ _zip_cdir_free(cdirnew);
+ }
+ }
+ else {
+ cdir = cdirnew;
+ if (za->open_flags & ZIP_CHECKCONS)
+ best = _zip_checkcons(za, cdir, &error);
+ else {
+ best = 0;
+ }
+ }
+ cdirnew = NULL;
+ }
+
+ match++;
+ _zip_buffer_set_offset(buffer, (zip_uint64_t)(match - _zip_buffer_data(buffer)));
}
_zip_buffer_free(buffer);
if (best < 0) {
- _zip_error_copy(&za->error, &error);
- _zip_cdir_free(cdir);
- return NULL;
+ _zip_error_copy(&za->error, &error);
+ _zip_cdir_free(cdir);
+ return NULL;
}
return cdir;
}
-static unsigned char *
-_zip_memmem(const unsigned char *big, size_t biglen, const unsigned char *little, size_t littlelen) {
+static const unsigned char *_zip_memmem(const unsigned char *big, size_t biglen, const unsigned char *little, size_t littlelen) {
const unsigned char *p;
- if ((biglen < littlelen) || (littlelen == 0))
- return NULL;
- p = big - 1;
- while ((p = (const unsigned char *)memchr(p + 1, little[0], (size_t)(big - (p + 1)) + (size_t)(biglen - littlelen) + 1)) != NULL) {
- if (memcmp(p + 1, little + 1, littlelen - 1) == 0)
- return (unsigned char *)p;
+ if (littlelen == 0) {
+ return big;
+ }
+
+ if (biglen < littlelen) {
+ return NULL;
}
- return NULL;
+ p = big;
+ while (true) {
+ p = (const unsigned char *)memchr(p, little[0], biglen - (littlelen - 1) - (size_t)(p - big));
+ if (p == NULL) {
+ return NULL;
+ }
+ if (memcmp(p + 1, little + 1, littlelen - 1) == 0) {
+ return p;
+ }
+ p += 1;
+ }
}
@@ -644,8 +686,8 @@ _zip_read_eocd(zip_buffer_t *buffer, zip_uint64_t buf_offset, unsigned int flags
zip_uint64_t i, nentry, size, offset, eocd_offset;
if (_zip_buffer_left(buffer) < EOCDLEN) {
- zip_error_set(error, ZIP_ER_INCONS, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_EOCD_LENGTH_INVALID);
+ return NULL;
}
eocd_offset = _zip_buffer_offset(buffer);
@@ -653,8 +695,8 @@ _zip_read_eocd(zip_buffer_t *buffer, zip_uint64_t buf_offset, unsigned int flags
_zip_buffer_get(buffer, 4); /* magic already verified */
if (_zip_buffer_get_32(buffer) != 0) {
- zip_error_set(error, ZIP_ER_MULTIDISK, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_MULTIDISK, 0);
+ return NULL;
}
/* number of cdir-entries on this disk */
@@ -663,31 +705,31 @@ _zip_read_eocd(zip_buffer_t *buffer, zip_uint64_t buf_offset, unsigned int flags
nentry = _zip_buffer_get_16(buffer);
if (nentry != i) {
- zip_error_set(error, ZIP_ER_NOZIP, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_NOZIP, 0);
+ return NULL;
}
size = _zip_buffer_get_32(buffer);
offset = _zip_buffer_get_32(buffer);
if (offset + size < offset) {
- zip_error_set(error, ZIP_ER_SEEK, EFBIG);
- return NULL;
+ zip_error_set(error, ZIP_ER_SEEK, EFBIG);
+ return NULL;
}
if (offset + size > buf_offset + eocd_offset) {
- /* cdir spans past EOCD record */
- zip_error_set(error, ZIP_ER_INCONS, 0);
- return NULL;
+ /* cdir spans past EOCD record */
+ zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_CDIR_OVERLAPS_EOCD);
+ return NULL;
}
if ((flags & ZIP_CHECKCONS) && offset + size != buf_offset + eocd_offset) {
- zip_error_set(error, ZIP_ER_INCONS, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_CDIR_LENGTH_INVALID);
+ return NULL;
}
if ((cd = _zip_cdir_new(nentry, error)) == NULL)
- return NULL;
+ return NULL;
cd->is_zip64 = false;
cd->size = size;
@@ -717,38 +759,38 @@ _zip_read_eocd64(zip_source_t *src, zip_buffer_t *buffer, zip_uint64_t buf_offse
/* valid seek value for start of EOCD */
if (eocd_offset > ZIP_INT64_MAX) {
- zip_error_set(error, ZIP_ER_SEEK, EFBIG);
- return NULL;
+ zip_error_set(error, ZIP_ER_SEEK, EFBIG);
+ return NULL;
}
/* does EOCD fit before EOCD locator? */
if (eocd_offset + EOCD64LEN > eocdloc_offset + buf_offset) {
- zip_error_set(error, ZIP_ER_INCONS, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_EOCD64_OVERLAPS_EOCD);
+ return NULL;
}
/* make sure current position of buffer is beginning of EOCD */
if (eocd_offset >= buf_offset && eocd_offset + EOCD64LEN <= buf_offset + _zip_buffer_size(buffer)) {
- _zip_buffer_set_offset(buffer, eocd_offset - buf_offset);
- free_buffer = false;
+ _zip_buffer_set_offset(buffer, eocd_offset - buf_offset);
+ free_buffer = false;
}
else {
- if (zip_source_seek(src, (zip_int64_t)eocd_offset, SEEK_SET) < 0) {
- _zip_error_set_from_source(error, src);
- return NULL;
- }
- if ((buffer = _zip_buffer_new_from_source(src, EOCD64LEN, eocd, error)) == NULL) {
- return NULL;
- }
- free_buffer = true;
+ if (zip_source_seek(src, (zip_int64_t)eocd_offset, SEEK_SET) < 0) {
+ zip_error_set_from_source(error, src);
+ return NULL;
+ }
+ if ((buffer = _zip_buffer_new_from_source(src, EOCD64LEN, eocd, error)) == NULL) {
+ return NULL;
+ }
+ free_buffer = true;
}
if (memcmp(_zip_buffer_get(buffer, 4), EOCD64_MAGIC, 4) != 0) {
- zip_error_set(error, ZIP_ER_INCONS, 0);
- if (free_buffer) {
- _zip_buffer_free(buffer);
- }
- return NULL;
+ zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_EOCD64_WRONG_MAGIC);
+ if (free_buffer) {
+ _zip_buffer_free(buffer);
+ }
+ return NULL;
}
/* size of EOCD */
@@ -756,11 +798,11 @@ _zip_read_eocd64(zip_source_t *src, zip_buffer_t *buffer, zip_uint64_t buf_offse
/* is there a hole between EOCD and EOCD locator, or do they overlap? */
if ((flags & ZIP_CHECKCONS) && size + eocd_offset + 12 != buf_offset + eocdloc_offset) {
- zip_error_set(error, ZIP_ER_INCONS, 0);
- if (free_buffer) {
- _zip_buffer_free(buffer);
- }
- return NULL;
+ zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_EOCD64_OVERLAPS_EOCD);
+ if (free_buffer) {
+ _zip_buffer_free(buffer);
+ }
+ return NULL;
}
_zip_buffer_get(buffer, 4); /* skip version made by/needed */
@@ -772,35 +814,35 @@ _zip_read_eocd64(zip_source_t *src, zip_buffer_t *buffer, zip_uint64_t buf_offse
otherwise, if the values are not the same, it's inconsistent;
in any case, if the value is not 0, we don't support it */
if (num_disks == 0xffff) {
- num_disks = num_disks64;
+ num_disks = num_disks64;
}
if (eocd_disk == 0xffff) {
- eocd_disk = eocd_disk64;
+ eocd_disk = eocd_disk64;
}
if ((flags & ZIP_CHECKCONS) && (eocd_disk != eocd_disk64 || num_disks != num_disks64)) {
- zip_error_set(error, ZIP_ER_INCONS, 0);
- if (free_buffer) {
- _zip_buffer_free(buffer);
- }
- return NULL;
+ zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_EOCD64_MISMATCH);
+ if (free_buffer) {
+ _zip_buffer_free(buffer);
+ }
+ return NULL;
}
if (num_disks != 0 || eocd_disk != 0) {
- zip_error_set(error, ZIP_ER_MULTIDISK, 0);
- if (free_buffer) {
- _zip_buffer_free(buffer);
- }
- return NULL;
+ zip_error_set(error, ZIP_ER_MULTIDISK, 0);
+ if (free_buffer) {
+ _zip_buffer_free(buffer);
+ }
+ return NULL;
}
nentry = _zip_buffer_get_64(buffer);
i = _zip_buffer_get_64(buffer);
if (nentry != i) {
- zip_error_set(error, ZIP_ER_MULTIDISK, 0);
- if (free_buffer) {
- _zip_buffer_free(buffer);
- }
- return NULL;
+ zip_error_set(error, ZIP_ER_MULTIDISK, 0);
+ if (free_buffer) {
+ _zip_buffer_free(buffer);
+ }
+ return NULL;
}
size = _zip_buffer_get_64(buffer);
@@ -808,38 +850,38 @@ _zip_read_eocd64(zip_source_t *src, zip_buffer_t *buffer, zip_uint64_t buf_offse
/* did we read past the end of the buffer? */
if (!_zip_buffer_ok(buffer)) {
- zip_error_set(error, ZIP_ER_INTERNAL, 0);
- if (free_buffer) {
- _zip_buffer_free(buffer);
- }
- return NULL;
+ zip_error_set(error, ZIP_ER_INTERNAL, 0);
+ if (free_buffer) {
+ _zip_buffer_free(buffer);
+ }
+ return NULL;
}
if (free_buffer) {
- _zip_buffer_free(buffer);
+ _zip_buffer_free(buffer);
}
if (offset > ZIP_INT64_MAX || offset + size < offset) {
- zip_error_set(error, ZIP_ER_SEEK, EFBIG);
- return NULL;
+ zip_error_set(error, ZIP_ER_SEEK, EFBIG);
+ return NULL;
}
if (offset + size > buf_offset + eocd_offset) {
- /* cdir spans past EOCD record */
- zip_error_set(error, ZIP_ER_INCONS, 0);
- return NULL;
+ /* cdir spans past EOCD record */
+ zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_CDIR_OVERLAPS_EOCD);
+ return NULL;
}
if ((flags & ZIP_CHECKCONS) && offset + size != buf_offset + eocd_offset) {
- zip_error_set(error, ZIP_ER_INCONS, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_CDIR_OVERLAPS_EOCD);
+ return NULL;
}
if (nentry > size / CDENTRYSIZE) {
- zip_error_set(error, ZIP_ER_INCONS, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_CDIR_INVALID);
+ return NULL;
}
if ((cd = _zip_cdir_new(nentry, error)) == NULL)
- return NULL;
+ return NULL;
cd->is_zip64 = true;
cd->size = size;
@@ -847,3 +889,79 @@ _zip_read_eocd64(zip_source_t *src, zip_buffer_t *buffer, zip_uint64_t buf_offse
return cd;
}
+
+
+static int decode_hex(char c) {
+ if (c >= '0' && c <= '9') {
+ return c - '0';
+ }
+ else if (c >= 'A' && c <= 'F') {
+ return c - 'A' + 10;
+ }
+ else {
+ return -1;
+ }
+}
+
+/* _zip_check_torrentzip:
+ check whether ZA has a valid TORRENTZIP comment, i.e. is torrentzipped */
+
+static void zip_check_torrentzip(zip_t *za, const zip_cdir_t *cdir) {
+ zip_uint32_t crc_should;
+ char buf[8+1];
+ size_t i;
+
+ if (cdir == NULL) {
+ return;
+ }
+
+ if (_zip_string_length(cdir->comment) != TORRENTZIP_SIGNATURE_LENGTH + TORRENTZIP_CRC_LENGTH
+ || strncmp((const char *)cdir->comment->raw, TORRENTZIP_SIGNATURE, TORRENTZIP_SIGNATURE_LENGTH) != 0)
+ return;
+
+ memcpy(buf, cdir->comment->raw + TORRENTZIP_SIGNATURE_LENGTH, TORRENTZIP_CRC_LENGTH);
+ buf[TORRENTZIP_CRC_LENGTH] = '\0';
+ crc_should = 0;
+ for (i = 0; i < TORRENTZIP_CRC_LENGTH; i += 2) {
+ int low, high;
+ high = decode_hex((buf[i]));
+ low = decode_hex(buf[i + 1]);
+ if (high < 0 || low < 0) {
+ return;
+ }
+ crc_should = (crc_should << 8) + (high << 4) + low;
+ }
+
+ {
+ zip_stat_t st;
+ zip_source_t* src_window;
+ zip_source_t* src_crc;
+ zip_uint8_t buffer[512];
+ zip_int64_t ret;
+
+ zip_stat_init(&st);
+ st.valid |= ZIP_STAT_SIZE | ZIP_STAT_CRC;
+ st.size = cdir->size;
+ st.crc = crc_should;
+ if ((src_window = _zip_source_window_new(za->src, cdir->offset, cdir->size, &st, 0, NULL, NULL, 0, false, NULL)) == NULL) {
+ return;
+ }
+ if ((src_crc = zip_source_crc_create(src_window, 1, NULL)) == NULL) {
+ zip_source_free(src_window);
+ return;
+ }
+ if (zip_source_open(src_crc) != 0) {
+ zip_source_free(src_crc);
+ return;
+ }
+ while ((ret = zip_source_read(src_crc, buffer, sizeof(buffer))) > 0) {
+ }
+ zip_source_free(src_crc);
+ if (ret < 0) {
+ return;
+ }
+ }
+
+ /* TODO: if check consistency, check cdir entries for valid values */
+ za->flags |= ZIP_AFL_IS_TORRENTZIP;
+}
diff --git a/src/Common/libzip/zip_pkware.c b/src/Common/libzip/zip_pkware.c
index eb12b1e9..6a8c9fcd 100644
--- a/src/Common/libzip/zip_pkware.c
+++ b/src/Common/libzip/zip_pkware.c
@@ -3,7 +3,7 @@
Copyright (C) 2009-2020 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -75,18 +75,18 @@ _zip_pkware_encrypt(zip_pkware_keys_t *keys, zip_uint8_t *out, const zip_uint8_t
zip_uint8_t tmp;
for (i = 0; i < len; i++) {
- b = in[i];
-
- if (out != NULL) {
- tmp = crypt_byte(keys);
- update_keys(keys, b);
- b ^= tmp;
- out[i] = b;
- }
- else {
- /* during initialization, we're only interested in key updates */
- update_keys(keys, b);
- }
+ b = in[i];
+
+ if (out != NULL) {
+ tmp = crypt_byte(keys);
+ update_keys(keys, b);
+ b ^= tmp;
+ out[i] = b;
+ }
+ else {
+ /* during initialization, we're only interested in key updates */
+ update_keys(keys, b);
+ }
}
}
@@ -98,15 +98,15 @@ _zip_pkware_decrypt(zip_pkware_keys_t *keys, zip_uint8_t *out, const zip_uint8_t
zip_uint8_t tmp;
for (i = 0; i < len; i++) {
- b = in[i];
+ b = in[i];
- /* during initialization, we're only interested in key updates */
- if (out != NULL) {
- tmp = crypt_byte(keys);
- b ^= tmp;
- out[i] = b;
- }
+ /* during initialization, we're only interested in key updates */
+ if (out != NULL) {
+ tmp = crypt_byte(keys);
+ b ^= tmp;
+ out[i] = b;
+ }
- update_keys(keys, b);
+ update_keys(keys, b);
}
}
diff --git a/src/Common/libzip/zip_progress.c b/src/Common/libzip/zip_progress.c
index ddb47c70..e080514b 100644
--- a/src/Common/libzip/zip_progress.c
+++ b/src/Common/libzip/zip_progress.c
@@ -3,7 +3,7 @@
Copyright (C) 2017-2020 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -73,7 +73,7 @@ _zip_progress_end(zip_progress_t *progress) {
void
_zip_progress_free(zip_progress_t *progress) {
if (progress == NULL) {
- return;
+ return;
}
_zip_progress_free_progress_callback(progress);
@@ -88,8 +88,8 @@ _zip_progress_new(zip_t *za) {
zip_progress_t *progress = (zip_progress_t *)malloc(sizeof(*progress));
if (progress == NULL) {
- zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
- return NULL;
+ zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
+ return NULL;
}
progress->za = za;
@@ -109,7 +109,7 @@ _zip_progress_new(zip_t *za) {
static void
_zip_progress_free_progress_callback(zip_progress_t *progress) {
if (progress->ud_progress_free) {
- progress->ud_progress_free(progress->ud_progress);
+ progress->ud_progress_free(progress->ud_progress);
}
progress->callback_progress = NULL;
@@ -120,7 +120,7 @@ _zip_progress_free_progress_callback(zip_progress_t *progress) {
static void
_zip_progress_free_cancel_callback(zip_progress_t *progress) {
if (progress->ud_cancel_free) {
- progress->ud_cancel_free(progress->ud_cancel);
+ progress->ud_cancel_free(progress->ud_cancel);
}
progress->callback_cancel = NULL;
@@ -150,18 +150,18 @@ _zip_progress_set_cancel_callback(zip_progress_t *progress, zip_cancel_callback
int
_zip_progress_start(zip_progress_t *progress) {
if (progress == NULL) {
- return 0;
+ return 0;
}
if (progress->callback_progress != NULL) {
- progress->last_update = 0.0;
- progress->callback_progress(progress->za, 0.0, progress->ud_progress);
+ progress->last_update = 0.0;
+ progress->callback_progress(progress->za, 0.0, progress->ud_progress);
}
if (progress->callback_cancel != NULL) {
- if (progress->callback_cancel(progress->za, progress->ud_cancel)) {
- return -1;
- }
+ if (progress->callback_cancel(progress->za, progress->ud_cancel)) {
+ return -1;
+ }
}
return 0;
@@ -171,7 +171,7 @@ _zip_progress_start(zip_progress_t *progress) {
int
_zip_progress_subrange(zip_progress_t *progress, double start, double end) {
if (progress == NULL) {
- return 0;
+ return 0;
}
progress->start = start;
@@ -185,22 +185,22 @@ _zip_progress_update(zip_progress_t *progress, double sub_current) {
double current;
if (progress == NULL) {
- return 0;
+ return 0;
}
if (progress->callback_progress != NULL) {
- current = ZIP_MIN(ZIP_MAX(sub_current, 0.0), 1.0) * (progress->end - progress->start) + progress->start;
+ current = ZIP_MIN(ZIP_MAX(sub_current, 0.0), 1.0) * (progress->end - progress->start) + progress->start;
- if (current - progress->last_update > progress->precision) {
- progress->callback_progress(progress->za, current, progress->ud_progress);
- progress->last_update = current;
- }
+ if (current - progress->last_update > progress->precision) {
+ progress->callback_progress(progress->za, current, progress->ud_progress);
+ progress->last_update = current;
+ }
}
if (progress->callback_cancel != NULL) {
- if (progress->callback_cancel(progress->za, progress->ud_cancel)) {
- return -1;
- }
+ if (progress->callback_cancel(progress->za, progress->ud_cancel)) {
+ return -1;
+ }
}
return 0;
@@ -210,24 +210,24 @@ _zip_progress_update(zip_progress_t *progress, double sub_current) {
ZIP_EXTERN int
zip_register_progress_callback_with_state(zip_t *za, double precision, zip_progress_callback callback, void (*ud_free)(void *), void *ud) {
if (callback != NULL) {
- if (za->progress == NULL) {
- if ((za->progress = _zip_progress_new(za)) == NULL) {
- return -1;
- }
- }
+ if (za->progress == NULL) {
+ if ((za->progress = _zip_progress_new(za)) == NULL) {
+ return -1;
+ }
+ }
- _zip_progress_set_progress_callback(za->progress, precision, callback, ud_free, ud);
+ _zip_progress_set_progress_callback(za->progress, precision, callback, ud_free, ud);
}
else {
- if (za->progress != NULL) {
- if (za->progress->callback_cancel == NULL) {
- _zip_progress_free(za->progress);
- za->progress = NULL;
- }
- else {
- _zip_progress_free_progress_callback(za->progress);
- }
- }
+ if (za->progress != NULL) {
+ if (za->progress->callback_cancel == NULL) {
+ _zip_progress_free(za->progress);
+ za->progress = NULL;
+ }
+ else {
+ _zip_progress_free_progress_callback(za->progress);
+ }
+ }
}
return 0;
@@ -237,24 +237,24 @@ zip_register_progress_callback_with_state(zip_t *za, double precision, zip_progr
ZIP_EXTERN int
zip_register_cancel_callback_with_state(zip_t *za, zip_cancel_callback callback, void (*ud_free)(void *), void *ud) {
if (callback != NULL) {
- if (za->progress == NULL) {
- if ((za->progress = _zip_progress_new(za)) == NULL) {
- return -1;
- }
- }
+ if (za->progress == NULL) {
+ if ((za->progress = _zip_progress_new(za)) == NULL) {
+ return -1;
+ }
+ }
- _zip_progress_set_cancel_callback(za->progress, callback, ud_free, ud);
+ _zip_progress_set_cancel_callback(za->progress, callback, ud_free, ud);
}
else {
- if (za->progress != NULL) {
- if (za->progress->callback_progress == NULL) {
- _zip_progress_free(za->progress);
- za->progress = NULL;
- }
- else {
- _zip_progress_free_cancel_callback(za->progress);
- }
- }
+ if (za->progress != NULL) {
+ if (za->progress->callback_progress == NULL) {
+ _zip_progress_free(za->progress);
+ za->progress = NULL;
+ }
+ else {
+ _zip_progress_free_cancel_callback(za->progress);
+ }
+ }
}
return 0;
@@ -278,16 +278,16 @@ zip_register_progress_callback(zip_t *za, zip_progress_callback_t progress_callb
struct legacy_ud *ud;
if (progress_callback == NULL) {
- zip_register_progress_callback_with_state(za, 0, NULL, NULL, NULL);
+ zip_register_progress_callback_with_state(za, 0, NULL, NULL, NULL);
}
if ((ud = (struct legacy_ud *)malloc(sizeof(*ud))) == NULL) {
- return;
+ return;
}
ud->callback = progress_callback;
if (zip_register_progress_callback_with_state(za, 0.001, _zip_legacy_progress_callback, free, ud) < 0) {
- free(ud);
+ free(ud);
}
}
diff --git a/src/Common/libzip/zip_random_unix.c b/src/Common/libzip/zip_random_unix.c
new file mode 100644
index 00000000..867df790
--- /dev/null
+++ b/src/Common/libzip/zip_random_unix.c
@@ -0,0 +1,110 @@
+/*
+ zip_random_unix.c -- fill the user's buffer with random stuff (Unix version)
+ Copyright (C) 2016-2021 Dieter Baron and Thomas Klausner
+
+ This file is part of libzip, a library to manipulate ZIP archives.
+ The authors can be contacted at <info@libzip.org>
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ 3. The names of the authors may not be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "zipint.h"
+
+#ifdef HAVE_CRYPTO
+#include "zip_crypto.h"
+#endif
+
+#ifdef HAVE_ARC4RANDOM
+
+#include <stdlib.h>
+
+#ifndef HAVE_SECURE_RANDOM
+ZIP_EXTERN bool
+zip_secure_random(zip_uint8_t *buffer, zip_uint16_t length) {
+ arc4random_buf(buffer, length);
+ return true;
+}
+#endif
+
+#ifndef HAVE_RANDOM_UINT32
+zip_uint32_t
+zip_random_uint32(void) {
+ return arc4random();
+}
+#endif
+
+#else /* HAVE_ARC4RANDOM */
+
+#ifndef HAVE_SECURE_RANDOM
+#include <fcntl.h>
+#include <unistd.h>
+
+ZIP_EXTERN bool
+zip_secure_random(zip_uint8_t *buffer, zip_uint16_t length) {
+ int fd;
+
+ if ((fd = open("/dev/urandom", O_RDONLY)) < 0) {
+ return false;
+ }
+
+ if (read(fd, buffer, length) != length) {
+ close(fd);
+ return false;
+ }
+
+ close(fd);
+ return true;
+}
+#endif
+
+#ifndef HAVE_RANDOM_UINT32
+#include <stdlib.h>
+
+#ifndef HAVE_RANDOM
+#define srandom srand
+#define random rand
+#endif
+
+zip_uint32_t
+zip_random_uint32(void) {
+ static bool seeded = false;
+
+ zip_uint32_t value;
+
+ if (zip_secure_random((zip_uint8_t *)&value, sizeof(value))) {
+ return value;
+ }
+
+ if (!seeded) {
+ srandom((unsigned int)time(NULL));
+ seeded = true;
+ }
+
+ return (zip_uint32_t)random();
+}
+#endif
+
+#endif /* HAVE_ARC4RANDOM */
diff --git a/src/Common/libzip/zip_filerange_crc.c b/src/Common/libzip/zip_random_uwp.c
index b8873634..0883ce45 100644
--- a/src/Common/libzip/zip_filerange_crc.c
+++ b/src/Common/libzip/zip_random_uwp.c
@@ -1,9 +1,9 @@
/*
- zip_filerange_crc.c -- compute CRC32 for a range of a file
- Copyright (C) 2008-2019 Dieter Baron and Thomas Klausner
+ zip_random_uwp.c -- fill the user's buffer with random stuff (UWP version)
+ Copyright (C) 2017-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -31,54 +31,52 @@
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
-#include <stdio.h>
-
#include "zipint.h"
+#ifdef HAVE_CRYPTO
+#include "zip_crypto.h"
+#endif
-int
-_zip_filerange_crc(zip_source_t *src, zip_uint64_t start, zip_uint64_t len, uLong *crcp, zip_error_t *error) {
- DEFINE_BYTE_ARRAY(buf, BUFSIZE);
+#ifndef HAVE_SECURE_RANDOM
- zip_int64_t n;
+#include <windows.h>
+#include <bcrypt.h>
- *crcp = crc32(0L, Z_NULL, 0);
-
- if (start > ZIP_INT64_MAX) {
- zip_error_set(error, ZIP_ER_SEEK, EFBIG);
- return -1;
+ZIP_EXTERN bool
+zip_secure_random(zip_uint8_t *buffer, zip_uint16_t length) {
+ BCRYPT_ALG_HANDLE hAlg = NULL;
+ NTSTATUS hr = BCryptOpenAlgorithmProvider(&hAlg, BCRYPT_RNG_ALGORITHM, MS_PRIMITIVE_PROVIDER, 0);
+ if (!BCRYPT_SUCCESS(hr) || hAlg == NULL) {
+ return false;
}
-
- if (zip_source_seek(src, (zip_int64_t)start, SEEK_SET) != 0) {
- _zip_error_set_from_source(error, src);
- return -1;
+ hr = BCryptGenRandom(&hAlg, buffer, length, 0);
+ BCryptCloseAlgorithmProvider(&hAlg, 0);
+ if (!BCRYPT_SUCCESS(hr)) {
+ return false;
}
+ return true;
+}
- if (!byte_array_init(buf, BUFSIZE)) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- return -1;
- }
+#endif
- while (len > 0) {
- n = (zip_int64_t)(len > BUFSIZE ? BUFSIZE : len);
- if ((n = zip_source_read(src, buf, (zip_uint64_t)n)) < 0) {
- _zip_error_set_from_source(error, src);
- byte_array_fini(buf);
- return -1;
- }
- if (n == 0) {
- zip_error_set(error, ZIP_ER_EOF, 0);
- byte_array_fini(buf);
- return -1;
- }
+#ifndef HAVE_RANDOM_UINT32
+#include <stdlib.h>
- *crcp = crc32(*crcp, buf, (uInt)n);
+zip_uint32_t
+zip_random_uint32(void) {
+ static bool seeded = false;
- len -= (zip_uint64_t)n;
+ zip_uint32_t value;
+
+ if (zip_secure_random((zip_uint8_t *)&value, sizeof(value))) {
+ return value;
}
- byte_array_fini(buf);
+ if (!seeded) {
+ srand((unsigned int)time(NULL));
+ seeded = true;
+ }
- return 0;
+ return (zip_uint32_t)rand();
}
+#endif
diff --git a/src/Common/libzip/zip_random_win32.c b/src/Common/libzip/zip_random_win32.c
new file mode 100644
index 00000000..789b9c20
--- /dev/null
+++ b/src/Common/libzip/zip_random_win32.c
@@ -0,0 +1,82 @@
+/*
+ zip_random_win32.c -- fill the user's buffer with random stuff (Windows version)
+ Copyright (C) 2016-2021 Dieter Baron and Thomas Klausner
+
+ This file is part of libzip, a library to manipulate ZIP archives.
+ The authors can be contacted at <info@libzip.org>
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ 3. The names of the authors may not be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "zipint.h"
+
+#ifdef HAVE_CRYPTO
+#include "zip_crypto.h"
+#endif
+
+#include <windows.h>
+
+#ifndef HAVE_SECURE_RANDOM
+
+#include <wincrypt.h>
+
+ZIP_EXTERN bool
+zip_secure_random(zip_uint8_t *buffer, zip_uint16_t length) {
+ HCRYPTPROV hprov;
+ if (!CryptAcquireContext(&hprov, NULL, NULL, PROV_RSA_AES, CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
+ return false;
+ }
+ if (!CryptGenRandom(hprov, length, buffer)) {
+ return false;
+ }
+ if (!CryptReleaseContext(hprov, 0)) {
+ return false;
+ }
+ return true;
+}
+#endif
+
+#ifndef HAVE_RANDOM_UINT32
+#include <stdlib.h>
+
+zip_uint32_t
+zip_random_uint32(void) {
+ static bool seeded = false;
+
+ zip_uint32_t value;
+
+ if (zip_secure_random((zip_uint8_t *)&value, sizeof(value))) {
+ return value;
+ }
+
+ if (!seeded) {
+ srand((unsigned int)time(NULL));
+ seeded = true;
+ }
+
+ return (zip_uint32_t)rand();
+}
+#endif
diff --git a/src/Common/libzip/zip_rename.c b/src/Common/libzip/zip_rename.c
index 75b456de..c89b06c9 100644
--- a/src/Common/libzip/zip_rename.c
+++ b/src/Common/libzip/zip_rename.c
@@ -1,9 +1,9 @@
/*
zip_rename.c -- rename file in zip archive
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
diff --git a/src/Common/libzip/zip_replace.c b/src/Common/libzip/zip_replace.c
index 30a2eb1d..96c083c3 100644
--- a/src/Common/libzip/zip_replace.c
+++ b/src/Common/libzip/zip_replace.c
@@ -1,9 +1,9 @@
/*
zip_replace.c -- replace file via callback function
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
diff --git a/src/Common/libzip/zip_set_archive_comment.c b/src/Common/libzip/zip_set_archive_comment.c
index 3f050b3e..7d06688e 100644
--- a/src/Common/libzip/zip_set_archive_comment.c
+++ b/src/Common/libzip/zip_set_archive_comment.c
@@ -1,9 +1,9 @@
/*
zip_set_archive_comment.c -- set archive comment
- Copyright (C) 2006-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -42,38 +42,42 @@ zip_set_archive_comment(zip_t *za, const char *comment, zip_uint16_t len) {
zip_string_t *cstr;
if (ZIP_IS_RDONLY(za)) {
- zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
+ return -1;
+ }
+ if (ZIP_WANT_TORRENTZIP(za)) {
+ zip_error_set(&za->error, ZIP_ER_NOT_ALLOWED, 0);
+ return -1;
}
if (len > 0 && comment == NULL) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return -1;
}
if (len > 0) {
- if ((cstr = _zip_string_new((const zip_uint8_t *)comment, len, ZIP_FL_ENC_GUESS, &za->error)) == NULL)
- return -1;
+ if ((cstr = _zip_string_new((const zip_uint8_t *)comment, len, ZIP_FL_ENC_GUESS, &za->error)) == NULL)
+ return -1;
- if (_zip_guess_encoding(cstr, ZIP_ENCODING_UNKNOWN) == ZIP_ENCODING_CP437) {
- _zip_string_free(cstr);
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return -1;
- }
+ if (_zip_guess_encoding(cstr, ZIP_ENCODING_UNKNOWN) == ZIP_ENCODING_CP437) {
+ _zip_string_free(cstr);
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return -1;
+ }
}
else
- cstr = NULL;
+ cstr = NULL;
_zip_string_free(za->comment_changes);
za->comment_changes = NULL;
if (((za->comment_orig && _zip_string_equal(za->comment_orig, cstr)) || (za->comment_orig == NULL && cstr == NULL))) {
- _zip_string_free(cstr);
- za->comment_changed = 0;
+ _zip_string_free(cstr);
+ za->comment_changed = 0;
}
else {
- za->comment_changes = cstr;
- za->comment_changed = 1;
+ za->comment_changes = cstr;
+ za->comment_changed = 1;
}
return 0;
diff --git a/src/Common/libzip/zip_set_archive_flag.c b/src/Common/libzip/zip_set_archive_flag.c
index e0d55021..834ef5ba 100644
--- a/src/Common/libzip/zip_set_archive_flag.c
+++ b/src/Common/libzip/zip_set_archive_flag.c
@@ -1,9 +1,9 @@
/*
zip_get_archive_flag.c -- set archive global flag
- Copyright (C) 2008-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2008-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -39,24 +39,35 @@ ZIP_EXTERN int
zip_set_archive_flag(zip_t *za, zip_flags_t flag, int value) {
unsigned int new_flags;
- if (value)
- new_flags = za->ch_flags | flag;
- else
- new_flags = za->ch_flags & ~flag;
+ if (flag == ZIP_AFL_IS_TORRENTZIP) {
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return -1;
+ }
+
+ /* TODO: when setting ZIP_AFL_WANT_TORRENTZIP, we should error out if any changes have been made that are not allowed for torrentzip. */
+
+ if (value) {
+ new_flags = za->ch_flags | flag;
+ }
+ else {
+ new_flags = za->ch_flags & ~flag;
+ }
- if (new_flags == za->ch_flags)
- return 0;
+ if (new_flags == za->ch_flags) {
+ return 0;
+ }
- if (ZIP_IS_RDONLY(za)) {
- zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
- return -1;
+ /* Allow removing ZIP_AFL_RDONLY if manually set, not if archive was opened read-only. */
+ if (za->flags & ZIP_AFL_RDONLY) {
+ zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
+ return -1;
}
if ((flag & ZIP_AFL_RDONLY) && value && (za->ch_flags & ZIP_AFL_RDONLY) == 0) {
- if (_zip_changed(za, NULL)) {
- zip_error_set(&za->error, ZIP_ER_CHANGED, 0);
- return -1;
- }
+ if (_zip_changed(za, NULL)) {
+ zip_error_set(&za->error, ZIP_ER_CHANGED, 0);
+ return -1;
+ }
}
za->ch_flags = new_flags;
diff --git a/src/Common/libzip/zip_set_default_password.c b/src/Common/libzip/zip_set_default_password.c
index 41c7c519..4bab513f 100644
--- a/src/Common/libzip/zip_set_default_password.c
+++ b/src/Common/libzip/zip_set_default_password.c
@@ -1,9 +1,9 @@
/*
zip_set_default_password.c -- set default password for decryption
- Copyright (C) 2009-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -41,18 +41,18 @@
ZIP_EXTERN int
zip_set_default_password(zip_t *za, const char *passwd) {
if (za == NULL)
- return -1;
+ return -1;
free(za->default_password);
- if (passwd) {
- if ((za->default_password = strdup(passwd)) == NULL) {
- zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
- return -1;
- }
+ if (passwd && passwd[0] != '\0') {
+ if ((za->default_password = strdup(passwd)) == NULL) {
+ zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
+ return -1;
+ }
}
else
- za->default_password = NULL;
+ za->default_password = NULL;
return 0;
}
diff --git a/src/Common/libzip/zip_set_file_comment.c b/src/Common/libzip/zip_set_file_comment.c
index 4277893f..5d2b0b8a 100644
--- a/src/Common/libzip/zip_set_file_comment.c
+++ b/src/Common/libzip/zip_set_file_comment.c
@@ -1,9 +1,9 @@
/*
zip_set_file_comment.c -- set comment for file in archive
- Copyright (C) 2006-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -39,8 +39,8 @@
ZIP_EXTERN int
zip_set_file_comment(zip_t *za, zip_uint64_t idx, const char *comment, int len) {
if (len < 0 || len > ZIP_UINT16_MAX) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return -1;
}
return zip_file_set_comment(za, idx, comment, (zip_uint16_t)len, 0);
}
diff --git a/src/Common/libzip/zip_set_file_compression.c b/src/Common/libzip/zip_set_file_compression.c
index 927fbb76..a193bb77 100644
--- a/src/Common/libzip/zip_set_file_compression.c
+++ b/src/Common/libzip/zip_set_file_compression.c
@@ -1,9 +1,9 @@
/*
zip_set_file_compression.c -- set compression for file in archive
- Copyright (C) 2012-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2012-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -40,19 +40,23 @@ zip_set_file_compression(zip_t *za, zip_uint64_t idx, zip_int32_t method, zip_ui
zip_entry_t *e;
zip_int32_t old_method;
- if (idx >= za->nentry || flags > 9) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return -1;
+ if (idx >= za->nentry) {
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return -1;
}
if (ZIP_IS_RDONLY(za)) {
- zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
+ return -1;
+ }
+ if (ZIP_WANT_TORRENTZIP(za)) {
+ zip_error_set(&za->error, ZIP_ER_NOT_ALLOWED, 0);
+ return -1;
}
if (!zip_compression_method_supported(method, true)) {
- zip_error_set(&za->error, ZIP_ER_COMPNOTSUPP, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_COMPNOTSUPP, 0);
+ return -1;
}
e = za->entry + idx;
@@ -65,26 +69,26 @@ zip_set_file_compression(zip_t *za, zip_uint64_t idx, zip_int32_t method, zip_ui
* to levels */
if (method == old_method) {
- if (e->changes) {
- e->changes->changed &= ~ZIP_DIRENT_COMP_METHOD;
- e->changes->compression_level = 0;
- if (e->changes->changed == 0) {
- _zip_dirent_free(e->changes);
- e->changes = NULL;
- }
- }
+ if (e->changes) {
+ e->changes->changed &= ~ZIP_DIRENT_COMP_METHOD;
+ e->changes->compression_level = 0;
+ if (e->changes->changed == 0) {
+ _zip_dirent_free(e->changes);
+ e->changes = NULL;
+ }
+ }
}
else {
- if (e->changes == NULL) {
- if ((e->changes = _zip_dirent_clone(e->orig)) == NULL) {
- zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
- return -1;
- }
- }
-
- e->changes->comp_method = method;
- e->changes->compression_level = (zip_uint16_t)flags;
- e->changes->changed |= ZIP_DIRENT_COMP_METHOD;
+ if (e->changes == NULL) {
+ if ((e->changes = _zip_dirent_clone(e->orig)) == NULL) {
+ zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
+ return -1;
+ }
+ }
+
+ e->changes->comp_method = method;
+ e->changes->compression_level = (zip_uint16_t)flags;
+ e->changes->changed |= ZIP_DIRENT_COMP_METHOD;
}
return 0;
diff --git a/src/Common/libzip/zip_set_name.c b/src/Common/libzip/zip_set_name.c
index 43c772e4..f1bf703e 100644
--- a/src/Common/libzip/zip_set_name.c
+++ b/src/Common/libzip/zip_set_name.c
@@ -1,9 +1,9 @@
/*
zip_set_name.c -- rename helper function
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -48,109 +48,109 @@ _zip_set_name(zip_t *za, zip_uint64_t idx, const char *name, zip_flags_t flags)
zip_string_t *old_str;
if (idx >= za->nentry) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return -1;
}
if (ZIP_IS_RDONLY(za)) {
- zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
+ return -1;
}
if (name && name[0] != '\0') {
- /* TODO: check for string too long */
- if ((str = _zip_string_new((const zip_uint8_t *)name, (zip_uint16_t)strlen(name), flags, &za->error)) == NULL)
- return -1;
- if ((flags & ZIP_FL_ENCODING_ALL) == ZIP_FL_ENC_GUESS && _zip_guess_encoding(str, ZIP_ENCODING_UNKNOWN) == ZIP_ENCODING_UTF8_GUESSED)
- str->encoding = ZIP_ENCODING_UTF8_KNOWN;
+ /* TODO: check for string too long */
+ if ((str = _zip_string_new((const zip_uint8_t *)name, (zip_uint16_t)strlen(name), flags, &za->error)) == NULL)
+ return -1;
+ if ((flags & ZIP_FL_ENCODING_ALL) == ZIP_FL_ENC_GUESS && _zip_guess_encoding(str, ZIP_ENCODING_UNKNOWN) == ZIP_ENCODING_UTF8_GUESSED)
+ str->encoding = ZIP_ENCODING_UTF8_KNOWN;
}
else
- str = NULL;
+ str = NULL;
/* TODO: encoding flags needed for CP437? */
if ((i = _zip_name_locate(za, name, 0, NULL)) >= 0 && (zip_uint64_t)i != idx) {
- _zip_string_free(str);
- zip_error_set(&za->error, ZIP_ER_EXISTS, 0);
- return -1;
+ _zip_string_free(str);
+ zip_error_set(&za->error, ZIP_ER_EXISTS, 0);
+ return -1;
}
/* no effective name change */
if (i >= 0 && (zip_uint64_t)i == idx) {
- _zip_string_free(str);
- return 0;
+ _zip_string_free(str);
+ return 0;
}
e = za->entry + idx;
if (e->orig)
- same_as_orig = _zip_string_equal(e->orig->filename, str);
+ same_as_orig = _zip_string_equal(e->orig->filename, str);
else
- same_as_orig = false;
+ same_as_orig = false;
if (!same_as_orig && e->changes == NULL) {
- if ((e->changes = _zip_dirent_clone(e->orig)) == NULL) {
- zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
- _zip_string_free(str);
- return -1;
- }
+ if ((e->changes = _zip_dirent_clone(e->orig)) == NULL) {
+ zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
+ _zip_string_free(str);
+ return -1;
+ }
}
if ((new_name = _zip_string_get(same_as_orig ? e->orig->filename : str, NULL, 0, &za->error)) == NULL) {
- _zip_string_free(str);
- return -1;
+ _zip_string_free(str);
+ return -1;
}
if (e->changes) {
- old_str = e->changes->filename;
+ old_str = e->changes->filename;
}
else if (e->orig) {
- old_str = e->orig->filename;
+ old_str = e->orig->filename;
}
else {
- old_str = NULL;
+ old_str = NULL;
}
if (old_str) {
- if ((old_name = _zip_string_get(old_str, NULL, 0, &za->error)) == NULL) {
- _zip_string_free(str);
- return -1;
- }
+ if ((old_name = _zip_string_get(old_str, NULL, 0, &za->error)) == NULL) {
+ _zip_string_free(str);
+ return -1;
+ }
}
else {
- old_name = NULL;
+ old_name = NULL;
}
if (_zip_hash_add(za->names, new_name, idx, 0, &za->error) == false) {
- _zip_string_free(str);
- return -1;
+ _zip_string_free(str);
+ return -1;
}
if (old_name) {
- _zip_hash_delete(za->names, old_name, NULL);
+ _zip_hash_delete(za->names, old_name, NULL);
}
if (same_as_orig) {
- if (e->changes) {
- if (e->changes->changed & ZIP_DIRENT_FILENAME) {
- _zip_string_free(e->changes->filename);
- e->changes->changed &= ~ZIP_DIRENT_FILENAME;
- if (e->changes->changed == 0) {
- _zip_dirent_free(e->changes);
- e->changes = NULL;
- }
- else {
- /* TODO: what if not cloned? can that happen? */
- e->changes->filename = e->orig->filename;
- }
- }
- }
- _zip_string_free(str);
+ if (e->changes) {
+ if (e->changes->changed & ZIP_DIRENT_FILENAME) {
+ _zip_string_free(e->changes->filename);
+ e->changes->changed &= ~ZIP_DIRENT_FILENAME;
+ if (e->changes->changed == 0) {
+ _zip_dirent_free(e->changes);
+ e->changes = NULL;
+ }
+ else {
+ /* TODO: what if not cloned? can that happen? */
+ e->changes->filename = e->orig->filename;
+ }
+ }
+ }
+ _zip_string_free(str);
}
else {
- if (e->changes->changed & ZIP_DIRENT_FILENAME) {
- _zip_string_free(e->changes->filename);
- }
- e->changes->changed |= ZIP_DIRENT_FILENAME;
- e->changes->filename = str;
+ if (e->changes->changed & ZIP_DIRENT_FILENAME) {
+ _zip_string_free(e->changes->filename);
+ }
+ e->changes->changed |= ZIP_DIRENT_FILENAME;
+ e->changes->filename = str;
}
return 0;
diff --git a/src/Common/libzip/zip_source_accept_empty.c b/src/Common/libzip/zip_source_accept_empty.c
index e6d51516..e772aeea 100644
--- a/src/Common/libzip/zip_source_accept_empty.c
+++ b/src/Common/libzip/zip_source_accept_empty.c
@@ -1,9 +1,9 @@
/*
zip_source_accept_empty.c -- if empty source is a valid archive
- Copyright (C) 2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2019-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -37,16 +37,16 @@
bool
zip_source_accept_empty(zip_source_t *src) {
- int ret;
+ zip_int64_t ret;
if ((zip_source_supports(src) & ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_ACCEPT_EMPTY)) == 0) {
- if (ZIP_SOURCE_IS_LAYERED(src)) {
- return zip_source_accept_empty(src->src);
- }
- return true;
+ if (ZIP_SOURCE_IS_LAYERED(src)) {
+ return zip_source_accept_empty(src->src);
+ }
+ return true;
}
- ret = (int)_zip_source_call(src, NULL, 0, ZIP_SOURCE_ACCEPT_EMPTY);
+ ret = _zip_source_call(src, NULL, 0, ZIP_SOURCE_ACCEPT_EMPTY);
return ret != 0;
}
diff --git a/src/Common/libzip/zip_source_begin_write.c b/src/Common/libzip/zip_source_begin_write.c
index 432c2c15..4a9d5d5d 100644
--- a/src/Common/libzip/zip_source_begin_write.c
+++ b/src/Common/libzip/zip_source_begin_write.c
@@ -1,9 +1,9 @@
/*
zip_source_begin_write.c -- start a new file for writing
- Copyright (C) 2014-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -37,13 +37,18 @@
ZIP_EXTERN int
zip_source_begin_write(zip_source_t *src) {
+ if (ZIP_SOURCE_IS_LAYERED(src)) {
+ zip_error_set(&src->error, ZIP_ER_OPNOTSUPP, 0);
+ return -1;
+ }
+
if (ZIP_SOURCE_IS_OPEN_WRITING(src)) {
- zip_error_set(&src->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&src->error, ZIP_ER_INVAL, 0);
+ return -1;
}
if (_zip_source_call(src, NULL, 0, ZIP_SOURCE_BEGIN_WRITE) < 0) {
- return -1;
+ return -1;
}
src->write_state = ZIP_SOURCE_WRITE_OPEN;
diff --git a/src/Common/libzip/zip_source_begin_write_cloning.c b/src/Common/libzip/zip_source_begin_write_cloning.c
index 41b4c73c..df195fcd 100644
--- a/src/Common/libzip/zip_source_begin_write_cloning.c
+++ b/src/Common/libzip/zip_source_begin_write_cloning.c
@@ -1,9 +1,9 @@
/*
zip_source_begin_write_cloning.c -- clone part of file for writing
- Copyright (C) 2017-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2017-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -37,13 +37,18 @@
ZIP_EXTERN int
zip_source_begin_write_cloning(zip_source_t *src, zip_uint64_t offset) {
+ if (ZIP_SOURCE_IS_LAYERED(src)) {
+ zip_error_set(&src->error, ZIP_ER_OPNOTSUPP, 0);
+ return -1;
+ }
+
if (ZIP_SOURCE_IS_OPEN_WRITING(src)) {
- zip_error_set(&src->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&src->error, ZIP_ER_INVAL, 0);
+ return -1;
}
if (_zip_source_call(src, NULL, offset, ZIP_SOURCE_BEGIN_WRITE_CLONING) < 0) {
- return -1;
+ return -1;
}
src->write_state = ZIP_SOURCE_WRITE_OPEN;
diff --git a/src/Common/libzip/zip_source_buffer.c b/src/Common/libzip/zip_source_buffer.c
index 519d2c30..44159536 100644
--- a/src/Common/libzip/zip_source_buffer.c
+++ b/src/Common/libzip/zip_source_buffer.c
@@ -1,9 +1,9 @@
/*
zip_source_buffer.c -- create zip data source from buffer
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -50,8 +50,8 @@ struct buffer {
zip_uint64_t shared_fragments; /* number of shared fragments */
struct buffer *shared_buffer; /* buffer fragments are shared with */
- zip_uint64_t size; /* size of buffer */
+ zip_uint64_t size; /* size of buffer */
zip_uint64_t offset; /* current offset in buffer */
zip_uint64_t current_fragment; /* fragment current offset is in */
};
@@ -87,7 +87,7 @@ zip_source_t *zip_source_buffer_fragment_with_attributes_create(const zip_buffer
ZIP_EXTERN zip_source_t *
zip_source_buffer(zip_t *za, const void *data, zip_uint64_t len, int freep) {
if (za == NULL)
- return NULL;
+ return NULL;
return zip_source_buffer_with_attributes_create(data, len, freep, NULL, &za->error);
}
@@ -104,12 +104,12 @@ zip_source_buffer_with_attributes_create(const void *data, zip_uint64_t len, int
zip_buffer_fragment_t fragment;
if (data == NULL) {
- if (len > 0) {
- zip_error_set(error, ZIP_ER_INVAL, 0);
- return NULL;
- }
+ if (len > 0) {
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return NULL;
+ }
- return zip_source_buffer_fragment_with_attributes_create(NULL, 0, freep, attributes, error);
+ return zip_source_buffer_fragment_with_attributes_create(NULL, 0, freep, attributes, error);
}
fragment.data = (zip_uint8_t *)data;
@@ -122,7 +122,7 @@ zip_source_buffer_with_attributes_create(const void *data, zip_uint64_t len, int
ZIP_EXTERN zip_source_t *
zip_source_buffer_fragment(zip_t *za, const zip_buffer_fragment_t *fragments, zip_uint64_t nfragments, int freep) {
if (za == NULL) {
- return NULL;
+ return NULL;
}
return zip_source_buffer_fragment_with_attributes_create(fragments, nfragments, freep, NULL, &za->error);
@@ -141,35 +141,35 @@ zip_source_buffer_fragment_with_attributes_create(const zip_buffer_fragment_t *f
buffer_t *buffer;
if (fragments == NULL && nfragments > 0) {
- zip_error_set(error, ZIP_ER_INVAL, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return NULL;
}
if ((buffer = buffer_new(fragments, nfragments, freep, error)) == NULL) {
- return NULL;
+ return NULL;
}
if ((ctx = (struct read_data *)malloc(sizeof(*ctx))) == NULL) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- buffer_free(buffer);
- return NULL;
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ buffer_free(buffer);
+ return NULL;
}
ctx->in = buffer;
ctx->out = NULL;
ctx->mtime = time(NULL);
if (attributes) {
- memcpy(&ctx->attributes, attributes, sizeof(ctx->attributes));
+ (void)memcpy_s(&ctx->attributes, sizeof(ctx->attributes), attributes, sizeof(ctx->attributes));
}
else {
- zip_file_attributes_init(&ctx->attributes);
+ zip_file_attributes_init(&ctx->attributes);
}
zip_error_init(&ctx->error);
if ((zs = zip_source_function_create(read_data, ctx, error)) == NULL) {
- buffer_free(ctx->in);
- free(ctx);
- return NULL;
+ buffer_free(ctx->in);
+ free(ctx);
+ return NULL;
}
return zs;
@@ -187,133 +187,133 @@ read_data(void *state, void *data, zip_uint64_t len, zip_source_cmd_t cmd) {
switch (cmd) {
case ZIP_SOURCE_BEGIN_WRITE:
- if ((ctx->out = buffer_new(NULL, 0, 0, &ctx->error)) == NULL) {
- return -1;
- }
- ctx->out->offset = 0;
- ctx->out->current_fragment = 0;
- return 0;
+ if ((ctx->out = buffer_new(NULL, 0, 0, &ctx->error)) == NULL) {
+ return -1;
+ }
+ ctx->out->offset = 0;
+ ctx->out->current_fragment = 0;
+ return 0;
case ZIP_SOURCE_BEGIN_WRITE_CLONING:
- if ((ctx->out = buffer_clone(ctx->in, len, &ctx->error)) == NULL) {
- return -1;
- }
- ctx->out->offset = len;
- ctx->out->current_fragment = ctx->out->nfragments;
- return 0;
+ if ((ctx->out = buffer_clone(ctx->in, len, &ctx->error)) == NULL) {
+ return -1;
+ }
+ ctx->out->offset = len;
+ ctx->out->current_fragment = ctx->out->nfragments;
+ return 0;
case ZIP_SOURCE_CLOSE:
- return 0;
+ return 0;
case ZIP_SOURCE_COMMIT_WRITE:
- buffer_free(ctx->in);
- ctx->in = ctx->out;
- ctx->out = NULL;
- return 0;
+ buffer_free(ctx->in);
+ ctx->in = ctx->out;
+ ctx->out = NULL;
+ return 0;
case ZIP_SOURCE_ERROR:
- return zip_error_to_data(&ctx->error, data, len);
+ return zip_error_to_data(&ctx->error, data, len);
case ZIP_SOURCE_FREE:
- buffer_free(ctx->in);
- buffer_free(ctx->out);
- free(ctx);
- return 0;
+ buffer_free(ctx->in);
+ buffer_free(ctx->out);
+ free(ctx);
+ return 0;
case ZIP_SOURCE_GET_FILE_ATTRIBUTES: {
- if (len < sizeof(ctx->attributes)) {
- zip_error_set(&ctx->error, ZIP_ER_INVAL, 0);
- return -1;
- }
+ if (len < sizeof(ctx->attributes)) {
+ zip_error_set(&ctx->error, ZIP_ER_INVAL, 0);
+ return -1;
+ }
- memcpy(data, &ctx->attributes, sizeof(ctx->attributes));
+ (void)memcpy_s(data, sizeof(ctx->attributes), &ctx->attributes, sizeof(ctx->attributes));
- return sizeof(ctx->attributes);
+ return sizeof(ctx->attributes);
}
case ZIP_SOURCE_OPEN:
- ctx->in->offset = 0;
- ctx->in->current_fragment = 0;
- return 0;
+ ctx->in->offset = 0;
+ ctx->in->current_fragment = 0;
+ return 0;
case ZIP_SOURCE_READ:
- if (len > ZIP_INT64_MAX) {
- zip_error_set(&ctx->error, ZIP_ER_INVAL, 0);
- return -1;
- }
- return buffer_read(ctx->in, data, len);
+ if (len > ZIP_INT64_MAX) {
+ zip_error_set(&ctx->error, ZIP_ER_INVAL, 0);
+ return -1;
+ }
+ return buffer_read(ctx->in, data, len);
case ZIP_SOURCE_REMOVE: {
- buffer_t *empty = buffer_new(NULL, 0, 0, &ctx->error);
- if (empty == NULL) {
- return -1;
- }
+ buffer_t *empty = buffer_new(NULL, 0, 0, &ctx->error);
+ if (empty == NULL) {
+ return -1;
+ }
- buffer_free(ctx->in);
- ctx->in = empty;
- return 0;
+ buffer_free(ctx->in);
+ ctx->in = empty;
+ return 0;
}
case ZIP_SOURCE_ROLLBACK_WRITE:
- buffer_free(ctx->out);
- ctx->out = NULL;
- return 0;
+ buffer_free(ctx->out);
+ ctx->out = NULL;
+ return 0;
case ZIP_SOURCE_SEEK:
- return buffer_seek(ctx->in, data, len, &ctx->error);
+ return buffer_seek(ctx->in, data, len, &ctx->error);
case ZIP_SOURCE_SEEK_WRITE:
- return buffer_seek(ctx->out, data, len, &ctx->error);
+ return buffer_seek(ctx->out, data, len, &ctx->error);
case ZIP_SOURCE_STAT: {
- zip_stat_t *st;
+ zip_stat_t *st;
- if (len < sizeof(*st)) {
- zip_error_set(&ctx->error, ZIP_ER_INVAL, 0);
- return -1;
- }
+ if (len < sizeof(*st)) {
+ zip_error_set(&ctx->error, ZIP_ER_INVAL, 0);
+ return -1;
+ }
- st = (zip_stat_t *)data;
+ st = (zip_stat_t *)data;
- zip_stat_init(st);
- st->mtime = ctx->mtime;
- st->size = ctx->in->size;
- st->comp_size = st->size;
- st->comp_method = ZIP_CM_STORE;
- st->encryption_method = ZIP_EM_NONE;
- st->valid = ZIP_STAT_MTIME | ZIP_STAT_SIZE | ZIP_STAT_COMP_SIZE | ZIP_STAT_COMP_METHOD | ZIP_STAT_ENCRYPTION_METHOD;
+ zip_stat_init(st);
+ st->mtime = ctx->mtime;
+ st->size = ctx->in->size;
+ st->comp_size = st->size;
+ st->comp_method = ZIP_CM_STORE;
+ st->encryption_method = ZIP_EM_NONE;
+ st->valid = ZIP_STAT_MTIME | ZIP_STAT_SIZE | ZIP_STAT_COMP_SIZE | ZIP_STAT_COMP_METHOD | ZIP_STAT_ENCRYPTION_METHOD;
- return sizeof(*st);
+ return sizeof(*st);
}
case ZIP_SOURCE_SUPPORTS:
- return zip_source_make_command_bitmap(ZIP_SOURCE_GET_FILE_ATTRIBUTES, ZIP_SOURCE_OPEN, ZIP_SOURCE_READ, ZIP_SOURCE_CLOSE, ZIP_SOURCE_STAT, ZIP_SOURCE_ERROR, ZIP_SOURCE_FREE, ZIP_SOURCE_SEEK, ZIP_SOURCE_TELL, ZIP_SOURCE_BEGIN_WRITE, ZIP_SOURCE_BEGIN_WRITE_CLONING, ZIP_SOURCE_COMMIT_WRITE, ZIP_SOURCE_REMOVE, ZIP_SOURCE_ROLLBACK_WRITE, ZIP_SOURCE_SEEK_WRITE, ZIP_SOURCE_TELL_WRITE, ZIP_SOURCE_WRITE, -1);
+ return zip_source_make_command_bitmap(ZIP_SOURCE_GET_FILE_ATTRIBUTES, ZIP_SOURCE_OPEN, ZIP_SOURCE_READ, ZIP_SOURCE_CLOSE, ZIP_SOURCE_STAT, ZIP_SOURCE_ERROR, ZIP_SOURCE_FREE, ZIP_SOURCE_SEEK, ZIP_SOURCE_TELL, ZIP_SOURCE_BEGIN_WRITE, ZIP_SOURCE_BEGIN_WRITE_CLONING, ZIP_SOURCE_COMMIT_WRITE, ZIP_SOURCE_REMOVE, ZIP_SOURCE_ROLLBACK_WRITE, ZIP_SOURCE_SEEK_WRITE, ZIP_SOURCE_TELL_WRITE, ZIP_SOURCE_WRITE, ZIP_SOURCE_SUPPORTS_REOPEN, -1);
case ZIP_SOURCE_TELL:
- if (ctx->in->offset > ZIP_INT64_MAX) {
- zip_error_set(&ctx->error, ZIP_ER_TELL, EOVERFLOW);
- return -1;
- }
- return (zip_int64_t)ctx->in->offset;
+ if (ctx->in->offset > ZIP_INT64_MAX) {
+ zip_error_set(&ctx->error, ZIP_ER_TELL, EOVERFLOW);
+ return -1;
+ }
+ return (zip_int64_t)ctx->in->offset;
case ZIP_SOURCE_TELL_WRITE:
- if (ctx->out->offset > ZIP_INT64_MAX) {
- zip_error_set(&ctx->error, ZIP_ER_TELL, EOVERFLOW);
- return -1;
- }
- return (zip_int64_t)ctx->out->offset;
+ if (ctx->out->offset > ZIP_INT64_MAX) {
+ zip_error_set(&ctx->error, ZIP_ER_TELL, EOVERFLOW);
+ return -1;
+ }
+ return (zip_int64_t)ctx->out->offset;
case ZIP_SOURCE_WRITE:
- if (len > ZIP_INT64_MAX) {
- zip_error_set(&ctx->error, ZIP_ER_INVAL, 0);
- return -1;
- }
- return buffer_write(ctx->out, data, len, &ctx->error);
+ if (len > ZIP_INT64_MAX) {
+ zip_error_set(&ctx->error, ZIP_ER_INVAL, 0);
+ return -1;
+ }
+ return buffer_write(ctx->out, data, len, &ctx->error);
default:
- zip_error_set(&ctx->error, ZIP_ER_OPNOTSUPP, 0);
- return -1;
+ zip_error_set(&ctx->error, ZIP_ER_OPNOTSUPP, 0);
+ return -1;
}
}
@@ -324,50 +324,51 @@ buffer_clone(buffer_t *buffer, zip_uint64_t offset, zip_error_t *error) {
buffer_t *clone;
if (offset == 0) {
- return buffer_new(NULL, 0, 1, error);
+ return buffer_new(NULL, 0, 1, error);
}
if (offset > buffer->size) {
- zip_error_set(error, ZIP_ER_INVAL, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return NULL;
}
if (buffer->shared_buffer != NULL) {
- zip_error_set(error, ZIP_ER_INUSE, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_INUSE, 0);
+ return NULL;
}
fragment = buffer_find_fragment(buffer, offset);
fragment_offset = offset - buffer->fragment_offsets[fragment];
if (fragment_offset == 0) {
- fragment--;
- fragment_offset = buffer->fragments[fragment].length;
+ fragment--;
+ fragment_offset = buffer->fragments[fragment].length;
}
+ /* TODO: This should also consider the length of the fully shared fragments */
waste = buffer->fragments[fragment].length - fragment_offset;
if (waste > offset) {
- zip_error_set(error, ZIP_ER_OPNOTSUPP, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_OPNOTSUPP, 0);
+ return NULL;
}
if ((clone = buffer_new(buffer->fragments, fragment + 1, 0, error)) == NULL) {
- return NULL;
+ return NULL;
}
#ifndef __clang_analyzer__
/* clone->fragments can't be null, since it was created with at least one fragment */
- clone->fragments[clone->nfragments - 1].length = fragment_offset;
+ clone->fragments[fragment].length = fragment_offset;
#endif
clone->fragment_offsets[clone->nfragments] = offset;
clone->size = offset;
- clone->first_owned_fragment = ZIP_MIN(buffer->first_owned_fragment, clone->nfragments - 1);
+ clone->first_owned_fragment = ZIP_MIN(buffer->first_owned_fragment, clone->nfragments);
buffer->shared_buffer = clone;
clone->shared_buffer = buffer;
- buffer->shared_fragments = clone->nfragments;
+ buffer->shared_fragments = fragment + 1;
clone->shared_fragments = fragment + 1;
-
+
return clone;
}
@@ -376,20 +377,24 @@ static zip_uint64_t
buffer_find_fragment(const buffer_t *buffer, zip_uint64_t offset) {
zip_uint64_t low, high, mid;
+ if (buffer->nfragments == 0) {
+ return 0;
+ }
+
low = 0;
high = buffer->nfragments - 1;
while (low < high) {
- mid = (high - low) / 2 + low;
- if (buffer->fragment_offsets[mid] > offset) {
- high = mid - 1;
- }
- else if (mid == buffer->nfragments || buffer->fragment_offsets[mid + 1] > offset) {
- return mid;
- }
- else {
- low = mid + 1;
- }
+ mid = (high - low) / 2 + low;
+ if (buffer->fragment_offsets[mid] > offset) {
+ high = mid - 1;
+ }
+ else if (mid == buffer->nfragments || buffer->fragment_offsets[mid + 1] > offset) {
+ return mid;
+ }
+ else {
+ low = mid + 1;
+ }
}
return low;
@@ -401,18 +406,18 @@ buffer_free(buffer_t *buffer) {
zip_uint64_t i;
if (buffer == NULL) {
- return;
+ return;
}
if (buffer->shared_buffer != NULL) {
- buffer->shared_buffer->shared_buffer = NULL;
- buffer->shared_buffer->shared_fragments = 0;
+ buffer->shared_buffer->shared_buffer = NULL;
+ buffer->shared_buffer->shared_fragments = 0;
- buffer->first_owned_fragment = ZIP_MAX(buffer->first_owned_fragment, buffer->shared_fragments);
+ buffer->first_owned_fragment = ZIP_MAX(buffer->first_owned_fragment, buffer->shared_fragments);
}
for (i = buffer->first_owned_fragment; i < buffer->nfragments; i++) {
- free(buffer->fragments[i].data);
+ free(buffer->fragments[i].data);
}
free(buffer->fragments);
free(buffer->fragment_offsets);
@@ -424,19 +429,29 @@ static bool
buffer_grow_fragments(buffer_t *buffer, zip_uint64_t capacity, zip_error_t *error) {
zip_buffer_fragment_t *fragments;
zip_uint64_t *offsets;
+ zip_uint64_t fragments_size;
+ zip_uint64_t offsets_size;
if (capacity < buffer->fragments_capacity) {
- return true;
+ return true;
+ }
+
+ fragments_size = sizeof(buffer->fragments[0]) * capacity;
+ offsets_size = sizeof(buffer->fragment_offsets[0]) * (capacity + 1);
+
+ if (capacity == ZIP_UINT64_MAX || fragments_size < capacity || fragments_size > SIZE_MAX|| offsets_size < capacity || offsets_size > SIZE_MAX) {
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return false;
}
- if ((fragments = realloc(buffer->fragments, sizeof(buffer->fragments[0]) * capacity)) == NULL) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- return false;
+ if ((fragments = realloc(buffer->fragments, (size_t)fragments_size)) == NULL) {
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return false;
}
buffer->fragments = fragments;
- if ((offsets = realloc(buffer->fragment_offsets, sizeof(buffer->fragment_offsets[0]) * (capacity + 1))) == NULL) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- return false;
+ if ((offsets = realloc(buffer->fragment_offsets, (size_t)offsets_size)) == NULL) {
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return false;
}
buffer->fragment_offsets = offsets;
buffer->fragments_capacity = capacity;
@@ -450,7 +465,7 @@ buffer_new(const zip_buffer_fragment_t *fragments, zip_uint64_t nfragments, int
buffer_t *buffer;
if ((buffer = malloc(sizeof(*buffer))) == NULL) {
- return NULL;
+ return NULL;
}
buffer->offset = 0;
@@ -464,42 +479,43 @@ buffer_new(const zip_buffer_fragment_t *fragments, zip_uint64_t nfragments, int
buffer->shared_fragments = 0;
if (nfragments == 0) {
- if ((buffer->fragment_offsets = malloc(sizeof(buffer->fragment_offsets[0]))) == NULL) {
- free(buffer);
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- return NULL;
- }
- buffer->fragment_offsets[0] = 0;
+ if ((buffer->fragment_offsets = malloc(sizeof(buffer->fragment_offsets[0]))) == NULL) {
+ free(buffer);
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
+ }
+ buffer->fragment_offsets[0] = 0;
}
else {
- zip_uint64_t i, j, offset;
-
- if (!buffer_grow_fragments(buffer, nfragments, NULL)) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- buffer_free(buffer);
- return NULL;
- }
-
- offset = 0;
- for (i = 0, j = 0; i < nfragments; i++) {
- if (fragments[i].length == 0) {
- continue;
- }
- if (fragments[i].data == NULL) {
- zip_error_set(error, ZIP_ER_INVAL, 0);
- buffer_free(buffer);
- return NULL;
- }
- buffer->fragments[j].data = fragments[i].data;
- buffer->fragments[j].length = fragments[i].length;
- buffer->fragment_offsets[i] = offset;
- offset += fragments[i].length;
- j++;
- }
- buffer->nfragments = j;
- buffer->first_owned_fragment = free_data ? 0 : buffer->nfragments;
- buffer->fragment_offsets[buffer->nfragments] = offset;
- buffer->size = offset;
+ zip_uint64_t i, j, offset;
+
+ if (!buffer_grow_fragments(buffer, nfragments, NULL)) {
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ buffer_free(buffer);
+ return NULL;
+ }
+
+ offset = 0;
+ for (i = 0, j = 0; i < nfragments; i++) {
+ if (fragments[i].length == 0) {
+ continue;
+ }
+ if (fragments[i].data == NULL) {
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ buffer_free(buffer);
+ return NULL;
+ }
+ buffer->fragments[j].data = fragments[i].data;
+ buffer->fragments[j].length = fragments[i].length;
+ buffer->fragment_offsets[i] = offset;
+ /* TODO: overflow */
+ offset += fragments[i].length;
+ j++;
+ }
+ buffer->nfragments = j;
+ buffer->first_owned_fragment = free_data ? 0 : buffer->nfragments;
+ buffer->fragment_offsets[buffer->nfragments] = offset;
+ buffer->size = offset;
}
return buffer;
@@ -512,25 +528,28 @@ buffer_read(buffer_t *buffer, zip_uint8_t *data, zip_uint64_t length) {
length = ZIP_MIN(length, buffer->size - buffer->offset);
if (length == 0) {
- return 0;
+ return 0;
}
if (length > ZIP_INT64_MAX) {
- return -1;
+ return -1;
}
i = buffer->current_fragment;
fragment_offset = buffer->offset - buffer->fragment_offsets[i];
n = 0;
while (n < length) {
- zip_uint64_t left = ZIP_MIN(length - n, buffer->fragments[i].length - fragment_offset);
+ zip_uint64_t left = ZIP_MIN(length - n, buffer->fragments[i].length - fragment_offset);
+#if ZIP_UINT64_MAX > SIZE_MAX
+ left = ZIP_MIN(left, SIZE_MAX);
+#endif
- memcpy(data + n, buffer->fragments[i].data + fragment_offset, left);
+ (void)memcpy_s(data + n, (size_t)left, buffer->fragments[i].data + fragment_offset, (size_t)left);
- if (left == buffer->fragments[i].length - fragment_offset) {
- i++;
- }
- n += left;
- fragment_offset = 0;
+ if (left == buffer->fragments[i].length - fragment_offset) {
+ i++;
+ }
+ n += left;
+ fragment_offset = 0;
}
buffer->offset += n;
@@ -544,7 +563,7 @@ buffer_seek(buffer_t *buffer, void *data, zip_uint64_t len, zip_error_t *error)
zip_int64_t new_offset = zip_source_seek_compute_offset(buffer->offset, buffer->size, data, len, error);
if (new_offset < 0) {
- return -1;
+ return -1;
}
buffer->offset = (zip_uint64_t)new_offset;
@@ -555,66 +574,72 @@ buffer_seek(buffer_t *buffer, void *data, zip_uint64_t len, zip_error_t *error)
static zip_int64_t
buffer_write(buffer_t *buffer, const zip_uint8_t *data, zip_uint64_t length, zip_error_t *error) {
- zip_uint64_t n, i, fragment_offset, capacity;
+ zip_uint64_t copied, i, fragment_offset, capacity;
if (buffer->offset + length + WRITE_FRAGMENT_SIZE - 1 < length) {
- zip_error_set(error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return -1;
}
/* grow buffer if needed */
capacity = buffer_capacity(buffer);
if (buffer->offset + length > capacity) {
- zip_uint64_t needed_fragments = buffer->nfragments + (length - (capacity - buffer->offset) + WRITE_FRAGMENT_SIZE - 1) / WRITE_FRAGMENT_SIZE;
-
- if (needed_fragments > buffer->fragments_capacity) {
- zip_uint64_t new_capacity = buffer->fragments_capacity;
-
- if (new_capacity == 0) {
- new_capacity = 16;
- }
- while (new_capacity < needed_fragments) {
- new_capacity *= 2;
- }
-
- if (!buffer_grow_fragments(buffer, new_capacity, error)) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- return -1;
- }
- }
-
- while (buffer->nfragments < needed_fragments) {
- if ((buffer->fragments[buffer->nfragments].data = malloc(WRITE_FRAGMENT_SIZE)) == NULL) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- return -1;
- }
- buffer->fragments[buffer->nfragments].length = WRITE_FRAGMENT_SIZE;
- buffer->nfragments++;
- capacity += WRITE_FRAGMENT_SIZE;
- buffer->fragment_offsets[buffer->nfragments] = capacity;
- }
+ zip_uint64_t needed_fragments = buffer->nfragments + (length - (capacity - buffer->offset) + WRITE_FRAGMENT_SIZE - 1) / WRITE_FRAGMENT_SIZE;
+
+ if (needed_fragments > buffer->fragments_capacity) {
+ zip_uint64_t new_capacity = buffer->fragments_capacity;
+
+ if (new_capacity == 0) {
+ new_capacity = 16;
+ }
+ while (new_capacity < needed_fragments) {
+ new_capacity *= 2;
+ }
+
+ if (!buffer_grow_fragments(buffer, new_capacity, error)) {
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return -1;
+ }
+ }
+
+ while (buffer->nfragments < needed_fragments) {
+ if ((buffer->fragments[buffer->nfragments].data = malloc(WRITE_FRAGMENT_SIZE)) == NULL) {
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return -1;
+ }
+ buffer->fragments[buffer->nfragments].length = WRITE_FRAGMENT_SIZE;
+ buffer->nfragments++;
+ capacity += WRITE_FRAGMENT_SIZE;
+ buffer->fragment_offsets[buffer->nfragments] = capacity;
+ }
}
i = buffer->current_fragment;
fragment_offset = buffer->offset - buffer->fragment_offsets[i];
- n = 0;
- while (n < length) {
- zip_uint64_t left = ZIP_MIN(length - n, buffer->fragments[i].length - fragment_offset);
+ copied = 0;
+ while (copied < length) {
+ zip_uint64_t n = ZIP_MIN(ZIP_MIN(length - copied, buffer->fragments[i].length - fragment_offset), SIZE_MAX);
+#if ZIP_UINT64_MAX > SIZE_MAX
+ n = ZIP_MIN(n, SIZE_MAX);
+#endif
- memcpy(buffer->fragments[i].data + fragment_offset, data + n, left);
+ (void)memcpy_s(buffer->fragments[i].data + fragment_offset, (size_t)n, data + copied, (size_t)n);
- if (left == buffer->fragments[i].length - fragment_offset) {
- i++;
- }
- n += left;
- fragment_offset = 0;
+ if (n == buffer->fragments[i].length - fragment_offset) {
+ i++;
+ fragment_offset = 0;
+ }
+ else {
+ fragment_offset += n;
+ }
+ copied += n;
}
- buffer->offset += n;
+ buffer->offset += copied;
buffer->current_fragment = i;
if (buffer->offset > buffer->size) {
- buffer->size = buffer->offset;
+ buffer->size = buffer->offset;
}
- return (zip_int64_t)n;
+ return (zip_int64_t)copied;
}
diff --git a/src/Common/libzip/zip_source_call.c b/src/Common/libzip/zip_source_call.c
index e7c29544..8c98fc2e 100644
--- a/src/Common/libzip/zip_source_call.c
+++ b/src/Common/libzip/zip_source_call.c
@@ -1,9 +1,9 @@
/*
zip_source_call.c -- invoke callback command on zip_source
- Copyright (C) 2009-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -40,28 +40,28 @@ _zip_source_call(zip_source_t *src, void *data, zip_uint64_t length, zip_source_
zip_int64_t ret;
if ((src->supports & ZIP_SOURCE_MAKE_COMMAND_BITMASK(command)) == 0) {
- zip_error_set(&src->error, ZIP_ER_OPNOTSUPP, 0);
- return -1;
+ zip_error_set(&src->error, ZIP_ER_OPNOTSUPP, 0);
+ return -1;
}
if (src->src == NULL) {
- ret = src->cb.f(src->ud, data, length, command);
+ ret = src->cb.f(src->ud, data, length, command);
}
else {
- ret = src->cb.l(src->src, src->ud, data, length, command);
+ ret = src->cb.l(src->src, src->ud, data, length, command);
}
if (ret < 0) {
- if (command != ZIP_SOURCE_ERROR && command != ZIP_SOURCE_SUPPORTS) {
- int e[2];
+ if (command != ZIP_SOURCE_ERROR && command != ZIP_SOURCE_SUPPORTS) {
+ int e[2];
- if (_zip_source_call(src, e, sizeof(e), ZIP_SOURCE_ERROR) < 0) {
- zip_error_set(&src->error, ZIP_ER_INTERNAL, 0);
- }
- else {
- zip_error_set(&src->error, e[0], e[1]);
- }
- }
+ if (_zip_source_call(src, e, sizeof(e), ZIP_SOURCE_ERROR) < 0) {
+ zip_error_set(&src->error, ZIP_ER_INTERNAL, 0);
+ }
+ else {
+ zip_error_set(&src->error, e[0], e[1]);
+ }
+ }
}
return ret;
diff --git a/src/Common/libzip/zip_source_close.c b/src/Common/libzip/zip_source_close.c
index ab7898ce..f4f3ff2b 100644
--- a/src/Common/libzip/zip_source_close.c
+++ b/src/Common/libzip/zip_source_close.c
@@ -1,9 +1,9 @@
/*
zip_source_close.c -- close zip_source (stop reading)
- Copyright (C) 2009-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -38,19 +38,19 @@
int
zip_source_close(zip_source_t *src) {
if (!ZIP_SOURCE_IS_OPEN_READING(src)) {
- zip_error_set(&src->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&src->error, ZIP_ER_INVAL, 0);
+ return -1;
}
src->open_count--;
if (src->open_count == 0) {
- _zip_source_call(src, NULL, 0, ZIP_SOURCE_CLOSE);
+ _zip_source_call(src, NULL, 0, ZIP_SOURCE_CLOSE);
- if (ZIP_SOURCE_IS_LAYERED(src)) {
- if (zip_source_close(src->src) < 0) {
- zip_error_set(&src->error, ZIP_ER_INTERNAL, 0);
- }
- }
+ if (ZIP_SOURCE_IS_LAYERED(src)) {
+ if (zip_source_close(src->src) < 0) {
+ zip_error_set(&src->error, ZIP_ER_INTERNAL, 0);
+ }
+ }
}
return 0;
diff --git a/src/Common/libzip/zip_source_commit_write.c b/src/Common/libzip/zip_source_commit_write.c
index d1254bf1..d7f567b8 100644
--- a/src/Common/libzip/zip_source_commit_write.c
+++ b/src/Common/libzip/zip_source_commit_write.c
@@ -1,9 +1,9 @@
/*
zip_source_commit_write.c -- commit changes to file
- Copyright (C) 2014-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -37,24 +37,29 @@
ZIP_EXTERN int
zip_source_commit_write(zip_source_t *src) {
+ if (ZIP_SOURCE_IS_LAYERED(src)) {
+ zip_error_set(&src->error, ZIP_ER_OPNOTSUPP, 0);
+ return -1;
+ }
+
if (!ZIP_SOURCE_IS_OPEN_WRITING(src)) {
- zip_error_set(&src->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&src->error, ZIP_ER_INVAL, 0);
+ return -1;
}
if (src->open_count > 1) {
- zip_error_set(&src->error, ZIP_ER_INUSE, 0);
- return -1;
+ zip_error_set(&src->error, ZIP_ER_INUSE, 0);
+ return -1;
}
else if (ZIP_SOURCE_IS_OPEN_READING(src)) {
- if (zip_source_close(src) < 0) {
- return -1;
- }
+ if (zip_source_close(src) < 0) {
+ return -1;
+ }
}
if (_zip_source_call(src, NULL, 0, ZIP_SOURCE_COMMIT_WRITE) < 0) {
- src->write_state = ZIP_SOURCE_WRITE_FAILED;
- return -1;
+ src->write_state = ZIP_SOURCE_WRITE_FAILED;
+ return -1;
}
src->write_state = ZIP_SOURCE_WRITE_CLOSED;
diff --git a/src/Common/libzip/zip_source_compress.c b/src/Common/libzip/zip_source_compress.c
index e49929f5..3cf709ff 100644
--- a/src/Common/libzip/zip_source_compress.c
+++ b/src/Common/libzip/zip_source_compress.c
@@ -1,9 +1,9 @@
/*
zip_source_compress.c -- (de)compression routines
- Copyright (C) 2017-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2017-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -67,39 +67,42 @@ static struct implementation implementations[] = {
{ZIP_CM_BZIP2, &zip_algorithm_bzip2_compress, &zip_algorithm_bzip2_decompress},
#endif
#if defined(HAVE_LIBLZMA)
- /* Disabled - because 7z isn't able to unpack ZIP+LZMA ZIP+LZMA2
- archives made this way - and vice versa.
+ {ZIP_CM_LZMA, &zip_algorithm_xz_compress, &zip_algorithm_xz_decompress},
+ /* Disabled - because 7z isn't able to unpack ZIP+LZMA2
+ archives made this way - and vice versa.
- {ZIP_CM_LZMA, &zip_algorithm_xz_compress, &zip_algorithm_xz_decompress},
- {ZIP_CM_LZMA2, &zip_algorithm_xz_compress, &zip_algorithm_xz_decompress},
+ {ZIP_CM_LZMA2, &zip_algorithm_xz_compress, &zip_algorithm_xz_decompress},
*/
{ZIP_CM_XZ, &zip_algorithm_xz_compress, &zip_algorithm_xz_decompress},
#endif
+#if defined(HAVE_LIBZSTD)
+ {ZIP_CM_ZSTD, &zip_algorithm_zstd_compress, &zip_algorithm_zstd_decompress},
+#endif
};
static size_t implementations_size = sizeof(implementations) / sizeof(implementations[0]);
-static zip_source_t *compression_source_new(zip_t *za, zip_source_t *src, zip_int32_t method, bool compress, int compression_flags);
+static zip_source_t *compression_source_new(zip_t *za, zip_source_t *src, zip_int32_t method, bool compress, zip_uint32_t compression_flags);
static zip_int64_t compress_callback(zip_source_t *, void *, void *, zip_uint64_t, zip_source_cmd_t);
static void context_free(struct context *ctx);
-static struct context *context_new(zip_int32_t method, bool compress, int compression_flags, zip_compression_algorithm_t *algorithm);
+static struct context *context_new(zip_int32_t method, bool compress, zip_uint32_t compression_flags, zip_compression_algorithm_t *algorithm);
static zip_int64_t compress_read(zip_source_t *, struct context *, void *, zip_uint64_t);
-static zip_compression_algorithm_t *
-get_algorithm(zip_int32_t method, bool compress) {
+zip_compression_algorithm_t *
+_zip_get_compression_algorithm(zip_int32_t method, bool compress) {
size_t i;
zip_uint16_t real_method = ZIP_CM_ACTUAL(method);
for (i = 0; i < implementations_size; i++) {
- if (implementations[i].method == real_method) {
- if (compress) {
- return implementations[i].compress;
- }
- else {
- return implementations[i].decompress;
- }
- }
+ if (implementations[i].method == real_method) {
+ if (compress) {
+ return implementations[i].compress;
+ }
+ else {
+ return implementations[i].decompress;
+ }
+ }
}
return NULL;
@@ -108,13 +111,13 @@ get_algorithm(zip_int32_t method, bool compress) {
ZIP_EXTERN int
zip_compression_method_supported(zip_int32_t method, int compress) {
if (method == ZIP_CM_STORE) {
- return 1;
+ return 1;
}
- return get_algorithm(method, compress) != NULL;
+ return _zip_get_compression_algorithm(method, compress) != NULL;
}
zip_source_t *
-zip_source_compress(zip_t *za, zip_source_t *src, zip_int32_t method, int compression_flags) {
+zip_source_compress(zip_t *za, zip_source_t *src, zip_int32_t method, zip_uint32_t compression_flags) {
return compression_source_new(za, src, method, true, compression_flags);
}
@@ -125,29 +128,29 @@ zip_source_decompress(zip_t *za, zip_source_t *src, zip_int32_t method) {
static zip_source_t *
-compression_source_new(zip_t *za, zip_source_t *src, zip_int32_t method, bool compress, int compression_flags) {
+compression_source_new(zip_t *za, zip_source_t *src, zip_int32_t method, bool compress, zip_uint32_t compression_flags) {
struct context *ctx;
zip_source_t *s2;
zip_compression_algorithm_t *algorithm = NULL;
if (src == NULL) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return NULL;
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return NULL;
}
- if ((algorithm = get_algorithm(method, compress)) == NULL) {
- zip_error_set(&za->error, ZIP_ER_COMPNOTSUPP, 0);
- return NULL;
+ if ((algorithm = _zip_get_compression_algorithm(method, compress)) == NULL) {
+ zip_error_set(&za->error, ZIP_ER_COMPNOTSUPP, 0);
+ return NULL;
}
if ((ctx = context_new(method, compress, compression_flags, algorithm)) == NULL) {
- zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
- return NULL;
+ zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
+ return NULL;
}
if ((s2 = zip_source_layered(za, src, compress_callback, ctx)) == NULL) {
- context_free(ctx);
- return NULL;
+ context_free(ctx);
+ return NULL;
}
return s2;
@@ -155,11 +158,11 @@ compression_source_new(zip_t *za, zip_source_t *src, zip_int32_t method, bool co
static struct context *
-context_new(zip_int32_t method, bool compress, int compression_flags, zip_compression_algorithm_t *algorithm) {
+context_new(zip_int32_t method, bool compress, zip_uint32_t compression_flags, zip_compression_algorithm_t *algorithm) {
struct context *ctx;
if ((ctx = (struct context *)malloc(sizeof(*ctx))) == NULL) {
- return NULL;
+ return NULL;
}
zip_error_init(&ctx->error);
ctx->can_store = compress ? ZIP_CM_IS_DEFAULT(method) : false;
@@ -171,9 +174,9 @@ context_new(zip_int32_t method, bool compress, int compression_flags, zip_compre
ctx->is_stored = false;
if ((ctx->ud = ctx->algorithm->allocate(ZIP_CM_ACTUAL(method), compression_flags, &ctx->error)) == NULL) {
- zip_error_fini(&ctx->error);
- free(ctx);
- return NULL;
+ zip_error_fini(&ctx->error);
+ free(ctx);
+ return NULL;
}
return ctx;
@@ -183,7 +186,7 @@ context_new(zip_int32_t method, bool compress, int compression_flags, zip_compre
static void
context_free(struct context *ctx) {
if (ctx == NULL) {
- return;
+ return;
}
ctx->algorithm->deallocate(ctx->ud);
@@ -202,96 +205,96 @@ compress_read(zip_source_t *src, struct context *ctx, void *data, zip_uint64_t l
zip_uint64_t out_len;
if (zip_error_code_zip(&ctx->error) != ZIP_ER_OK) {
- return -1;
+ return -1;
}
if (len == 0 || ctx->end_of_stream) {
- return 0;
+ return 0;
}
out_offset = 0;
end = false;
while (!end && out_offset < len) {
- out_len = len - out_offset;
- ret = ctx->algorithm->process(ctx->ud, (zip_uint8_t *)data + out_offset, &out_len);
-
- if (ret != ZIP_COMPRESSION_ERROR) {
- out_offset += out_len;
- }
-
- switch (ret) {
- case ZIP_COMPRESSION_END:
- ctx->end_of_stream = true;
-
- if (!ctx->end_of_input) {
- /* TODO: garbage after stream, or compression ended before all data read */
- }
-
- if (ctx->first_read < 0) {
- /* we got end of processed stream before reading any input data */
- zip_error_set(&ctx->error, ZIP_ER_INTERNAL, 0);
- end = true;
- break;
- }
- if (ctx->can_store && (zip_uint64_t)ctx->first_read <= out_offset) {
- ctx->is_stored = true;
- ctx->size = (zip_uint64_t)ctx->first_read;
- memcpy(data, ctx->buffer, ctx->size);
- return (zip_int64_t)ctx->size;
- }
- end = true;
- break;
-
- case ZIP_COMPRESSION_OK:
- break;
-
- case ZIP_COMPRESSION_NEED_DATA:
- if (ctx->end_of_input) {
- /* TODO: error: stream not ended, but no more input */
- end = true;
- break;
- }
-
- if ((n = zip_source_read(src, ctx->buffer, sizeof(ctx->buffer))) < 0) {
- _zip_error_set_from_source(&ctx->error, src);
- end = true;
- break;
- }
- else if (n == 0) {
- ctx->end_of_input = true;
- ctx->algorithm->end_of_input(ctx->ud);
- if (ctx->first_read < 0) {
- ctx->first_read = 0;
- }
- }
- else {
- if (ctx->first_read >= 0) {
- /* we overwrote a previously filled ctx->buffer */
- ctx->can_store = false;
- }
- else {
- ctx->first_read = n;
- }
-
- ctx->algorithm->input(ctx->ud, ctx->buffer, (zip_uint64_t)n);
- }
- break;
-
- case ZIP_COMPRESSION_ERROR:
- /* error set by algorithm */
- if (zip_error_code_zip(&ctx->error) == ZIP_ER_OK) {
- zip_error_set(&ctx->error, ZIP_ER_INTERNAL, 0);
- }
- end = true;
- break;
- }
+ out_len = len - out_offset;
+ ret = ctx->algorithm->process(ctx->ud, (zip_uint8_t *)data + out_offset, &out_len);
+
+ if (ret != ZIP_COMPRESSION_ERROR) {
+ out_offset += out_len;
+ }
+
+ switch (ret) {
+ case ZIP_COMPRESSION_END:
+ ctx->end_of_stream = true;
+
+ if (!ctx->end_of_input) {
+ /* TODO: garbage after stream, or compression ended before all data read */
+ }
+
+ if (ctx->first_read < 0) {
+ /* we got end of processed stream before reading any input data */
+ zip_error_set(&ctx->error, ZIP_ER_INTERNAL, 0);
+ end = true;
+ break;
+ }
+ if (ctx->can_store && (zip_uint64_t)ctx->first_read <= out_offset) {
+ ctx->is_stored = true;
+ ctx->size = (zip_uint64_t)ctx->first_read;
+ (void)memcpy_s(data, ctx->size, ctx->buffer, ctx->size);
+ return (zip_int64_t)ctx->size;
+ }
+ end = true;
+ break;
+
+ case ZIP_COMPRESSION_OK:
+ break;
+
+ case ZIP_COMPRESSION_NEED_DATA:
+ if (ctx->end_of_input) {
+ /* TODO: error: stream not ended, but no more input */
+ end = true;
+ break;
+ }
+
+ if ((n = zip_source_read(src, ctx->buffer, sizeof(ctx->buffer))) < 0) {
+ zip_error_set_from_source(&ctx->error, src);
+ end = true;
+ break;
+ }
+ else if (n == 0) {
+ ctx->end_of_input = true;
+ ctx->algorithm->end_of_input(ctx->ud);
+ if (ctx->first_read < 0) {
+ ctx->first_read = 0;
+ }
+ }
+ else {
+ if (ctx->first_read >= 0) {
+ /* we overwrote a previously filled ctx->buffer */
+ ctx->can_store = false;
+ }
+ else {
+ ctx->first_read = n;
+ }
+
+ ctx->algorithm->input(ctx->ud, ctx->buffer, (zip_uint64_t)n);
+ }
+ break;
+
+ case ZIP_COMPRESSION_ERROR:
+ /* error set by algorithm */
+ if (zip_error_code_zip(&ctx->error) == ZIP_ER_OK) {
+ zip_error_set(&ctx->error, ZIP_ER_INTERNAL, 0);
+ }
+ end = true;
+ break;
+ }
}
if (out_offset > 0) {
- ctx->can_store = false;
- ctx->size += out_offset;
- return (zip_int64_t)out_offset;
+ ctx->can_store = false;
+ ctx->size += out_offset;
+ return (zip_int64_t)out_offset;
}
return (zip_error_code_zip(&ctx->error) == ZIP_ER_OK) ? 0 : -1;
@@ -305,85 +308,91 @@ compress_callback(zip_source_t *src, void *ud, void *data, zip_uint64_t len, zip
ctx = (struct context *)ud;
switch (cmd) {
- case ZIP_SOURCE_OPEN:
- ctx->size = 0;
- ctx->end_of_input = false;
- ctx->end_of_stream = false;
- ctx->is_stored = false;
- ctx->first_read = -1;
-
- if (!ctx->algorithm->start(ctx->ud)) {
- return -1;
- }
-
- return 0;
+ case ZIP_SOURCE_OPEN: {
+ zip_stat_t st;
+ zip_file_attributes_t attributes;
+
+ ctx->size = 0;
+ ctx->end_of_input = false;
+ ctx->end_of_stream = false;
+ ctx->is_stored = false;
+ ctx->first_read = -1;
+
+ if (zip_source_stat(src, &st) < 0 || zip_source_get_file_attributes(src, &attributes) < 0) {
+ zip_error_set_from_source(&ctx->error, src);
+ return -1;
+ }
+
+ if (!ctx->algorithm->start(ctx->ud, &st, &attributes)) {
+ return -1;
+ }
+
+ return 0;
+ }
case ZIP_SOURCE_READ:
- return compress_read(src, ctx, data, len);
+ return compress_read(src, ctx, data, len);
case ZIP_SOURCE_CLOSE:
- if (!ctx->algorithm->end(ctx->ud)) {
- return -1;
- }
- return 0;
+ if (!ctx->algorithm->end(ctx->ud)) {
+ return -1;
+ }
+ return 0;
case ZIP_SOURCE_STAT: {
- zip_stat_t *st;
-
- st = (zip_stat_t *)data;
-
- if (ctx->compress) {
- if (ctx->end_of_stream) {
- st->comp_method = ctx->is_stored ? ZIP_CM_STORE : ZIP_CM_ACTUAL(ctx->method);
- st->comp_size = ctx->size;
- st->valid |= ZIP_STAT_COMP_SIZE | ZIP_STAT_COMP_METHOD;
- }
- else {
- st->valid &= ~(ZIP_STAT_COMP_SIZE | ZIP_STAT_COMP_METHOD);
- }
- }
- else {
- st->comp_method = ZIP_CM_STORE;
- st->valid |= ZIP_STAT_COMP_METHOD;
- if (ctx->end_of_stream) {
- st->size = ctx->size;
- st->valid |= ZIP_STAT_SIZE;
- }
- else {
- st->valid &= ~ZIP_STAT_SIZE;
- }
- }
+ zip_stat_t *st;
+
+ st = (zip_stat_t *)data;
+
+ if (ctx->compress) {
+ if (ctx->end_of_stream) {
+ st->comp_method = ctx->is_stored ? ZIP_CM_STORE : ZIP_CM_ACTUAL(ctx->method);
+ st->comp_size = ctx->size;
+ st->valid |= ZIP_STAT_COMP_SIZE | ZIP_STAT_COMP_METHOD;
+ }
+ else {
+ st->valid &= ~(ZIP_STAT_COMP_SIZE | ZIP_STAT_COMP_METHOD);
+ }
+ }
+ else {
+ st->comp_method = ZIP_CM_STORE;
+ st->valid |= ZIP_STAT_COMP_METHOD;
+ st->valid &= ~ZIP_STAT_COMP_SIZE;
+ if (ctx->end_of_stream) {
+ st->size = ctx->size;
+ st->valid |= ZIP_STAT_SIZE;
+ }
+ }
}
- return 0;
+ return 0;
case ZIP_SOURCE_ERROR:
- return zip_error_to_data(&ctx->error, data, len);
+ return zip_error_to_data(&ctx->error, data, len);
case ZIP_SOURCE_FREE:
- context_free(ctx);
- return 0;
+ context_free(ctx);
+ return 0;
case ZIP_SOURCE_GET_FILE_ATTRIBUTES: {
- zip_file_attributes_t *attributes = (zip_file_attributes_t *)data;
+ zip_file_attributes_t *attributes = (zip_file_attributes_t *)data;
- if (len < sizeof(*attributes)) {
- zip_error_set(&ctx->error, ZIP_ER_INVAL, 0);
- return -1;
- }
+ if (len < sizeof(*attributes)) {
+ zip_error_set(&ctx->error, ZIP_ER_INVAL, 0);
+ return -1;
+ }
- attributes->valid |= ZIP_FILE_ATTRIBUTES_VERSION_NEEDED | ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS;
- attributes->version_needed = ctx->algorithm->version_needed;
- attributes->general_purpose_bit_mask = ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS_ALLOWED_MASK;
- attributes->general_purpose_bit_flags = (ctx->is_stored ? 0 : ctx->algorithm->general_purpose_bit_flags(ctx->ud));
+ attributes->valid |= ZIP_FILE_ATTRIBUTES_VERSION_NEEDED | ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS;
+ attributes->version_needed = ctx->algorithm->version_needed;
+ attributes->general_purpose_bit_mask = ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS_ALLOWED_MASK;
+ attributes->general_purpose_bit_flags = (ctx->is_stored ? 0 : ctx->algorithm->general_purpose_bit_flags(ctx->ud));
- return sizeof(*attributes);
+ return sizeof(*attributes);
}
case ZIP_SOURCE_SUPPORTS:
- return ZIP_SOURCE_SUPPORTS_READABLE | zip_source_make_command_bitmap(ZIP_SOURCE_GET_FILE_ATTRIBUTES, -1);
+ return ZIP_SOURCE_SUPPORTS_READABLE | zip_source_make_command_bitmap(ZIP_SOURCE_GET_FILE_ATTRIBUTES, ZIP_SOURCE_SUPPORTS_REOPEN, -1);
default:
- zip_error_set(&ctx->error, ZIP_ER_INTERNAL, 0);
- return -1;
+ return zip_source_pass_to_lower_layer(src, data, len, cmd);
}
}
diff --git a/src/Common/libzip/zip_source_crc.c b/src/Common/libzip/zip_source_crc.c
index 4f3f223f..435a084b 100644
--- a/src/Common/libzip/zip_source_crc.c
+++ b/src/Common/libzip/zip_source_crc.c
@@ -1,9 +1,9 @@
/*
zip_source_crc.c -- pass-through source that calculates CRC32 and size
- Copyright (C) 2009-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -52,17 +52,17 @@ static zip_int64_t crc_read(zip_source_t *, void *, void *, zip_uint64_t, zip_so
zip_source_t *
-zip_source_crc(zip_t *za, zip_source_t *src, int validate) {
+zip_source_crc_create(zip_source_t *src, int validate, zip_error_t *error) {
struct crc_context *ctx;
if (src == NULL) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return NULL;
}
if ((ctx = (struct crc_context *)malloc(sizeof(*ctx))) == NULL) {
- zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
}
zip_error_init(&ctx->error);
@@ -72,7 +72,7 @@ zip_source_crc(zip_t *za, zip_source_t *src, int validate) {
ctx->crc = (zip_uint32_t)crc32(0, NULL, 0);
ctx->size = 0;
- return zip_source_layered(za, src, crc_read, ctx);
+ return zip_source_layered_create(src, crc_read, ctx, error);
}
@@ -85,113 +85,119 @@ crc_read(zip_source_t *src, void *_ctx, void *data, zip_uint64_t len, zip_source
switch (cmd) {
case ZIP_SOURCE_OPEN:
- ctx->position = 0;
- return 0;
+ ctx->position = 0;
+ return 0;
case ZIP_SOURCE_READ:
- if ((n = zip_source_read(src, data, len)) < 0) {
- _zip_error_set_from_source(&ctx->error, src);
- return -1;
- }
-
- if (n == 0) {
- if (ctx->crc_position == ctx->position) {
- ctx->crc_complete = 1;
- ctx->size = ctx->position;
-
- if (ctx->validate) {
- struct zip_stat st;
-
- if (zip_source_stat(src, &st) < 0) {
- _zip_error_set_from_source(&ctx->error, src);
- return -1;
- }
-
- if ((st.valid & ZIP_STAT_CRC) && st.crc != ctx->crc) {
- zip_error_set(&ctx->error, ZIP_ER_CRC, 0);
- return -1;
- }
- if ((st.valid & ZIP_STAT_SIZE) && st.size != ctx->size) {
- zip_error_set(&ctx->error, ZIP_ER_INCONS, 0);
- return -1;
- }
- }
- }
- }
- else if (!ctx->crc_complete && ctx->position <= ctx->crc_position) {
- zip_uint64_t i, nn;
-
- for (i = ctx->crc_position - ctx->position; i < (zip_uint64_t)n; i += nn) {
- nn = ZIP_MIN(UINT_MAX, (zip_uint64_t)n - i);
-
- ctx->crc = (zip_uint32_t)crc32(ctx->crc, (const Bytef *)data + i, (uInt)nn);
- ctx->crc_position += nn;
- }
- }
- ctx->position += (zip_uint64_t)n;
- return n;
+ if ((n = zip_source_read(src, data, len)) < 0) {
+ zip_error_set_from_source(&ctx->error, src);
+ return -1;
+ }
+
+ if (n == 0) {
+ if (ctx->crc_position == ctx->position) {
+ ctx->crc_complete = 1;
+ ctx->size = ctx->position;
+
+ if (ctx->validate) {
+ struct zip_stat st;
+
+ if (zip_source_stat(src, &st) < 0) {
+ zip_error_set_from_source(&ctx->error, src);
+ return -1;
+ }
+
+ if ((st.valid & ZIP_STAT_CRC) && st.crc != ctx->crc) {
+ zip_error_set(&ctx->error, ZIP_ER_CRC, 0);
+ return -1;
+ }
+ if ((st.valid & ZIP_STAT_SIZE) && st.size != ctx->size) {
+ /* We don't have the index here, but the caller should know which file they are reading from. */
+ zip_error_set(&ctx->error, ZIP_ER_INCONS, MAKE_DETAIL_WITH_INDEX(ZIP_ER_DETAIL_INVALID_FILE_LENGTH, MAX_DETAIL_INDEX));
+ return -1;
+ }
+ }
+ }
+ }
+ else if (!ctx->crc_complete && ctx->position <= ctx->crc_position) {
+ zip_uint64_t i, nn;
+
+ for (i = ctx->crc_position - ctx->position; i < (zip_uint64_t)n; i += nn) {
+ nn = ZIP_MIN(UINT_MAX, (zip_uint64_t)n - i);
+
+ ctx->crc = (zip_uint32_t)crc32(ctx->crc, (const Bytef *)data + i, (uInt)nn);
+ ctx->crc_position += nn;
+ }
+ }
+ ctx->position += (zip_uint64_t)n;
+ return n;
case ZIP_SOURCE_CLOSE:
- return 0;
+ return 0;
case ZIP_SOURCE_STAT: {
- zip_stat_t *st;
-
- st = (zip_stat_t *)data;
-
- if (ctx->crc_complete) {
- /* TODO: Set comp_size, comp_method, encryption_method?
- After all, this only works for uncompressed data. */
- st->size = ctx->size;
- st->crc = ctx->crc;
- st->comp_size = ctx->size;
- st->comp_method = ZIP_CM_STORE;
- st->encryption_method = ZIP_EM_NONE;
- st->valid |= ZIP_STAT_SIZE | ZIP_STAT_CRC | ZIP_STAT_COMP_SIZE | ZIP_STAT_COMP_METHOD | ZIP_STAT_ENCRYPTION_METHOD;
- }
- return 0;
+ zip_stat_t *st;
+
+ st = (zip_stat_t *)data;
+
+ if (ctx->crc_complete) {
+ if ((st->valid & ZIP_STAT_SIZE) && st->size != ctx->size) {
+ zip_error_set(&ctx->error, ZIP_ER_DATA_LENGTH, 0);
+ return -1;
+ }
+ /* TODO: Set comp_size, comp_method, encryption_method?
+ After all, this only works for uncompressed data. */
+ st->size = ctx->size;
+ st->crc = ctx->crc;
+ st->comp_size = ctx->size;
+ st->comp_method = ZIP_CM_STORE;
+ st->encryption_method = ZIP_EM_NONE;
+ st->valid |= ZIP_STAT_SIZE | ZIP_STAT_CRC | ZIP_STAT_COMP_SIZE | ZIP_STAT_COMP_METHOD | ZIP_STAT_ENCRYPTION_METHOD;
+ }
+ return 0;
}
case ZIP_SOURCE_ERROR:
- return zip_error_to_data(&ctx->error, data, len);
+ return zip_error_to_data(&ctx->error, data, len);
case ZIP_SOURCE_FREE:
- free(ctx);
- return 0;
+ free(ctx);
+ return 0;
case ZIP_SOURCE_SUPPORTS: {
- zip_int64_t mask = zip_source_supports(src);
+ zip_int64_t mask = zip_source_supports(src);
- if (mask < 0) {
- _zip_error_set_from_source(&ctx->error, src);
- return -1;
- }
+ if (mask < 0) {
+ zip_error_set_from_source(&ctx->error, src);
+ return -1;
+ }
- return mask & ~zip_source_make_command_bitmap(ZIP_SOURCE_BEGIN_WRITE, ZIP_SOURCE_COMMIT_WRITE, ZIP_SOURCE_ROLLBACK_WRITE, ZIP_SOURCE_SEEK_WRITE, ZIP_SOURCE_TELL_WRITE, ZIP_SOURCE_REMOVE, ZIP_SOURCE_GET_FILE_ATTRIBUTES, -1);
+ mask &= ~zip_source_make_command_bitmap(ZIP_SOURCE_BEGIN_WRITE, ZIP_SOURCE_COMMIT_WRITE, ZIP_SOURCE_ROLLBACK_WRITE, ZIP_SOURCE_SEEK_WRITE, ZIP_SOURCE_TELL_WRITE, ZIP_SOURCE_REMOVE, ZIP_SOURCE_GET_FILE_ATTRIBUTES, -1);
+ mask |= zip_source_make_command_bitmap(ZIP_SOURCE_FREE, -1);
+ return mask;
}
case ZIP_SOURCE_SEEK: {
- zip_int64_t new_position;
- zip_source_args_seek_t *args = ZIP_SOURCE_GET_ARGS(zip_source_args_seek_t, data, len, &ctx->error);
+ zip_int64_t new_position;
+ zip_source_args_seek_t *args = ZIP_SOURCE_GET_ARGS(zip_source_args_seek_t, data, len, &ctx->error);
- if (args == NULL) {
- return -1;
- }
- if (zip_source_seek(src, args->offset, args->whence) < 0 || (new_position = zip_source_tell(src)) < 0) {
- _zip_error_set_from_source(&ctx->error, src);
- return -1;
- }
+ if (args == NULL) {
+ return -1;
+ }
+ if (zip_source_seek(src, args->offset, args->whence) < 0 || (new_position = zip_source_tell(src)) < 0) {
+ zip_error_set_from_source(&ctx->error, src);
+ return -1;
+ }
- ctx->position = (zip_uint64_t)new_position;
+ ctx->position = (zip_uint64_t)new_position;
- return 0;
+ return 0;
}
case ZIP_SOURCE_TELL:
- return (zip_int64_t)ctx->position;
+ return (zip_int64_t)ctx->position;
default:
- zip_error_set(&ctx->error, ZIP_ER_OPNOTSUPP, 0);
- return -1;
+ return zip_source_pass_to_lower_layer(src, data, len, cmd);
}
}
diff --git a/src/Common/libzip/zip_source_error.c b/src/Common/libzip/zip_source_error.c
index 2257f715..dc7fa20c 100644
--- a/src/Common/libzip/zip_source_error.c
+++ b/src/Common/libzip/zip_source_error.c
@@ -1,9 +1,9 @@
/*
zip_source_error.c -- get last error from zip_source
- Copyright (C) 2009-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
diff --git a/src/Common/libzip/zip_source_file.h b/src/Common/libzip/zip_source_file.h
index 43a46453..cca9fd2b 100644
--- a/src/Common/libzip/zip_source_file.h
+++ b/src/Common/libzip/zip_source_file.h
@@ -1,9 +1,9 @@
/*
zip_source_file.h -- header for common file operations
- Copyright (C) 2020 Dieter Baron and Thomas Klausner
+ Copyright (C) 2020-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -34,7 +34,7 @@
struct zip_source_file_stat {
zip_uint64_t size; /* must be valid for regular files */
time_t mtime; /* must always be valid, is initialized to current time */
- bool exists; /* must always be vaild */
+ bool exists; /* must always be valid */
bool regular_file; /* must always be valid */
};
diff --git a/src/Common/libzip/zip_source_file_common.c b/src/Common/libzip/zip_source_file_common.c
index 74e21009..6c58320f 100644
--- a/src/Common/libzip/zip_source_file_common.c
+++ b/src/Common/libzip/zip_source_file_common.c
@@ -1,9 +1,9 @@
/*
zip_source_file_common.c -- create data source from file
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -54,72 +54,80 @@ zip_source_file_common_new(const char *fname, void *file, zip_uint64_t start, zi
zip_source_file_context_t *ctx;
zip_source_t *zs;
zip_source_file_stat_t sb;
+ zip_uint64_t length;
if (ops == NULL) {
- zip_error_set(error, ZIP_ER_INVAL, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return NULL;
}
if (ops->close == NULL || ops->read == NULL || ops->seek == NULL || ops->stat == NULL) {
- zip_error_set(error, ZIP_ER_INTERNAL, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_INTERNAL, 0);
+ return NULL;
}
if (ops->write != NULL && (ops->commit_write == NULL || ops->create_temp_output == NULL || ops->remove == NULL || ops->rollback_write == NULL || ops->tell == NULL)) {
- zip_error_set(error, ZIP_ER_INTERNAL, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_INTERNAL, 0);
+ return NULL;
}
if (fname != NULL) {
- if (ops->open == NULL || ops->string_duplicate == NULL) {
- zip_error_set(error, ZIP_ER_INTERNAL, 0);
- return NULL;
- }
+ if (ops->open == NULL || ops->string_duplicate == NULL) {
+ zip_error_set(error, ZIP_ER_INTERNAL, 0);
+ return NULL;
+ }
}
else if (file == NULL) {
- zip_error_set(error, ZIP_ER_INVAL, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return NULL;
}
if (len < 0) {
- len = 0;
+ if (len == -1) {
+ len = ZIP_LENGTH_TO_END;
+ }
+ // TODO: return ZIP_ER_INVAL if len != ZIP_LENGTH_UNCHECKED?
+ length = 0;
+ }
+ else {
+ length = (zip_uint64_t)len;
}
- if (start > ZIP_INT64_MAX || start + (zip_uint64_t)len < start) {
- zip_error_set(error, ZIP_ER_INVAL, 0);
- return NULL;
+ if (start > ZIP_INT64_MAX || start + length < start) {
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return NULL;
}
if ((ctx = (zip_source_file_context_t *)malloc(sizeof(zip_source_file_context_t))) == NULL) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
}
ctx->ops = ops;
ctx->ops_userdata = ops_userdata;
ctx->fname = NULL;
if (fname) {
- if ((ctx->fname = ops->string_duplicate(ctx, fname)) == NULL) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- free(ctx);
- return NULL;
- }
+ if ((ctx->fname = ops->string_duplicate(ctx, fname)) == NULL) {
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ free(ctx);
+ return NULL;
+ }
}
ctx->f = file;
ctx->start = start;
- ctx->len = (zip_uint64_t)len;
+ ctx->len = length;
if (st) {
- memcpy(&ctx->st, st, sizeof(ctx->st));
- ctx->st.name = NULL;
- ctx->st.valid &= ~ZIP_STAT_NAME;
+ (void)memcpy_s(&ctx->st, sizeof(ctx->st), st, sizeof(*st));
+ ctx->st.name = NULL;
+ ctx->st.valid &= ~ZIP_STAT_NAME;
}
else {
- zip_stat_init(&ctx->st);
+ zip_stat_init(&ctx->st);
}
if (ctx->len > 0) {
- ctx->st.size = ctx->len;
- ctx->st.valid |= ZIP_STAT_SIZE;
+ ctx->st.size = ctx->len;
+ ctx->st.valid |= ZIP_STAT_SIZE;
}
zip_error_init(&ctx->stat_error);
@@ -130,7 +138,7 @@ zip_source_file_common_new(const char *fname, void *file, zip_uint64_t start, zi
zip_error_init(&ctx->error);
zip_file_attributes_init(&ctx->attributes);
- ctx->supports = ZIP_SOURCE_SUPPORTS_READABLE | zip_source_make_command_bitmap(ZIP_SOURCE_SUPPORTS, ZIP_SOURCE_TELL, -1);
+ ctx->supports = ZIP_SOURCE_SUPPORTS_READABLE | zip_source_make_command_bitmap(ZIP_SOURCE_SUPPORTS, ZIP_SOURCE_TELL, ZIP_SOURCE_SUPPORTS_REOPEN, -1);
zip_source_file_stat_init(&sb);
if (!ops->stat(ctx, &sb)) {
@@ -154,46 +162,48 @@ zip_source_file_common_new(const char *fname, void *file, zip_uint64_t start, zi
}
}
else {
- if ((ctx->st.valid & ZIP_STAT_MTIME) == 0) {
- ctx->st.mtime = sb.mtime;
- ctx->st.valid |= ZIP_STAT_MTIME;
- }
- if (sb.regular_file) {
- ctx->supports = ZIP_SOURCE_SUPPORTS_SEEKABLE;
-
- if (ctx->start + ctx->len > sb.size) {
- zip_error_set(error, ZIP_ER_INVAL, 0);
- free(ctx->fname);
- free(ctx);
- return NULL;
- }
-
- if (ctx->len == 0) {
- ctx->len = sb.size - ctx->start;
- ctx->st.size = ctx->len;
- ctx->st.valid |= ZIP_STAT_SIZE;
-
- /* when using a partial file, don't allow writing */
- if (ctx->fname && start == 0 && ops->write != NULL) {
- ctx->supports = ZIP_SOURCE_SUPPORTS_WRITABLE;
- }
- }
- }
-
- ctx->supports |= ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_GET_FILE_ATTRIBUTES);
+ if ((ctx->st.valid & ZIP_STAT_MTIME) == 0) {
+ ctx->st.mtime = sb.mtime;
+ ctx->st.valid |= ZIP_STAT_MTIME;
+ }
+ if (sb.regular_file) {
+ ctx->supports = ZIP_SOURCE_SUPPORTS_SEEKABLE;
+
+ if (ctx->start + ctx->len > sb.size) {
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ free(ctx->fname);
+ free(ctx);
+ return NULL;
+ }
+
+ if (ctx->len == 0) {
+ if (len != ZIP_LENGTH_UNCHECKED) {
+ ctx->len = sb.size - ctx->start;
+ ctx->st.size = ctx->len;
+ ctx->st.valid |= ZIP_STAT_SIZE;
+ }
+
+ /* when using a partial file, don't allow writing */
+ if (ctx->fname && start == 0 && ops->write != NULL) {
+ ctx->supports = ZIP_SOURCE_SUPPORTS_WRITABLE;
+ }
+ }
+ }
+
+ ctx->supports |= ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_GET_FILE_ATTRIBUTES);
}
ctx->supports |= ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_ACCEPT_EMPTY);
if (ops->create_temp_output_cloning != NULL) {
- if (ctx->supports & ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_BEGIN_WRITE)) {
- ctx->supports |= ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_BEGIN_WRITE_CLONING);
- }
+ if (ctx->supports & ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_BEGIN_WRITE)) {
+ ctx->supports |= ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_BEGIN_WRITE_CLONING);
+ }
}
if ((zs = zip_source_function_create(read_file, ctx, error)) == NULL) {
- free(ctx->fname);
- free(ctx);
- return NULL;
+ free(ctx->fname);
+ free(ctx);
+ return NULL;
}
return zs;
@@ -210,169 +220,169 @@ read_file(void *state, void *data, zip_uint64_t len, zip_source_cmd_t cmd) {
switch (cmd) {
case ZIP_SOURCE_ACCEPT_EMPTY:
- return 0;
+ return 0;
case ZIP_SOURCE_BEGIN_WRITE:
- /* write support should not be set if fname is NULL */
- if (ctx->fname == NULL) {
- zip_error_set(&ctx->error, ZIP_ER_INTERNAL, 0);
- return -1;
- }
- return ctx->ops->create_temp_output(ctx);
+ /* write support should not be set if fname is NULL */
+ if (ctx->fname == NULL) {
+ zip_error_set(&ctx->error, ZIP_ER_INTERNAL, 0);
+ return -1;
+ }
+ return ctx->ops->create_temp_output(ctx);
case ZIP_SOURCE_BEGIN_WRITE_CLONING:
- /* write support should not be set if fname is NULL */
- if (ctx->fname == NULL) {
- zip_error_set(&ctx->error, ZIP_ER_INTERNAL, 0);
- return -1;
- }
- return ctx->ops->create_temp_output_cloning(ctx, len);
+ /* write support should not be set if fname is NULL */
+ if (ctx->fname == NULL) {
+ zip_error_set(&ctx->error, ZIP_ER_INTERNAL, 0);
+ return -1;
+ }
+ return ctx->ops->create_temp_output_cloning(ctx, len);
case ZIP_SOURCE_CLOSE:
- if (ctx->fname) {
- ctx->ops->close(ctx);
- ctx->f = NULL;
- }
- return 0;
+ if (ctx->fname) {
+ ctx->ops->close(ctx);
+ ctx->f = NULL;
+ }
+ return 0;
case ZIP_SOURCE_COMMIT_WRITE: {
- zip_int64_t ret = ctx->ops->commit_write(ctx);
- ctx->fout = NULL;
- if (ret == 0) {
- free(ctx->tmpname);
- ctx->tmpname = NULL;
- }
- return ret;
+ zip_int64_t ret = ctx->ops->commit_write(ctx);
+ ctx->fout = NULL;
+ if (ret == 0) {
+ free(ctx->tmpname);
+ ctx->tmpname = NULL;
+ }
+ return ret;
}
case ZIP_SOURCE_ERROR:
- return zip_error_to_data(&ctx->error, data, len);
+ return zip_error_to_data(&ctx->error, data, len);
case ZIP_SOURCE_FREE:
- free(ctx->fname);
- free(ctx->tmpname);
- if (ctx->f) {
- ctx->ops->close(ctx);
- }
- free(ctx);
- return 0;
+ free(ctx->fname);
+ free(ctx->tmpname);
+ if (ctx->f) {
+ ctx->ops->close(ctx);
+ }
+ free(ctx);
+ return 0;
case ZIP_SOURCE_GET_FILE_ATTRIBUTES:
- if (len < sizeof(ctx->attributes)) {
- zip_error_set(&ctx->error, ZIP_ER_INVAL, 0);
- return -1;
- }
- memcpy(data, &ctx->attributes, sizeof(ctx->attributes));
- return sizeof(ctx->attributes);
+ if (len < sizeof(ctx->attributes)) {
+ zip_error_set(&ctx->error, ZIP_ER_INVAL, 0);
+ return -1;
+ }
+ (void)memcpy_s(data, sizeof(ctx->attributes), &ctx->attributes, sizeof(ctx->attributes));
+ return sizeof(ctx->attributes);
case ZIP_SOURCE_OPEN:
- if (ctx->fname) {
- if (ctx->ops->open(ctx) == false) {
- return -1;
- }
- }
-
- if (ctx->start > 0) { // TODO: rewind on re-open
- if (ctx->ops->seek(ctx, ctx->f, (zip_int64_t)ctx->start, SEEK_SET) == false) {
- /* TODO: skip by reading */
- return -1;
- }
- }
- ctx->offset = 0;
- return 0;
+ if (ctx->fname) {
+ if (ctx->ops->open(ctx) == false) {
+ return -1;
+ }
+ }
+
+ if (ctx->start > 0) { /* TODO: rewind on re-open */
+ if (ctx->ops->seek(ctx, ctx->f, (zip_int64_t)ctx->start, SEEK_SET) == false) {
+ /* TODO: skip by reading */
+ return -1;
+ }
+ }
+ ctx->offset = 0;
+ return 0;
case ZIP_SOURCE_READ: {
- zip_int64_t i;
- zip_uint64_t n;
-
- if (ctx->len > 0) {
- n = ZIP_MIN(ctx->len - ctx->offset, len);
- }
- else {
- n = len;
- }
-
- if ((i = ctx->ops->read(ctx, buf, n)) < 0) {
- zip_error_set(&ctx->error, ZIP_ER_READ, errno);
- return -1;
- }
- ctx->offset += (zip_uint64_t)i;
-
- return i;
+ zip_int64_t i;
+ zip_uint64_t n;
+
+ if (ctx->len > 0) {
+ n = ZIP_MIN(ctx->len - ctx->offset, len);
+ }
+ else {
+ n = len;
+ }
+
+ if ((i = ctx->ops->read(ctx, buf, n)) < 0) {
+ zip_error_set(&ctx->error, ZIP_ER_READ, errno);
+ return -1;
+ }
+ ctx->offset += (zip_uint64_t)i;
+
+ return i;
}
case ZIP_SOURCE_REMOVE:
- return ctx->ops->remove(ctx);
+ return ctx->ops->remove(ctx);
case ZIP_SOURCE_ROLLBACK_WRITE:
- ctx->ops->rollback_write(ctx);
- ctx->fout = NULL;
- free(ctx->tmpname);
- ctx->tmpname = NULL;
- return 0;
+ ctx->ops->rollback_write(ctx);
+ ctx->fout = NULL;
+ free(ctx->tmpname);
+ ctx->tmpname = NULL;
+ return 0;
case ZIP_SOURCE_SEEK: {
- zip_int64_t new_offset = zip_source_seek_compute_offset(ctx->offset, ctx->len, data, len, &ctx->error);
+ zip_int64_t new_offset = zip_source_seek_compute_offset(ctx->offset, ctx->len, data, len, &ctx->error);
- if (new_offset < 0) {
- return -1;
- }
+ if (new_offset < 0) {
+ return -1;
+ }
- /* The actual offset inside the file must be representable as zip_int64_t. */
- if (new_offset > ZIP_INT64_MAX - (zip_int64_t)ctx->start) {
- zip_error_set(&ctx->error, ZIP_ER_SEEK, EOVERFLOW);
- return -1;
- }
+ /* The actual offset inside the file must be representable as zip_int64_t. */
+ if (new_offset > ZIP_INT64_MAX - (zip_int64_t)ctx->start) {
+ zip_error_set(&ctx->error, ZIP_ER_SEEK, EOVERFLOW);
+ return -1;
+ }
- ctx->offset = (zip_uint64_t)new_offset;
+ ctx->offset = (zip_uint64_t)new_offset;
- if (ctx->ops->seek(ctx, ctx->f, (zip_int64_t)(ctx->offset + ctx->start), SEEK_SET) == false) {
- return -1;
- }
- return 0;
+ if (ctx->ops->seek(ctx, ctx->f, (zip_int64_t)(ctx->offset + ctx->start), SEEK_SET) == false) {
+ return -1;
+ }
+ return 0;
}
case ZIP_SOURCE_SEEK_WRITE: {
- zip_source_args_seek_t *args;
+ zip_source_args_seek_t *args;
- args = ZIP_SOURCE_GET_ARGS(zip_source_args_seek_t, data, len, &ctx->error);
- if (args == NULL) {
- return -1;
- }
+ args = ZIP_SOURCE_GET_ARGS(zip_source_args_seek_t, data, len, &ctx->error);
+ if (args == NULL) {
+ return -1;
+ }
- if (ctx->ops->seek(ctx, ctx->fout, args->offset, args->whence) == false) {
- return -1;
- }
- return 0;
+ if (ctx->ops->seek(ctx, ctx->fout, args->offset, args->whence) == false) {
+ return -1;
+ }
+ return 0;
}
case ZIP_SOURCE_STAT: {
- if (len < sizeof(ctx->st))
- return -1;
+ if (len < sizeof(ctx->st))
+ return -1;
- if (zip_error_code_zip(&ctx->stat_error) != 0) {
- zip_error_set(&ctx->error, zip_error_code_zip(&ctx->stat_error), zip_error_code_system(&ctx->stat_error));
- return -1;
- }
+ if (zip_error_code_zip(&ctx->stat_error) != 0) {
+ zip_error_set(&ctx->error, zip_error_code_zip(&ctx->stat_error), zip_error_code_system(&ctx->stat_error));
+ return -1;
+ }
- memcpy(data, &ctx->st, sizeof(ctx->st));
- return sizeof(ctx->st);
+ (void)memcpy_s(data, sizeof(ctx->st), &ctx->st, sizeof(ctx->st));
+ return sizeof(ctx->st);
}
case ZIP_SOURCE_SUPPORTS:
- return ctx->supports;
+ return ctx->supports;
case ZIP_SOURCE_TELL:
- return (zip_int64_t)ctx->offset;
+ return (zip_int64_t)ctx->offset;
case ZIP_SOURCE_TELL_WRITE:
- return ctx->ops->tell(ctx, ctx->fout);
+ return ctx->ops->tell(ctx, ctx->fout);
case ZIP_SOURCE_WRITE:
- return ctx->ops->write(ctx, data, len);
+ return ctx->ops->write(ctx, data, len);
default:
- zip_error_set(&ctx->error, ZIP_ER_OPNOTSUPP, 0);
- return -1;
+ zip_error_set(&ctx->error, ZIP_ER_OPNOTSUPP, 0);
+ return -1;
}
}
diff --git a/src/Common/libzip/zip_source_file_stdio.c b/src/Common/libzip/zip_source_file_stdio.c
index 4a22f78c..6dcc5639 100644
--- a/src/Common/libzip/zip_source_file_stdio.c
+++ b/src/Common/libzip/zip_source_file_stdio.c
@@ -3,7 +3,7 @@
Copyright (C) 2020 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -69,7 +69,7 @@ static zip_source_file_operations_t ops_stdio_read = {
ZIP_EXTERN zip_source_t *
zip_source_filep(zip_t *za, FILE *file, zip_uint64_t start, zip_int64_t len) {
if (za == NULL) {
- return NULL;
+ return NULL;
}
return zip_source_filep_create(file, start, len, &za->error);
@@ -78,9 +78,9 @@ zip_source_filep(zip_t *za, FILE *file, zip_uint64_t start, zip_int64_t len) {
ZIP_EXTERN zip_source_t *
zip_source_filep_create(FILE *file, zip_uint64_t start, zip_int64_t length, zip_error_t *error) {
- if (file == NULL || length < -1) {
- zip_error_set(error, ZIP_ER_INVAL, 0);
- return NULL;
+ if (file == NULL || length < ZIP_LENGTH_UNCHECKED) {
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return NULL;
}
return zip_source_file_common_new(NULL, file, start, length, NULL, &ops_stdio_read, NULL, error);
@@ -97,14 +97,14 @@ zip_int64_t
_zip_stdio_op_read(zip_source_file_context_t *ctx, void *buf, zip_uint64_t len) {
size_t i;
if (len > SIZE_MAX) {
- len = SIZE_MAX;
+ len = SIZE_MAX;
}
if ((i = fread(buf, 1, (size_t)len, ctx->f)) == 0) {
- if (ferror((FILE *)ctx->f)) {
- zip_error_set(&ctx->error, ZIP_ER_READ, errno);
- return -1;
- }
+ if (ferror((FILE *)ctx->f)) {
+ zip_error_set(&ctx->error, ZIP_ER_READ, errno);
+ return -1;
+ }
}
return (zip_int64_t)i;
@@ -115,14 +115,14 @@ bool
_zip_stdio_op_seek(zip_source_file_context_t *ctx, void *f, zip_int64_t offset, int whence) {
#if ZIP_FSEEK_MAX > ZIP_INT64_MAX
if (offset > ZIP_FSEEK_MAX || offset < ZIP_FSEEK_MIN) {
- zip_error_set(&ctx->error, ZIP_ER_SEEK, EOVERFLOW);
- return false;
+ zip_error_set(&ctx->error, ZIP_ER_SEEK, EOVERFLOW);
+ return false;
}
#endif
if (fseeko((FILE *)f, (off_t)offset, whence) < 0) {
- zip_error_set(&ctx->error, ZIP_ER_SEEK, errno);
- return false;
+ zip_error_set(&ctx->error, ZIP_ER_SEEK, errno);
+ return false;
}
return true;
}
@@ -135,10 +135,10 @@ _zip_stdio_op_stat(zip_source_file_context_t *ctx, zip_source_file_stat_t *st) {
int ret;
if (ctx->fname) {
- ret = stat(ctx->fname, &sb);
+ ret = stat(ctx->fname, &sb);
}
else {
- ret = fstat(fileno((FILE *)ctx->f), &sb);
+ ret = fstat(fileno((FILE *)ctx->f), &sb);
}
if (ret < 0) {
@@ -146,8 +146,8 @@ _zip_stdio_op_stat(zip_source_file_context_t *ctx, zip_source_file_stat_t *st) {
st->exists = false;
return true;
}
- zip_error_set(&ctx->error, ZIP_ER_READ, errno);
- return false;
+ zip_error_set(&ctx->error, ZIP_ER_READ, errno);
+ return false;
}
st->size = (zip_uint64_t)sb.st_size;
@@ -171,38 +171,8 @@ _zip_stdio_op_tell(zip_source_file_context_t *ctx, void *f) {
off_t offset = ftello((FILE *)f);
if (offset < 0) {
- zip_error_set(&ctx->error, ZIP_ER_SEEK, errno);
+ zip_error_set(&ctx->error, ZIP_ER_SEEK, errno);
}
return offset;
}
-
-
-/*
- * fopen replacement that sets the close-on-exec flag
- * some implementations support an fopen 'e' flag for that,
- * but e.g. macOS doesn't.
- */
-FILE *
-_zip_fopen_close_on_exec(const char *name, bool writeable) {
- int fd;
- int flags;
- FILE *fp;
-
- flags = O_CLOEXEC;
- if (writeable) {
- flags |= O_RDWR;
- }
- else {
- flags |= O_RDONLY;
- }
-
- /* mode argument needed on Windows */
- if ((fd = open(name, flags, 0666)) < 0) {
- return NULL;
- }
- if ((fp = fdopen(fd, writeable ? "r+b" : "rb")) == NULL) {
- return NULL;
- }
- return fp;
-}
diff --git a/src/Common/libzip/zip_source_file_stdio.h b/src/Common/libzip/zip_source_file_stdio.h
index 1bf698ce..802e6071 100644
--- a/src/Common/libzip/zip_source_file_stdio.h
+++ b/src/Common/libzip/zip_source_file_stdio.h
@@ -6,7 +6,7 @@
Copyright (C) 2020 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -42,6 +42,4 @@ bool _zip_stdio_op_seek(zip_source_file_context_t *ctx, void *f, zip_int64_t off
bool _zip_stdio_op_stat(zip_source_file_context_t *ctx, zip_source_file_stat_t *st);
zip_int64_t _zip_stdio_op_tell(zip_source_file_context_t *ctx, void *f);
-FILE *_zip_fopen_close_on_exec(const char *name, bool writeable);
-
#endif /* _HAD_ZIP_SOURCE_FILE_STDIO_H */
diff --git a/src/Common/libzip/zip_source_file_stdio_named.c b/src/Common/libzip/zip_source_file_stdio_named.c
new file mode 100644
index 00000000..1495d7dd
--- /dev/null
+++ b/src/Common/libzip/zip_source_file_stdio_named.c
@@ -0,0 +1,392 @@
+/*
+ zip_source_file_stdio_named.c -- source for stdio file opened by name
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
+
+ This file is part of libzip, a library to manipulate ZIP archives.
+ The authors can be contacted at <info@libzip.org>
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ 3. The names of the authors may not be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "zipint.h"
+
+#include "zip_source_file.h"
+#include "zip_source_file_stdio.h"
+
+#include <fcntl.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#ifdef HAVE_CLONEFILE
+#include <sys/attr.h>
+#include <sys/clonefile.h>
+#define CAN_CLONE
+#endif
+#ifdef HAVE_FICLONERANGE
+#include <linux/fs.h>
+#include <sys/ioctl.h>
+#define CAN_CLONE
+#endif
+
+static int create_temp_file(zip_source_file_context_t *ctx, bool create_file);
+
+static zip_int64_t _zip_stdio_op_commit_write(zip_source_file_context_t *ctx);
+static zip_int64_t _zip_stdio_op_create_temp_output(zip_source_file_context_t *ctx);
+#ifdef CAN_CLONE
+static zip_int64_t _zip_stdio_op_create_temp_output_cloning(zip_source_file_context_t *ctx, zip_uint64_t offset);
+#endif
+static bool _zip_stdio_op_open(zip_source_file_context_t *ctx);
+static zip_int64_t _zip_stdio_op_remove(zip_source_file_context_t *ctx);
+static void _zip_stdio_op_rollback_write(zip_source_file_context_t *ctx);
+static char *_zip_stdio_op_strdup(zip_source_file_context_t *ctx, const char *string);
+static zip_int64_t _zip_stdio_op_write(zip_source_file_context_t *ctx, const void *data, zip_uint64_t len);
+static FILE *_zip_fopen_close_on_exec(const char *name, bool writeable);
+
+/* clang-format off */
+static zip_source_file_operations_t ops_stdio_named = {
+ _zip_stdio_op_close,
+ _zip_stdio_op_commit_write,
+ _zip_stdio_op_create_temp_output,
+#ifdef CAN_CLONE
+ _zip_stdio_op_create_temp_output_cloning,
+#else
+ NULL,
+#endif
+ _zip_stdio_op_open,
+ _zip_stdio_op_read,
+ _zip_stdio_op_remove,
+ _zip_stdio_op_rollback_write,
+ _zip_stdio_op_seek,
+ _zip_stdio_op_stat,
+ _zip_stdio_op_strdup,
+ _zip_stdio_op_tell,
+ _zip_stdio_op_write
+};
+/* clang-format on */
+
+ZIP_EXTERN zip_source_t *
+zip_source_file(zip_t *za, const char *fname, zip_uint64_t start, zip_int64_t len) {
+ if (za == NULL)
+ return NULL;
+
+ return zip_source_file_create(fname, start, len, &za->error);
+}
+
+
+ZIP_EXTERN zip_source_t *
+zip_source_file_create(const char *fname, zip_uint64_t start, zip_int64_t length, zip_error_t *error) {
+ if (fname == NULL || length < ZIP_LENGTH_UNCHECKED) {
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return NULL;
+ }
+
+ return zip_source_file_common_new(fname, NULL, start, length, NULL, &ops_stdio_named, NULL, error);
+}
+
+
+static zip_int64_t
+_zip_stdio_op_commit_write(zip_source_file_context_t *ctx) {
+ if (fclose(ctx->fout) < 0) {
+ zip_error_set(&ctx->error, ZIP_ER_WRITE, errno);
+ return -1;
+ }
+ if (rename(ctx->tmpname, ctx->fname) < 0) {
+ zip_error_set(&ctx->error, ZIP_ER_RENAME, errno);
+ return -1;
+ }
+
+ return 0;
+}
+
+
+static zip_int64_t
+_zip_stdio_op_create_temp_output(zip_source_file_context_t *ctx) {
+ int fd = create_temp_file(ctx, true);
+
+ if (fd < 0) {
+ return -1;
+ }
+
+ if ((ctx->fout = fdopen(fd, "r+b")) == NULL) {
+ zip_error_set(&ctx->error, ZIP_ER_TMPOPEN, errno);
+ close(fd);
+ (void)remove(ctx->tmpname);
+ free(ctx->tmpname);
+ ctx->tmpname = NULL;
+ return -1;
+ }
+
+ return 0;
+}
+
+#ifdef CAN_CLONE
+static zip_int64_t
+_zip_stdio_op_create_temp_output_cloning(zip_source_file_context_t *ctx, zip_uint64_t offset) {
+ FILE *tfp;
+
+ if (offset > ZIP_OFF_MAX) {
+ zip_error_set(&ctx->error, ZIP_ER_SEEK, E2BIG);
+ return -1;
+ }
+
+#ifdef HAVE_CLONEFILE
+ /* clonefile insists on creating the file, so just create a name */
+ if (create_temp_file(ctx, false) < 0) {
+ return -1;
+ }
+
+ if (clonefile(ctx->fname, ctx->tmpname, 0) < 0) {
+ zip_error_set(&ctx->error, ZIP_ER_TMPOPEN, errno);
+ free(ctx->tmpname);
+ ctx->tmpname = NULL;
+ return -1;
+ }
+ if ((tfp = _zip_fopen_close_on_exec(ctx->tmpname, true)) == NULL) {
+ zip_error_set(&ctx->error, ZIP_ER_TMPOPEN, errno);
+ (void)remove(ctx->tmpname);
+ free(ctx->tmpname);
+ ctx->tmpname = NULL;
+ return -1;
+ }
+#else
+ {
+ int fd;
+ struct file_clone_range range;
+ struct stat st;
+
+ if (fstat(fileno(ctx->f), &st) < 0) {
+ zip_error_set(&ctx->error, ZIP_ER_TMPOPEN, errno);
+ return -1;
+ }
+
+ if ((fd = create_temp_file(ctx, true)) < 0) {
+ return -1;
+ }
+
+ range.src_fd = fileno(ctx->f);
+ range.src_offset = 0;
+ range.src_length = ((offset + st.st_blksize - 1) / st.st_blksize) * st.st_blksize;
+ if (range.src_length > st.st_size) {
+ range.src_length = 0;
+ }
+ range.dest_offset = 0;
+ if (ioctl(fd, FICLONERANGE, &range) < 0) {
+ zip_error_set(&ctx->error, ZIP_ER_TMPOPEN, errno);
+ (void)close(fd);
+ (void)remove(ctx->tmpname);
+ free(ctx->tmpname);
+ ctx->tmpname = NULL;
+ return -1;
+ }
+
+ if ((tfp = fdopen(fd, "r+b")) == NULL) {
+ zip_error_set(&ctx->error, ZIP_ER_TMPOPEN, errno);
+ (void)close(fd);
+ (void)remove(ctx->tmpname);
+ free(ctx->tmpname);
+ ctx->tmpname = NULL;
+ return -1;
+ }
+ }
+#endif
+
+ if (ftruncate(fileno(tfp), (off_t)offset) < 0) {
+ (void)fclose(tfp);
+ (void)remove(ctx->tmpname);
+ free(ctx->tmpname);
+ ctx->tmpname = NULL;
+ return -1;
+ }
+ if (fseeko(tfp, (off_t)offset, SEEK_SET) < 0) {
+ zip_error_set(&ctx->error, ZIP_ER_TMPOPEN, errno);
+ (void)fclose(tfp);
+ (void)remove(ctx->tmpname);
+ free(ctx->tmpname);
+ ctx->tmpname = NULL;
+ return -1;
+ }
+
+ ctx->fout = tfp;
+
+ return 0;
+}
+#endif
+
+static bool
+_zip_stdio_op_open(zip_source_file_context_t *ctx) {
+ if ((ctx->f = _zip_fopen_close_on_exec(ctx->fname, false)) == NULL) {
+ zip_error_set(&ctx->error, ZIP_ER_OPEN, errno);
+ return false;
+ }
+ return true;
+}
+
+
+static zip_int64_t
+_zip_stdio_op_remove(zip_source_file_context_t *ctx) {
+ if (remove(ctx->fname) < 0) {
+ zip_error_set(&ctx->error, ZIP_ER_REMOVE, errno);
+ return -1;
+ }
+ return 0;
+}
+
+
+static void
+_zip_stdio_op_rollback_write(zip_source_file_context_t *ctx) {
+ if (ctx->fout) {
+ fclose(ctx->fout);
+ }
+ (void)remove(ctx->tmpname);
+}
+
+static char *
+_zip_stdio_op_strdup(zip_source_file_context_t *ctx, const char *string) {
+ return strdup(string);
+}
+
+
+static zip_int64_t
+_zip_stdio_op_write(zip_source_file_context_t *ctx, const void *data, zip_uint64_t len) {
+ size_t ret;
+
+ clearerr((FILE *)ctx->fout);
+ ret = fwrite(data, 1, len, (FILE *)ctx->fout);
+ if (ret != len || ferror((FILE *)ctx->fout)) {
+ zip_error_set(&ctx->error, ZIP_ER_WRITE, errno);
+ return -1;
+ }
+
+ return (zip_int64_t)ret;
+}
+
+
+static int create_temp_file(zip_source_file_context_t *ctx, bool create_file) {
+ char *temp;
+ int mode;
+ struct stat st;
+ int fd = 0;
+ char *start, *end;
+
+ if (stat(ctx->fname, &st) == 0) {
+ mode = st.st_mode;
+ }
+ else {
+ mode = -1;
+ }
+
+ size_t temp_size = strlen(ctx->fname) + 13;
+ if ((temp = (char *)malloc(temp_size)) == NULL) {
+ zip_error_set(&ctx->error, ZIP_ER_MEMORY, 0);
+ return -1;
+ }
+ snprintf_s(temp, temp_size, "%s.XXXXXX.part", ctx->fname);
+ end = temp + strlen(temp) - 5;
+ start = end - 6;
+
+ for (;;) {
+ zip_uint32_t value = zip_random_uint32();
+ char *xs = start;
+
+ while (xs < end) {
+ char digit = value % 36;
+ if (digit < 10) {
+ *(xs++) = digit + '0';
+ }
+ else {
+ *(xs++) = digit - 10 + 'a';
+ }
+ value /= 36;
+ }
+
+ if (create_file) {
+ if ((fd = open(temp, O_CREAT | O_EXCL | O_RDWR | O_CLOEXEC, mode == -1 ? 0666 : (mode_t)mode)) >= 0) {
+ if (mode != -1) {
+ /* open() honors umask(), which we don't want in this case */
+#ifdef HAVE_FCHMOD
+ (void)fchmod(fd, (mode_t)mode);
+#else
+ (void)chmod(temp, (mode_t)mode);
+#endif
+ }
+ break;
+ }
+ if (errno != EEXIST) {
+ zip_error_set(&ctx->error, ZIP_ER_TMPOPEN, errno);
+ free(temp);
+ return -1;
+ }
+ }
+ else {
+ if (stat(temp, &st) < 0) {
+ if (errno == ENOENT) {
+ break;
+ }
+ else {
+ zip_error_set(&ctx->error, ZIP_ER_TMPOPEN, errno);
+ free(temp);
+ return -1;
+ }
+ }
+ }
+ }
+
+ ctx->tmpname = temp;
+
+ return fd; /* initialized to 0 if !create_file */
+}
+
+
+/*
+ * fopen replacement that sets the close-on-exec flag
+ * some implementations support an fopen 'e' flag for that,
+ * but e.g. macOS doesn't.
+ */
+static FILE *_zip_fopen_close_on_exec(const char *name, bool writeable) {
+ int fd;
+ int flags;
+ FILE *fp;
+
+ flags = O_CLOEXEC;
+ if (writeable) {
+ flags |= O_RDWR;
+ }
+ else {
+ flags |= O_RDONLY;
+ }
+
+ /* mode argument needed on Windows */
+ if ((fd = open(name, flags, 0666)) < 0) {
+ return NULL;
+ }
+ if ((fp = fdopen(fd, writeable ? "r+b" : "rb")) == NULL) {
+ return NULL;
+ }
+ return fp;
+}
diff --git a/src/Common/libzip/zip_source_file_win32.c b/src/Common/libzip/zip_source_file_win32.c
index 2fe838f1..624860b1 100644
--- a/src/Common/libzip/zip_source_file_win32.c
+++ b/src/Common/libzip/zip_source_file_win32.c
@@ -1,9 +1,9 @@
/*
zip_source_file_win32.c -- read-only Windows file source implementation
- Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -37,6 +37,8 @@ static bool _zip_win32_op_stat(zip_source_file_context_t *ctx, zip_source_file_s
static bool _zip_stat_win32(zip_source_file_context_t *ctx, zip_source_file_stat_t *st, HANDLE h);
+/* clang-format off */
+
static zip_source_file_operations_t ops_win32_read = {
_zip_win32_op_close,
NULL,
@@ -53,20 +55,21 @@ static zip_source_file_operations_t ops_win32_read = {
NULL
};
+/* clang-format on */
ZIP_EXTERN zip_source_t *
zip_source_win32handle(zip_t *za, HANDLE h, zip_uint64_t start, zip_int64_t len) {
if (za == NULL) {
return NULL;
}
-
+
return zip_source_win32handle_create(h, start, len, &za->error);
}
ZIP_EXTERN zip_source_t *
zip_source_win32handle_create(HANDLE h, zip_uint64_t start, zip_int64_t length, zip_error_t *error) {
- if (h == INVALID_HANDLE_VALUE || length < -1) {
+ if (h == INVALID_HANDLE_VALUE || length < ZIP_LENGTH_UNCHECKED) {
zip_error_set(error, ZIP_ER_INVAL, 0);
return NULL;
}
@@ -90,7 +93,7 @@ _zip_win32_op_read(zip_source_file_context_t *ctx, void *buf, zip_uint64_t len)
zip_error_set(&ctx->error, ZIP_ER_READ, _zip_win32_error_to_errno(GetLastError()));
return -1;
}
-
+
return (zip_int64_t)i;
}
@@ -112,7 +115,7 @@ _zip_win32_op_seek(zip_source_file_context_t *ctx, void *f, zip_int64_t offset,
break;
default:
zip_error_set(&ctx->error, ZIP_ER_SEEK, EINVAL);
- return -1;
+ return false;
}
li.QuadPart = (LONGLONG)offset;
@@ -135,13 +138,13 @@ zip_int64_t
_zip_win32_op_tell(zip_source_file_context_t *ctx, void *f) {
LARGE_INTEGER zero;
LARGE_INTEGER new_offset;
-
+
zero.QuadPart = 0;
if (!SetFilePointerEx((HANDLE)f, zero, &new_offset, FILE_CURRENT)) {
zip_error_set(&ctx->error, ZIP_ER_SEEK, _zip_win32_error_to_errno(GetLastError()));
return -1;
}
-
+
return (zip_int64_t)new_offset.QuadPart;
}
@@ -153,6 +156,7 @@ _zip_win32_error_to_errno(DWORD win32err) {
case ERROR_INVALID_PARAMETER:
return EINVAL;
case ERROR_FILE_NOT_FOUND:
+ case ERROR_PATH_NOT_FOUND:
return ENOENT;
case ERROR_INVALID_HANDLE:
return EBADF;
@@ -180,11 +184,11 @@ _zip_stat_win32(zip_source_file_context_t *ctx, zip_source_file_stat_t *st, HAND
zip_error_set(&ctx->error, ZIP_ER_READ, _zip_win32_error_to_errno(GetLastError()));
return false;
}
- if (_zip_filetime_to_time_t(mtimeft, &mtime) < 0) {
+ if (!_zip_filetime_to_time_t(mtimeft, &mtime)) {
zip_error_set(&ctx->error, ZIP_ER_READ, ERANGE);
return false;
}
-
+
st->exists = true;
st->mtime = mtime;
@@ -198,7 +202,7 @@ _zip_stat_win32(zip_source_file_context_t *ctx, zip_source_file_stat_t *st, HAND
st->size = (zip_uint64_t)size.QuadPart;
}
-
+
/* TODO: fill in ctx->attributes */
return true;
diff --git a/src/Common/libzip/zip_source_file_win32.h b/src/Common/libzip/zip_source_file_win32.h
index 5092e630..d86069ec 100644
--- a/src/Common/libzip/zip_source_file_win32.h
+++ b/src/Common/libzip/zip_source_file_win32.h
@@ -6,7 +6,7 @@
Copyright (C) 2020 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -43,19 +43,21 @@
#include <aclapi.h>
+#include <stdlib.h>
+
#include "zipint.h"
#include "zip_source_file.h"
struct zip_win32_file_operations {
char *(*allocate_tempname)(const char *name, size_t extra_chars, size_t *lengthp);
- HANDLE (__stdcall *create_file)(const void *name, DWORD access, DWORD share_mode, PSECURITY_ATTRIBUTES security_attributes, DWORD creation_disposition, DWORD file_attributes, HANDLE template_file);
- BOOL (__stdcall *delete_file)(const void *name);
- DWORD (__stdcall *get_file_attributes)(const void *name);
- BOOL (__stdcall *get_file_attributes_ex)(const void *name, GET_FILEEX_INFO_LEVELS info_level, void *information);
+ HANDLE(__stdcall *create_file)(const void *name, DWORD access, DWORD share_mode, PSECURITY_ATTRIBUTES security_attributes, DWORD creation_disposition, DWORD file_attributes, HANDLE template_file);
+ BOOL(__stdcall *delete_file)(const void *name);
+ DWORD(__stdcall *get_file_attributes)(const void *name);
+ BOOL(__stdcall *get_file_attributes_ex)(const void *name, GET_FILEEX_INFO_LEVELS info_level, void *information);
void (*make_tempname)(char *buf, size_t len, const char *name, zip_uint32_t i);
- BOOL (__stdcall *move_file)(const void *from, const void *to, DWORD flags);
- BOOL (__stdcall *set_file_attributes)(const void *name, DWORD attributes);
+ BOOL(__stdcall *move_file)(const void *from, const void *to, DWORD flags);
+ BOOL(__stdcall *set_file_attributes)(const void *name, DWORD attributes);
char *(*string_duplicate)(const char *string);
};
@@ -71,4 +73,12 @@ zip_int64_t _zip_win32_op_tell(zip_source_file_context_t *ctx, void *f);
bool _zip_filetime_to_time_t(FILETIME ft, time_t *t);
int _zip_win32_error_to_errno(DWORD win32err);
+#ifdef __clang__
+#define DONT_WARN_INCOMPATIBLE_FN_PTR_BEGIN _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wincompatible-function-pointer-types\"")
+#define DONT_WARN_INCOMPATIBLE_FN_PTR_END _Pragma("GCC diagnostic pop")
+#else
+#define DONT_WARN_INCOMPATIBLE_FN_PTR_BEGIN
+#define DONT_WARN_INCOMPATIBLE_FN_PTR_END
+#endif
+
#endif /* _HAD_ZIP_SOURCE_FILE_WIN32_H */
diff --git a/src/Common/libzip/zip_source_file_win32_ansi.c b/src/Common/libzip/zip_source_file_win32_ansi.c
new file mode 100644
index 00000000..58034cc2
--- /dev/null
+++ b/src/Common/libzip/zip_source_file_win32_ansi.c
@@ -0,0 +1,87 @@
+/*
+ zip_source_file_win32_ansi.c -- source for Windows file opened by ANSI name
+ Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner
+
+ This file is part of libzip, a library to manipulate ZIP archives.
+ The authors can be contacted at <info@libzip.org>
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ 3. The names of the authors may not be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "zip_source_file_win32.h"
+
+static char *ansi_allocate_tempname(const char *name, size_t extra_chars, size_t *lengthp);
+static void ansi_make_tempname(char *buf, size_t len, const char *name, zip_uint32_t i);
+
+/* clang-format off */
+DONT_WARN_INCOMPATIBLE_FN_PTR_BEGIN
+
+zip_win32_file_operations_t ops_ansi = {
+ ansi_allocate_tempname,
+ CreateFileA,
+ DeleteFileA,
+ GetFileAttributesA,
+ GetFileAttributesExA,
+ ansi_make_tempname,
+ MoveFileExA,
+ SetFileAttributesA,
+ strdup
+};
+
+DONT_WARN_INCOMPATIBLE_FN_PTR_END
+/* clang-format on */
+
+ZIP_EXTERN zip_source_t *
+zip_source_win32a(zip_t *za, const char *fname, zip_uint64_t start, zip_int64_t len) {
+ if (za == NULL)
+ return NULL;
+
+ return zip_source_win32a_create(fname, start, len, &za->error);
+}
+
+
+ZIP_EXTERN zip_source_t *
+zip_source_win32a_create(const char *fname, zip_uint64_t start, zip_int64_t length, zip_error_t *error) {
+ if (fname == NULL || length < ZIP_LENGTH_UNCHECKED) {
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return NULL;
+ }
+
+ return zip_source_file_common_new(fname, NULL, start, length, NULL, &_zip_source_file_win32_named_ops, &ops_ansi, error);
+}
+
+
+static char *
+ansi_allocate_tempname(const char *name, size_t extra_chars, size_t *lengthp) {
+ *lengthp = strlen(name) + extra_chars;
+ return (char *)malloc(*lengthp);
+}
+
+
+static void
+ansi_make_tempname(char *buf, size_t len, const char *name, zip_uint32_t i) {
+ snprintf_s(buf, len, "%s.%08x", name, i);
+}
diff --git a/src/Common/libzip/zip_source_file_win32_named.c b/src/Common/libzip/zip_source_file_win32_named.c
index 63791f8e..855e605a 100644
--- a/src/Common/libzip/zip_source_file_win32_named.c
+++ b/src/Common/libzip/zip_source_file_win32_named.c
@@ -3,7 +3,7 @@
Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -65,13 +65,13 @@ zip_source_file_operations_t _zip_source_file_win32_named_ops = {
static zip_int64_t
_zip_win32_named_op_commit_write(zip_source_file_context_t *ctx) {
zip_win32_file_operations_t *file_ops = (zip_win32_file_operations_t *)ctx->ops_userdata;
- DWORD attributes;
-
+ DWORD attributes;
+
if (!CloseHandle((HANDLE)ctx->fout)) {
zip_error_set(&ctx->error, ZIP_ER_WRITE, _zip_win32_error_to_errno(GetLastError()));
return -1;
}
-
+
attributes = file_ops->get_file_attributes(ctx->tmpname);
if (attributes == INVALID_FILE_ATTRIBUTES) {
zip_error_set(&ctx->error, ZIP_ER_RENAME, _zip_win32_error_to_errno(GetLastError()));
@@ -99,7 +99,6 @@ _zip_win32_named_op_create_temp_output(zip_source_file_context_t *ctx) {
zip_uint32_t value, i;
HANDLE th = INVALID_HANDLE_VALUE;
- void *temp = NULL;
PSECURITY_DESCRIPTOR psd = NULL;
PSECURITY_ATTRIBUTES psa = NULL;
SECURITY_ATTRIBUTES sa;
@@ -109,47 +108,47 @@ _zip_win32_named_op_create_temp_output(zip_source_file_context_t *ctx) {
char *tempname = NULL;
size_t tempname_size = 0;
- if ((HANDLE)ctx->f != INVALID_HANDLE_VALUE && GetFileType((HANDLE)ctx->f) == FILE_TYPE_DISK) {
- si = DACL_SECURITY_INFORMATION | UNPROTECTED_DACL_SECURITY_INFORMATION;
- success = GetSecurityInfo((HANDLE)ctx->f, SE_FILE_OBJECT, si, NULL, NULL, &dacl, NULL, &psd);
- if (success == ERROR_SUCCESS) {
- sa.nLength = sizeof(SECURITY_ATTRIBUTES);
- sa.bInheritHandle = FALSE;
- sa.lpSecurityDescriptor = psd;
- psa = &sa;
- }
- }
-
- #ifndef MS_UWP
+ if ((HANDLE)ctx->f != INVALID_HANDLE_VALUE && GetFileType((HANDLE)ctx->f) == FILE_TYPE_DISK) {
+ si = DACL_SECURITY_INFORMATION | UNPROTECTED_DACL_SECURITY_INFORMATION;
+ success = GetSecurityInfo((HANDLE)ctx->f, SE_FILE_OBJECT, si, NULL, NULL, &dacl, NULL, &psd);
+ if (success == ERROR_SUCCESS) {
+ sa.nLength = sizeof(SECURITY_ATTRIBUTES);
+ sa.bInheritHandle = FALSE;
+ sa.lpSecurityDescriptor = psd;
+ psa = &sa;
+ }
+ }
+
+#ifndef MS_UWP
value = GetTickCount();
#else
value = (zip_uint32_t)(GetTickCount64() & 0xffffffff);
#endif
-
+
if ((tempname = file_ops->allocate_tempname(ctx->fname, 10, &tempname_size)) == NULL) {
zip_error_set(&ctx->error, ZIP_ER_MEMORY, 0);
return -1;
}
-
+
for (i = 0; i < 1024 && th == INVALID_HANDLE_VALUE; i++) {
file_ops->make_tempname(tempname, tempname_size, ctx->fname, value + i);
-
+
th = win32_named_open(ctx, tempname, true, psa);
if (th == INVALID_HANDLE_VALUE && GetLastError() != ERROR_FILE_EXISTS)
break;
}
-
+
if (th == INVALID_HANDLE_VALUE) {
free(tempname);
LocalFree(psd);
zip_error_set(&ctx->error, ZIP_ER_TMPOPEN, _zip_win32_error_to_errno(GetLastError()));
return -1;
}
-
+
LocalFree(psd);
ctx->fout = th;
ctx->tmpname = tempname;
-
+
return 0;
}
@@ -157,11 +156,11 @@ _zip_win32_named_op_create_temp_output(zip_source_file_context_t *ctx) {
static bool
_zip_win32_named_op_open(zip_source_file_context_t *ctx) {
HANDLE h = win32_named_open(ctx, ctx->fname, false, NULL);
-
+
if (h == INVALID_HANDLE_VALUE) {
return false;
}
-
+
ctx->f = h;
return true;
}
@@ -194,7 +193,7 @@ _zip_win32_named_op_rollback_write(zip_source_file_context_t *ctx) {
static bool
_zip_win32_named_op_stat(zip_source_file_context_t *ctx, zip_source_file_stat_t *st) {
zip_win32_file_operations_t *file_ops = (zip_win32_file_operations_t *)ctx->ops_userdata;
-
+
WIN32_FILE_ATTRIBUTE_DATA file_attributes;
if (!file_ops->get_file_attributes_ex(ctx->fname, GetFileExInfoStandard, &file_attributes)) {
@@ -206,9 +205,16 @@ _zip_win32_named_op_stat(zip_source_file_context_t *ctx, zip_source_file_stat_t
zip_error_set(&ctx->error, ZIP_ER_READ, _zip_win32_error_to_errno(error));
return false;
}
-
+
st->exists = true;
- st->regular_file = true; /* TODO: Is this always right? How to determine without a HANDLE? */
+ st->regular_file = false;
+
+ if (file_attributes.dwFileAttributes != INVALID_FILE_ATTRIBUTES) {
+ if ((file_attributes.dwFileAttributes & (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_DEVICE | FILE_ATTRIBUTE_REPARSE_POINT)) == 0) {
+ st->regular_file = true;
+ }
+ }
+
if (!_zip_filetime_to_time_t(file_attributes.ftLastWriteTime, &st->mtime)) {
zip_error_set(&ctx->error, ZIP_ER_READ, ERANGE);
return false;
@@ -236,7 +242,7 @@ _zip_win32_named_op_write(zip_source_file_context_t *ctx, const void *data, zip_
zip_error_set(&ctx->error, ZIP_ER_WRITE, _zip_win32_error_to_errno(GetLastError()));
return -1;
}
-
+
return (zip_int64_t)ret;
}
@@ -249,8 +255,8 @@ win32_named_open(zip_source_file_context_t *ctx, const char *name, bool temporar
DWORD share_mode = FILE_SHARE_READ | FILE_SHARE_WRITE;
DWORD creation_disposition = OPEN_EXISTING;
DWORD file_attributes = FILE_ATTRIBUTE_NORMAL;
- HANDLE h;
-
+ HANDLE h;
+
if (temporary) {
access = GENERIC_READ | GENERIC_WRITE;
share_mode = FILE_SHARE_READ;
@@ -259,7 +265,7 @@ win32_named_open(zip_source_file_context_t *ctx, const char *name, bool temporar
}
h = file_ops->create_file(name, access, share_mode, security_attributes, creation_disposition, file_attributes, NULL);
-
+
if (h == INVALID_HANDLE_VALUE) {
zip_error_set(&ctx->error, ZIP_ER_OPEN, _zip_win32_error_to_errno(GetLastError()));
}
diff --git a/src/Common/libzip/zip_source_file_win32_utf16.c b/src/Common/libzip/zip_source_file_win32_utf16.c
index 83786483..8f07d021 100644
--- a/src/Common/libzip/zip_source_file_win32_utf16.c
+++ b/src/Common/libzip/zip_source_file_win32_utf16.c
@@ -3,7 +3,7 @@
Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -33,20 +33,14 @@
#include "zip_source_file_win32.h"
-#define RtlGenRandom SystemFunction036
-BOOLEAN NTAPI RtlGenRandom(PVOID RandomBuffer, ULONG RandomBufferLength);
-
-bool zip_secure_random(zip_uint8_t *buffer, zip_uint16_t length)
-{
- return RtlGenRandom (buffer, (ULONG) length);
-}
-
-
static char *utf16_allocate_tempname(const char *name, size_t extra_chars, size_t *lengthp);
static HANDLE __stdcall utf16_create_file(const char *name, DWORD access, DWORD share_mode, PSECURITY_ATTRIBUTES security_attributes, DWORD creation_disposition, DWORD file_attributes, HANDLE template_file);
static void utf16_make_tempname(char *buf, size_t len, const char *name, zip_uint32_t i);
static char *utf16_strdup(const char *string);
+/* clang-format off */
+DONT_WARN_INCOMPATIBLE_FN_PTR_BEGIN
+
zip_win32_file_operations_t ops_utf16 = {
utf16_allocate_tempname,
utf16_create_file,
@@ -59,10 +53,13 @@ zip_win32_file_operations_t ops_utf16 = {
utf16_strdup
};
+DONT_WARN_INCOMPATIBLE_FN_PTR_END
+/* clang-format on */
+
ZIP_EXTERN zip_source_t *
zip_source_win32w(zip_t *za, const wchar_t *fname, zip_uint64_t start, zip_int64_t len) {
if (za == NULL)
- return NULL;
+ return NULL;
return zip_source_win32w_create(fname, start, len, &za->error);
}
@@ -70,9 +67,9 @@ zip_source_win32w(zip_t *za, const wchar_t *fname, zip_uint64_t start, zip_int64
ZIP_EXTERN zip_source_t *
zip_source_win32w_create(const wchar_t *fname, zip_uint64_t start, zip_int64_t length, zip_error_t *error) {
- if (fname == NULL || length < -1) {
- zip_error_set(error, ZIP_ER_INVAL, 0);
- return NULL;
+ if (fname == NULL || length < ZIP_LENGTH_UNCHECKED) {
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return NULL;
}
@@ -87,8 +84,7 @@ utf16_allocate_tempname(const char *name, size_t extra_chars, size_t *lengthp) {
}
-static HANDLE __stdcall
-utf16_create_file(const char *name, DWORD access, DWORD share_mode, PSECURITY_ATTRIBUTES security_attributes, DWORD creation_disposition, DWORD file_attributes, HANDLE template_file) {
+static HANDLE __stdcall utf16_create_file(const char *name, DWORD access, DWORD share_mode, PSECURITY_ATTRIBUTES security_attributes, DWORD creation_disposition, DWORD file_attributes, HANDLE template_file) {
#ifdef MS_UWP
CREATEFILE2_EXTENDED_PARAMETERS extParams = {0};
extParams.dwFileAttributes = file_attributes;
@@ -97,7 +93,7 @@ utf16_create_file(const char *name, DWORD access, DWORD share_mode, PSECURITY_AT
extParams.dwSize = sizeof(extParams);
extParams.hTemplateFile = template_file;
extParams.lpSecurityAttributes = security_attributes;
-
+
return CreateFile2((const wchar_t *)name, access, share_mode, creation_disposition, &extParams);
#else
return CreateFileW((const wchar_t *)name, access, share_mode, security_attributes, creation_disposition, file_attributes, template_file);
@@ -107,7 +103,7 @@ utf16_create_file(const char *name, DWORD access, DWORD share_mode, PSECURITY_AT
static void
utf16_make_tempname(char *buf, size_t len, const char *name, zip_uint32_t i) {
- _snwprintf((wchar_t *)buf, len, L"%s.%08x", (const wchar_t *)name, i);
+ _snwprintf_s((wchar_t *)buf, len, len, L"%s.%08x", (const wchar_t *)name, i);
}
diff --git a/src/Common/libzip/zip_source_file_win32_utf8.c b/src/Common/libzip/zip_source_file_win32_utf8.c
index 4f258bc4..d154f97a 100644
--- a/src/Common/libzip/zip_source_file_win32_utf8.c
+++ b/src/Common/libzip/zip_source_file_win32_utf8.c
@@ -3,7 +3,7 @@
Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -38,7 +38,7 @@ zip_source_file(zip_t *za, const char *fname, zip_uint64_t start, zip_int64_t le
if (za == NULL) {
return NULL;
}
-
+
return zip_source_file_create(fname, start, len, &za->error);
}
@@ -49,7 +49,7 @@ zip_source_file_create(const char *fname, zip_uint64_t start, zip_int64_t length
wchar_t *wfname;
zip_source_t *source;
- if (fname == NULL || length < -1) {
+ if (fname == NULL || length < ZIP_LENGTH_UNCHECKED) {
zip_error_set(error, ZIP_ER_INVAL, 0);
return NULL;
}
@@ -67,7 +67,7 @@ zip_source_file_create(const char *fname, zip_uint64_t start, zip_int64_t length
MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, fname, -1, wfname, size);
source = zip_source_win32w_create(wfname, start, length, error);
-
+
free(wfname);
return source;
}
diff --git a/src/Common/libzip/zip_source_free.c b/src/Common/libzip/zip_source_free.c
index 2f10ef8f..1a800405 100644
--- a/src/Common/libzip/zip_source_free.c
+++ b/src/Common/libzip/zip_source_free.c
@@ -1,9 +1,9 @@
/*
zip_source_free.c -- free zip data source
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -40,31 +40,31 @@
ZIP_EXTERN void
zip_source_free(zip_source_t *src) {
if (src == NULL)
- return;
+ return;
if (src->refcount > 0) {
- src->refcount--;
+ src->refcount--;
}
if (src->refcount > 0) {
- return;
+ return;
}
if (ZIP_SOURCE_IS_OPEN_READING(src)) {
- src->open_count = 1; /* force close */
- zip_source_close(src);
+ src->open_count = 1; /* force close */
+ zip_source_close(src);
}
if (ZIP_SOURCE_IS_OPEN_WRITING(src)) {
- zip_source_rollback_write(src);
+ zip_source_rollback_write(src);
}
if (src->source_archive && !src->source_closed) {
- _zip_deregister_source(src->source_archive, src);
+ _zip_deregister_source(src->source_archive, src);
}
(void)_zip_source_call(src, NULL, 0, ZIP_SOURCE_FREE);
if (src->src) {
- zip_source_free(src->src);
+ zip_source_free(src->src);
}
free(src);
diff --git a/src/Common/libzip/zip_source_function.c b/src/Common/libzip/zip_source_function.c
index d5c1b5b0..1fe6396e 100644
--- a/src/Common/libzip/zip_source_function.c
+++ b/src/Common/libzip/zip_source_function.c
@@ -1,9 +1,9 @@
/*
zip_source_function.c -- create zip data source from callback function
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -40,7 +40,7 @@
ZIP_EXTERN zip_source_t *
zip_source_function(zip_t *za, zip_source_callback zcb, void *ud) {
if (za == NULL) {
- return NULL;
+ return NULL;
}
return zip_source_function_create(zcb, ud, &za->error);
@@ -52,15 +52,16 @@ zip_source_function_create(zip_source_callback zcb, void *ud, zip_error_t *error
zip_source_t *zs;
if ((zs = _zip_source_new(error)) == NULL)
- return NULL;
+ return NULL;
zs->cb.f = zcb;
zs->ud = ud;
zs->supports = zcb(ud, NULL, 0, ZIP_SOURCE_SUPPORTS);
if (zs->supports < 0) {
- zs->supports = ZIP_SOURCE_SUPPORTS_READABLE;
+ zs->supports = ZIP_SOURCE_SUPPORTS_READABLE;
}
+ zs->supports |= zip_source_make_command_bitmap(ZIP_SOURCE_SUPPORTS, -1);
return zs;
}
@@ -77,8 +78,8 @@ _zip_source_new(zip_error_t *error) {
zip_source_t *src;
if ((src = (zip_source_t *)malloc(sizeof(*src))) == NULL) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
}
src->src = NULL;
@@ -92,6 +93,7 @@ _zip_source_new(zip_error_t *error) {
zip_error_init(&src->error);
src->eof = false;
src->had_read_error = false;
+ src->bytes_read = 0;
return src;
}
diff --git a/src/Common/libzip/zip_source_get_file_attributes.c b/src/Common/libzip/zip_source_get_file_attributes.c
index acbede1d..4771dc16 100644
--- a/src/Common/libzip/zip_source_get_file_attributes.c
+++ b/src/Common/libzip/zip_source_get_file_attributes.c
@@ -3,7 +3,7 @@
Copyright (C) 2020 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -42,62 +42,66 @@ zip_file_attributes_init(zip_file_attributes_t *attributes) {
int
zip_source_get_file_attributes(zip_source_t *src, zip_file_attributes_t *attributes) {
if (src->source_closed) {
- return -1;
+ return -1;
}
if (attributes == NULL) {
- zip_error_set(&src->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&src->error, ZIP_ER_INVAL, 0);
+ return -1;
}
zip_file_attributes_init(attributes);
if (src->supports & ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_GET_FILE_ATTRIBUTES)) {
- if (_zip_source_call(src, attributes, sizeof(*attributes), ZIP_SOURCE_GET_FILE_ATTRIBUTES) < 0) {
- return -1;
- }
+ if (_zip_source_call(src, attributes, sizeof(*attributes), ZIP_SOURCE_GET_FILE_ATTRIBUTES) < 0) {
+ return -1;
+ }
}
if (ZIP_SOURCE_IS_LAYERED(src)) {
- zip_file_attributes_t lower_attributes;
+ zip_file_attributes_t lower_attributes;
- if (zip_source_get_file_attributes(src->src, &lower_attributes) < 0) {
- _zip_error_set_from_source(&src->error, src->src);
- return -1;
- }
+ zip_file_attributes_init(&lower_attributes);
- if ((lower_attributes.valid & ZIP_FILE_ATTRIBUTES_HOST_SYSTEM) && (attributes->valid & ZIP_FILE_ATTRIBUTES_HOST_SYSTEM) == 0) {
- attributes->host_system = lower_attributes.host_system;
- attributes->valid |= ZIP_FILE_ATTRIBUTES_HOST_SYSTEM;
- }
- if ((lower_attributes.valid & ZIP_FILE_ATTRIBUTES_ASCII) && (attributes->valid & ZIP_FILE_ATTRIBUTES_ASCII) == 0) {
- attributes->ascii = lower_attributes.ascii;
- attributes->valid |= ZIP_FILE_ATTRIBUTES_ASCII;
- }
- if ((lower_attributes.valid & ZIP_FILE_ATTRIBUTES_VERSION_NEEDED)) {
- if (attributes->valid & ZIP_FILE_ATTRIBUTES_VERSION_NEEDED) {
- attributes->version_needed = ZIP_MAX(lower_attributes.version_needed, attributes->version_needed);
- }
- else {
- attributes->version_needed = lower_attributes.version_needed;
- attributes->valid |= ZIP_FILE_ATTRIBUTES_VERSION_NEEDED;
- }
- }
- if ((lower_attributes.valid & ZIP_FILE_ATTRIBUTES_EXTERNAL_FILE_ATTRIBUTES) && (attributes->valid & ZIP_FILE_ATTRIBUTES_EXTERNAL_FILE_ATTRIBUTES) == 0) {
- attributes->external_file_attributes = lower_attributes.external_file_attributes;
- attributes->valid |= ZIP_FILE_ATTRIBUTES_EXTERNAL_FILE_ATTRIBUTES;
- }
- if ((lower_attributes.valid & ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS)) {
- if (attributes->valid & ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS) {
- attributes->general_purpose_bit_flags &= ~lower_attributes.general_purpose_bit_mask;
- attributes->general_purpose_bit_flags |= lower_attributes.general_purpose_bit_flags & lower_attributes.general_purpose_bit_mask;
- attributes->general_purpose_bit_mask |= lower_attributes.general_purpose_bit_mask;
- }
- else {
- attributes->valid |= ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS;
- attributes->general_purpose_bit_flags = lower_attributes.general_purpose_bit_flags;
- attributes->general_purpose_bit_mask = lower_attributes.general_purpose_bit_mask;
- }
- }
+ if (zip_source_get_file_attributes(src->src, &lower_attributes) < 0) {
+ zip_error_set_from_source(&src->error, src->src);
+ return -1;
+ }
+
+ if ((lower_attributes.valid & ZIP_FILE_ATTRIBUTES_HOST_SYSTEM) && (attributes->valid & ZIP_FILE_ATTRIBUTES_HOST_SYSTEM) == 0) {
+ attributes->host_system = lower_attributes.host_system;
+ attributes->valid |= ZIP_FILE_ATTRIBUTES_HOST_SYSTEM;
+ }
+ if ((lower_attributes.valid & ZIP_FILE_ATTRIBUTES_ASCII) && (attributes->valid & ZIP_FILE_ATTRIBUTES_ASCII) == 0) {
+ attributes->ascii = lower_attributes.ascii;
+ attributes->valid |= ZIP_FILE_ATTRIBUTES_ASCII;
+ }
+ if ((lower_attributes.valid & ZIP_FILE_ATTRIBUTES_VERSION_NEEDED)) {
+ if (attributes->valid & ZIP_FILE_ATTRIBUTES_VERSION_NEEDED) {
+ attributes->version_needed = ZIP_MAX(lower_attributes.version_needed, attributes->version_needed);
+ }
+ else {
+ attributes->version_needed = lower_attributes.version_needed;
+ attributes->valid |= ZIP_FILE_ATTRIBUTES_VERSION_NEEDED;
+ }
+ }
+ if ((lower_attributes.valid & ZIP_FILE_ATTRIBUTES_EXTERNAL_FILE_ATTRIBUTES) && (attributes->valid & ZIP_FILE_ATTRIBUTES_EXTERNAL_FILE_ATTRIBUTES) == 0) {
+ attributes->external_file_attributes = lower_attributes.external_file_attributes;
+ attributes->valid |= ZIP_FILE_ATTRIBUTES_EXTERNAL_FILE_ATTRIBUTES;
+ }
+ if ((lower_attributes.valid & ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS)) {
+ if (attributes->valid & ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS) {
+ /* only take from lower level what is not defined at current level */
+ lower_attributes.general_purpose_bit_mask &= ~attributes->general_purpose_bit_mask;
+
+ attributes->general_purpose_bit_flags |= lower_attributes.general_purpose_bit_flags & lower_attributes.general_purpose_bit_mask;
+ attributes->general_purpose_bit_mask |= lower_attributes.general_purpose_bit_mask;
+ }
+ else {
+ attributes->valid |= ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS;
+ attributes->general_purpose_bit_flags = lower_attributes.general_purpose_bit_flags;
+ attributes->general_purpose_bit_mask = lower_attributes.general_purpose_bit_mask;
+ }
+ }
}
return 0;
diff --git a/src/Common/libzip/zip_source_is_deleted.c b/src/Common/libzip/zip_source_is_deleted.c
index edd10ca2..838aa909 100644
--- a/src/Common/libzip/zip_source_is_deleted.c
+++ b/src/Common/libzip/zip_source_is_deleted.c
@@ -1,9 +1,9 @@
/*
zip_source_is_deleted.c -- was archive was removed?
- Copyright (C) 2014-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
diff --git a/src/Common/libzip/zip_source_layered.c b/src/Common/libzip/zip_source_layered.c
index d02bc852..62b78e68 100644
--- a/src/Common/libzip/zip_source_layered.c
+++ b/src/Common/libzip/zip_source_layered.c
@@ -1,9 +1,9 @@
/*
zip_source_layered.c -- create layered source
- Copyright (C) 2009-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -40,7 +40,7 @@
zip_source_t *
zip_source_layered(zip_t *za, zip_source_t *src, zip_source_layered_callback cb, void *ud) {
if (za == NULL)
- return NULL;
+ return NULL;
return zip_source_layered_create(src, cb, ud, &za->error);
}
@@ -49,19 +49,27 @@ zip_source_layered(zip_t *za, zip_source_t *src, zip_source_layered_callback cb,
zip_source_t *
zip_source_layered_create(zip_source_t *src, zip_source_layered_callback cb, void *ud, zip_error_t *error) {
zip_source_t *zs;
+ zip_int64_t lower_supports, supports;
- if ((zs = _zip_source_new(error)) == NULL)
- return NULL;
+ lower_supports = zip_source_supports(src);
+ supports = cb(src, ud, &lower_supports, sizeof(lower_supports), ZIP_SOURCE_SUPPORTS);
+ if (supports < 0) {
+ zip_error_set(error,ZIP_ER_INVAL, 0); /* Initialize in case cb doesn't return valid error. */
+ cb(src, ud, error, sizeof(*error), ZIP_SOURCE_ERROR);
+ return NULL;
+ }
+
+ if ((zs = _zip_source_new(error)) == NULL) {
+ return NULL;
+ }
- zip_source_keep(src);
zs->src = src;
zs->cb.l = cb;
zs->ud = ud;
+ zs->supports = supports;
- zs->supports = cb(src, ud, NULL, 0, ZIP_SOURCE_SUPPORTS);
- if (zs->supports < 0) {
- zs->supports = ZIP_SOURCE_SUPPORTS_READABLE;
- }
+ /* Layered sources can't support writing, since we currently have no use case. If we want to revisit this, we have to define how the two sources interact. */
+ zs->supports &= ~(ZIP_SOURCE_SUPPORTS_WRITABLE & ~ZIP_SOURCE_SUPPORTS_SEEKABLE);
return zs;
}
diff --git a/src/Common/libzip/zip_source_open.c b/src/Common/libzip/zip_source_open.c
index 414c677a..b34fa2c6 100644
--- a/src/Common/libzip/zip_source_open.c
+++ b/src/Common/libzip/zip_source_open.c
@@ -1,9 +1,9 @@
/*
zip_source_open.c -- open zip_source (prepare for reading)
- Copyright (C) 2009-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -37,38 +37,39 @@
ZIP_EXTERN int
zip_source_open(zip_source_t *src) {
if (src->source_closed) {
- return -1;
+ return -1;
}
if (src->write_state == ZIP_SOURCE_WRITE_REMOVED) {
- zip_error_set(&src->error, ZIP_ER_DELETED, 0);
- return -1;
+ zip_error_set(&src->error, ZIP_ER_DELETED, 0);
+ return -1;
}
if (ZIP_SOURCE_IS_OPEN_READING(src)) {
- if ((zip_source_supports(src) & ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_SEEK)) == 0) {
- zip_error_set(&src->error, ZIP_ER_INUSE, 0);
- return -1;
- }
+ if ((zip_source_supports(src) & ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_SEEK)) == 0) {
+ zip_error_set(&src->error, ZIP_ER_INUSE, 0);
+ return -1;
+ }
}
else {
- if (ZIP_SOURCE_IS_LAYERED(src)) {
- if (zip_source_open(src->src) < 0) {
- _zip_error_set_from_source(&src->error, src->src);
- return -1;
- }
- }
+ if (ZIP_SOURCE_IS_LAYERED(src)) {
+ if (zip_source_open(src->src) < 0) {
+ zip_error_set_from_source(&src->error, src->src);
+ return -1;
+ }
+ }
- if (_zip_source_call(src, NULL, 0, ZIP_SOURCE_OPEN) < 0) {
- if (ZIP_SOURCE_IS_LAYERED(src)) {
- zip_source_close(src->src);
- }
- return -1;
- }
+ if (_zip_source_call(src, NULL, 0, ZIP_SOURCE_OPEN) < 0) {
+ if (ZIP_SOURCE_IS_LAYERED(src)) {
+ zip_source_close(src->src);
+ }
+ return -1;
+ }
}
src->eof = false;
src->had_read_error = false;
_zip_error_clear(&src->error);
+ src->bytes_read = 0;
src->open_count++;
return 0;
diff --git a/src/Common/libzip/zip_source_pass_to_lower_layer.c b/src/Common/libzip/zip_source_pass_to_lower_layer.c
new file mode 100644
index 00000000..4a98222e
--- /dev/null
+++ b/src/Common/libzip/zip_source_pass_to_lower_layer.c
@@ -0,0 +1,78 @@
+/*
+ zip_source_pass_to_lower_layer.c -- pass command to lower layer
+ Copyright (C) 2022 Dieter Baron and Thomas Klausner
+
+ This file is part of libzip, a library to manipulate ZIP archives.
+ The authors can be contacted at <info@libzip.org>
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ 3. The names of the authors may not be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "zipint.h"
+
+zip_int64_t zip_source_pass_to_lower_layer(zip_source_t *src, void *data, zip_uint64_t length, zip_source_cmd_t command) {
+ switch (command) {
+ case ZIP_SOURCE_OPEN:
+ case ZIP_SOURCE_CLOSE:
+ case ZIP_SOURCE_FREE:
+ case ZIP_SOURCE_GET_FILE_ATTRIBUTES:
+ case ZIP_SOURCE_SUPPORTS_REOPEN:
+ return 0;
+
+ case ZIP_SOURCE_STAT:
+ return sizeof(zip_stat_t);
+
+ case ZIP_SOURCE_ACCEPT_EMPTY:
+ case ZIP_SOURCE_ERROR:
+ case ZIP_SOURCE_READ:
+ case ZIP_SOURCE_SEEK:
+ case ZIP_SOURCE_TELL:
+ return _zip_source_call(src, data, length, command);
+
+
+ case ZIP_SOURCE_BEGIN_WRITE:
+ case ZIP_SOURCE_BEGIN_WRITE_CLONING:
+ case ZIP_SOURCE_COMMIT_WRITE:
+ case ZIP_SOURCE_REMOVE:
+ case ZIP_SOURCE_ROLLBACK_WRITE:
+ case ZIP_SOURCE_SEEK_WRITE:
+ case ZIP_SOURCE_TELL_WRITE:
+ case ZIP_SOURCE_WRITE:
+ zip_error_set(&src->error, ZIP_ER_OPNOTSUPP, 0);
+ return -1;
+
+ case ZIP_SOURCE_SUPPORTS:
+ if (length < sizeof(zip_int64_t)) {
+ zip_error_set(&src->error, ZIP_ER_INTERNAL, 0);
+ return -1;
+ }
+ return *(zip_int64_t *)data;
+
+ default:
+ zip_error_set(&src->error, ZIP_ER_OPNOTSUPP, 0);
+ return -1;
+ }
+} \ No newline at end of file
diff --git a/src/Common/libzip/zip_source_pkware_decode.c b/src/Common/libzip/zip_source_pkware_decode.c
index c85b590c..b4c482b3 100644
--- a/src/Common/libzip/zip_source_pkware_decode.c
+++ b/src/Common/libzip/zip_source_pkware_decode.c
@@ -3,7 +3,7 @@
Copyright (C) 2009-2020 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -56,21 +56,21 @@ zip_source_pkware_decode(zip_t *za, zip_source_t *src, zip_uint16_t em, int flag
zip_source_t *s2;
if (password == NULL || src == NULL || em != ZIP_EM_TRAD_PKWARE) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return NULL;
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return NULL;
}
if (flags & ZIP_CODEC_ENCODE) {
- zip_error_set(&za->error, ZIP_ER_ENCRNOTSUPP, 0);
- return NULL;
+ zip_error_set(&za->error, ZIP_ER_ENCRNOTSUPP, 0);
+ return NULL;
}
if ((ctx = trad_pkware_new(password, &za->error)) == NULL) {
- return NULL;
+ return NULL;
}
if ((s2 = zip_source_layered(za, src, pkware_decrypt, ctx)) == NULL) {
- trad_pkware_free(ctx);
- return NULL;
+ trad_pkware_free(ctx);
+ return NULL;
}
return s2;
@@ -82,23 +82,23 @@ decrypt_header(zip_source_t *src, struct trad_pkware *ctx) {
zip_uint8_t header[ZIP_CRYPTO_PKWARE_HEADERLEN];
struct zip_stat st;
zip_int64_t n;
- bool ok;
+ bool ok = false;
if ((n = zip_source_read(src, header, ZIP_CRYPTO_PKWARE_HEADERLEN)) < 0) {
- _zip_error_set_from_source(&ctx->error, src);
- return -1;
+ zip_error_set_from_source(&ctx->error, src);
+ return -1;
}
if (n != ZIP_CRYPTO_PKWARE_HEADERLEN) {
- zip_error_set(&ctx->error, ZIP_ER_EOF, 0);
- return -1;
+ zip_error_set(&ctx->error, ZIP_ER_EOF, 0);
+ return -1;
}
_zip_pkware_decrypt(&ctx->keys, header, header, ZIP_CRYPTO_PKWARE_HEADERLEN);
if (zip_source_stat(src, &st)) {
- /* stat failed, skip password validation */
- return 0;
+ /* stat failed, skip password validation */
+ return 0;
}
/* password verification - two ways:
@@ -106,25 +106,23 @@ decrypt_header(zip_source_t *src, struct trad_pkware *ctx) {
* CRC - old PKWare way
*/
- ok = false;
-
if (st.valid & ZIP_STAT_MTIME) {
- unsigned short dostime, dosdate;
- _zip_u2d_time(st.mtime, &dostime, &dosdate);
- if (header[ZIP_CRYPTO_PKWARE_HEADERLEN - 1] == dostime >> 8) {
- ok = true;
- }
+ unsigned short dostime, dosdate;
+ _zip_u2d_time(st.mtime, &dostime, &dosdate);
+ if (header[ZIP_CRYPTO_PKWARE_HEADERLEN - 1] == dostime >> 8) {
+ ok = true;
+ }
}
if (st.valid & ZIP_STAT_CRC) {
- if (header[ZIP_CRYPTO_PKWARE_HEADERLEN - 1] == st.crc >> 24) {
- ok = true;
- }
+ if (header[ZIP_CRYPTO_PKWARE_HEADERLEN - 1] == st.crc >> 24) {
+ ok = true;
+ }
}
if (!ok && ((st.valid & (ZIP_STAT_MTIME | ZIP_STAT_CRC)) != 0)) {
- zip_error_set(&ctx->error, ZIP_ER_WRONGPASSWD, 0);
- return -1;
+ zip_error_set(&ctx->error, ZIP_ER_WRONGPASSWD, 0);
+ return -1;
}
return 0;
@@ -140,52 +138,51 @@ pkware_decrypt(zip_source_t *src, void *ud, void *data, zip_uint64_t len, zip_so
switch (cmd) {
case ZIP_SOURCE_OPEN:
- _zip_pkware_keys_reset(&ctx->keys);
- _zip_pkware_decrypt(&ctx->keys, NULL, (const zip_uint8_t *)ctx->password, strlen(ctx->password));
- if (decrypt_header(src, ctx) < 0) {
- return -1;
- }
- return 0;
+ _zip_pkware_keys_reset(&ctx->keys);
+ _zip_pkware_decrypt(&ctx->keys, NULL, (const zip_uint8_t *)ctx->password, strlen(ctx->password));
+ if (decrypt_header(src, ctx) < 0) {
+ return -1;
+ }
+ return 0;
case ZIP_SOURCE_READ:
- if ((n = zip_source_read(src, data, len)) < 0) {
- _zip_error_set_from_source(&ctx->error, src);
- return -1;
- }
+ if ((n = zip_source_read(src, data, len)) < 0) {
+ zip_error_set_from_source(&ctx->error, src);
+ return -1;
+ }
- _zip_pkware_decrypt(&ctx->keys, (zip_uint8_t *)data, (zip_uint8_t *)data, (zip_uint64_t)n);
- return n;
+ _zip_pkware_decrypt(&ctx->keys, (zip_uint8_t *)data, (zip_uint8_t *)data, (zip_uint64_t)n);
+ return n;
case ZIP_SOURCE_CLOSE:
- return 0;
+ return 0;
case ZIP_SOURCE_STAT: {
- zip_stat_t *st;
+ zip_stat_t *st;
- st = (zip_stat_t *)data;
+ st = (zip_stat_t *)data;
- st->encryption_method = ZIP_EM_NONE;
- st->valid |= ZIP_STAT_ENCRYPTION_METHOD;
- if (st->valid & ZIP_STAT_COMP_SIZE) {
- st->comp_size -= ZIP_CRYPTO_PKWARE_HEADERLEN;
- }
+ st->encryption_method = ZIP_EM_NONE;
+ st->valid |= ZIP_STAT_ENCRYPTION_METHOD;
+ if (st->valid & ZIP_STAT_COMP_SIZE) {
+ st->comp_size -= ZIP_CRYPTO_PKWARE_HEADERLEN;
+ }
- return 0;
+ return 0;
}
case ZIP_SOURCE_SUPPORTS:
- return zip_source_make_command_bitmap(ZIP_SOURCE_OPEN, ZIP_SOURCE_READ, ZIP_SOURCE_CLOSE, ZIP_SOURCE_STAT, ZIP_SOURCE_ERROR, ZIP_SOURCE_FREE, -1);
+ return zip_source_make_command_bitmap(ZIP_SOURCE_OPEN, ZIP_SOURCE_READ, ZIP_SOURCE_CLOSE, ZIP_SOURCE_STAT, ZIP_SOURCE_ERROR, ZIP_SOURCE_FREE, ZIP_SOURCE_SUPPORTS_REOPEN, -1);
case ZIP_SOURCE_ERROR:
- return zip_error_to_data(&ctx->error, data, len);
+ return zip_error_to_data(&ctx->error, data, len);
case ZIP_SOURCE_FREE:
- trad_pkware_free(ctx);
- return 0;
+ trad_pkware_free(ctx);
+ return 0;
default:
- zip_error_set(&ctx->error, ZIP_ER_INVAL, 0);
- return -1;
+ return zip_source_pass_to_lower_layer(src, data, len, cmd);
}
}
@@ -195,14 +192,14 @@ trad_pkware_new(const char *password, zip_error_t *error) {
struct trad_pkware *ctx;
if ((ctx = (struct trad_pkware *)malloc(sizeof(*ctx))) == NULL) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
}
if ((ctx->password = strdup(password)) == NULL) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- free(ctx);
- return NULL;
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ free(ctx);
+ return NULL;
}
zip_error_init(&ctx->error);
@@ -214,7 +211,7 @@ trad_pkware_new(const char *password, zip_error_t *error) {
static void
trad_pkware_free(struct trad_pkware *ctx) {
if (ctx == NULL) {
- return;
+ return;
}
free(ctx->password);
diff --git a/src/Common/libzip/zip_source_pkware_encode.c b/src/Common/libzip/zip_source_pkware_encode.c
index 1e8f42c3..d89b9f4e 100644
--- a/src/Common/libzip/zip_source_pkware_encode.c
+++ b/src/Common/libzip/zip_source_pkware_encode.c
@@ -3,7 +3,7 @@
Copyright (C) 2009-2020 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -42,6 +42,8 @@ struct trad_pkware {
zip_pkware_keys_t keys;
zip_buffer_t *buffer;
bool eof;
+ bool mtime_set;
+ time_t mtime;
zip_error_t error;
};
@@ -50,7 +52,7 @@ static int encrypt_header(zip_source_t *, struct trad_pkware *);
static zip_int64_t pkware_encrypt(zip_source_t *, void *, void *, zip_uint64_t, zip_source_cmd_t);
static void trad_pkware_free(struct trad_pkware *);
static struct trad_pkware *trad_pkware_new(const char *password, zip_error_t *error);
-
+static void set_mtime(struct trad_pkware* ctx, zip_stat_t* st);
zip_source_t *
zip_source_pkware_encode(zip_t *za, zip_source_t *src, zip_uint16_t em, int flags, const char *password) {
@@ -58,21 +60,21 @@ zip_source_pkware_encode(zip_t *za, zip_source_t *src, zip_uint16_t em, int flag
zip_source_t *s2;
if (password == NULL || src == NULL || em != ZIP_EM_TRAD_PKWARE) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return NULL;
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return NULL;
}
if (!(flags & ZIP_CODEC_ENCODE)) {
- zip_error_set(&za->error, ZIP_ER_ENCRNOTSUPP, 0);
- return NULL;
+ zip_error_set(&za->error, ZIP_ER_ENCRNOTSUPP, 0);
+ return NULL;
}
if ((ctx = trad_pkware_new(password, &za->error)) == NULL) {
- return NULL;
+ return NULL;
}
if ((s2 = zip_source_layered(za, src, pkware_encrypt, ctx)) == NULL) {
- trad_pkware_free(ctx);
- return NULL;
+ trad_pkware_free(ctx);
+ return NULL;
}
return s2;
@@ -81,20 +83,23 @@ zip_source_pkware_encode(zip_t *za, zip_source_t *src, zip_uint16_t em, int flag
static int
encrypt_header(zip_source_t *src, struct trad_pkware *ctx) {
- struct zip_stat st;
unsigned short dostime, dosdate;
zip_uint8_t *header;
- if (zip_source_stat(src, &st) != 0) {
- _zip_error_set_from_source(&ctx->error, src);
- return -1;
+ if (!ctx->mtime_set) {
+ struct zip_stat st;
+ if (zip_source_stat(src, &st) != 0) {
+ zip_error_set_from_source(&ctx->error, src);
+ return -1;
+ }
+ set_mtime(ctx, &st);
}
- _zip_u2d_time(st.mtime, &dostime, &dosdate);
+ _zip_u2d_time(ctx->mtime, &dostime, &dosdate);
if ((ctx->buffer = _zip_buffer_new(NULL, ZIP_CRYPTO_PKWARE_HEADERLEN)) == NULL) {
- zip_error_set(&ctx->error, ZIP_ER_MEMORY, 0);
- return -1;
+ zip_error_set(&ctx->error, ZIP_ER_MEMORY, 0);
+ return -1;
}
header = _zip_buffer_data(ctx->buffer);
@@ -102,10 +107,10 @@ encrypt_header(zip_source_t *src, struct trad_pkware *ctx) {
/* generate header from random bytes and mtime
see appnote.iz, XIII. Decryption, Step 2, last paragraph */
if (!zip_secure_random(header, ZIP_CRYPTO_PKWARE_HEADERLEN - 1)) {
- zip_error_set(&ctx->error, ZIP_ER_INTERNAL, 0);
- _zip_buffer_free(ctx->buffer);
- ctx->buffer = NULL;
- return -1;
+ zip_error_set(&ctx->error, ZIP_ER_INTERNAL, 0);
+ _zip_buffer_free(ctx->buffer);
+ ctx->buffer = NULL;
+ return -1;
}
header[ZIP_CRYPTO_PKWARE_HEADERLEN - 1] = (zip_uint8_t)((dostime >> 8) & 0xff);
@@ -125,92 +130,94 @@ pkware_encrypt(zip_source_t *src, void *ud, void *data, zip_uint64_t length, zip
switch (cmd) {
case ZIP_SOURCE_OPEN:
- ctx->eof = false;
+ ctx->eof = false;
- /* initialize keys */
- _zip_pkware_keys_reset(&ctx->keys);
- _zip_pkware_encrypt(&ctx->keys, NULL, (const zip_uint8_t *)ctx->password, strlen(ctx->password));
+ /* initialize keys */
+ _zip_pkware_keys_reset(&ctx->keys);
+ _zip_pkware_encrypt(&ctx->keys, NULL, (const zip_uint8_t *)ctx->password, strlen(ctx->password));
- if (encrypt_header(src, ctx) < 0) {
- return -1;
- }
- return 0;
+ if (encrypt_header(src, ctx) < 0) {
+ return -1;
+ }
+ return 0;
case ZIP_SOURCE_READ:
- buffer_n = 0;
+ buffer_n = 0;
- if (ctx->buffer) {
- /* write header values to data */
- buffer_n = _zip_buffer_read(ctx->buffer, data, length);
- data = (zip_uint8_t *)data + buffer_n;
- length -= buffer_n;
+ if (ctx->buffer) {
+ /* write header values to data */
+ buffer_n = _zip_buffer_read(ctx->buffer, data, length);
+ data = (zip_uint8_t *)data + buffer_n;
+ length -= buffer_n;
- if (_zip_buffer_eof(ctx->buffer)) {
- _zip_buffer_free(ctx->buffer);
- ctx->buffer = NULL;
- }
- }
+ if (_zip_buffer_eof(ctx->buffer)) {
+ _zip_buffer_free(ctx->buffer);
+ ctx->buffer = NULL;
+ }
+ }
- if (ctx->eof) {
- return (zip_int64_t)buffer_n;
- }
+ if (ctx->eof) {
+ return (zip_int64_t)buffer_n;
+ }
- if ((n = zip_source_read(src, data, length)) < 0) {
- _zip_error_set_from_source(&ctx->error, src);
- return -1;
- }
+ if ((n = zip_source_read(src, data, length)) < 0) {
+ zip_error_set_from_source(&ctx->error, src);
+ return -1;
+ }
- _zip_pkware_encrypt(&ctx->keys, (zip_uint8_t *)data, (zip_uint8_t *)data, (zip_uint64_t)n);
+ _zip_pkware_encrypt(&ctx->keys, (zip_uint8_t *)data, (zip_uint8_t *)data, (zip_uint64_t)n);
- if ((zip_uint64_t)n < length) {
- ctx->eof = true;
- }
+ if ((zip_uint64_t)n < length) {
+ ctx->eof = true;
+ }
- return (zip_int64_t)buffer_n + n;
+ return (zip_int64_t)buffer_n + n;
case ZIP_SOURCE_CLOSE:
- _zip_buffer_free(ctx->buffer);
- ctx->buffer = NULL;
- return 0;
+ _zip_buffer_free(ctx->buffer);
+ ctx->buffer = NULL;
+ return 0;
case ZIP_SOURCE_STAT: {
- zip_stat_t *st;
-
- st = (zip_stat_t *)data;
- st->encryption_method = ZIP_EM_TRAD_PKWARE;
- st->valid |= ZIP_STAT_ENCRYPTION_METHOD;
- if (st->valid & ZIP_STAT_COMP_SIZE) {
- st->comp_size += ZIP_CRYPTO_PKWARE_HEADERLEN;
- }
-
- return 0;
+ zip_stat_t *st;
+
+ st = (zip_stat_t *)data;
+ st->encryption_method = ZIP_EM_TRAD_PKWARE;
+ st->valid |= ZIP_STAT_ENCRYPTION_METHOD;
+ if (st->valid & ZIP_STAT_COMP_SIZE) {
+ st->comp_size += ZIP_CRYPTO_PKWARE_HEADERLEN;
+ }
+ set_mtime(ctx, st);
+ st->mtime = ctx->mtime;
+ st->valid |= ZIP_STAT_MTIME;
+
+ return 0;
}
case ZIP_SOURCE_GET_FILE_ATTRIBUTES: {
- zip_file_attributes_t *attributes = (zip_file_attributes_t *)data;
- if (length < sizeof(*attributes)) {
- zip_error_set(&ctx->error, ZIP_ER_INVAL, 0);
- return -1;
- }
- attributes->valid |= ZIP_FILE_ATTRIBUTES_VERSION_NEEDED;
- attributes->version_needed = 20;
-
- return 0;
+ zip_file_attributes_t *attributes = (zip_file_attributes_t *)data;
+ if (length < sizeof(*attributes)) {
+ zip_error_set(&ctx->error, ZIP_ER_INVAL, 0);
+ return -1;
+ }
+ attributes->valid |= ZIP_FILE_ATTRIBUTES_VERSION_NEEDED;
+ attributes->version_needed = 20;
+
+ return 0;
}
case ZIP_SOURCE_SUPPORTS:
- return zip_source_make_command_bitmap(ZIP_SOURCE_OPEN, ZIP_SOURCE_READ, ZIP_SOURCE_CLOSE, ZIP_SOURCE_STAT, ZIP_SOURCE_ERROR, ZIP_SOURCE_FREE, ZIP_SOURCE_GET_FILE_ATTRIBUTES, -1);
+ return zip_source_make_command_bitmap(ZIP_SOURCE_OPEN, ZIP_SOURCE_READ, ZIP_SOURCE_CLOSE, ZIP_SOURCE_STAT, ZIP_SOURCE_ERROR, ZIP_SOURCE_FREE, ZIP_SOURCE_GET_FILE_ATTRIBUTES, -1);
case ZIP_SOURCE_ERROR:
- return zip_error_to_data(&ctx->error, data, length);
+ return zip_error_to_data(&ctx->error, data, length);
case ZIP_SOURCE_FREE:
- trad_pkware_free(ctx);
- return 0;
+ trad_pkware_free(ctx);
+ return 0;
default:
- zip_error_set(&ctx->error, ZIP_ER_INVAL, 0);
- return -1;
+ return zip_source_pass_to_lower_layer(src, data, length, cmd);
}
}
@@ -220,16 +227,18 @@ trad_pkware_new(const char *password, zip_error_t *error) {
struct trad_pkware *ctx;
if ((ctx = (struct trad_pkware *)malloc(sizeof(*ctx))) == NULL) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
}
if ((ctx->password = strdup(password)) == NULL) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- free(ctx);
- return NULL;
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ free(ctx);
+ return NULL;
}
ctx->buffer = NULL;
+ ctx->mtime_set = false;
+ ctx->mtime = 0;
zip_error_init(&ctx->error);
return ctx;
@@ -239,7 +248,7 @@ trad_pkware_new(const char *password, zip_error_t *error) {
static void
trad_pkware_free(struct trad_pkware *ctx) {
if (ctx == NULL) {
- return;
+ return;
}
free(ctx->password);
@@ -247,3 +256,16 @@ trad_pkware_free(struct trad_pkware *ctx) {
zip_error_fini(&ctx->error);
free(ctx);
}
+
+
+static void set_mtime(struct trad_pkware* ctx, zip_stat_t* st) {
+ if (!ctx->mtime_set) {
+ if (st->valid & ZIP_STAT_MTIME) {
+ ctx->mtime = st->mtime;
+ }
+ else {
+ time(&ctx->mtime);
+ }
+ ctx->mtime_set = true;
+ }
+}
diff --git a/src/Common/libzip/zip_source_read.c b/src/Common/libzip/zip_source_read.c
index 33088cb1..0938fcb0 100644
--- a/src/Common/libzip/zip_source_read.c
+++ b/src/Common/libzip/zip_source_read.c
@@ -1,9 +1,9 @@
/*
zip_source_read.c -- read data from zip_source
- Copyright (C) 2009-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -41,45 +41,51 @@ zip_source_read(zip_source_t *src, void *data, zip_uint64_t len) {
zip_int64_t n;
if (src->source_closed) {
- return -1;
+ return -1;
}
if (!ZIP_SOURCE_IS_OPEN_READING(src) || len > ZIP_INT64_MAX || (len > 0 && data == NULL)) {
- zip_error_set(&src->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&src->error, ZIP_ER_INVAL, 0);
+ return -1;
}
if (src->had_read_error) {
- return -1;
+ return -1;
}
if (_zip_source_eof(src)) {
- return 0;
+ return 0;
}
if (len == 0) {
- return 0;
+ return 0;
}
bytes_read = 0;
while (bytes_read < len) {
- if ((n = _zip_source_call(src, (zip_uint8_t *)data + bytes_read, len - bytes_read, ZIP_SOURCE_READ)) < 0) {
- src->had_read_error = true;
- if (bytes_read == 0) {
- return -1;
- }
- else {
- return (zip_int64_t)bytes_read;
- }
- }
-
- if (n == 0) {
- src->eof = 1;
- break;
- }
-
- bytes_read += (zip_uint64_t)n;
+ if ((n = _zip_source_call(src, (zip_uint8_t *)data + bytes_read, len - bytes_read, ZIP_SOURCE_READ)) < 0) {
+ src->had_read_error = true;
+ if (bytes_read == 0) {
+ return -1;
+ }
+ else {
+ return (zip_int64_t)bytes_read;
+ }
+ }
+
+ if (n == 0) {
+ src->eof = 1;
+ break;
+ }
+
+ bytes_read += (zip_uint64_t)n;
}
+ if (src->bytes_read + bytes_read < src->bytes_read) {
+ src->bytes_read = ZIP_UINT64_MAX;
+ }
+ else {
+ src->bytes_read += bytes_read;
+ }
return (zip_int64_t)bytes_read;
}
diff --git a/src/Common/libzip/zip_source_remove.c b/src/Common/libzip/zip_source_remove.c
index 14eddb8f..c1d73ab9 100644
--- a/src/Common/libzip/zip_source_remove.c
+++ b/src/Common/libzip/zip_source_remove.c
@@ -1,9 +1,9 @@
/*
zip_source_remove.c -- remove empty archive
- Copyright (C) 2014-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -37,21 +37,26 @@
int
zip_source_remove(zip_source_t *src) {
+ if (ZIP_SOURCE_IS_LAYERED(src)) {
+ zip_error_set(&src->error, ZIP_ER_OPNOTSUPP, 0);
+ return -1;
+ }
+
if (src->write_state == ZIP_SOURCE_WRITE_REMOVED) {
- return 0;
+ return 0;
}
if (ZIP_SOURCE_IS_OPEN_READING(src)) {
- if (zip_source_close(src) < 0) {
- return -1;
- }
+ if (zip_source_close(src) < 0) {
+ return -1;
+ }
}
if (src->write_state != ZIP_SOURCE_WRITE_CLOSED) {
- zip_source_rollback_write(src);
+ zip_source_rollback_write(src);
}
if (_zip_source_call(src, NULL, 0, ZIP_SOURCE_REMOVE) < 0) {
- return -1;
+ return -1;
}
src->write_state = ZIP_SOURCE_WRITE_REMOVED;
diff --git a/src/Common/libzip/zip_source_rollback_write.c b/src/Common/libzip/zip_source_rollback_write.c
index e8259bff..ea1a1510 100644
--- a/src/Common/libzip/zip_source_rollback_write.c
+++ b/src/Common/libzip/zip_source_rollback_write.c
@@ -1,9 +1,9 @@
/*
zip_source_rollback_write.c -- discard changes
- Copyright (C) 2014-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -37,8 +37,12 @@
ZIP_EXTERN void
zip_source_rollback_write(zip_source_t *src) {
+ if (ZIP_SOURCE_IS_LAYERED(src)) {
+ return;
+ }
+
if (src->write_state != ZIP_SOURCE_WRITE_OPEN && src->write_state != ZIP_SOURCE_WRITE_FAILED) {
- return;
+ return;
}
_zip_source_call(src, NULL, 0, ZIP_SOURCE_ROLLBACK_WRITE);
diff --git a/src/Common/libzip/zip_source_seek.c b/src/Common/libzip/zip_source_seek.c
index 163daf1b..e3baad5a 100644
--- a/src/Common/libzip/zip_source_seek.c
+++ b/src/Common/libzip/zip_source_seek.c
@@ -1,9 +1,9 @@
/*
zip_source_seek.c -- seek to offset
- Copyright (C) 2014-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -40,18 +40,18 @@ zip_source_seek(zip_source_t *src, zip_int64_t offset, int whence) {
zip_source_args_seek_t args;
if (src->source_closed) {
- return -1;
+ return -1;
}
if (!ZIP_SOURCE_IS_OPEN_READING(src) || (whence != SEEK_SET && whence != SEEK_CUR && whence != SEEK_END)) {
- zip_error_set(&src->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&src->error, ZIP_ER_INVAL, 0);
+ return -1;
}
args.offset = offset;
args.whence = whence;
if (_zip_source_call(src, &args, sizeof(args), ZIP_SOURCE_SEEK) < 0) {
- return -1;
+ return -1;
}
src->eof = 0;
@@ -65,30 +65,30 @@ zip_source_seek_compute_offset(zip_uint64_t offset, zip_uint64_t length, void *d
zip_source_args_seek_t *args = ZIP_SOURCE_GET_ARGS(zip_source_args_seek_t, data, data_length, error);
if (args == NULL) {
- return -1;
+ return -1;
}
switch (args->whence) {
case SEEK_CUR:
- new_offset = (zip_int64_t)offset + args->offset;
- break;
+ new_offset = (zip_int64_t)offset + args->offset;
+ break;
case SEEK_END:
- new_offset = (zip_int64_t)length + args->offset;
- break;
+ new_offset = (zip_int64_t)length + args->offset;
+ break;
case SEEK_SET:
- new_offset = args->offset;
- break;
+ new_offset = args->offset;
+ break;
default:
- zip_error_set(error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return -1;
}
if (new_offset < 0 || (zip_uint64_t)new_offset > length) {
- zip_error_set(error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return -1;
}
return new_offset;
diff --git a/src/Common/libzip/zip_source_seek_write.c b/src/Common/libzip/zip_source_seek_write.c
index 6b0aa78e..34ae2f5a 100644
--- a/src/Common/libzip/zip_source_seek_write.c
+++ b/src/Common/libzip/zip_source_seek_write.c
@@ -1,9 +1,9 @@
/*
zip_source_seek_write.c -- seek to offset for writing
- Copyright (C) 2014-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -39,9 +39,14 @@ ZIP_EXTERN int
zip_source_seek_write(zip_source_t *src, zip_int64_t offset, int whence) {
zip_source_args_seek_t args;
+ if (ZIP_SOURCE_IS_LAYERED(src)) {
+ zip_error_set(&src->error, ZIP_ER_OPNOTSUPP, 0);
+ return -1;
+ }
+
if (!ZIP_SOURCE_IS_OPEN_WRITING(src) || (whence != SEEK_SET && whence != SEEK_CUR && whence != SEEK_END)) {
- zip_error_set(&src->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&src->error, ZIP_ER_INVAL, 0);
+ return -1;
}
args.offset = offset;
diff --git a/src/Common/libzip/zip_source_stat.c b/src/Common/libzip/zip_source_stat.c
index 3421d2cb..05dcb84d 100644
--- a/src/Common/libzip/zip_source_stat.c
+++ b/src/Common/libzip/zip_source_stat.c
@@ -1,9 +1,9 @@
/*
zip_source_stat.c -- get meta information from zip_source
- Copyright (C) 2009-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -38,24 +38,28 @@
ZIP_EXTERN int
zip_source_stat(zip_source_t *src, zip_stat_t *st) {
if (src->source_closed) {
- return -1;
+ return -1;
}
if (st == NULL) {
- zip_error_set(&src->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&src->error, ZIP_ER_INVAL, 0);
+ return -1;
+ }
+
+ if (src->write_state == ZIP_SOURCE_WRITE_REMOVED) {
+ zip_error_set(&src->error, ZIP_ER_READ, ENOENT);
}
zip_stat_init(st);
if (ZIP_SOURCE_IS_LAYERED(src)) {
- if (zip_source_stat(src->src, st) < 0) {
- _zip_error_set_from_source(&src->error, src->src);
- return -1;
- }
+ if (zip_source_stat(src->src, st) < 0) {
+ zip_error_set_from_source(&src->error, src->src);
+ return -1;
+ }
}
if (_zip_source_call(src, st, sizeof(*st), ZIP_SOURCE_STAT) < 0) {
- return -1;
+ return -1;
}
return 0;
diff --git a/src/Common/libzip/zip_source_supports.c b/src/Common/libzip/zip_source_supports.c
index 84715598..8fea2ae9 100644
--- a/src/Common/libzip/zip_source_supports.c
+++ b/src/Common/libzip/zip_source_supports.c
@@ -1,9 +1,9 @@
/*
zip_source_supports.c -- check for supported functions
- Copyright (C) 2014-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -42,6 +42,10 @@ zip_source_supports(zip_source_t *src) {
return src->supports;
}
+bool
+zip_source_supports_reopen(zip_source_t *src) {
+ return (zip_source_supports(src) & ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_SUPPORTS_REOPEN)) != 0;
+}
ZIP_EXTERN zip_int64_t
zip_source_make_command_bitmap(zip_source_cmd_t cmd0, ...) {
@@ -53,13 +57,18 @@ zip_source_make_command_bitmap(zip_source_cmd_t cmd0, ...) {
va_start(ap, cmd0);
for (;;) {
- int cmd = va_arg(ap, int);
- if (cmd < 0) {
- break;
- }
- bitmap |= ZIP_SOURCE_MAKE_COMMAND_BITMASK(cmd);
+ int cmd = va_arg(ap, int);
+ if (cmd < 0) {
+ break;
+ }
+ bitmap |= ZIP_SOURCE_MAKE_COMMAND_BITMASK(cmd);
}
va_end(ap);
return bitmap;
}
+
+
+ZIP_EXTERN int zip_source_is_seekable(zip_source_t *src) {
+ return ZIP_SOURCE_CHECK_SUPPORTED(zip_source_supports(src->src), ZIP_SOURCE_SEEK);
+}
diff --git a/src/Common/libzip/zip_source_tell.c b/src/Common/libzip/zip_source_tell.c
index 772e2524..49057ce5 100644
--- a/src/Common/libzip/zip_source_tell.c
+++ b/src/Common/libzip/zip_source_tell.c
@@ -1,9 +1,9 @@
/*
zip_source_tell.c -- report current offset
- Copyright (C) 2014-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -38,11 +38,19 @@
ZIP_EXTERN zip_int64_t
zip_source_tell(zip_source_t *src) {
if (src->source_closed) {
- return -1;
+ return -1;
}
if (!ZIP_SOURCE_IS_OPEN_READING(src)) {
- zip_error_set(&src->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&src->error, ZIP_ER_INVAL, 0);
+ return -1;
+ }
+
+ if ((src->supports & (ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_TELL) | ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_SEEK))) == 0) {
+ if (src->bytes_read > ZIP_INT64_MAX) {
+ zip_error_set(&src->error, ZIP_ER_TELL, EOVERFLOW);
+ return -1;
+ }
+ return (zip_int64_t)src->bytes_read;
}
return _zip_source_call(src, NULL, 0, ZIP_SOURCE_TELL);
diff --git a/src/Common/libzip/zip_source_tell_write.c b/src/Common/libzip/zip_source_tell_write.c
index 96ad7e26..a5b0e531 100644
--- a/src/Common/libzip/zip_source_tell_write.c
+++ b/src/Common/libzip/zip_source_tell_write.c
@@ -1,9 +1,9 @@
/*
zip_source_tell_write.c -- report current offset for writing
- Copyright (C) 2014-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -37,9 +37,14 @@
ZIP_EXTERN zip_int64_t
zip_source_tell_write(zip_source_t *src) {
+ if (ZIP_SOURCE_IS_LAYERED(src)) {
+ zip_error_set(&src->error, ZIP_ER_OPNOTSUPP, 0);
+ return -1;
+ }
+
if (!ZIP_SOURCE_IS_OPEN_WRITING(src)) {
- zip_error_set(&src->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&src->error, ZIP_ER_INVAL, 0);
+ return -1;
}
return _zip_source_call(src, NULL, 0, ZIP_SOURCE_TELL_WRITE);
diff --git a/src/Common/libzip/zip_source_window.c b/src/Common/libzip/zip_source_window.c
index d996015d..524e27c8 100644
--- a/src/Common/libzip/zip_source_window.c
+++ b/src/Common/libzip/zip_source_window.c
@@ -1,9 +1,9 @@
/*
zip_source_window.c -- return part of lower source
- Copyright (C) 2012-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2012-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -40,6 +40,7 @@
struct window {
zip_uint64_t start; /* where in file we start reading */
zip_uint64_t end; /* where in file we stop reading */
+ bool end_valid; /* whether end is set, otherwise read until EOF */
/* if not NULL, read file data for this file */
zip_t *source_archive;
@@ -48,6 +49,7 @@ struct window {
zip_uint64_t offset; /* offset in src for next read */
zip_stat_t stat;
+ zip_uint64_t stat_invalid;
zip_file_attributes_t attributes;
zip_error_t error;
zip_int64_t supports;
@@ -57,49 +59,68 @@ struct window {
static zip_int64_t window_read(zip_source_t *, void *, void *, zip_uint64_t, zip_source_cmd_t);
-zip_source_t *
-zip_source_window(zip_t *za, zip_source_t *src, zip_uint64_t start, zip_uint64_t len) {
- return _zip_source_window_new(src, start, len, NULL, 0, NULL, 0, &za->error);
+ZIP_EXTERN zip_source_t *
+zip_source_window_create(zip_source_t *src, zip_uint64_t start, zip_int64_t len, zip_error_t *error) {
+ return _zip_source_window_new(src, start, len, NULL, 0, NULL, NULL, 0, false, error);
}
zip_source_t *
-_zip_source_window_new(zip_source_t *src, zip_uint64_t start, zip_uint64_t length, zip_stat_t *st, zip_file_attributes_t *attributes, zip_t *source_archive, zip_uint64_t source_index, zip_error_t *error) {
+_zip_source_window_new(zip_source_t *src, zip_uint64_t start, zip_int64_t length, zip_stat_t *st, zip_uint64_t st_invalid, zip_file_attributes_t *attributes, zip_t *source_archive, zip_uint64_t source_index, bool take_ownership, zip_error_t *error) {
+ zip_source_t* window_source;
struct window *ctx;
- if (src == NULL || start + length < start || (source_archive == NULL && source_index != 0)) {
- zip_error_set(error, ZIP_ER_INVAL, 0);
- return NULL;
+ if (src == NULL || length < -1 || (source_archive == NULL && source_index != 0)) {
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return NULL;
+ }
+
+ if (length >= 0) {
+ if (start + (zip_uint64_t)length < start) {
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return NULL;
+ }
}
if ((ctx = (struct window *)malloc(sizeof(*ctx))) == NULL) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
}
ctx->start = start;
- ctx->end = start + length;
+ if (length == -1) {
+ ctx->end_valid = false;
+ }
+ else {
+ ctx->end = start + (zip_uint64_t)length;
+ ctx->end_valid = true;
+ }
zip_stat_init(&ctx->stat);
+ ctx->stat_invalid = st_invalid;
if (attributes != NULL) {
- memcpy(&ctx->attributes, attributes, sizeof(ctx->attributes));
+ (void)memcpy_s(&ctx->attributes, sizeof(ctx->attributes), attributes, sizeof(ctx->attributes));
}
else {
- zip_file_attributes_init(&ctx->attributes);
+ zip_file_attributes_init(&ctx->attributes);
}
ctx->source_archive = source_archive;
ctx->source_index = source_index;
zip_error_init(&ctx->error);
- ctx->supports = (zip_source_supports(src) & ZIP_SOURCE_SUPPORTS_SEEKABLE) | (zip_source_make_command_bitmap(ZIP_SOURCE_GET_FILE_ATTRIBUTES, ZIP_SOURCE_SUPPORTS, ZIP_SOURCE_TELL, -1));
+ ctx->supports = (zip_source_supports(src) & (ZIP_SOURCE_SUPPORTS_SEEKABLE | ZIP_SOURCE_SUPPORTS_REOPEN)) | (zip_source_make_command_bitmap(ZIP_SOURCE_GET_FILE_ATTRIBUTES, ZIP_SOURCE_SUPPORTS, ZIP_SOURCE_TELL, ZIP_SOURCE_FREE, -1));
ctx->needs_seek = (ctx->supports & ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_SEEK)) ? true : false;
if (st) {
- if (_zip_stat_merge(&ctx->stat, st, error) < 0) {
- free(ctx);
- return NULL;
- }
+ if (_zip_stat_merge(&ctx->stat, st, error) < 0) {
+ free(ctx);
+ return NULL;
+ }
}
-
- return zip_source_layered_create(src, window_read, ctx, error);
+
+ window_source = zip_source_layered_create(src, window_read, ctx, error);
+ if (window_source != NULL && !take_ownership) {
+ zip_source_keep(src);
+ }
+ return window_source;
}
@@ -116,7 +137,7 @@ _zip_source_invalidate(zip_source_t *src) {
src->source_closed = 1;
if (zip_error_code_zip(&src->error) == ZIP_ER_OK) {
- zip_error_set(&src->error, ZIP_ER_ZIPCLOSED, 0);
+ zip_error_set(&src->error, ZIP_ER_ZIPCLOSED, 0);
}
}
@@ -131,129 +152,171 @@ window_read(zip_source_t *src, void *_ctx, void *data, zip_uint64_t len, zip_sou
switch (cmd) {
case ZIP_SOURCE_CLOSE:
- return 0;
+ return 0;
case ZIP_SOURCE_ERROR:
- return zip_error_to_data(&ctx->error, data, len);
+ return zip_error_to_data(&ctx->error, data, len);
case ZIP_SOURCE_FREE:
- free(ctx);
- return 0;
+ free(ctx);
+ return 0;
case ZIP_SOURCE_OPEN:
- if (ctx->source_archive) {
- zip_uint64_t offset;
-
- if ((offset = _zip_file_get_offset(ctx->source_archive, ctx->source_index, &ctx->error)) == 0) {
- return -1;
- }
- if (ctx->end + offset < ctx->end) {
- /* zip archive data claims end of data past zip64 limits */
- zip_error_set(&ctx->error, ZIP_ER_INCONS, 0);
- return -1;
- }
- ctx->start += offset;
- ctx->end += offset;
- ctx->source_archive = NULL;
- }
-
- if (!ctx->needs_seek) {
- DEFINE_BYTE_ARRAY(b, BUFSIZE);
-
- if (!byte_array_init(b, BUFSIZE)) {
- zip_error_set(&ctx->error, ZIP_ER_MEMORY, 0);
- return -1;
- }
-
- for (n = 0; n < ctx->start; n += (zip_uint64_t)ret) {
- i = (ctx->start - n > BUFSIZE ? BUFSIZE : ctx->start - n);
- if ((ret = zip_source_read(src, b, i)) < 0) {
- _zip_error_set_from_source(&ctx->error, src);
- byte_array_fini(b);
- return -1;
- }
- if (ret == 0) {
- zip_error_set(&ctx->error, ZIP_ER_EOF, 0);
- byte_array_fini(b);
- return -1;
- }
- }
-
- byte_array_fini(b);
- }
-
- ctx->offset = ctx->start;
- return 0;
+ if (ctx->source_archive) {
+ zip_uint64_t offset;
+
+ if ((offset = _zip_file_get_offset(ctx->source_archive, ctx->source_index, &ctx->error)) == 0) {
+ return -1;
+ }
+ if (ctx->end + offset < ctx->end) {
+ /* zip archive data claims end of data past zip64 limits */
+ zip_error_set(&ctx->error, ZIP_ER_INCONS, MAKE_DETAIL_WITH_INDEX(ZIP_ER_DETAIL_CDIR_ENTRY_INVALID, ctx->source_index));
+ return -1;
+ }
+ ctx->start += offset;
+ ctx->end += offset;
+ ctx->source_archive = NULL;
+ }
+
+ if (!ctx->needs_seek) {
+ DEFINE_BYTE_ARRAY(b, BUFSIZE);
+
+ if (!byte_array_init(b, BUFSIZE)) {
+ zip_error_set(&ctx->error, ZIP_ER_MEMORY, 0);
+ return -1;
+ }
+
+ for (n = 0; n < ctx->start; n += (zip_uint64_t)ret) {
+ i = (ctx->start - n > BUFSIZE ? BUFSIZE : ctx->start - n);
+ if ((ret = zip_source_read(src, b, i)) < 0) {
+ zip_error_set_from_source(&ctx->error, src);
+ byte_array_fini(b);
+ return -1;
+ }
+ if (ret == 0) {
+ zip_error_set(&ctx->error, ZIP_ER_EOF, 0);
+ byte_array_fini(b);
+ return -1;
+ }
+ }
+
+ byte_array_fini(b);
+ }
+
+ ctx->offset = ctx->start;
+ return 0;
case ZIP_SOURCE_READ:
- if (len > ctx->end - ctx->offset)
- len = ctx->end - ctx->offset;
-
- if (len == 0)
- return 0;
-
- if (ctx->needs_seek) {
- if (zip_source_seek(src, (zip_int64_t)ctx->offset, SEEK_SET) < 0) {
- _zip_error_set_from_source(&ctx->error, src);
- return -1;
- }
- }
-
- if ((ret = zip_source_read(src, data, len)) < 0) {
- zip_error_set(&ctx->error, ZIP_ER_EOF, 0);
- return -1;
- }
-
- ctx->offset += (zip_uint64_t)ret;
-
- if (ret == 0) {
- if (ctx->offset < ctx->end) {
- zip_error_set(&ctx->error, ZIP_ER_EOF, 0);
- return -1;
- }
- }
- return ret;
+ if (ctx->end_valid && len > ctx->end - ctx->offset) {
+ len = ctx->end - ctx->offset;
+ }
+
+ if (len == 0) {
+ return 0;
+ }
+
+ if (ctx->needs_seek) {
+ if (zip_source_seek(src, (zip_int64_t)ctx->offset, SEEK_SET) < 0) {
+ zip_error_set_from_source(&ctx->error, src);
+ return -1;
+ }
+ }
+
+ if ((ret = zip_source_read(src, data, len)) < 0) {
+ zip_error_set(&ctx->error, ZIP_ER_EOF, 0);
+ return -1;
+ }
+
+ ctx->offset += (zip_uint64_t)ret;
+
+ if (ret == 0) {
+ if (ctx->end_valid && ctx->offset < ctx->end) {
+ zip_error_set(&ctx->error, ZIP_ER_EOF, 0);
+ return -1;
+ }
+ }
+ return ret;
case ZIP_SOURCE_SEEK: {
- zip_int64_t new_offset = zip_source_seek_compute_offset(ctx->offset - ctx->start, ctx->end - ctx->start, data, len, &ctx->error);
-
- if (new_offset < 0) {
- return -1;
- }
-
- ctx->offset = (zip_uint64_t)new_offset + ctx->start;
- return 0;
+ zip_int64_t new_offset;
+
+ if (!ctx->end_valid) {
+ zip_source_args_seek_t *args = ZIP_SOURCE_GET_ARGS(zip_source_args_seek_t, data, len, &ctx->error);
+
+ if (args == NULL) {
+ return -1;
+ }
+ if (args->whence == SEEK_END) {
+ if (zip_source_seek(src, args->offset, args->whence) < 0) {
+ zip_error_set_from_source(&ctx->error, src);
+ return -1;
+ }
+ new_offset = zip_source_tell(src);
+ if (new_offset < 0) {
+ zip_error_set_from_source(&ctx->error, src);
+ return -1;
+ }
+ if ((zip_uint64_t)new_offset < ctx->start) {
+ zip_error_set(&ctx->error, ZIP_ER_INVAL, 0);
+ (void)zip_source_seek(src, (zip_int64_t)ctx->offset, SEEK_SET);
+ return -1;
+ }
+ ctx->offset = (zip_uint64_t)new_offset;
+ return 0;
+ }
+ }
+
+ new_offset = zip_source_seek_compute_offset(ctx->offset - ctx->start, ctx->end - ctx->start, data, len, &ctx->error);
+
+ if (new_offset < 0) {
+ return -1;
+ }
+
+ ctx->offset = (zip_uint64_t)new_offset + ctx->start;
+ return 0;
}
case ZIP_SOURCE_STAT: {
- zip_stat_t *st;
+ zip_stat_t *st;
+
+ st = (zip_stat_t *)data;
+
+ if (_zip_stat_merge(st, &ctx->stat, &ctx->error) < 0) {
+ return -1;
+ }
+
+ if (!(ctx->stat.valid & ZIP_STAT_SIZE)) {
+ if (ctx->end_valid) {
+ st->valid |= ZIP_STAT_SIZE;
+ st->size = ctx->end - ctx->start;
+ }
+ else if (st->valid & ZIP_STAT_SIZE) {
+ st->size -= ctx->start;
+ }
+ }
- st = (zip_stat_t *)data;
+ st->valid &= ~ctx->stat_invalid;
- if (_zip_stat_merge(st, &ctx->stat, &ctx->error) < 0) {
- return -1;
- }
- return 0;
+ return 0;
}
case ZIP_SOURCE_GET_FILE_ATTRIBUTES:
- if (len < sizeof(ctx->attributes)) {
- zip_error_set(&ctx->error, ZIP_ER_INVAL, 0);
- return -1;
- }
+ if (len < sizeof(ctx->attributes)) {
+ zip_error_set(&ctx->error, ZIP_ER_INVAL, 0);
+ return -1;
+ }
- memcpy(data, &ctx->attributes, sizeof(ctx->attributes));
- return sizeof(ctx->attributes);
+ (void)memcpy_s(data, sizeof(ctx->attributes), &ctx->attributes, sizeof(ctx->attributes));
+ return sizeof(ctx->attributes);
case ZIP_SOURCE_SUPPORTS:
- return ctx->supports;
+ return ctx->supports;
case ZIP_SOURCE_TELL:
- return (zip_int64_t)(ctx->offset - ctx->start);
+ return (zip_int64_t)(ctx->offset - ctx->start);
default:
- zip_error_set(&ctx->error, ZIP_ER_OPNOTSUPP, 0);
- return -1;
+ return zip_source_pass_to_lower_layer(src, data, len, cmd);
}
}
@@ -263,11 +326,11 @@ _zip_deregister_source(zip_t *za, zip_source_t *src) {
unsigned int i;
for (i = 0; i < za->nopen_source; i++) {
- if (za->open_source[i] == src) {
- za->open_source[i] = za->open_source[za->nopen_source - 1];
- za->nopen_source--;
- break;
- }
+ if (za->open_source[i] == src) {
+ za->open_source[i] = za->open_source[za->nopen_source - 1];
+ za->nopen_source--;
+ break;
+ }
}
}
@@ -277,15 +340,15 @@ _zip_register_source(zip_t *za, zip_source_t *src) {
zip_source_t **open_source;
if (za->nopen_source + 1 >= za->nopen_source_alloc) {
- unsigned int n;
- n = za->nopen_source_alloc + 10;
- open_source = (zip_source_t **)realloc(za->open_source, n * sizeof(zip_source_t *));
- if (open_source == NULL) {
- zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
- return -1;
- }
- za->nopen_source_alloc = n;
- za->open_source = open_source;
+ unsigned int n;
+ n = za->nopen_source_alloc + 10;
+ open_source = (zip_source_t **)realloc(za->open_source, n * sizeof(zip_source_t *));
+ if (open_source == NULL) {
+ zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
+ return -1;
+ }
+ za->nopen_source_alloc = n;
+ za->open_source = open_source;
}
za->open_source[za->nopen_source++] = src;
diff --git a/src/Common/libzip/zip_source_winzip_aes_decode.c b/src/Common/libzip/zip_source_winzip_aes_decode.c
new file mode 100644
index 00000000..ee53fb41
--- /dev/null
+++ b/src/Common/libzip/zip_source_winzip_aes_decode.c
@@ -0,0 +1,265 @@
+/*
+ zip_source_winzip_aes_decode.c -- Winzip AES decryption routines
+ Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner
+
+ This file is part of libzip, a library to manipulate ZIP archives.
+ The authors can be contacted at <info@libzip.org>
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ 3. The names of the authors may not be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "zipint.h"
+#include "zip_crypto.h"
+
+struct winzip_aes {
+ char *password;
+ zip_uint16_t encryption_method;
+
+ zip_uint64_t data_length;
+ zip_uint64_t current_position;
+
+ zip_winzip_aes_t *aes_ctx;
+ zip_error_t error;
+};
+
+
+static int decrypt_header(zip_source_t *src, struct winzip_aes *ctx);
+static void winzip_aes_free(struct winzip_aes *);
+static zip_int64_t winzip_aes_decrypt(zip_source_t *src, void *ud, void *data, zip_uint64_t len, zip_source_cmd_t cmd);
+static struct winzip_aes *winzip_aes_new(zip_uint16_t encryption_method, const char *password, zip_error_t *error);
+
+
+zip_source_t *
+zip_source_winzip_aes_decode(zip_t *za, zip_source_t *src, zip_uint16_t encryption_method, int flags, const char *password) {
+ zip_source_t *s2;
+ zip_stat_t st;
+ zip_uint64_t aux_length;
+ struct winzip_aes *ctx;
+
+ if ((encryption_method != ZIP_EM_AES_128 && encryption_method != ZIP_EM_AES_192 && encryption_method != ZIP_EM_AES_256) || password == NULL || src == NULL) {
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return NULL;
+ }
+ if (flags & ZIP_CODEC_ENCODE) {
+ zip_error_set(&za->error, ZIP_ER_ENCRNOTSUPP, 0);
+ return NULL;
+ }
+
+ if (zip_source_stat(src, &st) != 0) {
+ zip_error_set_from_source(&za->error, src);
+ return NULL;
+ }
+
+ aux_length = WINZIP_AES_PASSWORD_VERIFY_LENGTH + SALT_LENGTH(encryption_method) + HMAC_LENGTH;
+
+ if ((st.valid & ZIP_STAT_COMP_SIZE) == 0 || st.comp_size < aux_length) {
+ zip_error_set(&za->error, ZIP_ER_OPNOTSUPP, 0);
+ return NULL;
+ }
+
+ if ((ctx = winzip_aes_new(encryption_method, password, &za->error)) == NULL) {
+ return NULL;
+ }
+
+ ctx->data_length = st.comp_size - aux_length;
+
+ if ((s2 = zip_source_layered(za, src, winzip_aes_decrypt, ctx)) == NULL) {
+ winzip_aes_free(ctx);
+ return NULL;
+ }
+
+ return s2;
+}
+
+
+static int
+decrypt_header(zip_source_t *src, struct winzip_aes *ctx) {
+ zip_uint8_t header[WINZIP_AES_MAX_HEADER_LENGTH];
+ zip_uint8_t password_verification[WINZIP_AES_PASSWORD_VERIFY_LENGTH];
+ unsigned int headerlen;
+ zip_int64_t n;
+
+ headerlen = WINZIP_AES_PASSWORD_VERIFY_LENGTH + SALT_LENGTH(ctx->encryption_method);
+ if ((n = zip_source_read(src, header, headerlen)) < 0) {
+ zip_error_set_from_source(&ctx->error, src);
+ return -1;
+ }
+
+ if (n != headerlen) {
+ zip_error_set(&ctx->error, ZIP_ER_EOF, 0);
+ return -1;
+ }
+
+ if ((ctx->aes_ctx = _zip_winzip_aes_new((zip_uint8_t *)ctx->password, strlen(ctx->password), header, ctx->encryption_method, password_verification, &ctx->error)) == NULL) {
+ return -1;
+ }
+ if (memcmp(password_verification, header + SALT_LENGTH(ctx->encryption_method), WINZIP_AES_PASSWORD_VERIFY_LENGTH) != 0) {
+ _zip_winzip_aes_free(ctx->aes_ctx);
+ ctx->aes_ctx = NULL;
+ zip_error_set(&ctx->error, ZIP_ER_WRONGPASSWD, 0);
+ return -1;
+ }
+ return 0;
+}
+
+
+static bool
+verify_hmac(zip_source_t *src, struct winzip_aes *ctx) {
+ unsigned char computed[ZIP_CRYPTO_SHA1_LENGTH], from_file[HMAC_LENGTH];
+ if (zip_source_read(src, from_file, HMAC_LENGTH) < HMAC_LENGTH) {
+ zip_error_set_from_source(&ctx->error, src);
+ return false;
+ }
+
+ if (!_zip_winzip_aes_finish(ctx->aes_ctx, computed)) {
+ zip_error_set(&ctx->error, ZIP_ER_INTERNAL, 0);
+ return false;
+ }
+ _zip_winzip_aes_free(ctx->aes_ctx);
+ ctx->aes_ctx = NULL;
+
+ if (memcmp(from_file, computed, HMAC_LENGTH) != 0) {
+ zip_error_set(&ctx->error, ZIP_ER_CRC, 0);
+ return false;
+ }
+
+ return true;
+}
+
+
+static zip_int64_t
+winzip_aes_decrypt(zip_source_t *src, void *ud, void *data, zip_uint64_t len, zip_source_cmd_t cmd) {
+ struct winzip_aes *ctx;
+ zip_int64_t n;
+
+ ctx = (struct winzip_aes *)ud;
+
+ switch (cmd) {
+ case ZIP_SOURCE_OPEN:
+ if (decrypt_header(src, ctx) < 0) {
+ return -1;
+ }
+ ctx->current_position = 0;
+ return 0;
+
+ case ZIP_SOURCE_READ:
+ if (len > ctx->data_length - ctx->current_position) {
+ len = ctx->data_length - ctx->current_position;
+ }
+
+ if (len == 0) {
+ if (!verify_hmac(src, ctx)) {
+ return -1;
+ }
+ return 0;
+ }
+
+ if ((n = zip_source_read(src, data, len)) < 0) {
+ zip_error_set_from_source(&ctx->error, src);
+ return -1;
+ }
+ ctx->current_position += (zip_uint64_t)n;
+
+ if (!_zip_winzip_aes_decrypt(ctx->aes_ctx, (zip_uint8_t *)data, (zip_uint64_t)n)) {
+ zip_error_set(&ctx->error, ZIP_ER_INTERNAL, 0);
+ return -1;
+ }
+
+ return n;
+
+ case ZIP_SOURCE_CLOSE:
+ return 0;
+
+ case ZIP_SOURCE_STAT: {
+ zip_stat_t *st;
+
+ st = (zip_stat_t *)data;
+
+ st->encryption_method = ZIP_EM_NONE;
+ st->valid |= ZIP_STAT_ENCRYPTION_METHOD;
+ if (st->valid & ZIP_STAT_COMP_SIZE) {
+ st->comp_size -= 12 + SALT_LENGTH(ctx->encryption_method);
+ }
+
+ return 0;
+ }
+
+ case ZIP_SOURCE_SUPPORTS:
+ return zip_source_make_command_bitmap(ZIP_SOURCE_OPEN, ZIP_SOURCE_READ, ZIP_SOURCE_CLOSE, ZIP_SOURCE_STAT, ZIP_SOURCE_ERROR, ZIP_SOURCE_FREE, ZIP_SOURCE_SUPPORTS_REOPEN, -1);
+
+ case ZIP_SOURCE_ERROR:
+ return zip_error_to_data(&ctx->error, data, len);
+
+ case ZIP_SOURCE_FREE:
+ winzip_aes_free(ctx);
+ return 0;
+
+ default:
+ return zip_source_pass_to_lower_layer(src, data, len, cmd);
+ }
+}
+
+
+static void
+winzip_aes_free(struct winzip_aes *ctx) {
+ if (ctx == NULL) {
+ return;
+ }
+
+ _zip_crypto_clear(ctx->password, strlen(ctx->password));
+ free(ctx->password);
+ zip_error_fini(&ctx->error);
+ _zip_winzip_aes_free(ctx->aes_ctx);
+ free(ctx);
+}
+
+
+static struct winzip_aes *
+winzip_aes_new(zip_uint16_t encryption_method, const char *password, zip_error_t *error) {
+ struct winzip_aes *ctx;
+
+ if ((ctx = (struct winzip_aes *)malloc(sizeof(*ctx))) == NULL) {
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
+ }
+
+ if ((ctx->password = strdup(password)) == NULL) {
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ free(ctx);
+ return NULL;
+ }
+
+ ctx->encryption_method = encryption_method;
+ ctx->aes_ctx = NULL;
+
+ zip_error_init(&ctx->error);
+
+ return ctx;
+}
diff --git a/src/Common/libzip/zip_source_winzip_aes_encode.c b/src/Common/libzip/zip_source_winzip_aes_encode.c
new file mode 100644
index 00000000..87e2865a
--- /dev/null
+++ b/src/Common/libzip/zip_source_winzip_aes_encode.c
@@ -0,0 +1,253 @@
+/*
+ zip_source_winzip_aes_encode.c -- Winzip AES encryption routines
+ Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner
+
+ This file is part of libzip, a library to manipulate ZIP archives.
+ The authors can be contacted at <info@libzip.org>
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ 3. The names of the authors may not be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "zipint.h"
+#include "zip_crypto.h"
+
+struct winzip_aes {
+ char *password;
+ zip_uint16_t encryption_method;
+
+ zip_uint8_t data[ZIP_MAX(WINZIP_AES_MAX_HEADER_LENGTH, ZIP_CRYPTO_SHA1_LENGTH)];
+ zip_buffer_t *buffer;
+
+ zip_winzip_aes_t *aes_ctx;
+ bool eof;
+ zip_error_t error;
+};
+
+
+static int encrypt_header(zip_source_t *src, struct winzip_aes *ctx);
+static void winzip_aes_free(struct winzip_aes *);
+static zip_int64_t winzip_aes_encrypt(zip_source_t *src, void *ud, void *data, zip_uint64_t len, zip_source_cmd_t cmd);
+static struct winzip_aes *winzip_aes_new(zip_uint16_t encryption_method, const char *password, zip_error_t *error);
+
+
+zip_source_t *
+zip_source_winzip_aes_encode(zip_t *za, zip_source_t *src, zip_uint16_t encryption_method, int flags, const char *password) {
+ zip_source_t *s2;
+ struct winzip_aes *ctx;
+
+ if ((encryption_method != ZIP_EM_AES_128 && encryption_method != ZIP_EM_AES_192 && encryption_method != ZIP_EM_AES_256) || password == NULL || src == NULL) {
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return NULL;
+ }
+
+ if ((ctx = winzip_aes_new(encryption_method, password, &za->error)) == NULL) {
+ return NULL;
+ }
+
+ if ((s2 = zip_source_layered(za, src, winzip_aes_encrypt, ctx)) == NULL) {
+ winzip_aes_free(ctx);
+ return NULL;
+ }
+
+ return s2;
+}
+
+
+static int
+encrypt_header(zip_source_t *src, struct winzip_aes *ctx) {
+ zip_uint16_t salt_length = SALT_LENGTH(ctx->encryption_method);
+ if (!zip_secure_random(ctx->data, salt_length)) {
+ zip_error_set(&ctx->error, ZIP_ER_INTERNAL, 0);
+ return -1;
+ }
+
+ if ((ctx->aes_ctx = _zip_winzip_aes_new((zip_uint8_t *)ctx->password, strlen(ctx->password), ctx->data, ctx->encryption_method, ctx->data + salt_length, &ctx->error)) == NULL) {
+ return -1;
+ }
+
+ if ((ctx->buffer = _zip_buffer_new(ctx->data, salt_length + WINZIP_AES_PASSWORD_VERIFY_LENGTH)) == NULL) {
+ _zip_winzip_aes_free(ctx->aes_ctx);
+ ctx->aes_ctx = NULL;
+ zip_error_set(&ctx->error, ZIP_ER_MEMORY, 0);
+ return -1;
+ }
+
+ return 0;
+}
+
+
+static zip_int64_t
+winzip_aes_encrypt(zip_source_t *src, void *ud, void *data, zip_uint64_t length, zip_source_cmd_t cmd) {
+ struct winzip_aes *ctx;
+ zip_int64_t ret;
+ zip_uint64_t buffer_n;
+
+ ctx = (struct winzip_aes *)ud;
+
+ switch (cmd) {
+ case ZIP_SOURCE_OPEN:
+ ctx->eof = false;
+ if (encrypt_header(src, ctx) < 0) {
+ return -1;
+ }
+ return 0;
+
+ case ZIP_SOURCE_READ:
+ buffer_n = 0;
+
+ if (ctx->buffer) {
+ buffer_n = _zip_buffer_read(ctx->buffer, data, length);
+
+ data = (zip_uint8_t *)data + buffer_n;
+ length -= buffer_n;
+
+ if (_zip_buffer_eof(ctx->buffer)) {
+ _zip_buffer_free(ctx->buffer);
+ ctx->buffer = NULL;
+ }
+ }
+
+ if (ctx->eof) {
+ return (zip_int64_t)buffer_n;
+ }
+
+ if ((ret = zip_source_read(src, data, length)) < 0) {
+ zip_error_set_from_source(&ctx->error, src);
+ return -1;
+ }
+
+ if (!_zip_winzip_aes_encrypt(ctx->aes_ctx, data, (zip_uint64_t)ret)) {
+ zip_error_set(&ctx->error, ZIP_ER_INTERNAL, 0);
+ /* TODO: return partial read? */
+ return -1;
+ }
+
+ if ((zip_uint64_t)ret < length) {
+ ctx->eof = true;
+ if (!_zip_winzip_aes_finish(ctx->aes_ctx, ctx->data)) {
+ zip_error_set(&ctx->error, ZIP_ER_INTERNAL, 0);
+ /* TODO: return partial read? */
+ return -1;
+ }
+ _zip_winzip_aes_free(ctx->aes_ctx);
+ ctx->aes_ctx = NULL;
+ if ((ctx->buffer = _zip_buffer_new(ctx->data, HMAC_LENGTH)) == NULL) {
+ zip_error_set(&ctx->error, ZIP_ER_MEMORY, 0);
+ /* TODO: return partial read? */
+ return -1;
+ }
+ buffer_n += _zip_buffer_read(ctx->buffer, (zip_uint8_t *)data + ret, length - (zip_uint64_t)ret);
+ }
+
+ return (zip_int64_t)(buffer_n + (zip_uint64_t)ret);
+
+ case ZIP_SOURCE_CLOSE:
+ return 0;
+
+ case ZIP_SOURCE_STAT: {
+ zip_stat_t *st;
+
+ st = (zip_stat_t *)data;
+ st->encryption_method = ctx->encryption_method;
+ st->valid |= ZIP_STAT_ENCRYPTION_METHOD;
+ if (st->valid & ZIP_STAT_COMP_SIZE) {
+ st->comp_size += 12 + SALT_LENGTH(ctx->encryption_method);
+ }
+
+ return 0;
+ }
+
+ case ZIP_SOURCE_GET_FILE_ATTRIBUTES: {
+ zip_file_attributes_t *attributes = (zip_file_attributes_t *)data;
+ if (length < sizeof(*attributes)) {
+ zip_error_set(&ctx->error, ZIP_ER_INVAL, 0);
+ return -1;
+ }
+ attributes->valid |= ZIP_FILE_ATTRIBUTES_VERSION_NEEDED;
+ attributes->version_needed = 51;
+
+ return 0;
+ }
+
+ case ZIP_SOURCE_SUPPORTS:
+ return zip_source_make_command_bitmap(ZIP_SOURCE_OPEN, ZIP_SOURCE_READ, ZIP_SOURCE_CLOSE, ZIP_SOURCE_STAT, ZIP_SOURCE_ERROR, ZIP_SOURCE_FREE, ZIP_SOURCE_GET_FILE_ATTRIBUTES, -1);
+
+ case ZIP_SOURCE_ERROR:
+ return zip_error_to_data(&ctx->error, data, length);
+
+ case ZIP_SOURCE_FREE:
+ winzip_aes_free(ctx);
+ return 0;
+
+ default:
+ return zip_source_pass_to_lower_layer(src, data, length, cmd);
+ }
+}
+
+
+static void
+winzip_aes_free(struct winzip_aes *ctx) {
+ if (ctx == NULL) {
+ return;
+ }
+
+ _zip_crypto_clear(ctx->password, strlen(ctx->password));
+ free(ctx->password);
+ zip_error_fini(&ctx->error);
+ _zip_buffer_free(ctx->buffer);
+ _zip_winzip_aes_free(ctx->aes_ctx);
+ free(ctx);
+}
+
+
+static struct winzip_aes *
+winzip_aes_new(zip_uint16_t encryption_method, const char *password, zip_error_t *error) {
+ struct winzip_aes *ctx;
+
+ if ((ctx = (struct winzip_aes *)malloc(sizeof(*ctx))) == NULL) {
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
+ }
+
+ if ((ctx->password = strdup(password)) == NULL) {
+ free(ctx);
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
+ }
+
+ ctx->encryption_method = encryption_method;
+ ctx->buffer = NULL;
+ ctx->aes_ctx = NULL;
+
+ zip_error_init(&ctx->error);
+
+ ctx->eof = false;
+ return ctx;
+}
diff --git a/src/Common/libzip/zip_source_write.c b/src/Common/libzip/zip_source_write.c
index 73fc3a31..24dde9b2 100644
--- a/src/Common/libzip/zip_source_write.c
+++ b/src/Common/libzip/zip_source_write.c
@@ -1,9 +1,9 @@
/*
zip_source_write.c -- start a new file for writing
- Copyright (C) 2014-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -38,8 +38,8 @@
ZIP_EXTERN zip_int64_t
zip_source_write(zip_source_t *src, const void *data, zip_uint64_t length) {
if (!ZIP_SOURCE_IS_OPEN_WRITING(src) || length > ZIP_INT64_MAX) {
- zip_error_set(&src->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&src->error, ZIP_ER_INVAL, 0);
+ return -1;
}
return _zip_source_call(src, (void *)data, length, ZIP_SOURCE_WRITE);
diff --git a/src/Common/libzip/zip_source_zip.c b/src/Common/libzip/zip_source_zip.c
index 8a7feaa4..faabf0d2 100644
--- a/src/Common/libzip/zip_source_zip.c
+++ b/src/Common/libzip/zip_source_zip.c
@@ -1,9 +1,9 @@
/*
zip_source_zip.c -- create data source from zip file
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -34,23 +34,30 @@
#include <stdlib.h>
+#define _ZIP_COMPILING_DEPRECATED
#include "zipint.h"
-
-ZIP_EXTERN zip_source_t *
-zip_source_zip(zip_t *za, zip_t *srcza, zip_uint64_t srcidx, zip_flags_t flags, zip_uint64_t start, zip_int64_t len) {
+ZIP_EXTERN zip_source_t *zip_source_zip_create(zip_t *srcza, zip_uint64_t srcidx, zip_flags_t flags, zip_uint64_t start, zip_int64_t len, zip_error_t *error) {
if (len < -1) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return NULL;
+ }
+
+ if (len == 0) {
+ len = -1;
+ }
+
+ if (start == 0 && len == -1) {
+ flags |= ZIP_FL_COMPRESSED;
+ }
+ else {
+ flags &= ~ZIP_FL_COMPRESSED;
}
- if (len == -1)
- len = 0;
+ return zip_source_zip_file_create(srcza, srcidx, flags, start, len, NULL, error);
+}
- if (start == 0 && len == 0)
- flags |= ZIP_FL_COMPRESSED;
- else
- flags &= ~ZIP_FL_COMPRESSED;
- return _zip_source_zip_new(za, srcza, srcidx, flags, start, (zip_uint64_t)len, NULL);
+ZIP_EXTERN zip_source_t *zip_source_zip(zip_t *za, zip_t *srcza, zip_uint64_t srcidx, zip_flags_t flags, zip_uint64_t start, zip_int64_t len) {
+ return zip_source_zip_create(srcza, srcidx, flags, start, len, &za->error);
}
diff --git a/src/Common/libzip/zip_source_zip_new.c b/src/Common/libzip/zip_source_zip_new.c
index 6d547f0e..ecccdd68 100644
--- a/src/Common/libzip/zip_source_zip_new.c
+++ b/src/Common/libzip/zip_source_zip_new.c
@@ -1,9 +1,9 @@
/*
zip_source_zip_new.c -- prepare data structures for zip_fopen/zip_source_zip
- Copyright (C) 2012-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2012-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -38,142 +38,263 @@
static void _zip_file_attributes_from_dirent(zip_file_attributes_t *attributes, zip_dirent_t *de);
-zip_source_t *
-_zip_source_zip_new(zip_t *za, zip_t *srcza, zip_uint64_t srcidx, zip_flags_t flags, zip_uint64_t start, zip_uint64_t len, const char *password) {
+ZIP_EXTERN zip_source_t *zip_source_zip_file(zip_t* za, zip_t *srcza, zip_uint64_t srcidx, zip_flags_t flags, zip_uint64_t start, zip_int64_t len, const char *password) {
+ return zip_source_zip_file_create(srcza, srcidx, flags, start, len, password, &za->error);
+}
+
+
+ZIP_EXTERN zip_source_t *zip_source_zip_file_create(zip_t *srcza, zip_uint64_t srcidx, zip_flags_t flags, zip_uint64_t start, zip_int64_t len, const char *password, zip_error_t *error) {
+ /* TODO: We need to make sure that the returned source is invalidated when srcza is closed. */
zip_source_t *src, *s2;
zip_stat_t st;
zip_file_attributes_t attributes;
zip_dirent_t *de;
- bool partial_data, needs_crc, needs_decrypt, needs_decompress;
+ bool partial_data, needs_crc, encrypted, needs_decrypt, compressed, needs_decompress, changed_data, have_size, have_comp_size;
+ zip_flags_t stat_flags;
+ zip_int64_t data_len;
+ bool take_ownership = false;
+ bool empty_data = false;
- if (za == NULL) {
- return NULL;
+ if (srcza == NULL || srcidx >= srcza->nentry || len < -1) {
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return NULL;
}
- if (srcza == NULL || srcidx >= srcza->nentry) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return NULL;
+ if (flags & ZIP_FL_ENCRYPTED) {
+ flags |= ZIP_FL_COMPRESSED;
}
- if ((flags & ZIP_FL_UNCHANGED) == 0 && (ZIP_ENTRY_DATA_CHANGED(srcza->entry + srcidx) || srcza->entry[srcidx].deleted)) {
- zip_error_set(&za->error, ZIP_ER_CHANGED, 0);
- return NULL;
+ changed_data = false;
+ if ((flags & ZIP_FL_UNCHANGED) == 0) {
+ zip_entry_t *entry = srcza->entry + srcidx;
+ if (ZIP_ENTRY_DATA_CHANGED(entry)) {
+ if ((flags & ZIP_FL_COMPRESSED) || !zip_source_supports_reopen(entry->source)) {
+ zip_error_set(error, ZIP_ER_CHANGED, 0);
+ return NULL;
+ }
+
+ changed_data = true;
+ }
+ else if (entry->deleted) {
+ zip_error_set(error, ZIP_ER_CHANGED, 0);
+ return NULL;
+ }
}
- if (zip_stat_index(srcza, srcidx, flags | ZIP_FL_UNCHANGED, &st) < 0) {
- zip_error_set(&za->error, ZIP_ER_INTERNAL, 0);
- return NULL;
+ stat_flags = flags;
+ if (!changed_data) {
+ stat_flags |= ZIP_FL_UNCHANGED;
}
- if (flags & ZIP_FL_ENCRYPTED) {
- flags |= ZIP_FL_COMPRESSED;
+ if (zip_stat_index(srcza, srcidx, stat_flags, &st) < 0) {
+ zip_error_set(error, ZIP_ER_INTERNAL, 0);
+ return NULL;
}
- if ((start > 0 || len > 0) && (flags & ZIP_FL_COMPRESSED)) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return NULL;
+ if ((start > 0 || len >= 0) && (flags & ZIP_FL_COMPRESSED)) {
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return NULL;
}
+ have_size = (st.valid & ZIP_STAT_SIZE) != 0;
/* overflow or past end of file */
- if ((start > 0 || len > 0) && (start + len < start || start + len > st.size)) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return NULL;
+ if (len >= 0 && ((start > 0 && start + len < start) || (have_size && start + len > st.size))) {
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return NULL;
}
- if (len == 0) {
- len = st.size - start;
+ if (len == -1) {
+ if (have_size) {
+ if (st.size - start > ZIP_INT64_MAX) {
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return NULL;
+ }
+ data_len = (zip_int64_t)(st.size - start);
+ }
+ else {
+ data_len = -1;
+ }
+ }
+ else {
+ data_len = len;
}
- partial_data = len < st.size;
- needs_decrypt = ((flags & ZIP_FL_ENCRYPTED) == 0) && (st.encryption_method != ZIP_EM_NONE);
- needs_decompress = ((flags & ZIP_FL_COMPRESSED) == 0) && (st.comp_method != ZIP_CM_STORE);
+ if (have_size) {
+ partial_data = (zip_uint64_t)(data_len) < st.size;
+ }
+ else {
+ partial_data = true;
+ }
+ encrypted = (st.valid & ZIP_STAT_ENCRYPTION_METHOD) && (st.encryption_method != ZIP_EM_NONE);
+ needs_decrypt = ((flags & ZIP_FL_ENCRYPTED) == 0) && encrypted;
+ compressed = (st.valid & ZIP_STAT_COMP_METHOD) && (st.comp_method != ZIP_CM_STORE);
+ needs_decompress = ((flags & ZIP_FL_COMPRESSED) == 0) && compressed;
/* when reading the whole file, check for CRC errors */
- needs_crc = ((flags & ZIP_FL_COMPRESSED) == 0 || st.comp_method == ZIP_CM_STORE) && !partial_data;
+ needs_crc = ((flags & ZIP_FL_COMPRESSED) == 0 || !compressed) && !partial_data && (st.valid & ZIP_STAT_CRC) != 0;
if (needs_decrypt) {
- if (password == NULL) {
- password = za->default_password;
- }
- if (password == NULL) {
- zip_error_set(&za->error, ZIP_ER_NOPASSWD, 0);
- return NULL;
- }
+ if (password == NULL) {
+ password = srcza->default_password;
+ }
+ if (password == NULL) {
+ zip_error_set(error, ZIP_ER_NOPASSWD, 0);
+ return NULL;
+ }
}
- if ((de = _zip_get_dirent(srcza, srcidx, flags, &za->error)) == NULL) {
- return NULL;
+ if ((de = _zip_get_dirent(srcza, srcidx, flags, error)) == NULL) {
+ return NULL;
}
_zip_file_attributes_from_dirent(&attributes, de);
- if (st.comp_size == 0) {
- return zip_source_buffer_with_attributes(za, NULL, 0, 0, &attributes);
+ have_comp_size = (st.valid & ZIP_STAT_COMP_SIZE) != 0;
+ if (needs_decrypt || needs_decompress) {
+ empty_data = (have_comp_size && st.comp_size == 0);
}
+ else {
+ empty_data = (have_size && st.size == 0);
+ }
+ if (empty_data) {
+ src = zip_source_buffer_with_attributes_create(NULL, 0, 0, &attributes, error);
+ }
+ else {
+ src = NULL;
+ }
+
+
+ /* If we created source buffer above, we want the window source to take ownership of it. */
+ take_ownership = src != NULL;
+ /* if we created a buffer source above, then treat it as if
+ reading the changed data - that way we don't need add another
+ special case to the code below that wraps it in the window
+ source */
+ changed_data = changed_data || (src != NULL);
if (partial_data && !needs_decrypt && !needs_decompress) {
- struct zip_stat st2;
+ struct zip_stat st2;
+ zip_t *source_archive;
+ zip_uint64_t source_index;
+
+ if (changed_data) {
+ if (src == NULL) {
+ src = srcza->entry[srcidx].source;
+ }
+ source_archive = NULL;
+ source_index = 0;
+ }
+ else {
+ src = srcza->src;
+ source_archive = srcza;
+ source_index = srcidx;
+ }
- st2.size = len;
- st2.comp_size = len;
- st2.comp_method = ZIP_CM_STORE;
- st2.mtime = st.mtime;
- st2.valid = ZIP_STAT_SIZE | ZIP_STAT_COMP_SIZE | ZIP_STAT_COMP_METHOD | ZIP_STAT_MTIME;
+ st2.comp_method = ZIP_CM_STORE;
+ st2.valid = ZIP_STAT_COMP_METHOD;
+ if (data_len >= 0) {
+ st2.size = (zip_uint64_t)data_len;
+ st2.comp_size = (zip_uint64_t)data_len;
+ st2.valid |= ZIP_STAT_SIZE | ZIP_STAT_COMP_SIZE;
+ }
+ if (st.valid & ZIP_STAT_MTIME) {
+ st2.mtime = st.mtime;
+ st2.valid |= ZIP_STAT_MTIME;
+ }
- if ((src = _zip_source_window_new(srcza->src, start, len, &st2, &attributes, srcza, srcidx, &za->error)) == NULL) {
- return NULL;
- }
+ if ((src = _zip_source_window_new(src, start, data_len, &st2, ZIP_STAT_NAME, &attributes, source_archive, source_index, take_ownership, error)) == NULL) {
+ return NULL;
+ }
+ }
+ /* here we restrict src to file data, so no point in doing it for
+ source that already represents only the file data */
+ else if (!changed_data) {
+ /* this branch is executed only for archive sources; we know
+ that stat data come from the archive too, so it's safe to
+ assume that st has a comp_size specified */
+ if (st.comp_size > ZIP_INT64_MAX) {
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return NULL;
+ }
+ /* despite the fact that we want the whole data file, we still
+ wrap the source into a window source to add st and
+ attributes and to have a source that positions the read
+ offset properly before each read for multiple zip_file_t
+ referring to the same underlying source */
+ if ((src = _zip_source_window_new(srcza->src, 0, (zip_int64_t)st.comp_size, &st, ZIP_STAT_NAME, &attributes, srcza, srcidx, take_ownership, error)) == NULL) {
+ return NULL;
+ }
}
else {
- if ((src = _zip_source_window_new(srcza->src, 0, st.comp_size, &st, &attributes, srcza, srcidx, &za->error)) == NULL) {
- return NULL;
- }
+ /* this branch gets executed when reading the whole changed
+ data file or when "reading" from a zero-sized source buffer
+ that we created above */
+ if (src == NULL) {
+ src = srcza->entry[srcidx].source;
+ }
+ /* despite the fact that we want the whole data file, we still
+ wrap the source into a window source to add st and
+ attributes and to have a source that positions the read
+ offset properly before each read for multiple zip_file_t
+ referring to the same underlying source */
+ if ((src = _zip_source_window_new(src, 0, data_len, &st, ZIP_STAT_NAME, &attributes, NULL, 0, take_ownership, error)) == NULL) {
+ return NULL;
+ }
}
+ /* In all cases, src is a window source and therefore is owned by this function. */
+
if (_zip_source_set_source_archive(src, srcza) < 0) {
- zip_source_free(src);
- return NULL;
+ zip_source_free(src);
+ return NULL;
}
/* creating a layered source calls zip_keep() on the lower layer, so we free it */
if (needs_decrypt) {
- zip_encryption_implementation enc_impl;
+ zip_encryption_implementation enc_impl;
+
+ if ((enc_impl = _zip_get_encryption_implementation(st.encryption_method, ZIP_CODEC_DECODE)) == NULL) {
+ zip_error_set(error, ZIP_ER_ENCRNOTSUPP, 0);
+ return NULL;
+ }
- if ((enc_impl = _zip_get_encryption_implementation(st.encryption_method, ZIP_CODEC_DECODE)) == NULL) {
- zip_error_set(&za->error, ZIP_ER_ENCRNOTSUPP, 0);
- return NULL;
- }
+ s2 = enc_impl(srcza, src, st.encryption_method, 0, password);
+ if (s2 == NULL) {
+ zip_source_free(src);
+ return NULL;
+ }
- s2 = enc_impl(za, src, st.encryption_method, 0, password);
- zip_source_free(src);
- if (s2 == NULL) {
- return NULL;
- }
- src = s2;
+ src = s2;
}
if (needs_decompress) {
- s2 = zip_source_decompress(za, src, st.comp_method);
- zip_source_free(src);
- if (s2 == NULL) {
- return NULL;
- }
- src = s2;
+ s2 = zip_source_decompress(srcza, src, st.comp_method);
+ if (s2 == NULL) {
+ zip_source_free(src);
+ return NULL;
+ }
+ src = s2;
}
if (needs_crc) {
- s2 = zip_source_crc(za, src, 1);
- zip_source_free(src);
- if (s2 == NULL) {
- return NULL;
- }
- src = s2;
+ s2 = zip_source_crc_create(src, 1, error);
+ if (s2 == NULL) {
+ zip_source_free(src);
+ return NULL;
+ }
+ src = s2;
}
if (partial_data && (needs_decrypt || needs_decompress)) {
- s2 = zip_source_window(za, src, start, len);
- zip_source_free(src);
- if (s2 == NULL) {
- return NULL;
- }
- src = s2;
+ zip_stat_t st2;
+ zip_stat_init(&st2);
+ if (data_len >= 0) {
+ st2.valid = ZIP_STAT_SIZE;
+ st2.size = (zip_uint64_t)data_len;
+ }
+ s2 = _zip_source_window_new(src, start, data_len, &st2, ZIP_STAT_NAME, NULL, NULL, 0, true, error);
+ if (s2 == NULL) {
+ zip_source_free(src);
+ return NULL;
+ }
+ src = s2;
}
return src;
diff --git a/src/Common/libzip/zip_stat.c b/src/Common/libzip/zip_stat.c
index 341c6f77..51d8026d 100644
--- a/src/Common/libzip/zip_stat.c
+++ b/src/Common/libzip/zip_stat.c
@@ -1,9 +1,9 @@
/*
zip_stat.c -- get information about file by name
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -40,7 +40,7 @@ zip_stat(zip_t *za, const char *fname, zip_flags_t flags, zip_stat_t *st) {
zip_int64_t idx;
if ((idx = zip_name_locate(za, fname, flags)) < 0)
- return -1;
+ return -1;
return zip_stat_index(za, (zip_uint64_t)idx, flags, st);
}
diff --git a/src/Common/libzip/zip_stat_index.c b/src/Common/libzip/zip_stat_index.c
index 71f80491..da33c09e 100644
--- a/src/Common/libzip/zip_stat_index.c
+++ b/src/Common/libzip/zip_stat_index.c
@@ -3,7 +3,7 @@
Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -39,37 +39,68 @@ ZIP_EXTERN int
zip_stat_index(zip_t *za, zip_uint64_t index, zip_flags_t flags, zip_stat_t *st) {
const char *name;
zip_dirent_t *de;
+ zip_entry_t *entry;
- if ((de = _zip_get_dirent(za, index, flags, NULL)) == NULL)
- return -1;
+ if ((de = _zip_get_dirent(za, index, flags, NULL)) == NULL) {
+ return -1;
+ }
- if ((name = zip_get_name(za, index, flags)) == NULL)
- return -1;
+ if ((name = zip_get_name(za, index, flags)) == NULL) {
+ return -1;
+ }
+ entry = za->entry + index;
if ((flags & ZIP_FL_UNCHANGED) == 0 && ZIP_ENTRY_DATA_CHANGED(za->entry + index)) {
- zip_entry_t *entry = za->entry+index;
-
- if (zip_source_stat(entry->source, st) < 0) {
- zip_error_set(&za->error, ZIP_ER_CHANGED, 0);
- return -1;
- }
- if (entry->changes->changed & ZIP_DIRENT_LAST_MOD) {
- st->mtime = de->last_mod;
- st->valid |= ZIP_STAT_MTIME;
- }
+ if (zip_source_stat(entry->source, st) < 0) {
+ zip_error_set(&za->error, ZIP_ER_CHANGED, 0);
+ return -1;
+ }
+
+ if (ZIP_CM_IS_DEFAULT(de->comp_method)) {
+ if (!(st->valid & ZIP_STAT_COMP_METHOD) || st->comp_method == ZIP_CM_STORE) {
+ st->valid &= ~(ZIP_STAT_COMP_SIZE|ZIP_STAT_COMP_METHOD);
+ }
+ }
+ else {
+ if ((st->valid & ZIP_STAT_COMP_METHOD) && st->comp_method != de->comp_method) {
+ st->valid &= ~ZIP_STAT_COMP_SIZE;
+ }
+ st->valid |= ZIP_STAT_COMP_METHOD;
+ st->comp_method = de->comp_method;
+ }
+
+ if (((st->valid & (ZIP_STAT_COMP_METHOD|ZIP_STAT_SIZE)) == (ZIP_STAT_COMP_METHOD|ZIP_STAT_SIZE)) && st->comp_method == ZIP_CM_STORE) {
+ st->valid |= ZIP_STAT_COMP_SIZE;
+ st->comp_size = st->size;
+ }
+
+ if (entry->changes != NULL && entry->changes->changed & ZIP_DIRENT_LAST_MOD) {
+ st->mtime = de->last_mod;
+ st->valid |= ZIP_STAT_MTIME;
+ }
}
else {
- zip_stat_init(st);
-
- st->crc = de->crc;
- st->size = de->uncomp_size;
- st->mtime = de->last_mod;
- st->comp_size = de->comp_size;
- st->comp_method = (zip_uint16_t)de->comp_method;
- st->encryption_method = de->encryption_method;
- st->valid = (de->crc_valid ? ZIP_STAT_CRC : 0) | ZIP_STAT_SIZE | ZIP_STAT_MTIME | ZIP_STAT_COMP_SIZE | ZIP_STAT_COMP_METHOD | ZIP_STAT_ENCRYPTION_METHOD;
+ zip_stat_init(st);
+
+ st->crc = de->crc;
+ st->size = de->uncomp_size;
+ st->mtime = de->last_mod;
+ st->comp_size = de->comp_size;
+ st->comp_method = (zip_uint16_t)de->comp_method;
+ st->encryption_method = de->encryption_method;
+ st->valid = (de->crc_valid ? ZIP_STAT_CRC : 0) | ZIP_STAT_SIZE | ZIP_STAT_MTIME | ZIP_STAT_COMP_SIZE | ZIP_STAT_COMP_METHOD | ZIP_STAT_ENCRYPTION_METHOD;
+ if (entry->changes != NULL && entry->changes->changed & ZIP_DIRENT_COMP_METHOD) {
+ st->valid &= ~ZIP_STAT_COMP_SIZE;
+ }
+ }
+
+ if ((za->ch_flags & ZIP_AFL_WANT_TORRENTZIP) && (flags & ZIP_FL_UNCHANGED) == 0) {
+ st->comp_method = ZIP_CM_DEFLATE;
+ st->mtime = _zip_d2u_time(0xbc00, 0x2198);
+ st->valid |= ZIP_STAT_MTIME | ZIP_STAT_COMP_METHOD;
+ st->valid &= ~ZIP_STAT_COMP_SIZE;
}
st->index = index;
diff --git a/src/Common/libzip/zip_stat_init.c b/src/Common/libzip/zip_stat_init.c
index 6d0903d6..9c6088a7 100644
--- a/src/Common/libzip/zip_stat_init.c
+++ b/src/Common/libzip/zip_stat_init.c
@@ -1,9 +1,9 @@
/*
zip_stat_init.c -- initialize struct zip_stat.
- Copyright (C) 2006-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -54,28 +54,28 @@ int
_zip_stat_merge(zip_stat_t *dst, const zip_stat_t *src, zip_error_t *error) {
/* name is not merged, since zip_stat_t doesn't own it, and src may not be valid as long as dst */
if (src->valid & ZIP_STAT_INDEX) {
- dst->index = src->index;
+ dst->index = src->index;
}
if (src->valid & ZIP_STAT_SIZE) {
- dst->size = src->size;
+ dst->size = src->size;
}
if (src->valid & ZIP_STAT_COMP_SIZE) {
- dst->comp_size = src->comp_size;
+ dst->comp_size = src->comp_size;
}
if (src->valid & ZIP_STAT_MTIME) {
- dst->mtime = src->mtime;
+ dst->mtime = src->mtime;
}
if (src->valid & ZIP_STAT_CRC) {
- dst->crc = src->crc;
+ dst->crc = src->crc;
}
if (src->valid & ZIP_STAT_COMP_METHOD) {
- dst->comp_method = src->comp_method;
+ dst->comp_method = src->comp_method;
}
if (src->valid & ZIP_STAT_ENCRYPTION_METHOD) {
- dst->encryption_method = src->encryption_method;
+ dst->encryption_method = src->encryption_method;
}
if (src->valid & ZIP_STAT_FLAGS) {
- dst->flags = src->flags;
+ dst->flags = src->flags;
}
dst->valid |= src->valid;
diff --git a/src/Common/libzip/zip_strerror.c b/src/Common/libzip/zip_strerror.c
index 906c7f76..7d827931 100644
--- a/src/Common/libzip/zip_strerror.c
+++ b/src/Common/libzip/zip_strerror.c
@@ -1,9 +1,9 @@
/*
zip_sterror.c -- get string representation of zip error
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
diff --git a/src/Common/libzip/zip_string.c b/src/Common/libzip/zip_string.c
index 122721d8..1c964491 100644
--- a/src/Common/libzip/zip_string.c
+++ b/src/Common/libzip/zip_string.c
@@ -1,9 +1,9 @@
/*
zip_string.c -- string handling (with encoding)
- Copyright (C) 2012-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2012-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -45,7 +45,7 @@ _zip_string_crc32(const zip_string_t *s) {
crc = (zip_uint32_t)crc32(0L, Z_NULL, 0);
if (s != NULL)
- crc = (zip_uint32_t)crc32(crc, s->raw, s->length);
+ crc = (zip_uint32_t)crc32(crc, s->raw, s->length);
return crc;
}
@@ -54,10 +54,10 @@ _zip_string_crc32(const zip_string_t *s) {
int
_zip_string_equal(const zip_string_t *a, const zip_string_t *b) {
if (a == NULL || b == NULL)
- return a == b;
+ return a == b;
if (a->length != b->length)
- return 0;
+ return 0;
/* TODO: encoding */
@@ -68,7 +68,7 @@ _zip_string_equal(const zip_string_t *a, const zip_string_t *b) {
void
_zip_string_free(zip_string_t *s) {
if (s == NULL)
- return;
+ return;
free(s->raw);
free(s->converted);
@@ -81,29 +81,29 @@ _zip_string_get(zip_string_t *string, zip_uint32_t *lenp, zip_flags_t flags, zip
static const zip_uint8_t empty[1] = "";
if (string == NULL) {
- if (lenp)
- *lenp = 0;
- return empty;
+ if (lenp)
+ *lenp = 0;
+ return empty;
}
if ((flags & ZIP_FL_ENC_RAW) == 0) {
- /* start guessing */
- if (string->encoding == ZIP_ENCODING_UNKNOWN)
- _zip_guess_encoding(string, ZIP_ENCODING_UNKNOWN);
-
- if (((flags & ZIP_FL_ENC_STRICT) && string->encoding != ZIP_ENCODING_ASCII && string->encoding != ZIP_ENCODING_UTF8_KNOWN) || (string->encoding == ZIP_ENCODING_CP437)) {
- if (string->converted == NULL) {
- if ((string->converted = _zip_cp437_to_utf8(string->raw, string->length, &string->converted_length, error)) == NULL)
- return NULL;
- }
- if (lenp)
- *lenp = string->converted_length;
- return string->converted;
- }
+ /* start guessing */
+ if (string->encoding == ZIP_ENCODING_UNKNOWN)
+ _zip_guess_encoding(string, ZIP_ENCODING_UNKNOWN);
+
+ if (((flags & ZIP_FL_ENC_STRICT) && string->encoding != ZIP_ENCODING_ASCII && string->encoding != ZIP_ENCODING_UTF8_KNOWN) || (string->encoding == ZIP_ENCODING_CP437)) {
+ if (string->converted == NULL) {
+ if ((string->converted = _zip_cp437_to_utf8(string->raw, string->length, &string->converted_length, error)) == NULL)
+ return NULL;
+ }
+ if (lenp)
+ *lenp = string->converted_length;
+ return string->converted;
+ }
}
if (lenp)
- *lenp = string->length;
+ *lenp = string->length;
return string->raw;
}
@@ -111,7 +111,7 @@ _zip_string_get(zip_string_t *string, zip_uint32_t *lenp, zip_flags_t flags, zip
zip_uint16_t
_zip_string_length(const zip_string_t *s) {
if (s == NULL)
- return 0;
+ return 0;
return s->length;
}
@@ -123,34 +123,34 @@ _zip_string_new(const zip_uint8_t *raw, zip_uint16_t length, zip_flags_t flags,
zip_encoding_type_t expected_encoding;
if (length == 0)
- return NULL;
+ return NULL;
switch (flags & ZIP_FL_ENCODING_ALL) {
case ZIP_FL_ENC_GUESS:
- expected_encoding = ZIP_ENCODING_UNKNOWN;
- break;
+ expected_encoding = ZIP_ENCODING_UNKNOWN;
+ break;
case ZIP_FL_ENC_UTF_8:
- expected_encoding = ZIP_ENCODING_UTF8_KNOWN;
- break;
+ expected_encoding = ZIP_ENCODING_UTF8_KNOWN;
+ break;
case ZIP_FL_ENC_CP437:
- expected_encoding = ZIP_ENCODING_CP437;
- break;
+ expected_encoding = ZIP_ENCODING_CP437;
+ break;
default:
- zip_error_set(error, ZIP_ER_INVAL, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return NULL;
}
if ((s = (zip_string_t *)malloc(sizeof(*s))) == NULL) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
}
if ((s->raw = (zip_uint8_t *)malloc((size_t)length + 1)) == NULL) {
- free(s);
- return NULL;
+ free(s);
+ return NULL;
}
- memcpy(s->raw, raw, length);
+ (void)memcpy_s(s->raw, length + 1, raw, length);
s->raw[length] = '\0';
s->length = length;
s->encoding = ZIP_ENCODING_UNKNOWN;
@@ -158,11 +158,11 @@ _zip_string_new(const zip_uint8_t *raw, zip_uint16_t length, zip_flags_t flags,
s->converted_length = 0;
if (expected_encoding != ZIP_ENCODING_UNKNOWN) {
- if (_zip_guess_encoding(s, expected_encoding) == ZIP_ENCODING_ERROR) {
- _zip_string_free(s);
- zip_error_set(error, ZIP_ER_INVAL, 0);
- return NULL;
- }
+ if (_zip_guess_encoding(s, expected_encoding) == ZIP_ENCODING_ERROR) {
+ _zip_string_free(s);
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return NULL;
+ }
}
return s;
@@ -172,7 +172,7 @@ _zip_string_new(const zip_uint8_t *raw, zip_uint16_t length, zip_flags_t flags,
int
_zip_string_write(zip_t *za, const zip_string_t *s) {
if (s == NULL)
- return 0;
+ return 0;
return _zip_write(za, s->raw, s->length);
}
diff --git a/src/Common/libzip/zip_unchange.c b/src/Common/libzip/zip_unchange.c
index 1a78e2c3..d69a3dfe 100644
--- a/src/Common/libzip/zip_unchange.c
+++ b/src/Common/libzip/zip_unchange.c
@@ -1,9 +1,9 @@
/*
zip_unchange.c -- undo changes to file in zip archive
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -46,42 +46,47 @@ zip_unchange(zip_t *za, zip_uint64_t idx) {
int
_zip_unchange(zip_t *za, zip_uint64_t idx, int allow_duplicates) {
zip_int64_t i;
- const char *orig_name, *changed_name;
+ bool renamed;
if (idx >= za->nentry) {
- zip_error_set(&za->error, ZIP_ER_INVAL, 0);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_INVAL, 0);
+ return -1;
}
- if (!allow_duplicates && za->entry[idx].changes && (za->entry[idx].changes->changed & ZIP_DIRENT_FILENAME)) {
- if (za->entry[idx].orig != NULL) {
- if ((orig_name = _zip_get_name(za, idx, ZIP_FL_UNCHANGED, &za->error)) == NULL) {
- return -1;
- }
-
- i = _zip_name_locate(za, orig_name, 0, NULL);
- if (i >= 0 && (zip_uint64_t)i != idx) {
- zip_error_set(&za->error, ZIP_ER_EXISTS, 0);
- return -1;
- }
- }
- else {
- orig_name = NULL;
- }
-
- if ((changed_name = _zip_get_name(za, idx, 0, &za->error)) == NULL) {
- return -1;
- }
-
- if (orig_name) {
- if (_zip_hash_add(za->names, (const zip_uint8_t *)orig_name, idx, 0, &za->error) == false) {
- return -1;
- }
- }
- if (_zip_hash_delete(za->names, (const zip_uint8_t *)changed_name, &za->error) == false) {
- _zip_hash_delete(za->names, (const zip_uint8_t *)orig_name, NULL);
- return -1;
- }
+ renamed = za->entry[idx].changes && (za->entry[idx].changes->changed & ZIP_DIRENT_FILENAME);
+ if (!allow_duplicates && (renamed || za->entry[idx].deleted)) {
+ const char *orig_name = NULL;
+ const char *changed_name = NULL;
+
+ if (za->entry[idx].orig != NULL) {
+ if ((orig_name = _zip_get_name(za, idx, ZIP_FL_UNCHANGED, &za->error)) == NULL) {
+ return -1;
+ }
+
+ i = _zip_name_locate(za, orig_name, 0, NULL);
+ if (i >= 0 && (zip_uint64_t)i != idx) {
+ zip_error_set(&za->error, ZIP_ER_EXISTS, 0);
+ return -1;
+ }
+ }
+
+ if (renamed) {
+ if ((changed_name = _zip_get_name(za, idx, 0, &za->error)) == NULL) {
+ return -1;
+ }
+ }
+
+ if (orig_name) {
+ if (_zip_hash_add(za->names, (const zip_uint8_t *)orig_name, idx, 0, &za->error) == false) {
+ return -1;
+ }
+ }
+ if (changed_name) {
+ if (_zip_hash_delete(za->names, (const zip_uint8_t *)changed_name, &za->error) == false) {
+ _zip_hash_delete(za->names, (const zip_uint8_t *)orig_name, NULL);
+ return -1;
+ }
+ }
}
_zip_dirent_free(za->entry[idx].changes);
diff --git a/src/Common/libzip/zip_unchange_all.c b/src/Common/libzip/zip_unchange_all.c
index 2ae742f8..34f3702e 100644
--- a/src/Common/libzip/zip_unchange_all.c
+++ b/src/Common/libzip/zip_unchange_all.c
@@ -1,9 +1,9 @@
/*
zip_unchange.c -- undo changes to all files in zip archive
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -41,12 +41,12 @@ zip_unchange_all(zip_t *za) {
zip_uint64_t i;
if (!_zip_hash_revert(za->names, &za->error)) {
- return -1;
+ return -1;
}
ret = 0;
for (i = 0; i < za->nentry; i++)
- ret |= _zip_unchange(za, i, 1);
+ ret |= _zip_unchange(za, i, 1);
ret |= zip_unchange_archive(za);
diff --git a/src/Common/libzip/zip_unchange_archive.c b/src/Common/libzip/zip_unchange_archive.c
index bd223ef5..56a8e31f 100644
--- a/src/Common/libzip/zip_unchange_archive.c
+++ b/src/Common/libzip/zip_unchange_archive.c
@@ -1,9 +1,9 @@
/*
zip_unchange_archive.c -- undo global changes to ZIP archive
- Copyright (C) 2006-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -40,9 +40,9 @@
ZIP_EXTERN int
zip_unchange_archive(zip_t *za) {
if (za->comment_changed) {
- _zip_string_free(za->comment_changes);
- za->comment_changes = NULL;
- za->comment_changed = 0;
+ _zip_string_free(za->comment_changes);
+ za->comment_changes = NULL;
+ za->comment_changed = 0;
}
za->ch_flags = za->flags;
diff --git a/src/Common/libzip/zip_unchange_data.c b/src/Common/libzip/zip_unchange_data.c
index 74a429c9..6bdecd18 100644
--- a/src/Common/libzip/zip_unchange_data.c
+++ b/src/Common/libzip/zip_unchange_data.c
@@ -1,9 +1,9 @@
/*
zip_unchange_data.c -- undo helper function
- Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -37,16 +37,16 @@
void
_zip_unchange_data(zip_entry_t *ze) {
if (ze->source) {
- zip_source_free(ze->source);
- ze->source = NULL;
+ zip_source_free(ze->source);
+ ze->source = NULL;
}
if (ze->changes != NULL && (ze->changes->changed & ZIP_DIRENT_COMP_METHOD) && ze->changes->comp_method == ZIP_CM_REPLACED_DEFAULT) {
- ze->changes->changed &= ~ZIP_DIRENT_COMP_METHOD;
- if (ze->changes->changed == 0) {
- _zip_dirent_free(ze->changes);
- ze->changes = NULL;
- }
+ ze->changes->changed &= ~ZIP_DIRENT_COMP_METHOD;
+ if (ze->changes->changed == 0) {
+ _zip_dirent_free(ze->changes);
+ ze->changes = NULL;
+ }
}
ze->deleted = 0;
diff --git a/src/Common/libzip/zip_utf-8.c b/src/Common/libzip/zip_utf-8.c
index 099db9bf..678912f6 100644
--- a/src/Common/libzip/zip_utf-8.c
+++ b/src/Common/libzip/zip_utf-8.c
@@ -1,9 +1,9 @@
/*
zip_utf-8.c -- UTF-8 support functions for libzip
- Copyright (C) 2011-2019 Dieter Baron and Thomas Klausner
+ Copyright (C) 2011-2021 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -103,54 +103,54 @@ _zip_guess_encoding(zip_string_t *str, zip_encoding_type_t expected_encoding) {
zip_uint32_t i, j, ulen;
if (str == NULL)
- return ZIP_ENCODING_ASCII;
+ return ZIP_ENCODING_ASCII;
name = str->raw;
if (str->encoding != ZIP_ENCODING_UNKNOWN)
- enc = str->encoding;
+ enc = str->encoding;
else {
- enc = ZIP_ENCODING_ASCII;
- for (i = 0; i < str->length; i++) {
- if ((name[i] > 31 && name[i] < 128) || name[i] == '\r' || name[i] == '\n' || name[i] == '\t')
- continue;
-
- enc = ZIP_ENCODING_UTF8_GUESSED;
- if ((name[i] & UTF_8_LEN_2_MASK) == UTF_8_LEN_2_MATCH)
- ulen = 1;
- else if ((name[i] & UTF_8_LEN_3_MASK) == UTF_8_LEN_3_MATCH)
- ulen = 2;
- else if ((name[i] & UTF_8_LEN_4_MASK) == UTF_8_LEN_4_MATCH)
- ulen = 3;
- else {
- enc = ZIP_ENCODING_CP437;
- break;
- }
-
- if (i + ulen >= str->length) {
- enc = ZIP_ENCODING_CP437;
- break;
- }
-
- for (j = 1; j <= ulen; j++) {
- if ((name[i + j] & UTF_8_CONTINUE_MASK) != UTF_8_CONTINUE_MATCH) {
- enc = ZIP_ENCODING_CP437;
- goto done;
- }
- }
- i += ulen;
- }
+ enc = ZIP_ENCODING_ASCII;
+ for (i = 0; i < str->length; i++) {
+ if ((name[i] > 31 && name[i] < 128) || name[i] == '\r' || name[i] == '\n' || name[i] == '\t')
+ continue;
+
+ enc = ZIP_ENCODING_UTF8_GUESSED;
+ if ((name[i] & UTF_8_LEN_2_MASK) == UTF_8_LEN_2_MATCH)
+ ulen = 1;
+ else if ((name[i] & UTF_8_LEN_3_MASK) == UTF_8_LEN_3_MATCH)
+ ulen = 2;
+ else if ((name[i] & UTF_8_LEN_4_MASK) == UTF_8_LEN_4_MATCH)
+ ulen = 3;
+ else {
+ enc = ZIP_ENCODING_CP437;
+ break;
+ }
+
+ if (i + ulen >= str->length) {
+ enc = ZIP_ENCODING_CP437;
+ break;
+ }
+
+ for (j = 1; j <= ulen; j++) {
+ if ((name[i + j] & UTF_8_CONTINUE_MASK) != UTF_8_CONTINUE_MATCH) {
+ enc = ZIP_ENCODING_CP437;
+ goto done;
+ }
+ }
+ i += ulen;
+ }
}
done:
str->encoding = enc;
if (expected_encoding != ZIP_ENCODING_UNKNOWN) {
- if (expected_encoding == ZIP_ENCODING_UTF8_KNOWN && enc == ZIP_ENCODING_UTF8_GUESSED)
- str->encoding = enc = ZIP_ENCODING_UTF8_KNOWN;
+ if (expected_encoding == ZIP_ENCODING_UTF8_KNOWN && enc == ZIP_ENCODING_UTF8_GUESSED)
+ str->encoding = enc = ZIP_ENCODING_UTF8_KNOWN;
- if (expected_encoding != enc && enc != ZIP_ENCODING_ASCII)
- return ZIP_ENCODING_ERROR;
+ if (expected_encoding != enc && enc != ZIP_ENCODING_ASCII)
+ return ZIP_ENCODING_ERROR;
}
return enc;
@@ -160,11 +160,11 @@ done:
static zip_uint32_t
_zip_unicode_to_utf8_len(zip_uint32_t codepoint) {
if (codepoint < 0x0080)
- return 1;
+ return 1;
if (codepoint < 0x0800)
- return 2;
+ return 2;
if (codepoint < 0x10000)
- return 3;
+ return 3;
return 4;
}
@@ -172,19 +172,19 @@ _zip_unicode_to_utf8_len(zip_uint32_t codepoint) {
static zip_uint32_t
_zip_unicode_to_utf8(zip_uint32_t codepoint, zip_uint8_t *buf) {
if (codepoint < 0x0080) {
- buf[0] = codepoint & 0xff;
- return 1;
+ buf[0] = codepoint & 0xff;
+ return 1;
}
if (codepoint < 0x0800) {
- buf[0] = (zip_uint8_t)(UTF_8_LEN_2_MATCH | ((codepoint >> 6) & 0x1f));
- buf[1] = (zip_uint8_t)(UTF_8_CONTINUE_MATCH | (codepoint & 0x3f));
- return 2;
+ buf[0] = (zip_uint8_t)(UTF_8_LEN_2_MATCH | ((codepoint >> 6) & 0x1f));
+ buf[1] = (zip_uint8_t)(UTF_8_CONTINUE_MATCH | (codepoint & 0x3f));
+ return 2;
}
if (codepoint < 0x10000) {
- buf[0] = (zip_uint8_t)(UTF_8_LEN_3_MATCH | ((codepoint >> 12) & 0x0f));
- buf[1] = (zip_uint8_t)(UTF_8_CONTINUE_MATCH | ((codepoint >> 6) & 0x3f));
- buf[2] = (zip_uint8_t)(UTF_8_CONTINUE_MATCH | (codepoint & 0x3f));
- return 3;
+ buf[0] = (zip_uint8_t)(UTF_8_LEN_3_MATCH | ((codepoint >> 12) & 0x0f));
+ buf[1] = (zip_uint8_t)(UTF_8_CONTINUE_MATCH | ((codepoint >> 6) & 0x3f));
+ buf[2] = (zip_uint8_t)(UTF_8_CONTINUE_MATCH | (codepoint & 0x3f));
+ return 3;
}
buf[0] = (zip_uint8_t)(UTF_8_LEN_4_MATCH | ((codepoint >> 18) & 0x07));
buf[1] = (zip_uint8_t)(UTF_8_CONTINUE_MATCH | ((codepoint >> 12) & 0x3f));
@@ -201,26 +201,26 @@ _zip_cp437_to_utf8(const zip_uint8_t *const _cp437buf, zip_uint32_t len, zip_uin
zip_uint32_t buflen, i, offset;
if (len == 0) {
- if (utf8_lenp)
- *utf8_lenp = 0;
- return NULL;
+ if (utf8_lenp)
+ *utf8_lenp = 0;
+ return NULL;
}
buflen = 1;
for (i = 0; i < len; i++)
- buflen += _zip_unicode_to_utf8_len(_cp437_to_unicode[cp437buf[i]]);
+ buflen += _zip_unicode_to_utf8_len(_cp437_to_unicode[cp437buf[i]]);
if ((utf8buf = (zip_uint8_t *)malloc(buflen)) == NULL) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- return NULL;
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
}
offset = 0;
for (i = 0; i < len; i++)
- offset += _zip_unicode_to_utf8(_cp437_to_unicode[cp437buf[i]], utf8buf + offset);
+ offset += _zip_unicode_to_utf8(_cp437_to_unicode[cp437buf[i]], utf8buf + offset);
utf8buf[buflen - 1] = 0;
if (utf8_lenp)
- *utf8_lenp = buflen - 1;
+ *utf8_lenp = buflen - 1;
return utf8buf;
}
diff --git a/src/Common/libzip/zip_winzip_aes.c b/src/Common/libzip/zip_winzip_aes.c
new file mode 100644
index 00000000..ce269036
--- /dev/null
+++ b/src/Common/libzip/zip_winzip_aes.c
@@ -0,0 +1,162 @@
+/*
+ zip_winzip_aes.c -- Winzip AES de/encryption backend routines
+ Copyright (C) 2017-2021 Dieter Baron and Thomas Klausner
+
+ This file is part of libzip, a library to manipulate ZIP archives.
+ The authors can be contacted at <info@libzip.org>
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ 3. The names of the authors may not be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "zipint.h"
+
+#include "zip_crypto.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+
+#define MAX_KEY_LENGTH 256
+#define PBKDF2_ITERATIONS 1000
+
+struct _zip_winzip_aes {
+ _zip_crypto_aes_t *aes;
+ _zip_crypto_hmac_t *hmac;
+ zip_uint8_t counter[ZIP_CRYPTO_AES_BLOCK_LENGTH];
+ zip_uint8_t pad[ZIP_CRYPTO_AES_BLOCK_LENGTH];
+ int pad_offset;
+};
+
+static bool
+aes_crypt(zip_winzip_aes_t *ctx, zip_uint8_t *data, zip_uint64_t length) {
+ zip_uint64_t i, j;
+
+ for (i = 0; i < length; i++) {
+ if (ctx->pad_offset == AES_BLOCK_SIZE) {
+ for (j = 0; j < 8; j++) {
+ ctx->counter[j]++;
+ if (ctx->counter[j] != 0) {
+ break;
+ }
+ }
+ if (!_zip_crypto_aes_encrypt_block(ctx->aes, ctx->counter, ctx->pad)) {
+ return false;
+ }
+ ctx->pad_offset = 0;
+ }
+ data[i] ^= ctx->pad[ctx->pad_offset++];
+ }
+
+ return true;
+}
+
+
+zip_winzip_aes_t *
+_zip_winzip_aes_new(const zip_uint8_t *password, zip_uint64_t password_length, const zip_uint8_t *salt, zip_uint16_t encryption_method, zip_uint8_t *password_verify, zip_error_t *error) {
+ zip_winzip_aes_t *ctx;
+ zip_uint8_t buffer[2 * (MAX_KEY_LENGTH / 8) + WINZIP_AES_PASSWORD_VERIFY_LENGTH];
+ zip_uint16_t key_size = 0; /* in bits */
+ zip_uint16_t key_length; /* in bytes */
+
+ switch (encryption_method) {
+ case ZIP_EM_AES_128:
+ key_size = 128;
+ break;
+ case ZIP_EM_AES_192:
+ key_size = 192;
+ break;
+ case ZIP_EM_AES_256:
+ key_size = 256;
+ break;
+ }
+
+ if (key_size == 0 || salt == NULL || password == NULL || password_length == 0) {
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return NULL;
+ }
+
+ key_length = key_size / 8;
+
+ if ((ctx = (zip_winzip_aes_t *)malloc(sizeof(*ctx))) == NULL) {
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
+ }
+
+ memset(ctx->counter, 0, sizeof(ctx->counter));
+ ctx->pad_offset = ZIP_CRYPTO_AES_BLOCK_LENGTH;
+
+ if (!_zip_crypto_pbkdf2(password, password_length, salt, key_length / 2, PBKDF2_ITERATIONS, buffer, 2 * key_length + WINZIP_AES_PASSWORD_VERIFY_LENGTH)) {
+ free(ctx);
+ return NULL;
+ }
+
+ if ((ctx->aes = _zip_crypto_aes_new(buffer, key_size, error)) == NULL) {
+ _zip_crypto_clear(ctx, sizeof(*ctx));
+ free(ctx);
+ return NULL;
+ }
+ if ((ctx->hmac = _zip_crypto_hmac_new(buffer + key_length, key_length, error)) == NULL) {
+ _zip_crypto_aes_free(ctx->aes);
+ free(ctx);
+ return NULL;
+ }
+
+ if (password_verify) {
+ (void)memcpy_s(password_verify, WINZIP_AES_PASSWORD_VERIFY_LENGTH, buffer + (2 * key_size / 8), WINZIP_AES_PASSWORD_VERIFY_LENGTH);
+ }
+
+ return ctx;
+}
+
+
+bool
+_zip_winzip_aes_encrypt(zip_winzip_aes_t *ctx, zip_uint8_t *data, zip_uint64_t length) {
+ return aes_crypt(ctx, data, length) && _zip_crypto_hmac(ctx->hmac, data, length);
+}
+
+
+bool
+_zip_winzip_aes_decrypt(zip_winzip_aes_t *ctx, zip_uint8_t *data, zip_uint64_t length) {
+ return _zip_crypto_hmac(ctx->hmac, data, length) && aes_crypt(ctx, data, length);
+}
+
+
+bool
+_zip_winzip_aes_finish(zip_winzip_aes_t *ctx, zip_uint8_t *hmac) {
+ return _zip_crypto_hmac_output(ctx->hmac, hmac);
+}
+
+
+void
+_zip_winzip_aes_free(zip_winzip_aes_t *ctx) {
+ if (ctx == NULL) {
+ return;
+ }
+
+ _zip_crypto_aes_free(ctx->aes);
+ _zip_crypto_hmac_free(ctx->hmac);
+ free(ctx);
+}
diff --git a/src/Common/libzip/zipconf.h b/src/Common/libzip/zipconf.h
index e4224da2..472e06c1 100644
--- a/src/Common/libzip/zipconf.h
+++ b/src/Common/libzip/zipconf.h
@@ -1,40 +1,52 @@
-/*
- This file was generated automatically by C:\dev\prj\Github\VeraCrypt\src\Common\libzip\make_zip_err_str.sh
- from C:\dev\libraries\libzip\build\config.h; make changes there.
- */
-
#ifndef _HAD_ZIPCONF_H
#define _HAD_ZIPCONF_H
-extern const char * const _zip_err_str[];
-
-extern const int _zip_nerr_str;
-
-#define N ZIP_ET_NONE
-#define S ZIP_ET_SYS
-#define Z ZIP_ET_ZLIB
-
-extern const int _zip_err_type[];
-
+/*
+ zipconf.h -- platform specific include file
-typedef signed char zip_int8_t;
-typedef unsigned char zip_uint8_t;
-typedef signed short zip_int16_t;
-typedef unsigned short zip_uint16_t;
-typedef signed int zip_int32_t;
-typedef unsigned int zip_uint32_t;
-typedef signed long long zip_int64_t;
-typedef unsigned long long zip_uint64_t;
+ This file was generated automatically by CMake
+ based on ../cmake-zipconf.h.in.
+ */
-#define ZIP_INT8_MIN -0x80
+#define LIBZIP_VERSION "1.10.1"
+#define LIBZIP_VERSION_MAJOR 1
+#define LIBZIP_VERSION_MINOR 10
+#define LIBZIP_VERSION_MICRO 1
+
+/* #undef ZIP_STATIC */
+
+#define _Nullable
+#define _Nonnull
+
+#if !defined(__STDC_FORMAT_MACROS)
+#define __STDC_FORMAT_MACROS 1
+#endif
+#if defined(_MSC_VER) && _MSC_VER < 1700
+#include <stdint.h>
+#define PRIu32 "lu"
+#define PRIu64 "llu"
+#else
+#include <inttypes.h>
+#endif
+
+typedef int8_t zip_int8_t;
+typedef uint8_t zip_uint8_t;
+typedef int16_t zip_int16_t;
+typedef uint16_t zip_uint16_t;
+typedef int32_t zip_int32_t;
+typedef uint32_t zip_uint32_t;
+typedef int64_t zip_int64_t;
+typedef uint64_t zip_uint64_t;
+
+#define ZIP_INT8_MIN (-ZIP_INT8_MAX-1)
#define ZIP_INT8_MAX 0x7f
#define ZIP_UINT8_MAX 0xff
-#define ZIP_INT16_MIN -0x8000
+#define ZIP_INT16_MIN (-ZIP_INT16_MAX-1)
#define ZIP_INT16_MAX 0x7fff
#define ZIP_UINT16_MAX 0xffff
-#define ZIP_INT32_MIN -0x80000000L
+#define ZIP_INT32_MIN (-ZIP_INT32_MAX-1L)
#define ZIP_INT32_MAX 0x7fffffffL
#define ZIP_UINT32_MAX 0xffffffffLU
@@ -43,4 +55,3 @@ typedef unsigned long long zip_uint64_t;
#define ZIP_UINT64_MAX 0xffffffffffffffffULL
#endif /* zipconf.h */
-
diff --git a/src/Common/libzip/zipint.h b/src/Common/libzip/zipint.h
index 5f504ca9..4887b6c5 100644
--- a/src/Common/libzip/zipint.h
+++ b/src/Common/libzip/zipint.h
@@ -3,10 +3,10 @@
/*
zipint.h -- internal declarations.
- Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <libzip@nih.at>
+ The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -35,15 +35,16 @@
*/
#include "config.h"
+
#include "compat.h"
#ifdef ZIP_ALLOCATE_BUFFER
#include <stdlib.h>
#endif
-#include <zlib.h>
-
-#ifndef _ZIP_COMPILING_DEPRECATED
+#ifdef _ZIP_COMPILING_DEPRECATED
+#define ZIP_DEPRECATED(x)
+#else
#define ZIP_DISABLE_DEPRECATED
#endif
@@ -68,6 +69,12 @@
#define EF_WINZIP_AES_SIZE 7
#define MAX_DATA_DESCRIPTOR_LENGTH 24
+#define TORRENTZIP_SIGNATURE "TORRENTZIPPED-"
+#define TORRENTZIP_SIGNATURE_LENGTH 14
+#define TORRENTZIP_CRC_LENGTH 8
+#define TORRENTZIP_MEM_LEVEL 8
+#define TORRENTZIP_COMPRESSION_FLAGS ZIP_UINT16_MAX
+
#define ZIP_CRYPTO_PKWARE_HEADERLEN 12
#define ZIP_CM_REPLACED_DEFAULT (-2)
@@ -77,7 +84,6 @@
#define WINZIP_AES_MAX_HEADER_LENGTH (16 + WINZIP_AES_PASSWORD_VERIFY_LENGTH)
#define AES_BLOCK_SIZE 16
#define HMAC_LENGTH 10
-#define SHA1_LENGTH 20
#define SALT_LENGTH(method) ((method) == ZIP_EM_AES_128 ? 8 : ((method) == ZIP_EM_AES_192 ? 12 : 16))
#define ZIP_CM_IS_DEFAULT(x) ((x) == ZIP_CM_DEFAULT || (x) == ZIP_CM_REPLACED_DEFAULT)
@@ -123,8 +129,11 @@ enum zip_compression_status {
typedef enum zip_compression_status zip_compression_status_t;
struct zip_compression_algorithm {
+ /* Return maximum compressed size for uncompressed data of given size. */
+ zip_uint64_t (*maximum_compressed_size)(zip_uint64_t uncompressed_size);
+
/* called once to create new context */
- void *(*allocate)(zip_uint16_t method, int compression_flags, zip_error_t *error);
+ void *(*allocate)(zip_uint16_t method, zip_uint32_t compression_flags, zip_error_t *error);
/* called once to free context */
void (*deallocate)(void *ctx);
@@ -134,7 +143,7 @@ struct zip_compression_algorithm {
zip_uint8_t version_needed;
/* start processing */
- bool (*start)(void *ctx);
+ bool (*start)(void *ctx, zip_stat_t *st, zip_file_attributes_t *attributes);
/* stop processing */
bool (*end)(void *ctx);
@@ -155,7 +164,10 @@ extern zip_compression_algorithm_t zip_algorithm_deflate_compress;
extern zip_compression_algorithm_t zip_algorithm_deflate_decompress;
extern zip_compression_algorithm_t zip_algorithm_xz_compress;
extern zip_compression_algorithm_t zip_algorithm_xz_decompress;
+extern zip_compression_algorithm_t zip_algorithm_zstd_compress;
+extern zip_compression_algorithm_t zip_algorithm_zstd_decompress;
+zip_compression_algorithm_t *_zip_get_compression_algorithm(zip_int32_t method, bool compress);
/* This API is not final yet, but we need it internally, so it's private for now. */
@@ -165,25 +177,65 @@ const zip_uint8_t *zip_get_extra_field_by_id(zip_t *, int, int, zip_uint16_t, in
user-supplied compression/encryption implementation is finished.
Thus we will keep it private for now. */
-typedef zip_int64_t (*zip_source_layered_callback)(zip_source_t *, void *, void *, zip_uint64_t, enum zip_source_cmd);
-zip_source_t *zip_source_compress(zip_t *za, zip_source_t *src, zip_int32_t cm, int compression_flags);
-zip_source_t *zip_source_crc(zip_t *, zip_source_t *, int);
+zip_source_t *zip_source_compress(zip_t *za, zip_source_t *src, zip_int32_t cm, zip_uint32_t compression_flags);
+zip_source_t *zip_source_crc_create(zip_source_t *, int, zip_error_t *error);
zip_source_t *zip_source_decompress(zip_t *za, zip_source_t *src, zip_int32_t cm);
-zip_source_t *zip_source_layered(zip_t *, zip_source_t *, zip_source_layered_callback, void *);
-zip_source_t *zip_source_layered_create(zip_source_t *src, zip_source_layered_callback cb, void *ud, zip_error_t *error);
zip_source_t *zip_source_pkware_decode(zip_t *, zip_source_t *, zip_uint16_t, int, const char *);
zip_source_t *zip_source_pkware_encode(zip_t *, zip_source_t *, zip_uint16_t, int, const char *);
int zip_source_remove(zip_source_t *);
zip_int64_t zip_source_supports(zip_source_t *src);
-zip_source_t *zip_source_window(zip_t *, zip_source_t *, zip_uint64_t, zip_uint64_t);
+bool zip_source_supports_reopen(zip_source_t *src);
zip_source_t *zip_source_winzip_aes_decode(zip_t *, zip_source_t *, zip_uint16_t, int, const char *);
zip_source_t *zip_source_winzip_aes_encode(zip_t *, zip_source_t *, zip_uint16_t, int, const char *);
zip_source_t *zip_source_buffer_with_attributes(zip_t *za, const void *data, zip_uint64_t len, int freep, zip_file_attributes_t *attributes);
+zip_source_t *zip_source_buffer_with_attributes_create(const void *data, zip_uint64_t len, int freep, zip_file_attributes_t *attributes, zip_error_t *error);
/* error source for layered sources */
enum zip_les { ZIP_LES_NONE, ZIP_LES_UPPER, ZIP_LES_LOWER, ZIP_LES_INVAL };
+#define ZIP_DETAIL_ET_GLOBAL 0
+#define ZIP_DETAIL_ET_ENTRY 1
+
+struct _zip_err_info {
+ int type;
+ const char *description;
+};
+
+extern const struct _zip_err_info _zip_err_str[];
+extern const int _zip_err_str_count;
+extern const struct _zip_err_info _zip_err_details[];
+extern const int _zip_err_details_count;
+
+/* macros for libzip-internal errors */
+#define MAX_DETAIL_INDEX 0x7fffff
+#define MAKE_DETAIL_WITH_INDEX(error, index) ((((index) > MAX_DETAIL_INDEX) ? MAX_DETAIL_INDEX : (int)(index)) << 8 | (error))
+#define GET_INDEX_FROM_DETAIL(error) (((error) >> 8) & MAX_DETAIL_INDEX)
+#define GET_ERROR_FROM_DETAIL(error) ((error) & 0xff)
+#define ADD_INDEX_TO_DETAIL(error, index) MAKE_DETAIL_WITH_INDEX(GET_ERROR_FROM_DETAIL(error), (index))
+
+/* error code for libzip-internal errors */
+#define ZIP_ER_DETAIL_NO_DETAIL 0 /* G no detail */
+#define ZIP_ER_DETAIL_CDIR_OVERLAPS_EOCD 1 /* G central directory overlaps EOCD, or there is space between them */
+#define ZIP_ER_DETAIL_COMMENT_LENGTH_INVALID 2 /* G archive comment length incorrect */
+#define ZIP_ER_DETAIL_CDIR_LENGTH_INVALID 3 /* G central directory length invalid */
+#define ZIP_ER_DETAIL_CDIR_ENTRY_INVALID 4 /* E central header invalid */
+#define ZIP_ER_DETAIL_CDIR_WRONG_ENTRIES_COUNT 5 /* G central directory count of entries is incorrect */
+#define ZIP_ER_DETAIL_ENTRY_HEADER_MISMATCH 6 /* E local and central headers do not match */
+#define ZIP_ER_DETAIL_EOCD_LENGTH_INVALID 7 /* G wrong EOCD length */
+#define ZIP_ER_DETAIL_EOCD64_OVERLAPS_EOCD 8 /* G EOCD64 overlaps EOCD, or there is space between them */
+#define ZIP_ER_DETAIL_EOCD64_WRONG_MAGIC 9 /* G EOCD64 magic incorrect */
+#define ZIP_ER_DETAIL_EOCD64_MISMATCH 10 /* G EOCD64 and EOCD do not match */
+#define ZIP_ER_DETAIL_CDIR_INVALID 11 /* G invalid value in central directory */
+#define ZIP_ER_DETAIL_VARIABLE_SIZE_OVERFLOW 12 /* E variable size fields overflow header */
+#define ZIP_ER_DETAIL_INVALID_UTF8_IN_FILENAME 13 /* E invalid UTF-8 in filename */
+#define ZIP_ER_DETAIL_INVALID_UTF8_IN_COMMENT 13 /* E invalid UTF-8 in comment */
+#define ZIP_ER_DETAIL_INVALID_ZIP64_EF 14 /* E invalid Zip64 extra field */
+#define ZIP_ER_DETAIL_INVALID_WINZIPAES_EF 14 /* E invalid WinZip AES extra field */
+#define ZIP_ER_DETAIL_EF_TRAILING_GARBAGE 15 /* E garbage at end of extra fields */
+#define ZIP_ER_DETAIL_INVALID_EF_LENGTH 16 /* E extra field length is invalid */
+#define ZIP_ER_DETAIL_INVALID_FILE_LENGTH 17 /* E file length in header doesn't match actual file length */
+
/* directory entry: general purpose bit flags */
#define ZIP_GPBF_ENCRYPTED 0x0001u /* is encrypted */
@@ -253,14 +305,14 @@ struct zip {
zip_hash_t *names; /* hash table for name lookup */
zip_progress_t *progress; /* progress callback for zip_close() */
+
+ zip_uint32_t* write_crc; /* have _zip_write() compute CRC */
};
/* file in zip archive, part of API */
struct zip_file {
- zip_t *za; /* zip archive containing this file */
zip_error_t error; /* error information */
- bool eof;
zip_source_t *src; /* data source */
};
@@ -299,7 +351,7 @@ struct zip_dirent {
zip_uint32_t ext_attrib; /* (c) external file attributes */
zip_uint64_t offset; /* (c) offset of local header */
- zip_uint16_t compression_level; /* level of compression to use (never valid in orig) */
+ zip_uint32_t compression_level; /* level of compression to use (never valid in orig) */
zip_uint16_t encryption_method; /* encryption method, computed from other fields */
char *password; /* file specific encryption password */
};
@@ -336,8 +388,8 @@ typedef enum zip_source_write_state zip_source_write_state_t;
struct zip_source {
zip_source_t *src;
union {
- zip_source_callback f;
- zip_source_layered_callback l;
+ zip_source_callback f;
+ zip_source_layered_callback l;
} cb;
void *ud;
zip_error_t error;
@@ -347,8 +399,9 @@ struct zip_source {
bool source_closed; /* set if source archive is closed */
zip_t *source_archive; /* zip archive we're reading from, NULL if not from archive */
unsigned int refcount;
- bool eof; /* EOF reached */
- bool had_read_error; /* a previous ZIP_SOURCE_READ reported an error */
+ bool eof; /* EOF reached */
+ bool had_read_error; /* a previous ZIP_SOURCE_READ reported an error */
+ zip_uint64_t bytes_read; /* for sources that don't support ZIP_SOURCE_TELL. */
};
#define ZIP_SOURCE_IS_OPEN_READING(src) ((src)->open_count > 0)
@@ -408,7 +461,7 @@ struct zip_buffer {
struct zip_filelist {
zip_uint64_t idx;
- /* TODO const char *name; */
+ const char *name;
};
typedef struct zip_filelist zip_filelist_t;
@@ -421,10 +474,6 @@ struct _zip_pkware_keys {
};
typedef struct _zip_pkware_keys zip_pkware_keys_t;
-extern const char *const _zip_err_str[];
-extern const int _zip_nerr_str;
-extern const int _zip_err_type[];
-
#define ZIP_MAX(a, b) ((a) > (b) ? (a) : (b))
#define ZIP_MIN(a, b) ((a) < (b) ? (a) : (b))
@@ -433,6 +482,8 @@ extern const int _zip_err_type[];
#define ZIP_ENTRY_HAS_CHANGES(e) (ZIP_ENTRY_DATA_CHANGED(e) || (e)->deleted || ZIP_ENTRY_CHANGED((e), ZIP_DIRENT_ALL))
#define ZIP_IS_RDONLY(za) ((za)->ch_flags & ZIP_AFL_RDONLY)
+#define ZIP_IS_TORRENTZIP(za) ((za)->flags & ZIP_AFL_IS_TORRENTZIP)
+#define ZIP_WANT_TORRENTZIP(za) ((za)->ch_flags & ZIP_AFL_WANT_TORRENTZIP)
#ifdef HAVE_EXPLICIT_MEMSET
@@ -487,8 +538,11 @@ void _zip_dirent_finalize(zip_dirent_t *);
void _zip_dirent_init(zip_dirent_t *);
bool _zip_dirent_needs_zip64(const zip_dirent_t *, zip_flags_t);
zip_dirent_t *_zip_dirent_new(void);
+bool zip_dirent_process_ef_zip64(zip_dirent_t * zde, const zip_uint8_t * ef, zip_uint64_t got_len, bool local, zip_error_t * error);
zip_int64_t _zip_dirent_read(zip_dirent_t *zde, zip_source_t *src, zip_buffer_t *buffer, bool local, zip_error_t *error);
void _zip_dirent_set_version_needed(zip_dirent_t *de, bool force_zip64);
+void zip_dirent_torrentzip_normalize(zip_dirent_t *de);
+
zip_int32_t _zip_dirent_size(zip_source_t *src, zip_uint16_t, zip_error_t *);
int _zip_dirent_write(zip_t *za, zip_dirent_t *dirent, zip_flags_t flags);
@@ -510,7 +564,6 @@ void _zip_error_clear(zip_error_t *);
void _zip_error_get(const zip_error_t *, int *, int *);
void _zip_error_copy(zip_error_t *dst, const zip_error_t *src);
-void _zip_error_set_from_source(zip_error_t *, zip_source_t *);
const zip_uint8_t *_zip_extract_extra_field_by_id(zip_error_t *, zip_uint16_t, int, const zip_uint8_t *, zip_uint16_t, zip_uint16_t *);
@@ -532,7 +585,7 @@ zip_hash_t *_zip_hash_new(zip_error_t *error);
bool _zip_hash_reserve_capacity(zip_hash_t *hash, zip_uint64_t capacity, zip_error_t *error);
bool _zip_hash_revert(zip_hash_t *hash, zip_error_t *error);
-int _zip_mkstempm(char *path, int mode);
+int _zip_mkstempm(char *path, int mode, bool create_file);
zip_t *_zip_open(zip_source_t *, unsigned int, zip_error_t *);
@@ -563,16 +616,15 @@ bool _zip_source_had_error(zip_source_t *);
void _zip_source_invalidate(zip_source_t *src);
zip_source_t *_zip_source_new(zip_error_t *error);
int _zip_source_set_source_archive(zip_source_t *, zip_t *);
-zip_source_t *_zip_source_window_new(zip_source_t *src, zip_uint64_t start, zip_uint64_t length, zip_stat_t *st, zip_file_attributes_t *attributes, zip_t *source_archive, zip_uint64_t source_index, zip_error_t *error);
-zip_source_t *_zip_source_zip_new(zip_t *, zip_t *, zip_uint64_t, zip_flags_t, zip_uint64_t, zip_uint64_t, const char *);
+zip_source_t *_zip_source_window_new(zip_source_t *src, zip_uint64_t start, zip_int64_t length, zip_stat_t *st, zip_uint64_t st_invalid, zip_file_attributes_t *attributes, zip_t *source_archive, zip_uint64_t source_index, bool take_ownership, zip_error_t *error);
int _zip_stat_merge(zip_stat_t *dst, const zip_stat_t *src, zip_error_t *error);
-int _zip_string_equal(const zip_string_t *, const zip_string_t *);
-void _zip_string_free(zip_string_t *);
-zip_uint32_t _zip_string_crc32(const zip_string_t *);
-const zip_uint8_t *_zip_string_get(zip_string_t *, zip_uint32_t *, zip_flags_t, zip_error_t *);
-zip_uint16_t _zip_string_length(const zip_string_t *);
-zip_string_t *_zip_string_new(const zip_uint8_t *, zip_uint16_t, zip_flags_t, zip_error_t *);
+int _zip_string_equal(const zip_string_t *a, const zip_string_t *b);
+void _zip_string_free(zip_string_t *string);
+zip_uint32_t _zip_string_crc32(const zip_string_t *string);
+const zip_uint8_t *_zip_string_get(zip_string_t *string, zip_uint32_t *lenp, zip_flags_t flags, zip_error_t *error);
+zip_uint16_t _zip_string_length(const zip_string_t *string);
+zip_string_t *_zip_string_new(const zip_uint8_t *raw, zip_uint16_t length, zip_flags_t flags, zip_error_t *error);
int _zip_string_write(zip_t *za, const zip_string_t *string);
bool _zip_winzip_aes_decrypt(zip_winzip_aes_t *ctx, zip_uint8_t *data, zip_uint64_t length);
bool _zip_winzip_aes_encrypt(zip_winzip_aes_t *ctx, zip_uint8_t *data, zip_uint64_t length);
diff --git a/src/Common/lzma/7zTypes.h b/src/Common/lzma/7zTypes.h
index fe4fde3f..1fcb2473 100644
--- a/src/Common/lzma/7zTypes.h
+++ b/src/Common/lzma/7zTypes.h
@@ -1,8 +1,8 @@
/* 7zTypes.h -- Basic types
-2021-12-25 : Igor Pavlov : Public domain */
+2023-04-02 : Igor Pavlov : Public domain */
-#ifndef __7Z_TYPES_H
-#define __7Z_TYPES_H
+#ifndef ZIP7_7Z_TYPES_H
+#define ZIP7_7Z_TYPES_H
#ifdef _WIN32
/* #include <windows.h> */
@@ -52,6 +52,11 @@ typedef int SRes;
#define MY_ALIGN(n)
#endif
#else
+ /*
+ // C11/C++11:
+ #include <stdalign.h>
+ #define MY_ALIGN(n) alignas(n)
+ */
#define MY_ALIGN(n) __attribute__ ((aligned(n)))
#endif
@@ -62,7 +67,7 @@ typedef int SRes;
typedef unsigned WRes;
#define MY_SRes_HRESULT_FROM_WRes(x) HRESULT_FROM_WIN32(x)
-// #define MY_HRES_ERROR__INTERNAL_ERROR MY_SRes_HRESULT_FROM_WRes(ERROR_INTERNAL_ERROR)
+// #define MY_HRES_ERROR_INTERNAL_ERROR MY_SRes_HRESULT_FROM_WRes(ERROR_INTERNAL_ERROR)
#else // _WIN32
@@ -70,13 +75,13 @@ typedef unsigned WRes;
typedef int WRes;
// (FACILITY_ERRNO = 0x800) is 7zip's FACILITY constant to represent (errno) errors in HRESULT
-#define MY__FACILITY_ERRNO 0x800
-#define MY__FACILITY_WIN32 7
-#define MY__FACILITY__WRes MY__FACILITY_ERRNO
+#define MY_FACILITY_ERRNO 0x800
+#define MY_FACILITY_WIN32 7
+#define MY_FACILITY_WRes MY_FACILITY_ERRNO
#define MY_HRESULT_FROM_errno_CONST_ERROR(x) ((HRESULT)( \
( (HRESULT)(x) & 0x0000FFFF) \
- | (MY__FACILITY__WRes << 16) \
+ | (MY_FACILITY_WRes << 16) \
| (HRESULT)0x80000000 ))
#define MY_SRes_HRESULT_FROM_WRes(x) \
@@ -120,23 +125,19 @@ typedef int WRes;
#define ERROR_INVALID_REPARSE_DATA ((HRESULT)0x80071128L)
#define ERROR_REPARSE_TAG_INVALID ((HRESULT)0x80071129L)
-// if (MY__FACILITY__WRes != FACILITY_WIN32),
+// if (MY_FACILITY_WRes != FACILITY_WIN32),
// we use FACILITY_WIN32 for COM errors:
#define E_OUTOFMEMORY ((HRESULT)0x8007000EL)
#define E_INVALIDARG ((HRESULT)0x80070057L)
-#define MY__E_ERROR_NEGATIVE_SEEK ((HRESULT)0x80070083L)
+#define MY_E_ERROR_NEGATIVE_SEEK ((HRESULT)0x80070083L)
/*
// we can use FACILITY_ERRNO for some COM errors, that have errno equivalents:
#define E_OUTOFMEMORY MY_HRESULT_FROM_errno_CONST_ERROR(ENOMEM)
#define E_INVALIDARG MY_HRESULT_FROM_errno_CONST_ERROR(EINVAL)
-#define MY__E_ERROR_NEGATIVE_SEEK MY_HRESULT_FROM_errno_CONST_ERROR(EINVAL)
+#define MY_E_ERROR_NEGATIVE_SEEK MY_HRESULT_FROM_errno_CONST_ERROR(EINVAL)
*/
-// gcc / clang : (sizeof(long) == sizeof(void*)) in 32/64 bits
-typedef long INT_PTR;
-typedef unsigned long UINT_PTR;
-
#define TEXT(quote) quote
#define FILE_ATTRIBUTE_READONLY 0x0001
@@ -160,18 +161,18 @@ typedef unsigned long UINT_PTR;
#ifndef RINOK
-#define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; }
+#define RINOK(x) { const int _result_ = (x); if (_result_ != 0) return _result_; }
#endif
#ifndef RINOK_WRes
-#define RINOK_WRes(x) { WRes __result__ = (x); if (__result__ != 0) return __result__; }
+#define RINOK_WRes(x) { const WRes _result_ = (x); if (_result_ != 0) return _result_; }
#endif
typedef unsigned char Byte;
typedef short Int16;
typedef unsigned short UInt16;
-#ifdef _LZMA_UINT32_IS_ULONG
+#ifdef Z7_DECL_Int32_AS_long
typedef long Int32;
typedef unsigned long UInt32;
#else
@@ -210,37 +211,51 @@ typedef size_t SIZE_T;
#endif // _WIN32
-#define MY_HRES_ERROR__INTERNAL_ERROR ((HRESULT)0x8007054FL)
-
+#define MY_HRES_ERROR_INTERNAL_ERROR ((HRESULT)0x8007054FL)
-#ifdef _SZ_NO_INT_64
-/* define _SZ_NO_INT_64, if your compiler doesn't support 64-bit integers.
- NOTES: Some code will work incorrectly in that case! */
+#ifdef Z7_DECL_Int64_AS_long
typedef long Int64;
typedef unsigned long UInt64;
#else
-#if defined(_MSC_VER) || defined(__BORLANDC__)
+#if (defined(_MSC_VER) || defined(__BORLANDC__)) && !defined(__clang__)
typedef __int64 Int64;
typedef unsigned __int64 UInt64;
-#define UINT64_CONST(n) n
+#else
+#if defined(__clang__) || defined(__GNUC__)
+#include <stdint.h>
+typedef int64_t Int64;
+typedef uint64_t UInt64;
#else
typedef long long int Int64;
typedef unsigned long long int UInt64;
-#define UINT64_CONST(n) n ## ULL
+// #define UINT64_CONST(n) n ## ULL
+#endif
#endif
#endif
-#ifdef _LZMA_NO_SYSTEM_SIZE_T
-typedef UInt32 SizeT;
+#define UINT64_CONST(n) n
+
+
+#ifdef Z7_DECL_SizeT_AS_unsigned_int
+typedef unsigned int SizeT;
#else
typedef size_t SizeT;
#endif
+/*
+#if (defined(_MSC_VER) && _MSC_VER <= 1200)
+typedef size_t MY_uintptr_t;
+#else
+#include <stdint.h>
+typedef uintptr_t MY_uintptr_t;
+#endif
+*/
+
typedef int BoolInt;
/* typedef BoolInt Bool; */
#define True 1
@@ -248,23 +263,23 @@ typedef int BoolInt;
#ifdef _WIN32
-#define MY_STD_CALL __stdcall
+#define Z7_STDCALL __stdcall
#else
-#define MY_STD_CALL
+#define Z7_STDCALL
#endif
#ifdef _MSC_VER
#if _MSC_VER >= 1300
-#define MY_NO_INLINE __declspec(noinline)
+#define Z7_NO_INLINE __declspec(noinline)
#else
-#define MY_NO_INLINE
+#define Z7_NO_INLINE
#endif
-#define MY_FORCE_INLINE __forceinline
+#define Z7_FORCE_INLINE __forceinline
-#define MY_CDECL __cdecl
-#define MY_FAST_CALL __fastcall
+#define Z7_CDECL __cdecl
+#define Z7_FASTCALL __fastcall
#else // _MSC_VER
@@ -272,27 +287,25 @@ typedef int BoolInt;
|| (defined(__clang__) && (__clang_major__ >= 4)) \
|| defined(__INTEL_COMPILER) \
|| defined(__xlC__)
-#define MY_NO_INLINE __attribute__((noinline))
-// #define MY_FORCE_INLINE __attribute__((always_inline)) inline
+#define Z7_NO_INLINE __attribute__((noinline))
+#define Z7_FORCE_INLINE __attribute__((always_inline)) inline
#else
-#define MY_NO_INLINE
+#define Z7_NO_INLINE
+#define Z7_FORCE_INLINE
#endif
-#define MY_FORCE_INLINE
-
-
-#define MY_CDECL
+#define Z7_CDECL
#if defined(_M_IX86) \
|| defined(__i386__)
-// #define MY_FAST_CALL __attribute__((fastcall))
-// #define MY_FAST_CALL __attribute__((cdecl))
-#define MY_FAST_CALL
+// #define Z7_FASTCALL __attribute__((fastcall))
+// #define Z7_FASTCALL __attribute__((cdecl))
+#define Z7_FASTCALL
#elif defined(MY_CPU_AMD64)
-// #define MY_FAST_CALL __attribute__((ms_abi))
-#define MY_FAST_CALL
+// #define Z7_FASTCALL __attribute__((ms_abi))
+#define Z7_FASTCALL
#else
-#define MY_FAST_CALL
+#define Z7_FASTCALL
#endif
#endif // _MSC_VER
@@ -300,41 +313,49 @@ typedef int BoolInt;
/* The following interfaces use first parameter as pointer to structure */
-typedef struct IByteIn IByteIn;
-struct IByteIn
+// #define Z7_C_IFACE_CONST_QUAL
+#define Z7_C_IFACE_CONST_QUAL const
+
+#define Z7_C_IFACE_DECL(a) \
+ struct a ## _; \
+ typedef Z7_C_IFACE_CONST_QUAL struct a ## _ * a ## Ptr; \
+ typedef struct a ## _ a; \
+ struct a ## _
+
+
+Z7_C_IFACE_DECL (IByteIn)
{
- Byte (*Read)(const IByteIn *p); /* reads one byte, returns 0 in case of EOF or error */
+ Byte (*Read)(IByteInPtr p); /* reads one byte, returns 0 in case of EOF or error */
};
#define IByteIn_Read(p) (p)->Read(p)
-typedef struct IByteOut IByteOut;
-struct IByteOut
+Z7_C_IFACE_DECL (IByteOut)
{
- void (*Write)(const IByteOut *p, Byte b);
+ void (*Write)(IByteOutPtr p, Byte b);
};
#define IByteOut_Write(p, b) (p)->Write(p, b)
-typedef struct ISeqInStream ISeqInStream;
-struct ISeqInStream
+Z7_C_IFACE_DECL (ISeqInStream)
{
- SRes (*Read)(const ISeqInStream *p, void *buf, size_t *size);
+ SRes (*Read)(ISeqInStreamPtr p, void *buf, size_t *size);
/* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
(output(*size) < input(*size)) is allowed */
};
#define ISeqInStream_Read(p, buf, size) (p)->Read(p, buf, size)
+/* try to read as much as avail in stream and limited by (*processedSize) */
+SRes SeqInStream_ReadMax(ISeqInStreamPtr stream, void *buf, size_t *processedSize);
/* it can return SZ_ERROR_INPUT_EOF */
-SRes SeqInStream_Read(const ISeqInStream *stream, void *buf, size_t size);
-SRes SeqInStream_Read2(const ISeqInStream *stream, void *buf, size_t size, SRes errorType);
-SRes SeqInStream_ReadByte(const ISeqInStream *stream, Byte *buf);
+// SRes SeqInStream_Read(ISeqInStreamPtr stream, void *buf, size_t size);
+// SRes SeqInStream_Read2(ISeqInStreamPtr stream, void *buf, size_t size, SRes errorType);
+SRes SeqInStream_ReadByte(ISeqInStreamPtr stream, Byte *buf);
-typedef struct ISeqOutStream ISeqOutStream;
-struct ISeqOutStream
+Z7_C_IFACE_DECL (ISeqOutStream)
{
- size_t (*Write)(const ISeqOutStream *p, const void *buf, size_t size);
+ size_t (*Write)(ISeqOutStreamPtr p, const void *buf, size_t size);
/* Returns: result - the number of actually written bytes.
(result < size) means error */
};
@@ -348,29 +369,26 @@ typedef enum
} ESzSeek;
-typedef struct ISeekInStream ISeekInStream;
-struct ISeekInStream
+Z7_C_IFACE_DECL (ISeekInStream)
{
- SRes (*Read)(const ISeekInStream *p, void *buf, size_t *size); /* same as ISeqInStream::Read */
- SRes (*Seek)(const ISeekInStream *p, Int64 *pos, ESzSeek origin);
+ SRes (*Read)(ISeekInStreamPtr p, void *buf, size_t *size); /* same as ISeqInStream::Read */
+ SRes (*Seek)(ISeekInStreamPtr p, Int64 *pos, ESzSeek origin);
};
#define ISeekInStream_Read(p, buf, size) (p)->Read(p, buf, size)
#define ISeekInStream_Seek(p, pos, origin) (p)->Seek(p, pos, origin)
-typedef struct ILookInStream ILookInStream;
-struct ILookInStream
+Z7_C_IFACE_DECL (ILookInStream)
{
- SRes (*Look)(const ILookInStream *p, const void **buf, size_t *size);
+ SRes (*Look)(ILookInStreamPtr p, const void **buf, size_t *size);
/* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
(output(*size) > input(*size)) is not allowed
(output(*size) < input(*size)) is allowed */
- SRes (*Skip)(const ILookInStream *p, size_t offset);
+ SRes (*Skip)(ILookInStreamPtr p, size_t offset);
/* offset must be <= output(*size) of Look */
-
- SRes (*Read)(const ILookInStream *p, void *buf, size_t *size);
+ SRes (*Read)(ILookInStreamPtr p, void *buf, size_t *size);
/* reads directly (without buffer). It's same as ISeqInStream::Read */
- SRes (*Seek)(const ILookInStream *p, Int64 *pos, ESzSeek origin);
+ SRes (*Seek)(ILookInStreamPtr p, Int64 *pos, ESzSeek origin);
};
#define ILookInStream_Look(p, buf, size) (p)->Look(p, buf, size)
@@ -379,19 +397,18 @@ struct ILookInStream
#define ILookInStream_Seek(p, pos, origin) (p)->Seek(p, pos, origin)
-SRes LookInStream_LookRead(const ILookInStream *stream, void *buf, size_t *size);
-SRes LookInStream_SeekTo(const ILookInStream *stream, UInt64 offset);
+SRes LookInStream_LookRead(ILookInStreamPtr stream, void *buf, size_t *size);
+SRes LookInStream_SeekTo(ILookInStreamPtr stream, UInt64 offset);
/* reads via ILookInStream::Read */
-SRes LookInStream_Read2(const ILookInStream *stream, void *buf, size_t size, SRes errorType);
-SRes LookInStream_Read(const ILookInStream *stream, void *buf, size_t size);
-
+SRes LookInStream_Read2(ILookInStreamPtr stream, void *buf, size_t size, SRes errorType);
+SRes LookInStream_Read(ILookInStreamPtr stream, void *buf, size_t size);
typedef struct
{
ILookInStream vt;
- const ISeekInStream *realStream;
+ ISeekInStreamPtr realStream;
size_t pos;
size_t size; /* it's data size */
@@ -403,13 +420,13 @@ typedef struct
void LookToRead2_CreateVTable(CLookToRead2 *p, int lookahead);
-#define LookToRead2_Init(p) { (p)->pos = (p)->size = 0; }
+#define LookToRead2_INIT(p) { (p)->pos = (p)->size = 0; }
typedef struct
{
ISeqInStream vt;
- const ILookInStream *realStream;
+ ILookInStreamPtr realStream;
} CSecToLook;
void SecToLook_CreateVTable(CSecToLook *p);
@@ -419,20 +436,19 @@ void SecToLook_CreateVTable(CSecToLook *p);
typedef struct
{
ISeqInStream vt;
- const ILookInStream *realStream;
+ ILookInStreamPtr realStream;
} CSecToRead;
void SecToRead_CreateVTable(CSecToRead *p);
-typedef struct ICompressProgress ICompressProgress;
-
-struct ICompressProgress
+Z7_C_IFACE_DECL (ICompressProgress)
{
- SRes (*Progress)(const ICompressProgress *p, UInt64 inSize, UInt64 outSize);
+ SRes (*Progress)(ICompressProgressPtr p, UInt64 inSize, UInt64 outSize);
/* Returns: result. (result != SZ_OK) means break.
Value (UInt64)(Int64)-1 for size means unknown value. */
};
+
#define ICompressProgress_Progress(p, inSize, outSize) (p)->Progress(p, inSize, outSize)
@@ -470,13 +486,13 @@ struct ISzAlloc
-#ifndef MY_container_of
+#ifndef Z7_container_of
/*
-#define MY_container_of(ptr, type, m) container_of(ptr, type, m)
-#define MY_container_of(ptr, type, m) CONTAINING_RECORD(ptr, type, m)
-#define MY_container_of(ptr, type, m) ((type *)((char *)(ptr) - offsetof(type, m)))
-#define MY_container_of(ptr, type, m) (&((type *)0)->m == (ptr), ((type *)(((char *)(ptr)) - MY_offsetof(type, m))))
+#define Z7_container_of(ptr, type, m) container_of(ptr, type, m)
+#define Z7_container_of(ptr, type, m) CONTAINING_RECORD(ptr, type, m)
+#define Z7_container_of(ptr, type, m) ((type *)((char *)(ptr) - offsetof(type, m)))
+#define Z7_container_of(ptr, type, m) (&((type *)0)->m == (ptr), ((type *)(((char *)(ptr)) - MY_offsetof(type, m))))
*/
/*
@@ -485,24 +501,64 @@ struct ISzAlloc
GCC 4.8.1 : classes with non-public variable members"
*/
-#define MY_container_of(ptr, type, m) ((type *)(void *)((char *)(void *)(1 ? (ptr) : &((type *)0)->m) - MY_offsetof(type, m)))
+#define Z7_container_of(ptr, type, m) \
+ ((type *)(void *)((char *)(void *) \
+ (1 ? (ptr) : &((type *)NULL)->m) - MY_offsetof(type, m)))
-#endif
-
-#define CONTAINER_FROM_VTBL_SIMPLE(ptr, type, m) ((type *)(void *)(ptr))
+#define Z7_container_of_CONST(ptr, type, m) \
+ ((const type *)(const void *)((const char *)(const void *) \
+ (1 ? (ptr) : &((type *)NULL)->m) - MY_offsetof(type, m)))
/*
-#define CONTAINER_FROM_VTBL(ptr, type, m) CONTAINER_FROM_VTBL_SIMPLE(ptr, type, m)
+#define Z7_container_of_NON_CONST_FROM_CONST(ptr, type, m) \
+ ((type *)(void *)(const void *)((const char *)(const void *) \
+ (1 ? (ptr) : &((type *)NULL)->m) - MY_offsetof(type, m)))
*/
-#define CONTAINER_FROM_VTBL(ptr, type, m) MY_container_of(ptr, type, m)
-#define CONTAINER_FROM_VTBL_CLS(ptr, type, m) CONTAINER_FROM_VTBL_SIMPLE(ptr, type, m)
+#endif
+
+#define Z7_CONTAINER_FROM_VTBL_SIMPLE(ptr, type, m) ((type *)(void *)(ptr))
+
+// #define Z7_CONTAINER_FROM_VTBL(ptr, type, m) Z7_CONTAINER_FROM_VTBL_SIMPLE(ptr, type, m)
+#define Z7_CONTAINER_FROM_VTBL(ptr, type, m) Z7_container_of(ptr, type, m)
+// #define Z7_CONTAINER_FROM_VTBL(ptr, type, m) Z7_container_of_NON_CONST_FROM_CONST(ptr, type, m)
+
+#define Z7_CONTAINER_FROM_VTBL_CONST(ptr, type, m) Z7_container_of_CONST(ptr, type, m)
+
+#define Z7_CONTAINER_FROM_VTBL_CLS(ptr, type, m) Z7_CONTAINER_FROM_VTBL_SIMPLE(ptr, type, m)
/*
-#define CONTAINER_FROM_VTBL_CLS(ptr, type, m) CONTAINER_FROM_VTBL(ptr, type, m)
+#define Z7_CONTAINER_FROM_VTBL_CLS(ptr, type, m) Z7_CONTAINER_FROM_VTBL(ptr, type, m)
*/
+#if defined (__clang__) || defined(__GNUC__)
+#define Z7_DIAGNOSCTIC_IGNORE_BEGIN_CAST_QUAL \
+ _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Wcast-qual\"")
+#define Z7_DIAGNOSCTIC_IGNORE_END_CAST_QUAL \
+ _Pragma("GCC diagnostic pop")
+#else
+#define Z7_DIAGNOSCTIC_IGNORE_BEGIN_CAST_QUAL
+#define Z7_DIAGNOSCTIC_IGNORE_END_CAST_QUAL
+#endif
+
+#define Z7_CONTAINER_FROM_VTBL_TO_DECL_VAR(ptr, type, m, p) \
+ Z7_DIAGNOSCTIC_IGNORE_BEGIN_CAST_QUAL \
+ type *p = Z7_CONTAINER_FROM_VTBL(ptr, type, m); \
+ Z7_DIAGNOSCTIC_IGNORE_END_CAST_QUAL
+
+#define Z7_CONTAINER_FROM_VTBL_TO_DECL_VAR_pp_vt_p(type) \
+ Z7_CONTAINER_FROM_VTBL_TO_DECL_VAR(pp, type, vt, p)
-#define MY_memset_0_ARRAY(a) memset((a), 0, sizeof(a))
+// #define ZIP7_DECLARE_HANDLE(name) typedef void *name;
+#define Z7_DECLARE_HANDLE(name) struct name##_dummy{int unused;}; typedef struct name##_dummy *name;
+
+
+#define Z7_memset_0_ARRAY(a) memset((a), 0, sizeof(a))
+
+#ifndef Z7_ARRAY_SIZE
+#define Z7_ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
+#endif
+
#ifdef _WIN32
@@ -520,6 +576,22 @@ struct ISzAlloc
#endif
+#define k_PropVar_TimePrec_0 0
+#define k_PropVar_TimePrec_Unix 1
+#define k_PropVar_TimePrec_DOS 2
+#define k_PropVar_TimePrec_HighPrec 3
+#define k_PropVar_TimePrec_Base 16
+#define k_PropVar_TimePrec_100ns (k_PropVar_TimePrec_Base + 7)
+#define k_PropVar_TimePrec_1ns (k_PropVar_TimePrec_Base + 9)
+
EXTERN_C_END
#endif
+
+/*
+#ifndef Z7_ST
+#ifdef _7ZIP_ST
+#define Z7_ST
+#endif
+#endif
+*/
diff --git a/src/Common/lzma/7zWindows.h b/src/Common/lzma/7zWindows.h
new file mode 100644
index 00000000..42c6db8b
--- /dev/null
+++ b/src/Common/lzma/7zWindows.h
@@ -0,0 +1,101 @@
+/* 7zWindows.h -- StdAfx
+2023-04-02 : Igor Pavlov : Public domain */
+
+#ifndef ZIP7_INC_7Z_WINDOWS_H
+#define ZIP7_INC_7Z_WINDOWS_H
+
+#ifdef _WIN32
+
+#if defined(__clang__)
+# pragma clang diagnostic push
+#endif
+
+#if defined(_MSC_VER)
+
+#pragma warning(push)
+#pragma warning(disable : 4668) // '_WIN32_WINNT' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
+
+#if _MSC_VER == 1900
+// for old kit10 versions
+// #pragma warning(disable : 4255) // winuser.h(13979): warning C4255: 'GetThreadDpiAwarenessContext':
+#endif
+// win10 Windows Kit:
+#endif // _MSC_VER
+
+#if defined(_MSC_VER) && _MSC_VER <= 1200 && !defined(_WIN64)
+// for msvc6 without sdk2003
+#define RPC_NO_WINDOWS_H
+#endif
+
+#if defined(__MINGW32__) || defined(__MINGW64__)
+// #if defined(__GNUC__) && !defined(__clang__)
+#include <windows.h>
+#else
+#include <Windows.h>
+#endif
+// #include <basetsd.h>
+// #include <wtypes.h>
+
+// but if precompiled with clang-cl then we need
+// #include <windows.h>
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif
+
+#if defined(__clang__)
+# pragma clang diagnostic pop
+#endif
+
+#if defined(_MSC_VER) && _MSC_VER <= 1200 && !defined(_WIN64)
+#ifndef _W64
+
+typedef long LONG_PTR, *PLONG_PTR;
+typedef unsigned long ULONG_PTR, *PULONG_PTR;
+typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
+
+#define Z7_OLD_WIN_SDK
+#endif // _W64
+#endif // _MSC_VER == 1200
+
+#ifdef Z7_OLD_WIN_SDK
+
+#ifndef INVALID_FILE_ATTRIBUTES
+#define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
+#endif
+#ifndef INVALID_SET_FILE_POINTER
+#define INVALID_SET_FILE_POINTER ((DWORD)-1)
+#endif
+#ifndef FILE_SPECIAL_ACCESS
+#define FILE_SPECIAL_ACCESS (FILE_ANY_ACCESS)
+#endif
+
+// ShlObj.h:
+// #define BIF_NEWDIALOGSTYLE 0x0040
+
+#pragma warning(disable : 4201)
+// #pragma warning(disable : 4115)
+
+#undef VARIANT_TRUE
+#define VARIANT_TRUE ((VARIANT_BOOL)-1)
+#endif
+
+#endif // Z7_OLD_WIN_SDK
+
+#ifdef UNDER_CE
+#undef VARIANT_TRUE
+#define VARIANT_TRUE ((VARIANT_BOOL)-1)
+#endif
+
+
+#if defined(_MSC_VER)
+#if _MSC_VER >= 1400 && _MSC_VER <= 1600
+ // BaseTsd.h(148) : 'HandleToULong' : unreferenced inline function has been removed
+ // string.h
+ // #pragma warning(disable : 4514)
+#endif
+#endif
+
+
+/* #include "7zTypes.h" */
+
+#endif
diff --git a/src/Common/lzma/Alloc.c b/src/Common/lzma/Alloc.c
index d1af76c5..d841bf20 100644
--- a/src/Common/lzma/Alloc.c
+++ b/src/Common/lzma/Alloc.c
@@ -1,38 +1,54 @@
/* Alloc.c -- Memory allocation functions
-2021-07-13 : Igor Pavlov : Public domain */
+2023-04-02 : Igor Pavlov : Public domain */
#include "Precomp.h"
-#include <stdio.h>
-
#ifdef _WIN32
-#include <Windows.h>
+#include "7zWindows.h"
#endif
#include <stdlib.h>
#include "Alloc.h"
-/* #define _SZ_ALLOC_DEBUG */
+#ifdef _WIN32
+#ifdef Z7_LARGE_PAGES
+#if defined(__clang__) || defined(__GNUC__)
+typedef void (*Z7_voidFunction)(void);
+#define MY_CAST_FUNC (Z7_voidFunction)
+#elif defined(_MSC_VER) && _MSC_VER > 1920
+#define MY_CAST_FUNC (void *)
+// #pragma warning(disable : 4191) // 'type cast': unsafe conversion from 'FARPROC' to 'void (__cdecl *)()'
+#else
+#define MY_CAST_FUNC
+#endif
+#endif // Z7_LARGE_PAGES
+#endif // _WIN32
+
+// #define SZ_ALLOC_DEBUG
+/* #define SZ_ALLOC_DEBUG */
-/* use _SZ_ALLOC_DEBUG to debug alloc/free operations */
-#ifdef _SZ_ALLOC_DEBUG
+/* use SZ_ALLOC_DEBUG to debug alloc/free operations */
+#ifdef SZ_ALLOC_DEBUG
+#include <string.h>
#include <stdio.h>
-int g_allocCount = 0;
-int g_allocCountMid = 0;
-int g_allocCountBig = 0;
+static int g_allocCount = 0;
+#ifdef _WIN32
+static int g_allocCountMid = 0;
+static int g_allocCountBig = 0;
+#endif
#define CONVERT_INT_TO_STR(charType, tempSize) \
- unsigned char temp[tempSize]; unsigned i = 0; \
- while (val >= 10) { temp[i++] = (unsigned char)('0' + (unsigned)(val % 10)); val /= 10; } \
+ char temp[tempSize]; unsigned i = 0; \
+ while (val >= 10) { temp[i++] = (char)('0' + (unsigned)(val % 10)); val /= 10; } \
*s++ = (charType)('0' + (unsigned)val); \
while (i != 0) { i--; *s++ = temp[i]; } \
*s = 0;
static void ConvertUInt64ToString(UInt64 val, char *s)
{
- CONVERT_INT_TO_STR(char, 24);
+ CONVERT_INT_TO_STR(char, 24)
}
#define GET_HEX_CHAR(t) ((char)(((t < 10) ? ('0' + t) : ('A' + (t - 10)))))
@@ -77,7 +93,7 @@ static void PrintAligned(const char *s, size_t align)
Print(s);
}
-static void PrintLn()
+static void PrintLn(void)
{
Print("\n");
}
@@ -89,10 +105,10 @@ static void PrintHex(UInt64 v, size_t align)
PrintAligned(s, align);
}
-static void PrintDec(UInt64 v, size_t align)
+static void PrintDec(int v, size_t align)
{
char s[32];
- ConvertUInt64ToString(v, s);
+ ConvertUInt64ToString((unsigned)v, s);
PrintAligned(s, align);
}
@@ -102,12 +118,19 @@ static void PrintAddr(void *p)
}
-#define PRINT_ALLOC(name, cnt, size, ptr) \
+#define PRINT_REALLOC(name, cnt, size, ptr) { \
+ Print(name " "); \
+ if (!ptr) PrintDec(cnt++, 10); \
+ PrintHex(size, 10); \
+ PrintAddr(ptr); \
+ PrintLn(); }
+
+#define PRINT_ALLOC(name, cnt, size, ptr) { \
Print(name " "); \
PrintDec(cnt++, 10); \
PrintHex(size, 10); \
PrintAddr(ptr); \
- PrintLn();
+ PrintLn(); }
#define PRINT_FREE(name, cnt, ptr) if (ptr) { \
Print(name " "); \
@@ -117,7 +140,9 @@ static void PrintAddr(void *p)
#else
+#ifdef _WIN32
#define PRINT_ALLOC(name, cnt, size, ptr)
+#endif
#define PRINT_FREE(name, cnt, ptr)
#define Print(s)
#define PrintLn()
@@ -127,16 +152,31 @@ static void PrintAddr(void *p)
#endif
+/*
+by specification:
+ malloc(non_NULL, 0) : returns NULL or a unique pointer value that can later be successfully passed to free()
+ realloc(NULL, size) : the call is equivalent to malloc(size)
+ realloc(non_NULL, 0) : the call is equivalent to free(ptr)
+
+in main compilers:
+ malloc(0) : returns non_NULL
+ realloc(NULL, 0) : returns non_NULL
+ realloc(non_NULL, 0) : returns NULL
+*/
+
void *MyAlloc(size_t size)
{
if (size == 0)
return NULL;
- PRINT_ALLOC("Alloc ", g_allocCount, size, NULL);
- #ifdef _SZ_ALLOC_DEBUG
+ // PRINT_ALLOC("Alloc ", g_allocCount, size, NULL)
+ #ifdef SZ_ALLOC_DEBUG
{
void *p = malloc(size);
- // PRINT_ALLOC("Alloc ", g_allocCount, size, p);
+ if (p)
+ {
+ PRINT_ALLOC("Alloc ", g_allocCount, size, p)
+ }
return p;
}
#else
@@ -146,33 +186,64 @@ void *MyAlloc(size_t size)
void MyFree(void *address)
{
- PRINT_FREE("Free ", g_allocCount, address);
+ PRINT_FREE("Free ", g_allocCount, address)
free(address);
}
+void *MyRealloc(void *address, size_t size)
+{
+ if (size == 0)
+ {
+ MyFree(address);
+ return NULL;
+ }
+ // PRINT_REALLOC("Realloc ", g_allocCount, size, address)
+ #ifdef SZ_ALLOC_DEBUG
+ {
+ void *p = realloc(address, size);
+ if (p)
+ {
+ PRINT_REALLOC("Realloc ", g_allocCount, size, address)
+ }
+ return p;
+ }
+ #else
+ return realloc(address, size);
+ #endif
+}
+
+
#ifdef _WIN32
void *MidAlloc(size_t size)
{
if (size == 0)
return NULL;
-
- PRINT_ALLOC("Alloc-Mid", g_allocCountMid, size, NULL);
-
+ #ifdef SZ_ALLOC_DEBUG
+ {
+ void *p = VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE);
+ if (p)
+ {
+ PRINT_ALLOC("Alloc-Mid", g_allocCountMid, size, p)
+ }
+ return p;
+ }
+ #else
return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE);
+ #endif
}
void MidFree(void *address)
{
- PRINT_FREE("Free-Mid", g_allocCountMid, address);
+ PRINT_FREE("Free-Mid", g_allocCountMid, address)
if (!address)
return;
VirtualFree(address, 0, MEM_RELEASE);
}
-#ifdef _7ZIP_LARGE_PAGES
+#ifdef Z7_LARGE_PAGES
#ifdef MEM_LARGE_PAGES
#define MY__MEM_LARGE_PAGES MEM_LARGE_PAGES
@@ -183,34 +254,35 @@ void MidFree(void *address)
extern
SIZE_T g_LargePageSize;
SIZE_T g_LargePageSize = 0;
-typedef SIZE_T (WINAPI *GetLargePageMinimumP)(VOID);
+typedef SIZE_T (WINAPI *Func_GetLargePageMinimum)(VOID);
-#endif // _7ZIP_LARGE_PAGES
-
-void SetLargePageSize()
+void SetLargePageSize(void)
{
- #ifdef _7ZIP_LARGE_PAGES
+ #ifdef Z7_LARGE_PAGES
SIZE_T size;
- GetLargePageMinimumP largePageMinimum = (GetLargePageMinimumP)
- GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetLargePageMinimum");
- if (!largePageMinimum)
+ const
+ Func_GetLargePageMinimum fn =
+ (Func_GetLargePageMinimum) MY_CAST_FUNC GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")),
+ "GetLargePageMinimum");
+ if (!fn)
return;
- size = largePageMinimum();
+ size = fn();
if (size == 0 || (size & (size - 1)) != 0)
return;
g_LargePageSize = size;
#endif
}
+#endif // Z7_LARGE_PAGES
void *BigAlloc(size_t size)
{
if (size == 0)
return NULL;
- PRINT_ALLOC("Alloc-Big", g_allocCountBig, size, NULL);
-
- #ifdef _7ZIP_LARGE_PAGES
+ PRINT_ALLOC("Alloc-Big", g_allocCountBig, size, NULL)
+
+ #ifdef Z7_LARGE_PAGES
{
SIZE_T ps = g_LargePageSize;
if (ps != 0 && ps <= (1 << 30) && size > (ps / 2))
@@ -220,38 +292,38 @@ void *BigAlloc(size_t size)
size2 = (size + ps) & ~ps;
if (size2 >= size)
{
- void *res = VirtualAlloc(NULL, size2, MEM_COMMIT | MY__MEM_LARGE_PAGES, PAGE_READWRITE);
- if (res)
- return res;
+ void *p = VirtualAlloc(NULL, size2, MEM_COMMIT | MY__MEM_LARGE_PAGES, PAGE_READWRITE);
+ if (p)
+ {
+ PRINT_ALLOC("Alloc-BM ", g_allocCountMid, size2, p)
+ return p;
+ }
}
}
}
#endif
- return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE);
+ return MidAlloc(size);
}
void BigFree(void *address)
{
- PRINT_FREE("Free-Big", g_allocCountBig, address);
-
- if (!address)
- return;
- VirtualFree(address, 0, MEM_RELEASE);
+ PRINT_FREE("Free-Big", g_allocCountBig, address)
+ MidFree(address);
}
-#endif
+#endif // _WIN32
-static void *SzAlloc(ISzAllocPtr p, size_t size) { UNUSED_VAR(p); return MyAlloc(size); }
-static void SzFree(ISzAllocPtr p, void *address) { UNUSED_VAR(p); MyFree(address); }
+static void *SzAlloc(ISzAllocPtr p, size_t size) { UNUSED_VAR(p) return MyAlloc(size); }
+static void SzFree(ISzAllocPtr p, void *address) { UNUSED_VAR(p) MyFree(address); }
const ISzAlloc g_Alloc = { SzAlloc, SzFree };
#ifdef _WIN32
-static void *SzMidAlloc(ISzAllocPtr p, size_t size) { UNUSED_VAR(p); return MidAlloc(size); }
-static void SzMidFree(ISzAllocPtr p, void *address) { UNUSED_VAR(p); MidFree(address); }
-static void *SzBigAlloc(ISzAllocPtr p, size_t size) { UNUSED_VAR(p); return BigAlloc(size); }
-static void SzBigFree(ISzAllocPtr p, void *address) { UNUSED_VAR(p); BigFree(address); }
+static void *SzMidAlloc(ISzAllocPtr p, size_t size) { UNUSED_VAR(p) return MidAlloc(size); }
+static void SzMidFree(ISzAllocPtr p, void *address) { UNUSED_VAR(p) MidFree(address); }
+static void *SzBigAlloc(ISzAllocPtr p, size_t size) { UNUSED_VAR(p) return BigAlloc(size); }
+static void SzBigFree(ISzAllocPtr p, void *address) { UNUSED_VAR(p) BigFree(address); }
const ISzAlloc g_MidAlloc = { SzMidAlloc, SzMidFree };
const ISzAlloc g_BigAlloc = { SzBigAlloc, SzBigFree };
#endif
@@ -334,7 +406,7 @@ static void *SzAlignedAlloc(ISzAllocPtr pp, size_t size)
void *p;
void *pAligned;
size_t newSize;
- UNUSED_VAR(pp);
+ UNUSED_VAR(pp)
/* also we can allocate additional dummy ALLOC_ALIGN_SIZE bytes after aligned
block to prevent cache line sharing with another allocated blocks */
@@ -362,7 +434,7 @@ static void *SzAlignedAlloc(ISzAllocPtr pp, size_t size)
#else
void *p;
- UNUSED_VAR(pp);
+ UNUSED_VAR(pp)
if (posix_memalign(&p, ALLOC_ALIGN_SIZE, size))
return NULL;
@@ -377,7 +449,7 @@ static void *SzAlignedAlloc(ISzAllocPtr pp, size_t size)
static void SzAlignedFree(ISzAllocPtr pp, void *address)
{
- UNUSED_VAR(pp);
+ UNUSED_VAR(pp)
#ifndef USE_posix_memalign
if (address)
MyFree(((void **)address)[-1]);
@@ -401,7 +473,7 @@ const ISzAlloc g_AlignedAlloc = { SzAlignedAlloc, SzAlignedFree };
static void *AlignOffsetAlloc_Alloc(ISzAllocPtr pp, size_t size)
{
- CAlignOffsetAlloc *p = CONTAINER_FROM_VTBL(pp, CAlignOffsetAlloc, vt);
+ const CAlignOffsetAlloc *p = Z7_CONTAINER_FROM_VTBL_CONST(pp, CAlignOffsetAlloc, vt);
void *adr;
void *pAligned;
size_t newSize;
@@ -447,7 +519,7 @@ static void AlignOffsetAlloc_Free(ISzAllocPtr pp, void *address)
{
if (address)
{
- CAlignOffsetAlloc *p = CONTAINER_FROM_VTBL(pp, CAlignOffsetAlloc, vt);
+ const CAlignOffsetAlloc *p = Z7_CONTAINER_FROM_VTBL_CONST(pp, CAlignOffsetAlloc, vt);
PrintLn();
Print("- Aligned Free: ");
PrintLn();
diff --git a/src/Common/lzma/Alloc.h b/src/Common/lzma/Alloc.h
index 3be2041e..fac5b62f 100644
--- a/src/Common/lzma/Alloc.h
+++ b/src/Common/lzma/Alloc.h
@@ -1,19 +1,32 @@
/* Alloc.h -- Memory allocation functions
-2021-07-13 : Igor Pavlov : Public domain */
+2023-03-04 : Igor Pavlov : Public domain */
-#ifndef __COMMON_ALLOC_H
-#define __COMMON_ALLOC_H
+#ifndef ZIP7_INC_ALLOC_H
+#define ZIP7_INC_ALLOC_H
#include "7zTypes.h"
EXTERN_C_BEGIN
+/*
+ MyFree(NULL) : is allowed, as free(NULL)
+ MyAlloc(0) : returns NULL : but malloc(0) is allowed to return NULL or non_NULL
+ MyRealloc(NULL, 0) : returns NULL : but realloc(NULL, 0) is allowed to return NULL or non_NULL
+MyRealloc() is similar to realloc() for the following cases:
+ MyRealloc(non_NULL, 0) : returns NULL and always calls MyFree(ptr)
+ MyRealloc(NULL, non_ZERO) : returns NULL, if allocation failed
+ MyRealloc(non_NULL, non_ZERO) : returns NULL, if reallocation failed
+*/
+
void *MyAlloc(size_t size);
void MyFree(void *address);
+void *MyRealloc(void *address, size_t size);
#ifdef _WIN32
+#ifdef Z7_LARGE_PAGES
void SetLargePageSize(void);
+#endif
void *MidAlloc(size_t size);
void MidFree(void *address);
diff --git a/src/Common/lzma/Compiler.h b/src/Common/lzma/Compiler.h
index a9816fa5..185a52de 100644
--- a/src/Common/lzma/Compiler.h
+++ b/src/Common/lzma/Compiler.h
@@ -1,12 +1,37 @@
-/* Compiler.h
-2021-01-05 : Igor Pavlov : Public domain */
+/* Compiler.h : Compiler specific defines and pragmas
+2023-04-02 : Igor Pavlov : Public domain */
-#ifndef __7Z_COMPILER_H
-#define __7Z_COMPILER_H
+#ifndef ZIP7_INC_COMPILER_H
+#define ZIP7_INC_COMPILER_H
+
+#if defined(__clang__)
+# define Z7_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
+#endif
+#if defined(__clang__) && defined(__apple_build_version__)
+# define Z7_APPLE_CLANG_VERSION Z7_CLANG_VERSION
+#elif defined(__clang__)
+# define Z7_LLVM_CLANG_VERSION Z7_CLANG_VERSION
+#elif defined(__GNUC__)
+# define Z7_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
+#endif
+
+#ifdef _MSC_VER
+#if !defined(__clang__) && !defined(__GNUC__)
+#define Z7_MSC_VER_ORIGINAL _MSC_VER
+#endif
+#endif
+
+#if defined(__MINGW32__) || defined(__MINGW64__)
+#define Z7_MINGW
+#endif
+
+// #pragma GCC diagnostic ignored "-Wunknown-pragmas"
+
+#ifdef __clang__
+// padding size of '' with 4 bytes to alignment boundary
+#pragma GCC diagnostic ignored "-Wpadded"
+#endif
- #ifdef __clang__
- #pragma clang diagnostic ignored "-Wunused-private-field"
- #endif
#ifdef _MSC_VER
@@ -17,24 +42,115 @@
#pragma warning(disable : 4214) // nonstandard extension used : bit field types other than int
#endif
- #if _MSC_VER >= 1300
- #pragma warning(disable : 4996) // This function or variable may be unsafe
- #else
- #pragma warning(disable : 4511) // copy constructor could not be generated
- #pragma warning(disable : 4512) // assignment operator could not be generated
- #pragma warning(disable : 4514) // unreferenced inline function has been removed
- #pragma warning(disable : 4702) // unreachable code
- #pragma warning(disable : 4710) // not inlined
- #pragma warning(disable : 4714) // function marked as __forceinline not inlined
- #pragma warning(disable : 4786) // identifier was truncated to '255' characters in the debug information
- #endif
+#if defined(_MSC_VER) && _MSC_VER >= 1800
+#pragma warning(disable : 4464) // relative include path contains '..'
+#endif
+
+// == 1200 : -O1 : for __forceinline
+// >= 1900 : -O1 : for printf
+#pragma warning(disable : 4710) // function not inlined
+
+#if _MSC_VER < 1900
+// winnt.h: 'Int64ShllMod32'
+#pragma warning(disable : 4514) // unreferenced inline function has been removed
+#endif
+
+#if _MSC_VER < 1300
+// #pragma warning(disable : 4702) // unreachable code
+// Bra.c : -O1:
+#pragma warning(disable : 4714) // function marked as __forceinline not inlined
+#endif
+
+/*
+#if _MSC_VER > 1400 && _MSC_VER <= 1900
+// strcat: This function or variable may be unsafe
+// sysinfoapi.h: kit10: GetVersion was declared deprecated
+#pragma warning(disable : 4996)
+#endif
+*/
+
+#if _MSC_VER > 1200
+// -Wall warnings
+
+#pragma warning(disable : 4711) // function selected for automatic inline expansion
+#pragma warning(disable : 4820) // '2' bytes padding added after data member
+
+#if _MSC_VER >= 1400 && _MSC_VER < 1920
+// 1400: string.h: _DBG_MEMCPY_INLINE_
+// 1600 - 191x : smmintrin.h __cplusplus'
+// is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
+#pragma warning(disable : 4668)
+
+// 1400 - 1600 : WinDef.h : 'FARPROC' :
+// 1900 - 191x : immintrin.h: _readfsbase_u32
+// no function prototype given : converting '()' to '(void)'
+#pragma warning(disable : 4255)
+#endif
+
+#if _MSC_VER >= 1914
+// Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified
+#pragma warning(disable : 5045)
+#endif
+
+#endif // _MSC_VER > 1200
+#endif // _MSC_VER
+
+
+#if defined(__clang__) && (__clang_major__ >= 4)
+ #define Z7_PRAGMA_OPT_DISABLE_LOOP_UNROLL_VECTORIZE \
+ _Pragma("clang loop unroll(disable)") \
+ _Pragma("clang loop vectorize(disable)")
+ #define Z7_ATTRIB_NO_VECTORIZE
+#elif defined(__GNUC__) && (__GNUC__ >= 5)
+ #define Z7_ATTRIB_NO_VECTORIZE __attribute__((optimize("no-tree-vectorize")))
+ // __attribute__((optimize("no-unroll-loops")));
+ #define Z7_PRAGMA_OPT_DISABLE_LOOP_UNROLL_VECTORIZE
+#elif defined(_MSC_VER) && (_MSC_VER >= 1920)
+ #define Z7_PRAGMA_OPT_DISABLE_LOOP_UNROLL_VECTORIZE \
+ _Pragma("loop( no_vector )")
+ #define Z7_ATTRIB_NO_VECTORIZE
+#else
+ #define Z7_PRAGMA_OPT_DISABLE_LOOP_UNROLL_VECTORIZE
+ #define Z7_ATTRIB_NO_VECTORIZE
+#endif
+
+#if defined(MY_CPU_X86_OR_AMD64) && ( \
+ defined(__clang__) && (__clang_major__ >= 4) \
+ || defined(__GNUC__) && (__GNUC__ >= 5))
+ #define Z7_ATTRIB_NO_SSE __attribute__((__target__("no-sse")))
+#else
+ #define Z7_ATTRIB_NO_SSE
+#endif
+
+#define Z7_ATTRIB_NO_VECTOR \
+ Z7_ATTRIB_NO_VECTORIZE \
+ Z7_ATTRIB_NO_SSE
+
+
+#if defined(__clang__) && (__clang_major__ >= 8) \
+ || defined(__GNUC__) && (__GNUC__ >= 1000) \
+ /* || defined(_MSC_VER) && (_MSC_VER >= 1920) */
+ // GCC is not good for __builtin_expect()
+ #define Z7_LIKELY(x) (__builtin_expect((x), 1))
+ #define Z7_UNLIKELY(x) (__builtin_expect((x), 0))
+ // #define Z7_unlikely [[unlikely]]
+ // #define Z7_likely [[likely]]
+#else
+ #define Z7_LIKELY(x) (x)
+ #define Z7_UNLIKELY(x) (x)
+ // #define Z7_likely
+#endif
- #ifdef __clang__
- #pragma clang diagnostic ignored "-Wdeprecated-declarations"
- #pragma clang diagnostic ignored "-Wmicrosoft-exception-spec"
- // #pragma clang diagnostic ignored "-Wreserved-id-macro"
- #endif
+#if (defined(Z7_CLANG_VERSION) && (Z7_CLANG_VERSION >= 36000))
+#define Z7_DIAGNOSCTIC_IGNORE_BEGIN_RESERVED_MACRO_IDENTIFIER \
+ _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Wreserved-macro-identifier\"")
+#define Z7_DIAGNOSCTIC_IGNORE_END_RESERVED_MACRO_IDENTIFIER \
+ _Pragma("GCC diagnostic pop")
+#else
+#define Z7_DIAGNOSCTIC_IGNORE_BEGIN_RESERVED_MACRO_IDENTIFIER
+#define Z7_DIAGNOSCTIC_IGNORE_END_RESERVED_MACRO_IDENTIFIER
#endif
#define UNUSED_VAR(x) (void)x;
diff --git a/src/Common/lzma/CpuArch.c b/src/Common/lzma/CpuArch.c
index fa9afe39..33f8a3ab 100644
--- a/src/Common/lzma/CpuArch.c
+++ b/src/Common/lzma/CpuArch.c
@@ -1,187 +1,318 @@
/* CpuArch.c -- CPU specific code
-2021-07-13 : Igor Pavlov : Public domain */
+2023-05-18 : Igor Pavlov : Public domain */
#include "Precomp.h"
+// #include <stdio.h>
+
#include "CpuArch.h"
#ifdef MY_CPU_X86_OR_AMD64
-#if (defined(_MSC_VER) && !defined(MY_CPU_AMD64)) || defined(__GNUC__)
-#define USE_ASM
+#undef NEED_CHECK_FOR_CPUID
+#if !defined(MY_CPU_AMD64)
+#define NEED_CHECK_FOR_CPUID
#endif
-#if !defined(USE_ASM) && _MSC_VER >= 1500
-#include <intrin.h>
+/*
+ cpuid instruction supports (subFunction) parameter in ECX,
+ that is used only with some specific (function) parameter values.
+ But we always use only (subFunction==0).
+*/
+/*
+ __cpuid(): MSVC and GCC/CLANG use same function/macro name
+ but parameters are different.
+ We use MSVC __cpuid() parameters style for our z7_x86_cpuid() function.
+*/
+
+#if defined(__GNUC__) /* && (__GNUC__ >= 10) */ \
+ || defined(__clang__) /* && (__clang_major__ >= 10) */
+
+/* there was some CLANG/GCC compilers that have issues with
+ rbx(ebx) handling in asm blocks in -fPIC mode (__PIC__ is defined).
+ compiler's <cpuid.h> contains the macro __cpuid() that is similar to our code.
+ The history of __cpuid() changes in CLANG/GCC:
+ GCC:
+ 2007: it preserved ebx for (__PIC__ && __i386__)
+ 2013: it preserved rbx and ebx for __PIC__
+ 2014: it doesn't preserves rbx and ebx anymore
+ we suppose that (__GNUC__ >= 5) fixed that __PIC__ ebx/rbx problem.
+ CLANG:
+ 2014+: it preserves rbx, but only for 64-bit code. No __PIC__ check.
+ Why CLANG cares about 64-bit mode only, and doesn't care about ebx (in 32-bit)?
+ Do we need __PIC__ test for CLANG or we must care about rbx even if
+ __PIC__ is not defined?
+*/
+
+#define ASM_LN "\n"
+
+#if defined(MY_CPU_AMD64) && defined(__PIC__) \
+ && ((defined (__GNUC__) && (__GNUC__ < 5)) || defined(__clang__))
+
+#define x86_cpuid_MACRO(p, func) { \
+ __asm__ __volatile__ ( \
+ ASM_LN "mov %%rbx, %q1" \
+ ASM_LN "cpuid" \
+ ASM_LN "xchg %%rbx, %q1" \
+ : "=a" ((p)[0]), "=&r" ((p)[1]), "=c" ((p)[2]), "=d" ((p)[3]) : "0" (func), "2"(0)); }
+
+ /* "=&r" selects free register. It can select even rbx, if that register is free.
+ "=&D" for (RDI) also works, but the code can be larger with "=&D"
+ "2"(0) means (subFunction = 0),
+ 2 is (zero-based) index in the output constraint list "=c" (ECX). */
+
+#elif defined(MY_CPU_X86) && defined(__PIC__) \
+ && ((defined (__GNUC__) && (__GNUC__ < 5)) || defined(__clang__))
+
+#define x86_cpuid_MACRO(p, func) { \
+ __asm__ __volatile__ ( \
+ ASM_LN "mov %%ebx, %k1" \
+ ASM_LN "cpuid" \
+ ASM_LN "xchg %%ebx, %k1" \
+ : "=a" ((p)[0]), "=&r" ((p)[1]), "=c" ((p)[2]), "=d" ((p)[3]) : "0" (func), "2"(0)); }
+
+#else
+
+#define x86_cpuid_MACRO(p, func) { \
+ __asm__ __volatile__ ( \
+ ASM_LN "cpuid" \
+ : "=a" ((p)[0]), "=b" ((p)[1]), "=c" ((p)[2]), "=d" ((p)[3]) : "0" (func), "2"(0)); }
+
#endif
-#if defined(USE_ASM) && !defined(MY_CPU_AMD64)
-static UInt32 CheckFlag(UInt32 flag)
-{
- #ifdef _MSC_VER
- __asm pushfd;
- __asm pop EAX;
- __asm mov EDX, EAX;
- __asm xor EAX, flag;
- __asm push EAX;
- __asm popfd;
- __asm pushfd;
- __asm pop EAX;
- __asm xor EAX, EDX;
- __asm push EDX;
- __asm popfd;
- __asm and flag, EAX;
- #else
+
+void Z7_FASTCALL z7_x86_cpuid(UInt32 p[4], UInt32 func)
+{
+ x86_cpuid_MACRO(p, func)
+}
+
+
+Z7_NO_INLINE
+UInt32 Z7_FASTCALL z7_x86_cpuid_GetMaxFunc(void)
+{
+ #if defined(NEED_CHECK_FOR_CPUID)
+ #define EFALGS_CPUID_BIT 21
+ UInt32 a;
__asm__ __volatile__ (
- "pushf\n\t"
- "pop %%EAX\n\t"
- "movl %%EAX,%%EDX\n\t"
- "xorl %0,%%EAX\n\t"
- "push %%EAX\n\t"
- "popf\n\t"
- "pushf\n\t"
- "pop %%EAX\n\t"
- "xorl %%EDX,%%EAX\n\t"
- "push %%EDX\n\t"
- "popf\n\t"
- "andl %%EAX, %0\n\t":
- "=c" (flag) : "c" (flag) :
- "%eax", "%edx");
+ ASM_LN "pushf"
+ ASM_LN "pushf"
+ ASM_LN "pop %0"
+ // ASM_LN "movl %0, %1"
+ // ASM_LN "xorl $0x200000, %0"
+ ASM_LN "btc %1, %0"
+ ASM_LN "push %0"
+ ASM_LN "popf"
+ ASM_LN "pushf"
+ ASM_LN "pop %0"
+ ASM_LN "xorl (%%esp), %0"
+
+ ASM_LN "popf"
+ ASM_LN
+ : "=&r" (a) // "=a"
+ : "i" (EFALGS_CPUID_BIT)
+ );
+ if ((a & (1 << EFALGS_CPUID_BIT)) == 0)
+ return 0;
+ #endif
+ {
+ UInt32 p[4];
+ x86_cpuid_MACRO(p, 0)
+ return p[0];
+ }
+}
+
+#undef ASM_LN
+
+#elif !defined(_MSC_VER)
+
+/*
+// for gcc/clang and other: we can try to use __cpuid macro:
+#include <cpuid.h>
+void Z7_FASTCALL z7_x86_cpuid(UInt32 p[4], UInt32 func)
+{
+ __cpuid(func, p[0], p[1], p[2], p[3]);
+}
+UInt32 Z7_FASTCALL z7_x86_cpuid_GetMaxFunc(void)
+{
+ return (UInt32)__get_cpuid_max(0, NULL);
+}
+*/
+// for unsupported cpuid:
+void Z7_FASTCALL z7_x86_cpuid(UInt32 p[4], UInt32 func)
+{
+ UNUSED_VAR(func)
+ p[0] = p[1] = p[2] = p[3] = 0;
+}
+UInt32 Z7_FASTCALL z7_x86_cpuid_GetMaxFunc(void)
+{
+ return 0;
+}
+
+#else // _MSC_VER
+
+#if !defined(MY_CPU_AMD64)
+
+UInt32 __declspec(naked) Z7_FASTCALL z7_x86_cpuid_GetMaxFunc(void)
+{
+ #if defined(NEED_CHECK_FOR_CPUID)
+ #define EFALGS_CPUID_BIT 21
+ __asm pushfd
+ __asm pushfd
+ /*
+ __asm pop eax
+ // __asm mov edx, eax
+ __asm btc eax, EFALGS_CPUID_BIT
+ __asm push eax
+ */
+ __asm btc dword ptr [esp], EFALGS_CPUID_BIT
+ __asm popfd
+ __asm pushfd
+ __asm pop eax
+ // __asm xor eax, edx
+ __asm xor eax, [esp]
+ // __asm push edx
+ __asm popfd
+ __asm and eax, (1 shl EFALGS_CPUID_BIT)
+ __asm jz end_func
+ #endif
+ __asm push ebx
+ __asm xor eax, eax // func
+ __asm xor ecx, ecx // subFunction (optional) for (func == 0)
+ __asm cpuid
+ __asm pop ebx
+ #if defined(NEED_CHECK_FOR_CPUID)
+ end_func:
#endif
- return flag;
+ __asm ret 0
}
-#define CHECK_CPUID_IS_SUPPORTED if (CheckFlag(1 << 18) == 0 || CheckFlag(1 << 21) == 0) return False;
-#else
-#define CHECK_CPUID_IS_SUPPORTED
-#endif
-#ifndef USE_ASM
- #ifdef _MSC_VER
+void __declspec(naked) Z7_FASTCALL z7_x86_cpuid(UInt32 p[4], UInt32 func)
+{
+ UNUSED_VAR(p)
+ UNUSED_VAR(func)
+ __asm push ebx
+ __asm push edi
+ __asm mov edi, ecx // p
+ __asm mov eax, edx // func
+ __asm xor ecx, ecx // subfunction (optional) for (func == 0)
+ __asm cpuid
+ __asm mov [edi ], eax
+ __asm mov [edi + 4], ebx
+ __asm mov [edi + 8], ecx
+ __asm mov [edi + 12], edx
+ __asm pop edi
+ __asm pop ebx
+ __asm ret 0
+}
+
+#else // MY_CPU_AMD64
+
#if _MSC_VER >= 1600
- #define MY__cpuidex __cpuidex
+ #include <intrin.h>
+ #define MY_cpuidex __cpuidex
#else
-
/*
- __cpuid (function == 4) requires subfunction number in ECX.
+ __cpuid (func == (0 or 7)) requires subfunction number in ECX.
MSDN: The __cpuid intrinsic clears the ECX register before calling the cpuid instruction.
__cpuid() in new MSVC clears ECX.
- __cpuid() in old MSVC (14.00) doesn't clear ECX
- We still can use __cpuid for low (function) values that don't require ECX,
- but __cpuid() in old MSVC will be incorrect for some function values: (function == 4).
+ __cpuid() in old MSVC (14.00) x64 doesn't clear ECX
+ We still can use __cpuid for low (func) values that don't require ECX,
+ but __cpuid() in old MSVC will be incorrect for some func values: (func == 7).
So here we use the hack for old MSVC to send (subFunction) in ECX register to cpuid instruction,
- where ECX value is first parameter for FAST_CALL / NO_INLINE function,
- So the caller of MY__cpuidex_HACK() sets ECX as subFunction, and
+ where ECX value is first parameter for FASTCALL / NO_INLINE func,
+ So the caller of MY_cpuidex_HACK() sets ECX as subFunction, and
old MSVC for __cpuid() doesn't change ECX and cpuid instruction gets (subFunction) value.
- DON'T remove MY_NO_INLINE and MY_FAST_CALL for MY__cpuidex_HACK() !!!
+DON'T remove Z7_NO_INLINE and Z7_FASTCALL for MY_cpuidex_HACK(): !!!
*/
-
static
-MY_NO_INLINE
-void MY_FAST_CALL MY__cpuidex_HACK(UInt32 subFunction, int *CPUInfo, UInt32 function)
+Z7_NO_INLINE void Z7_FASTCALL MY_cpuidex_HACK(UInt32 subFunction, UInt32 func, int *CPUInfo)
{
- UNUSED_VAR(subFunction);
- __cpuid(CPUInfo, function);
+ UNUSED_VAR(subFunction)
+ __cpuid(CPUInfo, func);
}
-
- #define MY__cpuidex(info, func, func2) MY__cpuidex_HACK(func2, info, func)
- #pragma message("======== MY__cpuidex_HACK WAS USED ========")
- #endif
- #else
- #define MY__cpuidex(info, func, func2) __cpuid(info, func)
- #pragma message("======== (INCORRECT ?) cpuid WAS USED ========")
- #endif
+ #define MY_cpuidex(info, func, func2) MY_cpuidex_HACK(func2, func, info)
+ #pragma message("======== MY_cpuidex_HACK WAS USED ========")
+ #endif // _MSC_VER >= 1600
+
+#if !defined(MY_CPU_AMD64)
+/* inlining for __cpuid() in MSVC x86 (32-bit) produces big ineffective code,
+ so we disable inlining here */
+Z7_NO_INLINE
#endif
-
-
-
-
-void MyCPUID(UInt32 function, UInt32 *a, UInt32 *b, UInt32 *c, UInt32 *d)
+void Z7_FASTCALL z7_x86_cpuid(UInt32 p[4], UInt32 func)
{
- #ifdef USE_ASM
-
- #ifdef _MSC_VER
-
- UInt32 a2, b2, c2, d2;
- __asm xor EBX, EBX;
- __asm xor ECX, ECX;
- __asm xor EDX, EDX;
- __asm mov EAX, function;
- __asm cpuid;
- __asm mov a2, EAX;
- __asm mov b2, EBX;
- __asm mov c2, ECX;
- __asm mov d2, EDX;
-
- *a = a2;
- *b = b2;
- *c = c2;
- *d = d2;
-
- #else
-
- __asm__ __volatile__ (
- #if defined(MY_CPU_AMD64) && defined(__PIC__)
- "mov %%rbx, %%rdi;"
- "cpuid;"
- "xchg %%rbx, %%rdi;"
- : "=a" (*a) ,
- "=D" (*b) ,
- #elif defined(MY_CPU_X86) && defined(__PIC__)
- "mov %%ebx, %%edi;"
- "cpuid;"
- "xchgl %%ebx, %%edi;"
- : "=a" (*a) ,
- "=D" (*b) ,
- #else
- "cpuid"
- : "=a" (*a) ,
- "=b" (*b) ,
- #endif
- "=c" (*c) ,
- "=d" (*d)
- : "0" (function), "c"(0) ) ;
-
- #endif
-
- #else
+ MY_cpuidex((int *)p, (int)func, 0);
+}
- int CPUInfo[4];
+Z7_NO_INLINE
+UInt32 Z7_FASTCALL z7_x86_cpuid_GetMaxFunc(void)
+{
+ int a[4];
+ MY_cpuidex(a, 0, 0);
+ return a[0];
+}
- MY__cpuidex(CPUInfo, (int)function, 0);
+#endif // MY_CPU_AMD64
+#endif // _MSC_VER
- *a = (UInt32)CPUInfo[0];
- *b = (UInt32)CPUInfo[1];
- *c = (UInt32)CPUInfo[2];
- *d = (UInt32)CPUInfo[3];
+#if defined(NEED_CHECK_FOR_CPUID)
+#define CHECK_CPUID_IS_SUPPORTED { if (z7_x86_cpuid_GetMaxFunc() == 0) return 0; }
+#else
+#define CHECK_CPUID_IS_SUPPORTED
+#endif
+#undef NEED_CHECK_FOR_CPUID
- #endif
-}
-BoolInt x86cpuid_CheckAndRead(Cx86cpuid *p)
+static
+BoolInt x86cpuid_Func_1(UInt32 *p)
{
CHECK_CPUID_IS_SUPPORTED
- MyCPUID(0, &p->maxFunc, &p->vendor[0], &p->vendor[2], &p->vendor[1]);
- MyCPUID(1, &p->ver, &p->b, &p->c, &p->d);
+ z7_x86_cpuid(p, 1);
return True;
}
-static const UInt32 kVendors[][3] =
+/*
+static const UInt32 kVendors[][1] =
{
- { 0x756E6547, 0x49656E69, 0x6C65746E},
- { 0x68747541, 0x69746E65, 0x444D4163},
- { 0x746E6543, 0x48727561, 0x736C7561}
+ { 0x756E6547 }, // , 0x49656E69, 0x6C65746E },
+ { 0x68747541 }, // , 0x69746E65, 0x444D4163 },
+ { 0x746E6543 } // , 0x48727561, 0x736C7561 }
};
+*/
+
+/*
+typedef struct
+{
+ UInt32 maxFunc;
+ UInt32 vendor[3];
+ UInt32 ver;
+ UInt32 b;
+ UInt32 c;
+ UInt32 d;
+} Cx86cpuid;
+
+enum
+{
+ CPU_FIRM_INTEL,
+ CPU_FIRM_AMD,
+ CPU_FIRM_VIA
+};
+int x86cpuid_GetFirm(const Cx86cpuid *p);
+#define x86cpuid_ver_GetFamily(ver) (((ver >> 16) & 0xff0) | ((ver >> 8) & 0xf))
+#define x86cpuid_ver_GetModel(ver) (((ver >> 12) & 0xf0) | ((ver >> 4) & 0xf))
+#define x86cpuid_ver_GetStepping(ver) (ver & 0xf)
int x86cpuid_GetFirm(const Cx86cpuid *p)
{
unsigned i;
- for (i = 0; i < sizeof(kVendors) / sizeof(kVendors[i]); i++)
+ for (i = 0; i < sizeof(kVendors) / sizeof(kVendors[0]); i++)
{
const UInt32 *v = kVendors[i];
- if (v[0] == p->vendor[0] &&
- v[1] == p->vendor[1] &&
- v[2] == p->vendor[2])
+ if (v[0] == p->vendor[0]
+ // && v[1] == p->vendor[1]
+ // && v[2] == p->vendor[2]
+ )
return (int)i;
}
return -1;
@@ -190,41 +321,55 @@ int x86cpuid_GetFirm(const Cx86cpuid *p)
BoolInt CPU_Is_InOrder()
{
Cx86cpuid p;
- int firm;
UInt32 family, model;
if (!x86cpuid_CheckAndRead(&p))
return True;
- family = x86cpuid_GetFamily(p.ver);
- model = x86cpuid_GetModel(p.ver);
-
- firm = x86cpuid_GetFirm(&p);
+ family = x86cpuid_ver_GetFamily(p.ver);
+ model = x86cpuid_ver_GetModel(p.ver);
- switch (firm)
+ switch (x86cpuid_GetFirm(&p))
{
case CPU_FIRM_INTEL: return (family < 6 || (family == 6 && (
- /* In-Order Atom CPU */
- model == 0x1C /* 45 nm, N4xx, D4xx, N5xx, D5xx, 230, 330 */
- || model == 0x26 /* 45 nm, Z6xx */
- || model == 0x27 /* 32 nm, Z2460 */
- || model == 0x35 /* 32 nm, Z2760 */
- || model == 0x36 /* 32 nm, N2xxx, D2xxx */
+ // In-Order Atom CPU
+ model == 0x1C // 45 nm, N4xx, D4xx, N5xx, D5xx, 230, 330
+ || model == 0x26 // 45 nm, Z6xx
+ || model == 0x27 // 32 nm, Z2460
+ || model == 0x35 // 32 nm, Z2760
+ || model == 0x36 // 32 nm, N2xxx, D2xxx
)));
case CPU_FIRM_AMD: return (family < 5 || (family == 5 && (model < 6 || model == 0xA)));
case CPU_FIRM_VIA: return (family < 6 || (family == 6 && model < 0xF));
}
- return True;
+ return False; // v23 : unknown processors are not In-Order
}
+*/
+
+#ifdef _WIN32
+#include "7zWindows.h"
+#endif
#if !defined(MY_CPU_AMD64) && defined(_WIN32)
-#include <Windows.h>
-static BoolInt CPU_Sys_Is_SSE_Supported()
+
+/* for legacy SSE ia32: there is no user-space cpu instruction to check
+ that OS supports SSE register storing/restoring on context switches.
+ So we need some OS-specific function to check that it's safe to use SSE registers.
+*/
+
+Z7_FORCE_INLINE
+static BoolInt CPU_Sys_Is_SSE_Supported(void)
{
- OSVERSIONINFO vi;
- vi.dwOSVersionInfoSize = sizeof(vi);
- if (!GetVersionEx(&vi))
- return False;
- return (vi.dwMajorVersion >= 5);
+#ifdef _MSC_VER
+ #pragma warning(push)
+ #pragma warning(disable : 4996) // `GetVersion': was declared deprecated
+#endif
+ /* low byte is major version of Windows
+ We suppose that any Windows version since
+ Windows2000 (major == 5) supports SSE registers */
+ return (Byte)GetVersion() >= 5;
+#if defined(_MSC_VER)
+ #pragma warning(pop)
+#endif
}
#define CHECK_SYS_SSE_SUPPORT if (!CPU_Sys_Is_SSE_Supported()) return False;
#else
@@ -232,94 +377,300 @@ static BoolInt CPU_Sys_Is_SSE_Supported()
#endif
-static UInt32 X86_CPUID_ECX_Get_Flags()
+#if !defined(MY_CPU_AMD64)
+
+BoolInt CPU_IsSupported_CMOV(void)
{
- Cx86cpuid p;
+ UInt32 a[4];
+ if (!x86cpuid_Func_1(&a[0]))
+ return 0;
+ return (a[3] >> 15) & 1;
+}
+
+BoolInt CPU_IsSupported_SSE(void)
+{
+ UInt32 a[4];
CHECK_SYS_SSE_SUPPORT
- if (!x86cpuid_CheckAndRead(&p))
+ if (!x86cpuid_Func_1(&a[0]))
+ return 0;
+ return (a[3] >> 25) & 1;
+}
+
+BoolInt CPU_IsSupported_SSE2(void)
+{
+ UInt32 a[4];
+ CHECK_SYS_SSE_SUPPORT
+ if (!x86cpuid_Func_1(&a[0]))
+ return 0;
+ return (a[3] >> 26) & 1;
+}
+
+#endif
+
+
+static UInt32 x86cpuid_Func_1_ECX(void)
+{
+ UInt32 a[4];
+ CHECK_SYS_SSE_SUPPORT
+ if (!x86cpuid_Func_1(&a[0]))
return 0;
- return p.c;
+ return a[2];
}
-BoolInt CPU_IsSupported_AES()
+BoolInt CPU_IsSupported_AES(void)
{
- return (X86_CPUID_ECX_Get_Flags() >> 25) & 1;
+ return (x86cpuid_Func_1_ECX() >> 25) & 1;
}
-BoolInt CPU_IsSupported_SSSE3()
+BoolInt CPU_IsSupported_SSSE3(void)
{
- return (X86_CPUID_ECX_Get_Flags() >> 9) & 1;
+ return (x86cpuid_Func_1_ECX() >> 9) & 1;
}
-BoolInt CPU_IsSupported_SSE41()
+BoolInt CPU_IsSupported_SSE41(void)
{
- return (X86_CPUID_ECX_Get_Flags() >> 19) & 1;
+ return (x86cpuid_Func_1_ECX() >> 19) & 1;
}
-BoolInt CPU_IsSupported_SHA()
+BoolInt CPU_IsSupported_SHA(void)
{
- Cx86cpuid p;
CHECK_SYS_SSE_SUPPORT
- if (!x86cpuid_CheckAndRead(&p))
- return False;
- if (p.maxFunc < 7)
+ if (z7_x86_cpuid_GetMaxFunc() < 7)
return False;
{
- UInt32 d[4] = { 0 };
- MyCPUID(7, &d[0], &d[1], &d[2], &d[3]);
+ UInt32 d[4];
+ z7_x86_cpuid(d, 7);
return (d[1] >> 29) & 1;
}
}
-// #include <stdio.h>
+/*
+MSVC: _xgetbv() intrinsic is available since VS2010SP1.
+ MSVC also defines (_XCR_XFEATURE_ENABLED_MASK) macro in
+ <immintrin.h> that we can use or check.
+ For any 32-bit x86 we can use asm code in MSVC,
+ but MSVC asm code is huge after compilation.
+ So _xgetbv() is better
+
+ICC: _xgetbv() intrinsic is available (in what version of ICC?)
+ ICC defines (__GNUC___) and it supports gnu assembler
+ also ICC supports MASM style code with -use-msasm switch.
+ but ICC doesn't support __attribute__((__target__))
+
+GCC/CLANG 9:
+ _xgetbv() is macro that works via __builtin_ia32_xgetbv()
+ and we need __attribute__((__target__("xsave")).
+ But with __target__("xsave") the function will be not
+ inlined to function that has no __target__("xsave") attribute.
+ If we want _xgetbv() call inlining, then we should use asm version
+ instead of calling _xgetbv().
+ Note:intrinsic is broke before GCC 8.2:
+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85684
+*/
-#ifdef _WIN32
-#include <Windows.h>
+#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1100) \
+ || defined(_MSC_VER) && (_MSC_VER >= 1600) && (_MSC_FULL_VER >= 160040219) \
+ || defined(__GNUC__) && (__GNUC__ >= 9) \
+ || defined(__clang__) && (__clang_major__ >= 9)
+// we define ATTRIB_XGETBV, if we want to use predefined _xgetbv() from compiler
+#if defined(__INTEL_COMPILER)
+#define ATTRIB_XGETBV
+#elif defined(__GNUC__) || defined(__clang__)
+// we don't define ATTRIB_XGETBV here, because asm version is better for inlining.
+// #define ATTRIB_XGETBV __attribute__((__target__("xsave")))
+#else
+#define ATTRIB_XGETBV
+#endif
+#endif
+
+#if defined(ATTRIB_XGETBV)
+#include <immintrin.h>
#endif
-BoolInt CPU_IsSupported_AVX2()
+
+// XFEATURE_ENABLED_MASK/XCR0
+#define MY_XCR_XFEATURE_ENABLED_MASK 0
+
+#if defined(ATTRIB_XGETBV)
+ATTRIB_XGETBV
+#endif
+static UInt64 x86_xgetbv_0(UInt32 num)
{
- Cx86cpuid p;
- CHECK_SYS_SSE_SUPPORT
+#if defined(ATTRIB_XGETBV)
+ {
+ return
+ #if (defined(_MSC_VER))
+ _xgetbv(num);
+ #else
+ __builtin_ia32_xgetbv(
+ #if !defined(__clang__)
+ (int)
+ #endif
+ num);
+ #endif
+ }
+
+#elif defined(__GNUC__) || defined(__clang__) || defined(__SUNPRO_CC)
+
+ UInt32 a, d;
+ #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+ __asm__
+ (
+ "xgetbv"
+ : "=a"(a), "=d"(d) : "c"(num) : "cc"
+ );
+ #else // is old gcc
+ __asm__
+ (
+ ".byte 0x0f, 0x01, 0xd0" "\n\t"
+ : "=a"(a), "=d"(d) : "c"(num) : "cc"
+ );
+ #endif
+ return ((UInt64)d << 32) | a;
+ // return a;
+
+#elif defined(_MSC_VER) && !defined(MY_CPU_AMD64)
+
+ UInt32 a, d;
+ __asm {
+ push eax
+ push edx
+ push ecx
+ mov ecx, num;
+ // xor ecx, ecx // = MY_XCR_XFEATURE_ENABLED_MASK
+ _emit 0x0f
+ _emit 0x01
+ _emit 0xd0
+ mov a, eax
+ mov d, edx
+ pop ecx
+ pop edx
+ pop eax
+ }
+ return ((UInt64)d << 32) | a;
+ // return a;
+
+#else // it's unknown compiler
+ // #error "Need xgetbv function"
+ UNUSED_VAR(num)
+ // for MSVC-X64 we could call external function from external file.
+ /* Actually we had checked OSXSAVE/AVX in cpuid before.
+ So it's expected that OS supports at least AVX and below. */
+ // if (num != MY_XCR_XFEATURE_ENABLED_MASK) return 0; // if not XCR0
+ return
+ // (1 << 0) | // x87
+ (1 << 1) // SSE
+ | (1 << 2); // AVX
+
+#endif
+}
+#ifdef _WIN32
+/*
+ Windows versions do not know about new ISA extensions that
+ can be introduced. But we still can use new extensions,
+ even if Windows doesn't report about supporting them,
+ But we can use new extensions, only if Windows knows about new ISA extension
+ that changes the number or size of registers: SSE, AVX/XSAVE, AVX512
+ So it's enough to check
+ MY_PF_AVX_INSTRUCTIONS_AVAILABLE
+ instead of
+ MY_PF_AVX2_INSTRUCTIONS_AVAILABLE
+*/
+#define MY_PF_XSAVE_ENABLED 17
+// #define MY_PF_SSSE3_INSTRUCTIONS_AVAILABLE 36
+// #define MY_PF_SSE4_1_INSTRUCTIONS_AVAILABLE 37
+// #define MY_PF_SSE4_2_INSTRUCTIONS_AVAILABLE 38
+// #define MY_PF_AVX_INSTRUCTIONS_AVAILABLE 39
+// #define MY_PF_AVX2_INSTRUCTIONS_AVAILABLE 40
+// #define MY_PF_AVX512F_INSTRUCTIONS_AVAILABLE 41
+#endif
+
+BoolInt CPU_IsSupported_AVX(void)
+{
#ifdef _WIN32
- #define MY__PF_XSAVE_ENABLED 17
- if (!IsProcessorFeaturePresent(MY__PF_XSAVE_ENABLED))
+ if (!IsProcessorFeaturePresent(MY_PF_XSAVE_ENABLED))
return False;
+ /* PF_AVX_INSTRUCTIONS_AVAILABLE probably is supported starting from
+ some latest Win10 revisions. But we need AVX in older Windows also.
+ So we don't use the following check: */
+ /*
+ if (!IsProcessorFeaturePresent(MY_PF_AVX_INSTRUCTIONS_AVAILABLE))
+ return False;
+ */
#endif
- if (!x86cpuid_CheckAndRead(&p))
+ /*
+ OS must use new special XSAVE/XRSTOR instructions to save
+ AVX registers when it required for context switching.
+ At OS statring:
+ OS sets CR4.OSXSAVE flag to signal the processor that OS supports the XSAVE extensions.
+ Also OS sets bitmask in XCR0 register that defines what
+ registers will be processed by XSAVE instruction:
+ XCR0.SSE[bit 0] - x87 registers and state
+ XCR0.SSE[bit 1] - SSE registers and state
+ XCR0.AVX[bit 2] - AVX registers and state
+ CR4.OSXSAVE is reflected to CPUID.1:ECX.OSXSAVE[bit 27].
+ So we can read that bit in user-space.
+ XCR0 is available for reading in user-space by new XGETBV instruction.
+ */
+ {
+ const UInt32 c = x86cpuid_Func_1_ECX();
+ if (0 == (1
+ & (c >> 28) // AVX instructions are supported by hardware
+ & (c >> 27))) // OSXSAVE bit: XSAVE and related instructions are enabled by OS.
+ return False;
+ }
+
+ /* also we can check
+ CPUID.1:ECX.XSAVE [bit 26] : that shows that
+ XSAVE, XRESTOR, XSETBV, XGETBV instructions are supported by hardware.
+ But that check is redundant, because if OSXSAVE bit is set, then XSAVE is also set */
+
+ /* If OS have enabled XSAVE extension instructions (OSXSAVE == 1),
+ in most cases we expect that OS also will support storing/restoring
+ for AVX and SSE states at least.
+ But to be ensure for that we call user-space instruction
+ XGETBV(0) to get XCR0 value that contains bitmask that defines
+ what exact states(registers) OS have enabled for storing/restoring.
+ */
+
+ {
+ const UInt32 bm = (UInt32)x86_xgetbv_0(MY_XCR_XFEATURE_ENABLED_MASK);
+ // printf("\n=== XGetBV=%d\n", bm);
+ return 1
+ & (bm >> 1) // SSE state is supported (set by OS) for storing/restoring
+ & (bm >> 2); // AVX state is supported (set by OS) for storing/restoring
+ }
+ // since Win7SP1: we can use GetEnabledXStateFeatures();
+}
+
+
+BoolInt CPU_IsSupported_AVX2(void)
+{
+ if (!CPU_IsSupported_AVX())
return False;
- if (p.maxFunc < 7)
+ if (z7_x86_cpuid_GetMaxFunc() < 7)
return False;
{
- UInt32 d[4] = { 0 };
- MyCPUID(7, &d[0], &d[1], &d[2], &d[3]);
+ UInt32 d[4];
+ z7_x86_cpuid(d, 7);
// printf("\ncpuid(7): ebx=%8x ecx=%8x\n", d[1], d[2]);
return 1
& (d[1] >> 5); // avx2
}
}
-BoolInt CPU_IsSupported_VAES_AVX2()
+BoolInt CPU_IsSupported_VAES_AVX2(void)
{
- Cx86cpuid p;
- CHECK_SYS_SSE_SUPPORT
-
- #ifdef _WIN32
- #define MY__PF_XSAVE_ENABLED 17
- if (!IsProcessorFeaturePresent(MY__PF_XSAVE_ENABLED))
+ if (!CPU_IsSupported_AVX())
return False;
- #endif
-
- if (!x86cpuid_CheckAndRead(&p))
- return False;
- if (p.maxFunc < 7)
+ if (z7_x86_cpuid_GetMaxFunc() < 7)
return False;
{
- UInt32 d[4] = { 0 };
- MyCPUID(7, &d[0], &d[1], &d[2], &d[3]);
+ UInt32 d[4];
+ z7_x86_cpuid(d, 7);
// printf("\ncpuid(7): ebx=%8x ecx=%8x\n", d[1], d[2]);
return 1
& (d[1] >> 5) // avx2
@@ -328,20 +679,15 @@ BoolInt CPU_IsSupported_VAES_AVX2()
}
}
-BoolInt CPU_IsSupported_PageGB()
+BoolInt CPU_IsSupported_PageGB(void)
{
- Cx86cpuid cpuid;
- if (!x86cpuid_CheckAndRead(&cpuid))
- return False;
+ CHECK_CPUID_IS_SUPPORTED
{
- UInt32 d[4] = { 0 };
- MyCPUID(0x80000000, &d[0], &d[1], &d[2], &d[3]);
+ UInt32 d[4];
+ z7_x86_cpuid(d, 0x80000000);
if (d[0] < 0x80000001)
return False;
- }
- {
- UInt32 d[4] = { 0 };
- MyCPUID(0x80000001, &d[0], &d[1], &d[2], &d[3]);
+ z7_x86_cpuid(d, 0x80000001);
return (d[3] >> 26) & 1;
}
}
@@ -351,11 +697,11 @@ BoolInt CPU_IsSupported_PageGB()
#ifdef _WIN32
-#include <Windows.h>
+#include "7zWindows.h"
-BoolInt CPU_IsSupported_CRC32() { return IsProcessorFeaturePresent(PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE) ? 1 : 0; }
-BoolInt CPU_IsSupported_CRYPTO() { return IsProcessorFeaturePresent(PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE) ? 1 : 0; }
-BoolInt CPU_IsSupported_NEON() { return IsProcessorFeaturePresent(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE) ? 1 : 0; }
+BoolInt CPU_IsSupported_CRC32(void) { return IsProcessorFeaturePresent(PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE) ? 1 : 0; }
+BoolInt CPU_IsSupported_CRYPTO(void) { return IsProcessorFeaturePresent(PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE) ? 1 : 0; }
+BoolInt CPU_IsSupported_NEON(void) { return IsProcessorFeaturePresent(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE) ? 1 : 0; }
#else
@@ -378,28 +724,27 @@ static void Print_sysctlbyname(const char *name)
}
}
*/
+/*
+ Print_sysctlbyname("hw.pagesize");
+ Print_sysctlbyname("machdep.cpu.brand_string");
+*/
-static BoolInt My_sysctlbyname_Get_BoolInt(const char *name)
+static BoolInt z7_sysctlbyname_Get_BoolInt(const char *name)
{
UInt32 val = 0;
- if (My_sysctlbyname_Get_UInt32(name, &val) == 0 && val == 1)
+ if (z7_sysctlbyname_Get_UInt32(name, &val) == 0 && val == 1)
return 1;
return 0;
}
- /*
- Print_sysctlbyname("hw.pagesize");
- Print_sysctlbyname("machdep.cpu.brand_string");
- */
-
BoolInt CPU_IsSupported_CRC32(void)
{
- return My_sysctlbyname_Get_BoolInt("hw.optional.armv8_crc32");
+ return z7_sysctlbyname_Get_BoolInt("hw.optional.armv8_crc32");
}
BoolInt CPU_IsSupported_NEON(void)
{
- return My_sysctlbyname_Get_BoolInt("hw.optional.neon");
+ return z7_sysctlbyname_Get_BoolInt("hw.optional.neon");
}
#ifdef MY_CPU_ARM64
@@ -461,15 +806,15 @@ MY_HWCAP_CHECK_FUNC (AES)
#include <sys/sysctl.h>
-int My_sysctlbyname_Get(const char *name, void *buf, size_t *bufSize)
+int z7_sysctlbyname_Get(const char *name, void *buf, size_t *bufSize)
{
return sysctlbyname(name, buf, bufSize, NULL, 0);
}
-int My_sysctlbyname_Get_UInt32(const char *name, UInt32 *val)
+int z7_sysctlbyname_Get_UInt32(const char *name, UInt32 *val)
{
size_t bufSize = sizeof(*val);
- int res = My_sysctlbyname_Get(name, val, &bufSize);
+ const int res = z7_sysctlbyname_Get(name, val, &bufSize);
if (res == 0 && bufSize != sizeof(*val))
return EFAULT;
return res;
diff --git a/src/Common/lzma/CpuArch.h b/src/Common/lzma/CpuArch.h
index 529d3a50..8e5d8a54 100644
--- a/src/Common/lzma/CpuArch.h
+++ b/src/Common/lzma/CpuArch.h
@@ -1,8 +1,8 @@
/* CpuArch.h -- CPU specific code
-2021-07-13 : Igor Pavlov : Public domain */
+2023-04-02 : Igor Pavlov : Public domain */
-#ifndef __CPU_ARCH_H
-#define __CPU_ARCH_H
+#ifndef ZIP7_INC_CPU_ARCH_H
+#define ZIP7_INC_CPU_ARCH_H
#include "7zTypes.h"
@@ -51,7 +51,13 @@ MY_CPU_64BIT means that processor can work with 64-bit registers.
|| defined(__AARCH64EB__) \
|| defined(__aarch64__)
#define MY_CPU_ARM64
- #define MY_CPU_NAME "arm64"
+ #ifdef __ILP32__
+ #define MY_CPU_NAME "arm64-32"
+ #define MY_CPU_SIZEOF_POINTER 4
+ #else
+ #define MY_CPU_NAME "arm64"
+ #define MY_CPU_SIZEOF_POINTER 8
+ #endif
#define MY_CPU_64BIT
#endif
@@ -68,8 +74,10 @@ MY_CPU_64BIT means that processor can work with 64-bit registers.
#define MY_CPU_ARM
#if defined(__thumb__) || defined(__THUMBEL__) || defined(_M_ARMT)
+ #define MY_CPU_ARMT
#define MY_CPU_NAME "armt"
#else
+ #define MY_CPU_ARM32
#define MY_CPU_NAME "arm"
#endif
/* #define MY_CPU_32BIT */
@@ -103,6 +111,8 @@ MY_CPU_64BIT means that processor can work with 64-bit registers.
|| defined(__PPC__) \
|| defined(_POWER)
+#define MY_CPU_PPC_OR_PPC64
+
#if defined(__ppc64__) \
|| defined(__powerpc64__) \
|| defined(_LP64) \
@@ -123,12 +133,15 @@ MY_CPU_64BIT means that processor can work with 64-bit registers.
#endif
-#if defined(__sparc64__)
- #define MY_CPU_NAME "sparc64"
- #define MY_CPU_64BIT
-#elif defined(__sparc__)
- #define MY_CPU_NAME "sparc"
- /* #define MY_CPU_32BIT */
+#if defined(__riscv) \
+ || defined(__riscv__)
+ #if __riscv_xlen == 32
+ #define MY_CPU_NAME "riscv32"
+ #elif __riscv_xlen == 64
+ #define MY_CPU_NAME "riscv64"
+ #else
+ #define MY_CPU_NAME "riscv"
+ #endif
#endif
@@ -194,6 +207,9 @@ MY_CPU_64BIT means that processor can work with 64-bit registers.
#error Stop_Compiling_Bad_Endian
#endif
+#if !defined(MY_CPU_LE) && !defined(MY_CPU_BE)
+ #error Stop_Compiling_CPU_ENDIAN_must_be_detected_at_compile_time
+#endif
#if defined(MY_CPU_32BIT) && defined(MY_CPU_64BIT)
#error Stop_Compiling_Bad_32_64_BIT
@@ -250,6 +266,67 @@ MY_CPU_64BIT means that processor can work with 64-bit registers.
+#ifdef __has_builtin
+ #define Z7_has_builtin(x) __has_builtin(x)
+#else
+ #define Z7_has_builtin(x) 0
+#endif
+
+
+#define Z7_BSWAP32_CONST(v) \
+ ( (((UInt32)(v) << 24) ) \
+ | (((UInt32)(v) << 8) & (UInt32)0xff0000) \
+ | (((UInt32)(v) >> 8) & (UInt32)0xff00 ) \
+ | (((UInt32)(v) >> 24) ))
+
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1300)
+
+#include <stdlib.h>
+
+/* Note: these macros will use bswap instruction (486), that is unsupported in 386 cpu */
+
+#pragma intrinsic(_byteswap_ushort)
+#pragma intrinsic(_byteswap_ulong)
+#pragma intrinsic(_byteswap_uint64)
+
+#define Z7_BSWAP16(v) _byteswap_ushort(v)
+#define Z7_BSWAP32(v) _byteswap_ulong (v)
+#define Z7_BSWAP64(v) _byteswap_uint64(v)
+#define Z7_CPU_FAST_BSWAP_SUPPORTED
+
+#elif (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) \
+ || (defined(__clang__) && Z7_has_builtin(__builtin_bswap16))
+
+#define Z7_BSWAP16(v) __builtin_bswap16(v)
+#define Z7_BSWAP32(v) __builtin_bswap32(v)
+#define Z7_BSWAP64(v) __builtin_bswap64(v)
+#define Z7_CPU_FAST_BSWAP_SUPPORTED
+
+#else
+
+#define Z7_BSWAP16(v) ((UInt16) \
+ ( ((UInt32)(v) << 8) \
+ | ((UInt32)(v) >> 8) \
+ ))
+
+#define Z7_BSWAP32(v) Z7_BSWAP32_CONST(v)
+
+#define Z7_BSWAP64(v) \
+ ( ( ( (UInt64)(v) ) << 8 * 7 ) \
+ | ( ( (UInt64)(v) & ((UInt32)0xff << 8 * 1) ) << 8 * 5 ) \
+ | ( ( (UInt64)(v) & ((UInt32)0xff << 8 * 2) ) << 8 * 3 ) \
+ | ( ( (UInt64)(v) & ((UInt32)0xff << 8 * 3) ) << 8 * 1 ) \
+ | ( ( (UInt64)(v) >> 8 * 1 ) & ((UInt32)0xff << 8 * 3) ) \
+ | ( ( (UInt64)(v) >> 8 * 3 ) & ((UInt32)0xff << 8 * 2) ) \
+ | ( ( (UInt64)(v) >> 8 * 5 ) & ((UInt32)0xff << 8 * 1) ) \
+ | ( ( (UInt64)(v) >> 8 * 7 ) ) \
+ )
+
+#endif
+
+
+
#ifdef MY_CPU_LE
#if defined(MY_CPU_X86_OR_AMD64) \
|| defined(MY_CPU_ARM64)
@@ -269,13 +346,11 @@ MY_CPU_64BIT means that processor can work with 64-bit registers.
#define GetUi32(p) (*(const UInt32 *)(const void *)(p))
#ifdef MY_CPU_LE_UNALIGN_64
#define GetUi64(p) (*(const UInt64 *)(const void *)(p))
+#define SetUi64(p, v) { *(UInt64 *)(void *)(p) = (v); }
#endif
#define SetUi16(p, v) { *(UInt16 *)(void *)(p) = (v); }
#define SetUi32(p, v) { *(UInt32 *)(void *)(p) = (v); }
-#ifdef MY_CPU_LE_UNALIGN_64
-#define SetUi64(p, v) { *(UInt64 *)(void *)(p) = (v); }
-#endif
#else
@@ -302,51 +377,26 @@ MY_CPU_64BIT means that processor can work with 64-bit registers.
#endif
-#ifndef MY_CPU_LE_UNALIGN_64
-
+#ifndef GetUi64
#define GetUi64(p) (GetUi32(p) | ((UInt64)GetUi32(((const Byte *)(p)) + 4) << 32))
+#endif
+#ifndef SetUi64
#define SetUi64(p, v) { Byte *_ppp2_ = (Byte *)(p); UInt64 _vvv2_ = (v); \
- SetUi32(_ppp2_ , (UInt32)_vvv2_); \
- SetUi32(_ppp2_ + 4, (UInt32)(_vvv2_ >> 32)); }
-
+ SetUi32(_ppp2_ , (UInt32)_vvv2_) \
+ SetUi32(_ppp2_ + 4, (UInt32)(_vvv2_ >> 32)) }
#endif
+#if defined(MY_CPU_LE_UNALIGN) && defined(Z7_CPU_FAST_BSWAP_SUPPORTED)
+#define GetBe32(p) Z7_BSWAP32 (*(const UInt32 *)(const void *)(p))
+#define SetBe32(p, v) { (*(UInt32 *)(void *)(p)) = Z7_BSWAP32(v); }
-#ifdef __has_builtin
- #define MY__has_builtin(x) __has_builtin(x)
-#else
- #define MY__has_builtin(x) 0
+#if defined(MY_CPU_LE_UNALIGN_64)
+#define GetBe64(p) Z7_BSWAP64 (*(const UInt64 *)(const void *)(p))
#endif
-#if defined(MY_CPU_LE_UNALIGN) && /* defined(_WIN64) && */ defined(_MSC_VER) && (_MSC_VER >= 1300)
-
-/* Note: we use bswap instruction, that is unsupported in 386 cpu */
-
-#include <stdlib.h>
-
-#pragma intrinsic(_byteswap_ushort)
-#pragma intrinsic(_byteswap_ulong)
-#pragma intrinsic(_byteswap_uint64)
-
-/* #define GetBe16(p) _byteswap_ushort(*(const UInt16 *)(const Byte *)(p)) */
-#define GetBe32(p) _byteswap_ulong (*(const UInt32 *)(const void *)(p))
-#define GetBe64(p) _byteswap_uint64(*(const UInt64 *)(const void *)(p))
-
-#define SetBe32(p, v) (*(UInt32 *)(void *)(p)) = _byteswap_ulong(v)
-
-#elif defined(MY_CPU_LE_UNALIGN) && ( \
- (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) \
- || (defined(__clang__) && MY__has_builtin(__builtin_bswap16)) )
-
-/* #define GetBe16(p) __builtin_bswap16(*(const UInt16 *)(const void *)(p)) */
-#define GetBe32(p) __builtin_bswap32(*(const UInt32 *)(const void *)(p))
-#define GetBe64(p) __builtin_bswap64(*(const UInt64 *)(const void *)(p))
-
-#define SetBe32(p, v) (*(UInt32 *)(void *)(p)) = __builtin_bswap32(v)
-
#else
#define GetBe32(p) ( \
@@ -355,8 +405,6 @@ MY_CPU_64BIT means that processor can work with 64-bit registers.
((UInt32)((const Byte *)(p))[2] << 8) | \
((const Byte *)(p))[3] )
-#define GetBe64(p) (((UInt64)GetBe32(p) << 32) | GetBe32(((const Byte *)(p)) + 4))
-
#define SetBe32(p, v) { Byte *_ppp_ = (Byte *)(p); UInt32 _vvv_ = (v); \
_ppp_[0] = (Byte)(_vvv_ >> 24); \
_ppp_[1] = (Byte)(_vvv_ >> 16); \
@@ -365,50 +413,83 @@ MY_CPU_64BIT means that processor can work with 64-bit registers.
#endif
+#ifndef GetBe64
+#define GetBe64(p) (((UInt64)GetBe32(p) << 32) | GetBe32(((const Byte *)(p)) + 4))
+#endif
#ifndef GetBe16
-
#define GetBe16(p) ( (UInt16) ( \
((UInt16)((const Byte *)(p))[0] << 8) | \
((const Byte *)(p))[1] ))
+#endif
+
+#if defined(MY_CPU_BE)
+#define Z7_CONV_BE_TO_NATIVE_CONST32(v) (v)
+#define Z7_CONV_LE_TO_NATIVE_CONST32(v) Z7_BSWAP32_CONST(v)
+#define Z7_CONV_NATIVE_TO_BE_32(v) (v)
+#elif defined(MY_CPU_LE)
+#define Z7_CONV_BE_TO_NATIVE_CONST32(v) Z7_BSWAP32_CONST(v)
+#define Z7_CONV_LE_TO_NATIVE_CONST32(v) (v)
+#define Z7_CONV_NATIVE_TO_BE_32(v) Z7_BSWAP32(v)
+#else
+#error Stop_Compiling_Unknown_Endian_CONV
#endif
+#if defined(MY_CPU_BE)
-#ifdef MY_CPU_X86_OR_AMD64
+#define GetBe32a(p) (*(const UInt32 *)(const void *)(p))
+#define GetBe16a(p) (*(const UInt16 *)(const void *)(p))
+#define SetBe32a(p, v) { *(UInt32 *)(void *)(p) = (v); }
+#define SetBe16a(p, v) { *(UInt16 *)(void *)(p) = (v); }
-typedef struct
-{
- UInt32 maxFunc;
- UInt32 vendor[3];
- UInt32 ver;
- UInt32 b;
- UInt32 c;
- UInt32 d;
-} Cx86cpuid;
+#define GetUi32a(p) GetUi32(p)
+#define GetUi16a(p) GetUi16(p)
+#define SetUi32a(p, v) SetUi32(p, v)
+#define SetUi16a(p, v) SetUi16(p, v)
-enum
-{
- CPU_FIRM_INTEL,
- CPU_FIRM_AMD,
- CPU_FIRM_VIA
-};
+#elif defined(MY_CPU_LE)
-void MyCPUID(UInt32 function, UInt32 *a, UInt32 *b, UInt32 *c, UInt32 *d);
+#define GetUi32a(p) (*(const UInt32 *)(const void *)(p))
+#define GetUi16a(p) (*(const UInt16 *)(const void *)(p))
+#define SetUi32a(p, v) { *(UInt32 *)(void *)(p) = (v); }
+#define SetUi16a(p, v) { *(UInt16 *)(void *)(p) = (v); }
-BoolInt x86cpuid_CheckAndRead(Cx86cpuid *p);
-int x86cpuid_GetFirm(const Cx86cpuid *p);
+#define GetBe32a(p) GetBe32(p)
+#define GetBe16a(p) GetBe16(p)
+#define SetBe32a(p, v) SetBe32(p, v)
+#define SetBe16a(p, v) SetBe16(p, v)
-#define x86cpuid_GetFamily(ver) (((ver >> 16) & 0xFF0) | ((ver >> 8) & 0xF))
-#define x86cpuid_GetModel(ver) (((ver >> 12) & 0xF0) | ((ver >> 4) & 0xF))
-#define x86cpuid_GetStepping(ver) (ver & 0xF)
+#else
+#error Stop_Compiling_Unknown_Endian_CPU_a
+#endif
-BoolInt CPU_Is_InOrder(void);
+
+#if defined(MY_CPU_X86_OR_AMD64) \
+ || defined(MY_CPU_ARM_OR_ARM64) \
+ || defined(MY_CPU_PPC_OR_PPC64)
+ #define Z7_CPU_FAST_ROTATE_SUPPORTED
+#endif
+
+
+#ifdef MY_CPU_X86_OR_AMD64
+
+void Z7_FASTCALL z7_x86_cpuid(UInt32 a[4], UInt32 function);
+UInt32 Z7_FASTCALL z7_x86_cpuid_GetMaxFunc(void);
+#if defined(MY_CPU_AMD64)
+#define Z7_IF_X86_CPUID_SUPPORTED
+#else
+#define Z7_IF_X86_CPUID_SUPPORTED if (z7_x86_cpuid_GetMaxFunc())
+#endif
BoolInt CPU_IsSupported_AES(void);
+BoolInt CPU_IsSupported_AVX(void);
BoolInt CPU_IsSupported_AVX2(void);
BoolInt CPU_IsSupported_VAES_AVX2(void);
+BoolInt CPU_IsSupported_CMOV(void);
+BoolInt CPU_IsSupported_SSE(void);
+BoolInt CPU_IsSupported_SSE2(void);
BoolInt CPU_IsSupported_SSSE3(void);
BoolInt CPU_IsSupported_SSE41(void);
BoolInt CPU_IsSupported_SHA(void);
@@ -433,8 +514,8 @@ BoolInt CPU_IsSupported_AES(void);
#endif
#if defined(__APPLE__)
-int My_sysctlbyname_Get(const char *name, void *buf, size_t *bufSize);
-int My_sysctlbyname_Get_UInt32(const char *name, UInt32 *val);
+int z7_sysctlbyname_Get(const char *name, void *buf, size_t *bufSize);
+int z7_sysctlbyname_Get_UInt32(const char *name, UInt32 *val);
#endif
EXTERN_C_END
diff --git a/src/Common/lzma/LzFind.c b/src/Common/lzma/LzFind.c
index 1b73c284..0fbd5aae 100644
--- a/src/Common/lzma/LzFind.c
+++ b/src/Common/lzma/LzFind.c
@@ -1,5 +1,5 @@
/* LzFind.c -- Match finder for LZ algorithms
-2021-11-29 : Igor Pavlov : Public domain */
+2023-03-14 : Igor Pavlov : Public domain */
#include "Precomp.h"
@@ -17,7 +17,7 @@
#define kEmptyHashValue 0
#define kMaxValForNormalize ((UInt32)0)
-// #define kMaxValForNormalize ((UInt32)(1 << 20) + 0xFFF) // for debug
+// #define kMaxValForNormalize ((UInt32)(1 << 20) + 0xfff) // for debug
// #define kNormalizeAlign (1 << 7) // alignment for speculated accesses
@@ -67,10 +67,10 @@
static void LzInWindow_Free(CMatchFinder *p, ISzAllocPtr alloc)
{
- if (!p->directInput)
+ // if (!p->directInput)
{
- ISzAlloc_Free(alloc, p->bufferBase);
- p->bufferBase = NULL;
+ ISzAlloc_Free(alloc, p->bufBase);
+ p->bufBase = NULL;
}
}
@@ -79,7 +79,7 @@ static int LzInWindow_Create2(CMatchFinder *p, UInt32 blockSize, ISzAllocPtr all
{
if (blockSize == 0)
return 0;
- if (!p->bufferBase || p->blockSize != blockSize)
+ if (!p->bufBase || p->blockSize != blockSize)
{
// size_t blockSizeT;
LzInWindow_Free(p, alloc);
@@ -101,11 +101,11 @@ static int LzInWindow_Create2(CMatchFinder *p, UInt32 blockSize, ISzAllocPtr all
#endif
*/
- p->bufferBase = (Byte *)ISzAlloc_Alloc(alloc, blockSize);
- // printf("\nbufferBase = %p\n", p->bufferBase);
+ p->bufBase = (Byte *)ISzAlloc_Alloc(alloc, blockSize);
+ // printf("\nbufferBase = %p\n", p->bufBase);
// return 0; // for debug
}
- return (p->bufferBase != NULL);
+ return (p->bufBase != NULL);
}
static const Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; }
@@ -113,7 +113,7 @@ static const Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return
static UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return GET_AVAIL_BYTES(p); }
-MY_NO_INLINE
+Z7_NO_INLINE
static void MatchFinder_ReadBlock(CMatchFinder *p)
{
if (p->streamEndWasReached || p->result != SZ_OK)
@@ -127,8 +127,8 @@ static void MatchFinder_ReadBlock(CMatchFinder *p)
UInt32 curSize = 0xFFFFFFFF - GET_AVAIL_BYTES(p);
if (curSize > p->directInputRem)
curSize = (UInt32)p->directInputRem;
- p->directInputRem -= curSize;
p->streamPos += curSize;
+ p->directInputRem -= curSize;
if (p->directInputRem == 0)
p->streamEndWasReached = 1;
return;
@@ -136,8 +136,8 @@ static void MatchFinder_ReadBlock(CMatchFinder *p)
for (;;)
{
- Byte *dest = p->buffer + GET_AVAIL_BYTES(p);
- size_t size = (size_t)(p->bufferBase + p->blockSize - dest);
+ const Byte *dest = p->buffer + GET_AVAIL_BYTES(p);
+ size_t size = (size_t)(p->bufBase + p->blockSize - dest);
if (size == 0)
{
/* we call ReadBlock() after NeedMove() and MoveBlock().
@@ -153,7 +153,14 @@ static void MatchFinder_ReadBlock(CMatchFinder *p)
// #define kRead 3
// if (size > kRead) size = kRead; // for debug
- p->result = ISeqInStream_Read(p->stream, dest, &size);
+ /*
+ // we need cast (Byte *)dest.
+ #ifdef __clang__
+ #pragma GCC diagnostic ignored "-Wcast-qual"
+ #endif
+ */
+ p->result = ISeqInStream_Read(p->stream,
+ p->bufBase + (dest - p->bufBase), &size);
if (p->result != SZ_OK)
return;
if (size == 0)
@@ -173,14 +180,14 @@ static void MatchFinder_ReadBlock(CMatchFinder *p)
-MY_NO_INLINE
+Z7_NO_INLINE
void MatchFinder_MoveBlock(CMatchFinder *p)
{
- const size_t offset = (size_t)(p->buffer - p->bufferBase) - p->keepSizeBefore;
+ const size_t offset = (size_t)(p->buffer - p->bufBase) - p->keepSizeBefore;
const size_t keepBefore = (offset & (kBlockMoveAlign - 1)) + p->keepSizeBefore;
- p->buffer = p->bufferBase + keepBefore;
- memmove(p->bufferBase,
- p->bufferBase + (offset & ~((size_t)kBlockMoveAlign - 1)),
+ p->buffer = p->bufBase + keepBefore;
+ memmove(p->bufBase,
+ p->bufBase + (offset & ~((size_t)kBlockMoveAlign - 1)),
keepBefore + (size_t)GET_AVAIL_BYTES(p));
}
@@ -198,7 +205,7 @@ int MatchFinder_NeedMove(CMatchFinder *p)
return 0;
if (p->streamEndWasReached || p->result != SZ_OK)
return 0;
- return ((size_t)(p->bufferBase + p->blockSize - p->buffer) <= p->keepSizeAfter);
+ return ((size_t)(p->bufBase + p->blockSize - p->buffer) <= p->keepSizeAfter);
}
void MatchFinder_ReadIfRequired(CMatchFinder *p)
@@ -214,6 +221,8 @@ static void MatchFinder_SetDefaultSettings(CMatchFinder *p)
p->cutValue = 32;
p->btMode = 1;
p->numHashBytes = 4;
+ p->numHashBytes_Min = 2;
+ p->numHashOutBits = 0;
p->bigHash = 0;
}
@@ -222,8 +231,10 @@ static void MatchFinder_SetDefaultSettings(CMatchFinder *p)
void MatchFinder_Construct(CMatchFinder *p)
{
unsigned i;
- p->bufferBase = NULL;
+ p->buffer = NULL;
+ p->bufBase = NULL;
p->directInput = 0;
+ p->stream = NULL;
p->hash = NULL;
p->expectedDataSize = (UInt64)(Int64)-1;
MatchFinder_SetDefaultSettings(p);
@@ -238,6 +249,8 @@ void MatchFinder_Construct(CMatchFinder *p)
}
}
+#undef kCrcPoly
+
static void MatchFinder_FreeThisClassMemory(CMatchFinder *p, ISzAllocPtr alloc)
{
ISzAlloc_Free(alloc, p->hash);
@@ -252,7 +265,7 @@ void MatchFinder_Free(CMatchFinder *p, ISzAllocPtr alloc)
static CLzRef* AllocRefs(size_t num, ISzAllocPtr alloc)
{
- size_t sizeInBytes = (size_t)num * sizeof(CLzRef);
+ const size_t sizeInBytes = (size_t)num * sizeof(CLzRef);
if (sizeInBytes / sizeof(CLzRef) != num)
return NULL;
return (CLzRef *)ISzAlloc_Alloc(alloc, sizeInBytes);
@@ -298,6 +311,62 @@ static UInt32 GetBlockSize(CMatchFinder *p, UInt32 historySize)
}
+// input is historySize
+static UInt32 MatchFinder_GetHashMask2(CMatchFinder *p, UInt32 hs)
+{
+ if (p->numHashBytes == 2)
+ return (1 << 16) - 1;
+ if (hs != 0)
+ hs--;
+ hs |= (hs >> 1);
+ hs |= (hs >> 2);
+ hs |= (hs >> 4);
+ hs |= (hs >> 8);
+ // we propagated 16 bits in (hs). Low 16 bits must be set later
+ if (hs >= (1 << 24))
+ {
+ if (p->numHashBytes == 3)
+ hs = (1 << 24) - 1;
+ /* if (bigHash) mode, GetHeads4b() in LzFindMt.c needs (hs >= ((1 << 24) - 1))) */
+ }
+ // (hash_size >= (1 << 16)) : Required for (numHashBytes > 2)
+ hs |= (1 << 16) - 1; /* don't change it! */
+ // bt5: we adjust the size with recommended minimum size
+ if (p->numHashBytes >= 5)
+ hs |= (256 << kLzHash_CrcShift_2) - 1;
+ return hs;
+}
+
+// input is historySize
+static UInt32 MatchFinder_GetHashMask(CMatchFinder *p, UInt32 hs)
+{
+ if (p->numHashBytes == 2)
+ return (1 << 16) - 1;
+ if (hs != 0)
+ hs--;
+ hs |= (hs >> 1);
+ hs |= (hs >> 2);
+ hs |= (hs >> 4);
+ hs |= (hs >> 8);
+ // we propagated 16 bits in (hs). Low 16 bits must be set later
+ hs >>= 1;
+ if (hs >= (1 << 24))
+ {
+ if (p->numHashBytes == 3)
+ hs = (1 << 24) - 1;
+ else
+ hs >>= 1;
+ /* if (bigHash) mode, GetHeads4b() in LzFindMt.c needs (hs >= ((1 << 24) - 1))) */
+ }
+ // (hash_size >= (1 << 16)) : Required for (numHashBytes > 2)
+ hs |= (1 << 16) - 1; /* don't change it! */
+ // bt5: we adjust the size with recommended minimum size
+ if (p->numHashBytes >= 5)
+ hs |= (256 << kLzHash_CrcShift_2) - 1;
+ return hs;
+}
+
+
int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
ISzAllocPtr alloc)
@@ -318,78 +387,91 @@ int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
p->blockSize = 0;
if (p->directInput || LzInWindow_Create2(p, GetBlockSize(p, historySize), alloc))
{
- const UInt32 newCyclicBufferSize = historySize + 1; // do not change it
- UInt32 hs;
- p->matchMaxLen = matchMaxLen;
+ size_t hashSizeSum;
{
- // UInt32 hs4;
- p->fixedHashSize = 0;
- hs = (1 << 16) - 1;
- if (p->numHashBytes != 2)
+ UInt32 hs;
+ UInt32 hsCur;
+
+ if (p->numHashOutBits != 0)
{
- hs = historySize;
- if (hs > p->expectedDataSize)
- hs = (UInt32)p->expectedDataSize;
- if (hs != 0)
- hs--;
- hs |= (hs >> 1);
- hs |= (hs >> 2);
- hs |= (hs >> 4);
- hs |= (hs >> 8);
- // we propagated 16 bits in (hs). Low 16 bits must be set later
- hs >>= 1;
- if (hs >= (1 << 24))
- {
- if (p->numHashBytes == 3)
- hs = (1 << 24) - 1;
- else
- hs >>= 1;
- /* if (bigHash) mode, GetHeads4b() in LzFindMt.c needs (hs >= ((1 << 24) - 1))) */
- }
-
- // hs = ((UInt32)1 << 25) - 1; // for test
-
+ unsigned numBits = p->numHashOutBits;
+ const unsigned nbMax =
+ (p->numHashBytes == 2 ? 16 :
+ (p->numHashBytes == 3 ? 24 : 32));
+ if (numBits > nbMax)
+ numBits = nbMax;
+ if (numBits >= 32)
+ hs = (UInt32)0 - 1;
+ else
+ hs = ((UInt32)1 << numBits) - 1;
// (hash_size >= (1 << 16)) : Required for (numHashBytes > 2)
hs |= (1 << 16) - 1; /* don't change it! */
-
- // bt5: we adjust the size with recommended minimum size
if (p->numHashBytes >= 5)
hs |= (256 << kLzHash_CrcShift_2) - 1;
+ {
+ const UInt32 hs2 = MatchFinder_GetHashMask2(p, historySize);
+ if (hs > hs2)
+ hs = hs2;
+ }
+ hsCur = hs;
+ if (p->expectedDataSize < historySize)
+ {
+ const UInt32 hs2 = MatchFinder_GetHashMask2(p, (UInt32)p->expectedDataSize);
+ if (hsCur > hs2)
+ hsCur = hs2;
+ }
}
- p->hashMask = hs;
- hs++;
-
- /*
- hs4 = (1 << 20);
- if (hs4 > hs)
- hs4 = hs;
- // hs4 = (1 << 16); // for test
- p->hash4Mask = hs4 - 1;
- */
+ else
+ {
+ hs = MatchFinder_GetHashMask(p, historySize);
+ hsCur = hs;
+ if (p->expectedDataSize < historySize)
+ {
+ hsCur = MatchFinder_GetHashMask(p, (UInt32)p->expectedDataSize);
+ if (hsCur > hs) // is it possible?
+ hsCur = hs;
+ }
+ }
+
+ p->hashMask = hsCur;
- if (p->numHashBytes > 2) p->fixedHashSize += kHash2Size;
- if (p->numHashBytes > 3) p->fixedHashSize += kHash3Size;
- // if (p->numHashBytes > 4) p->fixedHashSize += hs4; // kHash4Size;
- hs += p->fixedHashSize;
+ hashSizeSum = hs;
+ hashSizeSum++;
+ if (hashSizeSum < hs)
+ return 0;
+ {
+ UInt32 fixedHashSize = 0;
+ if (p->numHashBytes > 2 && p->numHashBytes_Min <= 2) fixedHashSize += kHash2Size;
+ if (p->numHashBytes > 3 && p->numHashBytes_Min <= 3) fixedHashSize += kHash3Size;
+ // if (p->numHashBytes > 4) p->fixedHashSize += hs4; // kHash4Size;
+ hashSizeSum += fixedHashSize;
+ p->fixedHashSize = fixedHashSize;
+ }
}
+ p->matchMaxLen = matchMaxLen;
+
{
size_t newSize;
size_t numSons;
+ const UInt32 newCyclicBufferSize = historySize + 1; // do not change it
p->historySize = historySize;
- p->hashSizeSum = hs;
p->cyclicBufferSize = newCyclicBufferSize; // it must be = (historySize + 1)
numSons = newCyclicBufferSize;
if (p->btMode)
numSons <<= 1;
- newSize = hs + numSons;
+ newSize = hashSizeSum + numSons;
+
+ if (numSons < newCyclicBufferSize || newSize < numSons)
+ return 0;
// aligned size is not required here, but it can be better for some loops
#define NUM_REFS_ALIGN_MASK 0xF
newSize = (newSize + NUM_REFS_ALIGN_MASK) & ~(size_t)NUM_REFS_ALIGN_MASK;
- if (p->hash && p->numRefs == newSize)
+ // 22.02: we don't reallocate buffer, if old size is enough
+ if (p->hash && p->numRefs >= newSize)
return 1;
MatchFinder_FreeThisClassMemory(p, alloc);
@@ -398,7 +480,7 @@ int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
if (p->hash)
{
- p->son = p->hash + p->hashSizeSum;
+ p->son = p->hash + hashSizeSum;
return 1;
}
}
@@ -470,7 +552,8 @@ void MatchFinder_Init_HighHash(CMatchFinder *p)
void MatchFinder_Init_4(CMatchFinder *p)
{
- p->buffer = p->bufferBase;
+ if (!p->directInput)
+ p->buffer = p->bufBase;
{
/* kEmptyHashValue = 0 (Zero) is used in hash tables as NO-VALUE marker.
the code in CMatchFinderMt expects (pos = 1) */
@@ -507,20 +590,20 @@ void MatchFinder_Init(CMatchFinder *p)
#ifdef MY_CPU_X86_OR_AMD64
- #if defined(__clang__) && (__clang_major__ >= 8) \
- || defined(__GNUC__) && (__GNUC__ >= 8) \
- || defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1900)
- #define USE_SATUR_SUB_128
- #define USE_AVX2
- #define ATTRIB_SSE41 __attribute__((__target__("sse4.1")))
- #define ATTRIB_AVX2 __attribute__((__target__("avx2")))
+ #if defined(__clang__) && (__clang_major__ >= 4) \
+ || defined(Z7_GCC_VERSION) && (Z7_GCC_VERSION >= 40701)
+ // || defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1900)
+
+ #define USE_LZFIND_SATUR_SUB_128
+ #define USE_LZFIND_SATUR_SUB_256
+ #define LZFIND_ATTRIB_SSE41 __attribute__((__target__("sse4.1")))
+ #define LZFIND_ATTRIB_AVX2 __attribute__((__target__("avx2")))
#elif defined(_MSC_VER)
#if (_MSC_VER >= 1600)
- #define USE_SATUR_SUB_128
- #if (_MSC_VER >= 1900)
- #define USE_AVX2
- #include <immintrin.h> // avx
- #endif
+ #define USE_LZFIND_SATUR_SUB_128
+ #endif
+ #if (_MSC_VER >= 1900)
+ #define USE_LZFIND_SATUR_SUB_256
#endif
#endif
@@ -529,16 +612,16 @@ void MatchFinder_Init(CMatchFinder *p)
#if defined(__clang__) && (__clang_major__ >= 8) \
|| defined(__GNUC__) && (__GNUC__ >= 8)
- #define USE_SATUR_SUB_128
+ #define USE_LZFIND_SATUR_SUB_128
#ifdef MY_CPU_ARM64
- // #define ATTRIB_SSE41 __attribute__((__target__("")))
+ // #define LZFIND_ATTRIB_SSE41 __attribute__((__target__("")))
#else
- // #define ATTRIB_SSE41 __attribute__((__target__("fpu=crypto-neon-fp-armv8")))
+ // #define LZFIND_ATTRIB_SSE41 __attribute__((__target__("fpu=crypto-neon-fp-armv8")))
#endif
#elif defined(_MSC_VER)
#if (_MSC_VER >= 1910)
- #define USE_SATUR_SUB_128
+ #define USE_LZFIND_SATUR_SUB_128
#endif
#endif
@@ -550,121 +633,130 @@ void MatchFinder_Init(CMatchFinder *p)
#endif
-/*
-#ifndef ATTRIB_SSE41
- #define ATTRIB_SSE41
-#endif
-#ifndef ATTRIB_AVX2
- #define ATTRIB_AVX2
-#endif
-*/
-#ifdef USE_SATUR_SUB_128
+#ifdef USE_LZFIND_SATUR_SUB_128
-// #define _SHOW_HW_STATUS
+// #define Z7_SHOW_HW_STATUS
-#ifdef _SHOW_HW_STATUS
+#ifdef Z7_SHOW_HW_STATUS
#include <stdio.h>
-#define _PRF(x) x
-_PRF(;)
+#define PRF(x) x
+PRF(;)
#else
-#define _PRF(x)
+#define PRF(x)
#endif
+
#ifdef MY_CPU_ARM_OR_ARM64
#ifdef MY_CPU_ARM64
-// #define FORCE_SATUR_SUB_128
+// #define FORCE_LZFIND_SATUR_SUB_128
#endif
+typedef uint32x4_t LzFind_v128;
+#define SASUB_128_V(v, s) \
+ vsubq_u32(vmaxq_u32(v, s), s)
-typedef uint32x4_t v128;
-#define SASUB_128(i) \
- *(v128 *)(void *)(items + (i) * 4) = \
- vsubq_u32(vmaxq_u32(*(const v128 *)(const void *)(items + (i) * 4), sub2), sub2);
-
-#else
+#else // MY_CPU_ARM_OR_ARM64
#include <smmintrin.h> // sse4.1
-typedef __m128i v128;
-#define SASUB_128(i) \
- *(v128 *)(void *)(items + (i) * 4) = \
- _mm_sub_epi32(_mm_max_epu32(*(const v128 *)(const void *)(items + (i) * 4), sub2), sub2); // SSE 4.1
+typedef __m128i LzFind_v128;
+// SSE 4.1
+#define SASUB_128_V(v, s) \
+ _mm_sub_epi32(_mm_max_epu32(v, s), s)
-#endif
+#endif // MY_CPU_ARM_OR_ARM64
+#define SASUB_128(i) \
+ *( LzFind_v128 *)( void *)(items + (i) * 4) = SASUB_128_V( \
+ *(const LzFind_v128 *)(const void *)(items + (i) * 4), sub2);
+
-MY_NO_INLINE
+Z7_NO_INLINE
static
-#ifdef ATTRIB_SSE41
-ATTRIB_SSE41
+#ifdef LZFIND_ATTRIB_SSE41
+LZFIND_ATTRIB_SSE41
#endif
void
-MY_FAST_CALL
+Z7_FASTCALL
LzFind_SaturSub_128(UInt32 subValue, CLzRef *items, const CLzRef *lim)
{
- v128 sub2 =
+ const LzFind_v128 sub2 =
#ifdef MY_CPU_ARM_OR_ARM64
vdupq_n_u32(subValue);
#else
_mm_set_epi32((Int32)subValue, (Int32)subValue, (Int32)subValue, (Int32)subValue);
#endif
+ Z7_PRAGMA_OPT_DISABLE_LOOP_UNROLL_VECTORIZE
do
{
- SASUB_128(0)
- SASUB_128(1)
- SASUB_128(2)
- SASUB_128(3)
- items += 4 * 4;
+ SASUB_128(0) SASUB_128(1) items += 2 * 4;
+ SASUB_128(0) SASUB_128(1) items += 2 * 4;
}
while (items != lim);
}
-#ifdef USE_AVX2
+#ifdef USE_LZFIND_SATUR_SUB_256
#include <immintrin.h> // avx
+/*
+clang :immintrin.h uses
+#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \
+ defined(__AVX2__)
+#include <avx2intrin.h>
+#endif
+so we need <avxintrin.h> for clang-cl */
-#define SASUB_256(i) *(__m256i *)(void *)(items + (i) * 8) = _mm256_sub_epi32(_mm256_max_epu32(*(const __m256i *)(const void *)(items + (i) * 8), sub2), sub2); // AVX2
+#if defined(__clang__)
+#include <avxintrin.h>
+#include <avx2intrin.h>
+#endif
-MY_NO_INLINE
+// AVX2:
+#define SASUB_256(i) \
+ *( __m256i *)( void *)(items + (i) * 8) = \
+ _mm256_sub_epi32(_mm256_max_epu32( \
+ *(const __m256i *)(const void *)(items + (i) * 8), sub2), sub2);
+
+Z7_NO_INLINE
static
-#ifdef ATTRIB_AVX2
-ATTRIB_AVX2
+#ifdef LZFIND_ATTRIB_AVX2
+LZFIND_ATTRIB_AVX2
#endif
void
-MY_FAST_CALL
+Z7_FASTCALL
LzFind_SaturSub_256(UInt32 subValue, CLzRef *items, const CLzRef *lim)
{
- __m256i sub2 = _mm256_set_epi32(
+ const __m256i sub2 = _mm256_set_epi32(
(Int32)subValue, (Int32)subValue, (Int32)subValue, (Int32)subValue,
(Int32)subValue, (Int32)subValue, (Int32)subValue, (Int32)subValue);
+ Z7_PRAGMA_OPT_DISABLE_LOOP_UNROLL_VECTORIZE
do
{
- SASUB_256(0)
- SASUB_256(1)
- items += 2 * 8;
+ SASUB_256(0) SASUB_256(1) items += 2 * 8;
+ SASUB_256(0) SASUB_256(1) items += 2 * 8;
}
while (items != lim);
}
-#endif // USE_AVX2
+#endif // USE_LZFIND_SATUR_SUB_256
-#ifndef FORCE_SATUR_SUB_128
-typedef void (MY_FAST_CALL *LZFIND_SATUR_SUB_CODE_FUNC)(
+#ifndef FORCE_LZFIND_SATUR_SUB_128
+typedef void (Z7_FASTCALL *LZFIND_SATUR_SUB_CODE_FUNC)(
UInt32 subValue, CLzRef *items, const CLzRef *lim);
static LZFIND_SATUR_SUB_CODE_FUNC g_LzFind_SaturSub;
-#endif // FORCE_SATUR_SUB_128
+#endif // FORCE_LZFIND_SATUR_SUB_128
-#endif // USE_SATUR_SUB_128
+#endif // USE_LZFIND_SATUR_SUB_128
// kEmptyHashValue must be zero
-// #define SASUB_32(i) v = items[i]; m = v - subValue; if (v < subValue) m = kEmptyHashValue; items[i] = m;
-#define SASUB_32(i) v = items[i]; if (v < subValue) v = subValue; items[i] = v - subValue;
+// #define SASUB_32(i) { UInt32 v = items[i]; UInt32 m = v - subValue; if (v < subValue) m = kEmptyHashValue; items[i] = m; }
+#define SASUB_32(i) { UInt32 v = items[i]; if (v < subValue) v = subValue; items[i] = v - subValue; }
-#ifdef FORCE_SATUR_SUB_128
+#ifdef FORCE_LZFIND_SATUR_SUB_128
#define DEFAULT_SaturSub LzFind_SaturSub_128
@@ -672,24 +764,19 @@ static LZFIND_SATUR_SUB_CODE_FUNC g_LzFind_SaturSub;
#define DEFAULT_SaturSub LzFind_SaturSub_32
-MY_NO_INLINE
+Z7_NO_INLINE
static
void
-MY_FAST_CALL
+Z7_FASTCALL
LzFind_SaturSub_32(UInt32 subValue, CLzRef *items, const CLzRef *lim)
{
+ Z7_PRAGMA_OPT_DISABLE_LOOP_UNROLL_VECTORIZE
do
{
- UInt32 v;
- SASUB_32(0)
- SASUB_32(1)
- SASUB_32(2)
- SASUB_32(3)
- SASUB_32(4)
- SASUB_32(5)
- SASUB_32(6)
- SASUB_32(7)
- items += 8;
+ SASUB_32(0) SASUB_32(1) items += 2;
+ SASUB_32(0) SASUB_32(1) items += 2;
+ SASUB_32(0) SASUB_32(1) items += 2;
+ SASUB_32(0) SASUB_32(1) items += 2;
}
while (items != lim);
}
@@ -697,27 +784,23 @@ LzFind_SaturSub_32(UInt32 subValue, CLzRef *items, const CLzRef *lim)
#endif
-MY_NO_INLINE
+Z7_NO_INLINE
void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, size_t numItems)
{
- #define K_NORM_ALIGN_BLOCK_SIZE (1 << 6)
-
- CLzRef *lim;
-
- for (; numItems != 0 && ((unsigned)(ptrdiff_t)items & (K_NORM_ALIGN_BLOCK_SIZE - 1)) != 0; numItems--)
+ #define LZFIND_NORM_ALIGN_BLOCK_SIZE (1 << 7)
+ Z7_PRAGMA_OPT_DISABLE_LOOP_UNROLL_VECTORIZE
+ for (; numItems != 0 && ((unsigned)(ptrdiff_t)items & (LZFIND_NORM_ALIGN_BLOCK_SIZE - 1)) != 0; numItems--)
{
- UInt32 v;
- SASUB_32(0);
+ SASUB_32(0)
items++;
}
-
{
- #define K_NORM_ALIGN_MASK (K_NORM_ALIGN_BLOCK_SIZE / 4 - 1)
- lim = items + (numItems & ~(size_t)K_NORM_ALIGN_MASK);
- numItems &= K_NORM_ALIGN_MASK;
+ const size_t k_Align_Mask = (LZFIND_NORM_ALIGN_BLOCK_SIZE / 4 - 1);
+ CLzRef *lim = items + (numItems & ~(size_t)k_Align_Mask);
+ numItems &= k_Align_Mask;
if (items != lim)
{
- #if defined(USE_SATUR_SUB_128) && !defined(FORCE_SATUR_SUB_128)
+ #if defined(USE_LZFIND_SATUR_SUB_128) && !defined(FORCE_LZFIND_SATUR_SUB_128)
if (g_LzFind_SaturSub)
g_LzFind_SaturSub(subValue, items, lim);
else
@@ -726,12 +809,10 @@ void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, size_t numItems)
}
items = lim;
}
-
-
+ Z7_PRAGMA_OPT_DISABLE_LOOP_UNROLL_VECTORIZE
for (; numItems != 0; numItems--)
{
- UInt32 v;
- SASUB_32(0);
+ SASUB_32(0)
items++;
}
}
@@ -740,7 +821,7 @@ void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, size_t numItems)
// call MatchFinder_CheckLimits() only after (p->pos++) update
-MY_NO_INLINE
+Z7_NO_INLINE
static void MatchFinder_CheckLimits(CMatchFinder *p)
{
if (// !p->streamEndWasReached && p->result == SZ_OK &&
@@ -768,11 +849,14 @@ static void MatchFinder_CheckLimits(CMatchFinder *p)
const UInt32 subValue = (p->pos - p->historySize - 1) /* & ~(UInt32)(kNormalizeAlign - 1) */;
// const UInt32 subValue = (1 << 15); // for debug
// printf("\nMatchFinder_Normalize() subValue == 0x%x\n", subValue);
- size_t numSonRefs = p->cyclicBufferSize;
- if (p->btMode)
- numSonRefs <<= 1;
- Inline_MatchFinder_ReduceOffsets(p, subValue);
- MatchFinder_Normalize3(subValue, p->hash, (size_t)p->hashSizeSum + numSonRefs);
+ MatchFinder_REDUCE_OFFSETS(p, subValue)
+ MatchFinder_Normalize3(subValue, p->hash, (size_t)p->hashMask + 1 + p->fixedHashSize);
+ {
+ size_t numSonRefs = p->cyclicBufferSize;
+ if (p->btMode)
+ numSonRefs <<= 1;
+ MatchFinder_Normalize3(subValue, p->son, numSonRefs);
+ }
}
if (p->cyclicBufferPos == p->cyclicBufferSize)
@@ -785,7 +869,7 @@ static void MatchFinder_CheckLimits(CMatchFinder *p)
/*
(lenLimit > maxLen)
*/
-MY_FORCE_INLINE
+Z7_FORCE_INLINE
static UInt32 * Hc_GetMatchesSpec(size_t lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
size_t _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue,
UInt32 *d, unsigned maxLen)
@@ -867,7 +951,7 @@ static UInt32 * Hc_GetMatchesSpec(size_t lenLimit, UInt32 curMatch, UInt32 pos,
}
-MY_FORCE_INLINE
+Z7_FORCE_INLINE
UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
size_t _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue,
UInt32 *d, UInt32 maxLen)
@@ -1004,7 +1088,7 @@ static void SkipMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const
#define MOVE_POS_RET MOVE_POS return distances;
-MY_NO_INLINE
+Z7_NO_INLINE
static void MatchFinder_MovePos(CMatchFinder *p)
{
/* we go here at the end of stream data, when (avail < num_hash_bytes)
@@ -1015,11 +1099,11 @@ static void MatchFinder_MovePos(CMatchFinder *p)
if (p->btMode)
p->sons[(p->cyclicBufferPos << p->btMode) + 1] = 0; // kEmptyHashValue
*/
- MOVE_POS;
+ MOVE_POS
}
#define GET_MATCHES_HEADER2(minLen, ret_op) \
- unsigned lenLimit; UInt32 hv; Byte *cur; UInt32 curMatch; \
+ unsigned lenLimit; UInt32 hv; const Byte *cur; UInt32 curMatch; \
lenLimit = (unsigned)p->lenLimit; { if (lenLimit < minLen) { MatchFinder_MovePos(p); ret_op; }} \
cur = p->buffer;
@@ -1028,11 +1112,11 @@ static void MatchFinder_MovePos(CMatchFinder *p)
#define MF_PARAMS(p) lenLimit, curMatch, p->pos, p->buffer, p->son, p->cyclicBufferPos, p->cyclicBufferSize, p->cutValue
-#define SKIP_FOOTER SkipMatchesSpec(MF_PARAMS(p)); MOVE_POS; } while (--num);
+#define SKIP_FOOTER SkipMatchesSpec(MF_PARAMS(p)); MOVE_POS } while (--num);
#define GET_MATCHES_FOOTER_BASE(_maxLen_, func) \
distances = func(MF_PARAMS(p), \
- distances, (UInt32)_maxLen_); MOVE_POS_RET;
+ distances, (UInt32)_maxLen_); MOVE_POS_RET
#define GET_MATCHES_FOOTER_BT(_maxLen_) \
GET_MATCHES_FOOTER_BASE(_maxLen_, GetMatchesSpec1)
@@ -1052,7 +1136,7 @@ static void MatchFinder_MovePos(CMatchFinder *p)
static UInt32* Bt2_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
{
GET_MATCHES_HEADER(2)
- HASH2_CALC;
+ HASH2_CALC
curMatch = p->hash[hv];
p->hash[hv] = p->pos;
GET_MATCHES_FOOTER_BT(1)
@@ -1061,7 +1145,7 @@ static UInt32* Bt2_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
UInt32* Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
{
GET_MATCHES_HEADER(3)
- HASH_ZIP_CALC;
+ HASH_ZIP_CALC
curMatch = p->hash[hv];
p->hash[hv] = p->pos;
GET_MATCHES_FOOTER_BT(2)
@@ -1082,7 +1166,7 @@ static UInt32* Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
UInt32 *hash;
GET_MATCHES_HEADER(3)
- HASH3_CALC;
+ HASH3_CALC
hash = p->hash;
pos = p->pos;
@@ -1107,7 +1191,7 @@ static UInt32* Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
if (maxLen == lenLimit)
{
SkipMatchesSpec(MF_PARAMS(p));
- MOVE_POS_RET;
+ MOVE_POS_RET
}
}
@@ -1123,7 +1207,7 @@ static UInt32* Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
UInt32 *hash;
GET_MATCHES_HEADER(4)
- HASH4_CALC;
+ HASH4_CALC
hash = p->hash;
pos = p->pos;
@@ -1190,7 +1274,7 @@ static UInt32* Bt5_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
UInt32 *hash;
GET_MATCHES_HEADER(5)
- HASH5_CALC;
+ HASH5_CALC
hash = p->hash;
pos = p->pos;
@@ -1246,7 +1330,7 @@ static UInt32* Bt5_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
if (maxLen == lenLimit)
{
SkipMatchesSpec(MF_PARAMS(p));
- MOVE_POS_RET;
+ MOVE_POS_RET
}
break;
}
@@ -1263,7 +1347,7 @@ static UInt32* Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
UInt32 *hash;
GET_MATCHES_HEADER(4)
- HASH4_CALC;
+ HASH4_CALC
hash = p->hash;
pos = p->pos;
@@ -1314,12 +1398,12 @@ static UInt32* Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
if (maxLen == lenLimit)
{
p->son[p->cyclicBufferPos] = curMatch;
- MOVE_POS_RET;
+ MOVE_POS_RET
}
break;
}
- GET_MATCHES_FOOTER_HC(maxLen);
+ GET_MATCHES_FOOTER_HC(maxLen)
}
@@ -1330,7 +1414,7 @@ static UInt32 * Hc5_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
UInt32 *hash;
GET_MATCHES_HEADER(5)
- HASH5_CALC;
+ HASH5_CALC
hash = p->hash;
pos = p->pos;
@@ -1386,19 +1470,19 @@ static UInt32 * Hc5_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
if (maxLen == lenLimit)
{
p->son[p->cyclicBufferPos] = curMatch;
- MOVE_POS_RET;
+ MOVE_POS_RET
}
break;
}
- GET_MATCHES_FOOTER_HC(maxLen);
+ GET_MATCHES_FOOTER_HC(maxLen)
}
UInt32* Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
{
GET_MATCHES_HEADER(3)
- HASH_ZIP_CALC;
+ HASH_ZIP_CALC
curMatch = p->hash[hv];
p->hash[hv] = p->pos;
GET_MATCHES_FOOTER_HC(2)
@@ -1409,7 +1493,7 @@ static void Bt2_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
{
SKIP_HEADER(2)
{
- HASH2_CALC;
+ HASH2_CALC
curMatch = p->hash[hv];
p->hash[hv] = p->pos;
}
@@ -1420,7 +1504,7 @@ void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
{
SKIP_HEADER(3)
{
- HASH_ZIP_CALC;
+ HASH_ZIP_CALC
curMatch = p->hash[hv];
p->hash[hv] = p->pos;
}
@@ -1433,7 +1517,7 @@ static void Bt3_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
{
UInt32 h2;
UInt32 *hash;
- HASH3_CALC;
+ HASH3_CALC
hash = p->hash;
curMatch = (hash + kFix3HashSize)[hv];
hash[h2] =
@@ -1448,7 +1532,7 @@ static void Bt4_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
{
UInt32 h2, h3;
UInt32 *hash;
- HASH4_CALC;
+ HASH4_CALC
hash = p->hash;
curMatch = (hash + kFix4HashSize)[hv];
hash [h2] =
@@ -1464,7 +1548,7 @@ static void Bt5_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
{
UInt32 h2, h3;
UInt32 *hash;
- HASH5_CALC;
+ HASH5_CALC
hash = p->hash;
curMatch = (hash + kFix5HashSize)[hv];
hash [h2] =
@@ -1478,7 +1562,7 @@ static void Bt5_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
#define HC_SKIP_HEADER(minLen) \
do { if (p->lenLimit < minLen) { MatchFinder_MovePos(p); num--; continue; } { \
- Byte *cur; \
+ const Byte *cur; \
UInt32 *hash; \
UInt32 *son; \
UInt32 pos = p->pos; \
@@ -1510,7 +1594,7 @@ static void Hc4_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
HC_SKIP_HEADER(4)
UInt32 h2, h3;
- HASH4_CALC;
+ HASH4_CALC
curMatch = (hash + kFix4HashSize)[hv];
hash [h2] =
(hash + kFix3HashSize)[h3] =
@@ -1540,7 +1624,7 @@ void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
{
HC_SKIP_HEADER(3)
- HASH_ZIP_CALC;
+ HASH_ZIP_CALC
curMatch = hash[hv];
hash[hv] = pos;
@@ -1590,17 +1674,17 @@ void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder2 *vTable)
-void LzFindPrepare()
+void LzFindPrepare(void)
{
- #ifndef FORCE_SATUR_SUB_128
- #ifdef USE_SATUR_SUB_128
+ #ifndef FORCE_LZFIND_SATUR_SUB_128
+ #ifdef USE_LZFIND_SATUR_SUB_128
LZFIND_SATUR_SUB_CODE_FUNC f = NULL;
#ifdef MY_CPU_ARM_OR_ARM64
{
if (CPU_IsSupported_NEON())
{
// #pragma message ("=== LzFind NEON")
- _PRF(printf("\n=== LzFind NEON\n"));
+ PRF(printf("\n=== LzFind NEON\n"));
f = LzFind_SaturSub_128;
}
// f = 0; // for debug
@@ -1609,20 +1693,25 @@ void LzFindPrepare()
if (CPU_IsSupported_SSE41())
{
// #pragma message ("=== LzFind SSE41")
- _PRF(printf("\n=== LzFind SSE41\n"));
+ PRF(printf("\n=== LzFind SSE41\n"));
f = LzFind_SaturSub_128;
- #ifdef USE_AVX2
+ #ifdef USE_LZFIND_SATUR_SUB_256
if (CPU_IsSupported_AVX2())
{
// #pragma message ("=== LzFind AVX2")
- _PRF(printf("\n=== LzFind AVX2\n"));
+ PRF(printf("\n=== LzFind AVX2\n"));
f = LzFind_SaturSub_256;
}
#endif
}
#endif // MY_CPU_ARM_OR_ARM64
g_LzFind_SaturSub = f;
- #endif // USE_SATUR_SUB_128
- #endif // FORCE_SATUR_SUB_128
+ #endif // USE_LZFIND_SATUR_SUB_128
+ #endif // FORCE_LZFIND_SATUR_SUB_128
}
+
+
+#undef MOVE_POS
+#undef MOVE_POS_RET
+#undef PRF
diff --git a/src/Common/lzma/LzFind.h b/src/Common/lzma/LzFind.h
index eea873ff..a3f72c98 100644
--- a/src/Common/lzma/LzFind.h
+++ b/src/Common/lzma/LzFind.h
@@ -1,8 +1,8 @@
/* LzFind.h -- Match finder for LZ algorithms
-2021-07-13 : Igor Pavlov : Public domain */
+2023-03-04 : Igor Pavlov : Public domain */
-#ifndef __LZ_FIND_H
-#define __LZ_FIND_H
+#ifndef ZIP7_INC_LZ_FIND_H
+#define ZIP7_INC_LZ_FIND_H
#include "7zTypes.h"
@@ -10,9 +10,9 @@ EXTERN_C_BEGIN
typedef UInt32 CLzRef;
-typedef struct _CMatchFinder
+typedef struct
{
- Byte *buffer;
+ const Byte *buffer;
UInt32 pos;
UInt32 posLimit;
UInt32 streamPos; /* wrap over Zero is allowed (streamPos < pos). Use (UInt32)(streamPos - pos) */
@@ -32,8 +32,8 @@ typedef struct _CMatchFinder
UInt32 hashMask;
UInt32 cutValue;
- Byte *bufferBase;
- ISeqInStream *stream;
+ Byte *bufBase;
+ ISeqInStreamPtr stream;
UInt32 blockSize;
UInt32 keepSizeBefore;
@@ -43,7 +43,9 @@ typedef struct _CMatchFinder
size_t directInputRem;
UInt32 historySize;
UInt32 fixedHashSize;
- UInt32 hashSizeSum;
+ Byte numHashBytes_Min;
+ Byte numHashOutBits;
+ Byte _pad2_[2];
SRes result;
UInt32 crc[256];
size_t numRefs;
@@ -69,24 +71,45 @@ void MatchFinder_ReadIfRequired(CMatchFinder *p);
void MatchFinder_Construct(CMatchFinder *p);
-/* Conditions:
- historySize <= 3 GB
- keepAddBufferBefore + matchMaxLen + keepAddBufferAfter < 511MB
+/* (directInput = 0) is default value.
+ It's required to provide correct (directInput) value
+ before calling MatchFinder_Create().
+ You can set (directInput) by any of the following calls:
+ - MatchFinder_SET_DIRECT_INPUT_BUF()
+ - MatchFinder_SET_STREAM()
+ - MatchFinder_SET_STREAM_MODE()
*/
+
+#define MatchFinder_SET_DIRECT_INPUT_BUF(p, _src_, _srcLen_) { \
+ (p)->stream = NULL; \
+ (p)->directInput = 1; \
+ (p)->buffer = (_src_); \
+ (p)->directInputRem = (_srcLen_); }
+
+/*
+#define MatchFinder_SET_STREAM_MODE(p) { \
+ (p)->directInput = 0; }
+*/
+
+#define MatchFinder_SET_STREAM(p, _stream_) { \
+ (p)->stream = _stream_; \
+ (p)->directInput = 0; }
+
+
int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
ISzAllocPtr alloc);
void MatchFinder_Free(CMatchFinder *p, ISzAllocPtr alloc);
void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, size_t numItems);
-// void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue);
/*
-#define Inline_MatchFinder_InitPos(p, val) \
+#define MatchFinder_INIT_POS(p, val) \
(p)->pos = (val); \
(p)->streamPos = (val);
*/
-#define Inline_MatchFinder_ReduceOffsets(p, subValue) \
+// void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue);
+#define MatchFinder_REDUCE_OFFSETS(p, subValue) \
(p)->pos -= (subValue); \
(p)->streamPos -= (subValue);
@@ -107,7 +130,7 @@ typedef const Byte * (*Mf_GetPointerToCurrentPos_Func)(void *object);
typedef UInt32 * (*Mf_GetMatches_Func)(void *object, UInt32 *distances);
typedef void (*Mf_Skip_Func)(void *object, UInt32);
-typedef struct _IMatchFinder
+typedef struct
{
Mf_Init_Func Init;
Mf_GetNumAvailableBytes_Func GetNumAvailableBytes;
diff --git a/src/Common/lzma/LzFindMt.c b/src/Common/lzma/LzFindMt.c
index 4e67fc3f..5253e6eb 100644
--- a/src/Common/lzma/LzFindMt.c
+++ b/src/Common/lzma/LzFindMt.c
@@ -1,5 +1,5 @@
/* LzFindMt.c -- multithreaded Match finder for LZ algorithms
-2021-12-21 : Igor Pavlov : Public domain */
+2023-04-02 : Igor Pavlov : Public domain */
#include "Precomp.h"
@@ -69,7 +69,7 @@ extern UInt64 g_NumIters_Bytes;
UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
h3 = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); }
-#define __MT_HASH4_CALC { \
+#define MT_HASH4_CALC { \
UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
h2 = temp & (kHash2Size - 1); \
temp ^= ((UInt32)cur[2] << 8); \
@@ -79,14 +79,14 @@ extern UInt64 g_NumIters_Bytes;
*/
-MY_NO_INLINE
+Z7_NO_INLINE
static void MtSync_Construct(CMtSync *p)
{
p->affinity = 0;
p->wasCreated = False;
p->csWasInitialized = False;
p->csWasEntered = False;
- Thread_Construct(&p->thread);
+ Thread_CONSTRUCT(&p->thread)
Event_Construct(&p->canStart);
Event_Construct(&p->wasStopped);
Semaphore_Construct(&p->freeSemaphore);
@@ -116,7 +116,7 @@ static void MtSync_Construct(CMtSync *p)
(p)->csWasEntered = False; }
-MY_NO_INLINE
+Z7_NO_INLINE
static UInt32 MtSync_GetNextBlock(CMtSync *p)
{
UInt32 numBlocks = 0;
@@ -140,14 +140,14 @@ static UInt32 MtSync_GetNextBlock(CMtSync *p)
// buffer is UNLOCKED here
Semaphore_Wait(&p->filledSemaphore);
- LOCK_BUFFER(p);
+ LOCK_BUFFER(p)
return numBlocks;
}
/* if Writing (Processing) thread was started, we must call MtSync_StopWriting() */
-MY_NO_INLINE
+Z7_NO_INLINE
static void MtSync_StopWriting(CMtSync *p)
{
if (!Thread_WasCreated(&p->thread) || p->needStart)
@@ -185,7 +185,7 @@ static void MtSync_StopWriting(CMtSync *p)
}
-MY_NO_INLINE
+Z7_NO_INLINE
static void MtSync_Destruct(CMtSync *p)
{
PRF(printf("\nMtSync_Destruct %p\n", p));
@@ -220,11 +220,11 @@ static void MtSync_Destruct(CMtSync *p)
// #define RINOK_THREAD(x) { if ((x) != 0) return SZ_ERROR_THREAD; }
// we want to get real system error codes here instead of SZ_ERROR_THREAD
-#define RINOK_THREAD(x) RINOK(x)
+#define RINOK_THREAD(x) RINOK_WRes(x)
// call it before each new file (when new starting is required):
-MY_NO_INLINE
+Z7_NO_INLINE
static SRes MtSync_Init(CMtSync *p, UInt32 numBlocks)
{
WRes wres;
@@ -245,12 +245,12 @@ static WRes MtSync_Create_WRes(CMtSync *p, THREAD_FUNC_TYPE startAddress, void *
if (p->wasCreated)
return SZ_OK;
- RINOK_THREAD(CriticalSection_Init(&p->cs));
+ RINOK_THREAD(CriticalSection_Init(&p->cs))
p->csWasInitialized = True;
p->csWasEntered = False;
- RINOK_THREAD(AutoResetEvent_CreateNotSignaled(&p->canStart));
- RINOK_THREAD(AutoResetEvent_CreateNotSignaled(&p->wasStopped));
+ RINOK_THREAD(AutoResetEvent_CreateNotSignaled(&p->canStart))
+ RINOK_THREAD(AutoResetEvent_CreateNotSignaled(&p->wasStopped))
p->needStart = True;
p->exit = True; /* p->exit is unused before (canStart) Event.
@@ -264,13 +264,13 @@ static WRes MtSync_Create_WRes(CMtSync *p, THREAD_FUNC_TYPE startAddress, void *
else
wres = Thread_Create(&p->thread, startAddress, obj);
- RINOK_THREAD(wres);
+ RINOK_THREAD(wres)
p->wasCreated = True;
return SZ_OK;
}
-MY_NO_INLINE
+Z7_NO_INLINE
static SRes MtSync_Create(CMtSync *p, THREAD_FUNC_TYPE startAddress, void *obj)
{
const WRes wres = MtSync_Create_WRes(p, startAddress, obj);
@@ -519,7 +519,7 @@ static void HashThreadFunc(CMatchFinderMt *mt)
if (mf->pos > (UInt32)kMtMaxValForNormalize - num)
{
const UInt32 subValue = (mf->pos - mf->historySize - 1); // & ~(UInt32)(kNormalizeAlign - 1);
- Inline_MatchFinder_ReduceOffsets(mf, subValue);
+ MatchFinder_REDUCE_OFFSETS(mf, subValue)
MatchFinder_Normalize3(subValue, mf->hash + mf->fixedHashSize, (size_t)mf->hashMask + 1);
}
@@ -560,7 +560,7 @@ static void HashThreadFunc(CMatchFinderMt *mt)
*/
-UInt32 * MY_FAST_CALL GetMatchesSpecN_2(const Byte *lenLimit, size_t pos, const Byte *cur, CLzRef *son,
+UInt32 * Z7_FASTCALL GetMatchesSpecN_2(const Byte *lenLimit, size_t pos, const Byte *cur, CLzRef *son,
UInt32 _cutValue, UInt32 *d, size_t _maxLen, const UInt32 *hash, const UInt32 *limit, const UInt32 *size,
size_t _cyclicBufferPos, UInt32 _cyclicBufferSize,
UInt32 *posRes);
@@ -749,7 +749,7 @@ static void BtFillBlock(CMatchFinderMt *p, UInt32 globalBlockIndex)
}
-MY_NO_INLINE
+Z7_NO_INLINE
static void BtThreadFunc(CMatchFinderMt *mt)
{
CMtSync *p = &mt->btSync;
@@ -864,15 +864,15 @@ SRes MatchFinderMt_Create(CMatchFinderMt *p, UInt32 historySize, UInt32 keepAddB
if (!MatchFinder_Create(mf, historySize, keepAddBufferBefore, matchMaxLen, keepAddBufferAfter, alloc))
return SZ_ERROR_MEM;
- RINOK(MtSync_Create(&p->hashSync, HashThreadFunc2, p));
- RINOK(MtSync_Create(&p->btSync, BtThreadFunc2, p));
+ RINOK(MtSync_Create(&p->hashSync, HashThreadFunc2, p))
+ RINOK(MtSync_Create(&p->btSync, BtThreadFunc2, p))
return SZ_OK;
}
SRes MatchFinderMt_InitMt(CMatchFinderMt *p)
{
- RINOK(MtSync_Init(&p->hashSync, kMtHashNumBlocks));
+ RINOK(MtSync_Init(&p->hashSync, kMtHashNumBlocks))
return MtSync_Init(&p->btSync, kMtBtNumBlocks);
}
@@ -941,7 +941,7 @@ void MatchFinderMt_ReleaseStream(CMatchFinderMt *p)
}
-MY_NO_INLINE
+Z7_NO_INLINE
static UInt32 MatchFinderMt_GetNextBlock_Bt(CMatchFinderMt *p)
{
if (p->failure_LZ_BT)
@@ -1163,7 +1163,7 @@ UInt32* MatchFinderMt_GetMatches_Bt4(CMatchFinderMt *p, UInt32 *d)
*/
-static UInt32 *MixMatches4(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *d)
+static UInt32 * MixMatches4(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *d)
{
UInt32 h2, h3, /* h4, */ c2, c3 /* , c4 */;
UInt32 *hash = p->hash;
@@ -1179,9 +1179,8 @@ static UInt32 *MixMatches4(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *d)
(hash + kFix3HashSize)[h3] = m;
// (hash + kFix4HashSize)[h4] = m;
- #define _USE_H2
-
- #ifdef _USE_H2
+ // #define BT5_USE_H2
+ // #ifdef BT5_USE_H2
if (c2 >= matchMinPos && cur[(ptrdiff_t)c2 - (ptrdiff_t)m] == cur[0])
{
d[1] = m - c2 - 1;
@@ -1197,8 +1196,8 @@ static UInt32 *MixMatches4(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *d)
}
d[0] = 3;
d += 2;
-
- #ifdef _USE_H4
+
+ #ifdef BT5_USE_H4
if (c4 >= matchMinPos)
if (
cur[(ptrdiff_t)c4 - (ptrdiff_t)m] == cur[0] &&
@@ -1214,7 +1213,7 @@ static UInt32 *MixMatches4(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *d)
d[0] = 2;
d += 2;
}
- #endif
+ // #endif
if (c3 >= matchMinPos && cur[(ptrdiff_t)c3 - (ptrdiff_t)m] == cur[0])
{
@@ -1228,7 +1227,7 @@ static UInt32 *MixMatches4(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *d)
d += 2;
}
- #ifdef _USE_H4
+ #ifdef BT5_USE_H4
if (c4 >= matchMinPos)
if (
cur[(ptrdiff_t)c4 - (ptrdiff_t)m] == cur[0] &&
@@ -1244,7 +1243,7 @@ static UInt32 *MixMatches4(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *d)
}
-static UInt32* MatchFinderMt2_GetMatches(CMatchFinderMt *p, UInt32 *d)
+static UInt32 * MatchFinderMt2_GetMatches(CMatchFinderMt *p, UInt32 *d)
{
const UInt32 *bt = p->btBufPos;
const UInt32 len = *bt++;
@@ -1268,7 +1267,7 @@ static UInt32* MatchFinderMt2_GetMatches(CMatchFinderMt *p, UInt32 *d)
-static UInt32* MatchFinderMt_GetMatches(CMatchFinderMt *p, UInt32 *d)
+static UInt32 * MatchFinderMt_GetMatches(CMatchFinderMt *p, UInt32 *d)
{
const UInt32 *bt = p->btBufPos;
UInt32 len = *bt++;
@@ -1398,3 +1397,10 @@ void MatchFinderMt_CreateVTable(CMatchFinderMt *p, IMatchFinder2 *vTable)
break;
}
}
+
+#undef RINOK_THREAD
+#undef PRF
+#undef MF
+#undef GetUi24hi_from32
+#undef LOCK_BUFFER
+#undef UNLOCK_BUFFER
diff --git a/src/Common/lzma/LzFindMt.h b/src/Common/lzma/LzFindMt.h
index 660b7244..db5923ea 100644
--- a/src/Common/lzma/LzFindMt.h
+++ b/src/Common/lzma/LzFindMt.h
@@ -1,15 +1,15 @@
/* LzFindMt.h -- multithreaded Match finder for LZ algorithms
-2021-07-12 : Igor Pavlov : Public domain */
+2023-03-05 : Igor Pavlov : Public domain */
-#ifndef __LZ_FIND_MT_H
-#define __LZ_FIND_MT_H
+#ifndef ZIP7_INC_LZ_FIND_MT_H
+#define ZIP7_INC_LZ_FIND_MT_H
#include "LzFind.h"
#include "Threads.h"
EXTERN_C_BEGIN
-typedef struct _CMtSync
+typedef struct
{
UInt32 numProcessedBlocks;
CThread thread;
@@ -39,7 +39,7 @@ typedef UInt32 * (*Mf_Mix_Matches)(void *p, UInt32 matchMinPos, UInt32 *distance
typedef void (*Mf_GetHeads)(const Byte *buffer, UInt32 pos,
UInt32 *hash, UInt32 hashMask, UInt32 *heads, UInt32 numHeads, const UInt32 *crc);
-typedef struct _CMatchFinderMt
+typedef struct
{
/* LZ */
const Byte *pointerToCurPos;
diff --git a/src/Common/lzma/LzFindOpt.c b/src/Common/lzma/LzFindOpt.c
index 8ff006e0..85bdc136 100644
--- a/src/Common/lzma/LzFindOpt.c
+++ b/src/Common/lzma/LzFindOpt.c
@@ -1,5 +1,5 @@
/* LzFindOpt.c -- multithreaded Match finder for LZ algorithms
-2021-07-13 : Igor Pavlov : Public domain */
+2023-04-02 : Igor Pavlov : Public domain */
#include "Precomp.h"
@@ -41,8 +41,8 @@ UInt64 g_NumIters_Bytes;
// #define CYC_TO_POS_OFFSET 1 // for debug
/*
-MY_NO_INLINE
-UInt32 * MY_FAST_CALL GetMatchesSpecN_1(const Byte *lenLimit, size_t pos, const Byte *cur, CLzRef *son,
+Z7_NO_INLINE
+UInt32 * Z7_FASTCALL GetMatchesSpecN_1(const Byte *lenLimit, size_t pos, const Byte *cur, CLzRef *son,
UInt32 _cutValue, UInt32 *d, size_t _maxLen, const UInt32 *hash, const UInt32 *limit, const UInt32 *size, UInt32 *posRes)
{
do
@@ -214,13 +214,13 @@ else
to eliminate "movsx" BUG in old MSVC x64 compiler.
*/
-UInt32 * MY_FAST_CALL GetMatchesSpecN_2(const Byte *lenLimit, size_t pos, const Byte *cur, CLzRef *son,
+UInt32 * Z7_FASTCALL GetMatchesSpecN_2(const Byte *lenLimit, size_t pos, const Byte *cur, CLzRef *son,
UInt32 _cutValue, UInt32 *d, size_t _maxLen, const UInt32 *hash, const UInt32 *limit, const UInt32 *size,
size_t _cyclicBufferPos, UInt32 _cyclicBufferSize,
UInt32 *posRes);
-MY_NO_INLINE
-UInt32 * MY_FAST_CALL GetMatchesSpecN_2(const Byte *lenLimit, size_t pos, const Byte *cur, CLzRef *son,
+Z7_NO_INLINE
+UInt32 * Z7_FASTCALL GetMatchesSpecN_2(const Byte *lenLimit, size_t pos, const Byte *cur, CLzRef *son,
UInt32 _cutValue, UInt32 *d, size_t _maxLen, const UInt32 *hash, const UInt32 *limit, const UInt32 *size,
size_t _cyclicBufferPos, UInt32 _cyclicBufferSize,
UInt32 *posRes)
@@ -404,7 +404,7 @@ else
/*
typedef UInt32 uint32plus; // size_t
-UInt32 * MY_FAST_CALL GetMatchesSpecN_3(uint32plus lenLimit, size_t pos, const Byte *cur, CLzRef *son,
+UInt32 * Z7_FASTCALL GetMatchesSpecN_3(uint32plus lenLimit, size_t pos, const Byte *cur, CLzRef *son,
UInt32 _cutValue, UInt32 *d, uint32plus _maxLen, const UInt32 *hash, const UInt32 *limit, const UInt32 *size,
size_t _cyclicBufferPos, UInt32 _cyclicBufferSize,
UInt32 *posRes)
diff --git a/src/Common/lzma/LzHash.h b/src/Common/lzma/LzHash.h
index 77b898cf..2b6290b6 100644
--- a/src/Common/lzma/LzHash.h
+++ b/src/Common/lzma/LzHash.h
@@ -1,8 +1,8 @@
-/* LzHash.h -- HASH functions for LZ algorithms
-2019-10-30 : Igor Pavlov : Public domain */
+/* LzHash.h -- HASH constants for LZ algorithms
+2023-03-05 : Igor Pavlov : Public domain */
-#ifndef __LZ_HASH_H
-#define __LZ_HASH_H
+#ifndef ZIP7_INC_LZ_HASH_H
+#define ZIP7_INC_LZ_HASH_H
/*
(kHash2Size >= (1 << 8)) : Required
diff --git a/src/Common/lzma/LzmaDec.c b/src/Common/lzma/LzmaDec.c
index d6742e5a..69bb8bba 100644
--- a/src/Common/lzma/LzmaDec.c
+++ b/src/Common/lzma/LzmaDec.c
@@ -1,5 +1,5 @@
/* LzmaDec.c -- LZMA Decoder
-2021-04-01 : Igor Pavlov : Public domain */
+2023-04-07 : Igor Pavlov : Public domain */
#include "Precomp.h"
@@ -8,15 +8,15 @@
/* #include "CpuArch.h" */
#include "LzmaDec.h"
-#define kNumTopBits 24
-#define kTopValue ((UInt32)1 << kNumTopBits)
+// #define kNumTopBits 24
+#define kTopValue ((UInt32)1 << 24)
#define kNumBitModelTotalBits 11
#define kBitModelTotal (1 << kNumBitModelTotalBits)
#define RC_INIT_SIZE 5
-#ifndef _LZMA_DEC_OPT
+#ifndef Z7_LZMA_DEC_OPT
#define kNumMoveBits 5
#define NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | (*buf++); }
@@ -25,14 +25,14 @@
#define UPDATE_0(p) range = bound; *(p) = (CLzmaProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits));
#define UPDATE_1(p) range -= bound; code -= bound; *(p) = (CLzmaProb)(ttt - (ttt >> kNumMoveBits));
#define GET_BIT2(p, i, A0, A1) IF_BIT_0(p) \
- { UPDATE_0(p); i = (i + i); A0; } else \
- { UPDATE_1(p); i = (i + i) + 1; A1; }
+ { UPDATE_0(p) i = (i + i); A0; } else \
+ { UPDATE_1(p) i = (i + i) + 1; A1; }
#define TREE_GET_BIT(probs, i) { GET_BIT2(probs + i, i, ;, ;); }
#define REV_BIT(p, i, A0, A1) IF_BIT_0(p + i) \
- { UPDATE_0(p + i); A0; } else \
- { UPDATE_1(p + i); A1; }
+ { UPDATE_0(p + i) A0; } else \
+ { UPDATE_1(p + i) A1; }
#define REV_BIT_VAR( p, i, m) REV_BIT(p, i, i += m; m += m, m += m; i += m; )
#define REV_BIT_CONST(p, i, m) REV_BIT(p, i, i += m; , i += m * 2; )
#define REV_BIT_LAST( p, i, m) REV_BIT(p, i, i -= m , ; )
@@ -40,19 +40,19 @@
#define TREE_DECODE(probs, limit, i) \
{ i = 1; do { TREE_GET_BIT(probs, i); } while (i < limit); i -= limit; }
-/* #define _LZMA_SIZE_OPT */
+/* #define Z7_LZMA_SIZE_OPT */
-#ifdef _LZMA_SIZE_OPT
+#ifdef Z7_LZMA_SIZE_OPT
#define TREE_6_DECODE(probs, i) TREE_DECODE(probs, (1 << 6), i)
#else
#define TREE_6_DECODE(probs, i) \
{ i = 1; \
- TREE_GET_BIT(probs, i); \
- TREE_GET_BIT(probs, i); \
- TREE_GET_BIT(probs, i); \
- TREE_GET_BIT(probs, i); \
- TREE_GET_BIT(probs, i); \
- TREE_GET_BIT(probs, i); \
+ TREE_GET_BIT(probs, i) \
+ TREE_GET_BIT(probs, i) \
+ TREE_GET_BIT(probs, i) \
+ TREE_GET_BIT(probs, i) \
+ TREE_GET_BIT(probs, i) \
+ TREE_GET_BIT(probs, i) \
i -= 0x40; }
#endif
@@ -64,25 +64,25 @@
probLit = prob + (offs + bit + symbol); \
GET_BIT2(probLit, symbol, offs ^= bit; , ;)
-#endif // _LZMA_DEC_OPT
+#endif // Z7_LZMA_DEC_OPT
#define NORMALIZE_CHECK if (range < kTopValue) { if (buf >= bufLimit) return DUMMY_INPUT_EOF; range <<= 8; code = (code << 8) | (*buf++); }
-#define IF_BIT_0_CHECK(p) ttt = *(p); NORMALIZE_CHECK; bound = (range >> kNumBitModelTotalBits) * (UInt32)ttt; if (code < bound)
+#define IF_BIT_0_CHECK(p) ttt = *(p); NORMALIZE_CHECK bound = (range >> kNumBitModelTotalBits) * (UInt32)ttt; if (code < bound)
#define UPDATE_0_CHECK range = bound;
#define UPDATE_1_CHECK range -= bound; code -= bound;
#define GET_BIT2_CHECK(p, i, A0, A1) IF_BIT_0_CHECK(p) \
- { UPDATE_0_CHECK; i = (i + i); A0; } else \
- { UPDATE_1_CHECK; i = (i + i) + 1; A1; }
+ { UPDATE_0_CHECK i = (i + i); A0; } else \
+ { UPDATE_1_CHECK i = (i + i) + 1; A1; }
#define GET_BIT_CHECK(p, i) GET_BIT2_CHECK(p, i, ; , ;)
#define TREE_DECODE_CHECK(probs, limit, i) \
{ i = 1; do { GET_BIT_CHECK(probs + i, i) } while (i < limit); i -= limit; }
#define REV_BIT_CHECK(p, i, m) IF_BIT_0_CHECK(p + i) \
- { UPDATE_0_CHECK; i += m; m += m; } else \
- { UPDATE_1_CHECK; m += m; i += m; }
+ { UPDATE_0_CHECK i += m; m += m; } else \
+ { UPDATE_1_CHECK m += m; i += m; }
#define kNumPosBitsMax 4
@@ -224,14 +224,14 @@ Out:
*/
-#ifdef _LZMA_DEC_OPT
+#ifdef Z7_LZMA_DEC_OPT
-int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaDec *p, SizeT limit, const Byte *bufLimit);
+int Z7_FASTCALL LZMA_DECODE_REAL(CLzmaDec *p, SizeT limit, const Byte *bufLimit);
#else
static
-int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaDec *p, SizeT limit, const Byte *bufLimit)
+int Z7_FASTCALL LZMA_DECODE_REAL(CLzmaDec *p, SizeT limit, const Byte *bufLimit)
{
CLzmaProb *probs = GET_PROBS;
unsigned state = (unsigned)p->state;
@@ -263,7 +263,7 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaDec *p, SizeT limit, const Byte *bufLimit
IF_BIT_0(prob)
{
unsigned symbol;
- UPDATE_0(prob);
+ UPDATE_0(prob)
prob = probs + Literal;
if (processedPos != 0 || checkDicSize != 0)
prob += (UInt32)3 * ((((processedPos << 8) + dic[(dicPos == 0 ? dicBufSize : dicPos) - 1]) & lpMask) << lc);
@@ -273,7 +273,7 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaDec *p, SizeT limit, const Byte *bufLimit
{
state -= (state < 4) ? state : 3;
symbol = 1;
- #ifdef _LZMA_SIZE_OPT
+ #ifdef Z7_LZMA_SIZE_OPT
do { NORMAL_LITER_DEC } while (symbol < 0x100);
#else
NORMAL_LITER_DEC
@@ -292,7 +292,7 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaDec *p, SizeT limit, const Byte *bufLimit
unsigned offs = 0x100;
state -= (state < 10) ? 3 : 6;
symbol = 1;
- #ifdef _LZMA_SIZE_OPT
+ #ifdef Z7_LZMA_SIZE_OPT
do
{
unsigned bit;
@@ -321,25 +321,25 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaDec *p, SizeT limit, const Byte *bufLimit
}
{
- UPDATE_1(prob);
+ UPDATE_1(prob)
prob = probs + IsRep + state;
IF_BIT_0(prob)
{
- UPDATE_0(prob);
+ UPDATE_0(prob)
state += kNumStates;
prob = probs + LenCoder;
}
else
{
- UPDATE_1(prob);
+ UPDATE_1(prob)
prob = probs + IsRepG0 + state;
IF_BIT_0(prob)
{
- UPDATE_0(prob);
+ UPDATE_0(prob)
prob = probs + IsRep0Long + COMBINED_PS_STATE;
IF_BIT_0(prob)
{
- UPDATE_0(prob);
+ UPDATE_0(prob)
// that case was checked before with kBadRepCode
// if (checkDicSize == 0 && processedPos == 0) { len = kMatchSpecLen_Error_Data + 1; break; }
@@ -353,30 +353,30 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaDec *p, SizeT limit, const Byte *bufLimit
state = state < kNumLitStates ? 9 : 11;
continue;
}
- UPDATE_1(prob);
+ UPDATE_1(prob)
}
else
{
UInt32 distance;
- UPDATE_1(prob);
+ UPDATE_1(prob)
prob = probs + IsRepG1 + state;
IF_BIT_0(prob)
{
- UPDATE_0(prob);
+ UPDATE_0(prob)
distance = rep1;
}
else
{
- UPDATE_1(prob);
+ UPDATE_1(prob)
prob = probs + IsRepG2 + state;
IF_BIT_0(prob)
{
- UPDATE_0(prob);
+ UPDATE_0(prob)
distance = rep2;
}
else
{
- UPDATE_1(prob);
+ UPDATE_1(prob)
distance = rep3;
rep3 = rep2;
}
@@ -389,37 +389,37 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaDec *p, SizeT limit, const Byte *bufLimit
prob = probs + RepLenCoder;
}
- #ifdef _LZMA_SIZE_OPT
+ #ifdef Z7_LZMA_SIZE_OPT
{
unsigned lim, offset;
CLzmaProb *probLen = prob + LenChoice;
IF_BIT_0(probLen)
{
- UPDATE_0(probLen);
+ UPDATE_0(probLen)
probLen = prob + LenLow + GET_LEN_STATE;
offset = 0;
lim = (1 << kLenNumLowBits);
}
else
{
- UPDATE_1(probLen);
+ UPDATE_1(probLen)
probLen = prob + LenChoice2;
IF_BIT_0(probLen)
{
- UPDATE_0(probLen);
+ UPDATE_0(probLen)
probLen = prob + LenLow + GET_LEN_STATE + (1 << kLenNumLowBits);
offset = kLenNumLowSymbols;
lim = (1 << kLenNumLowBits);
}
else
{
- UPDATE_1(probLen);
+ UPDATE_1(probLen)
probLen = prob + LenHigh;
offset = kLenNumLowSymbols * 2;
lim = (1 << kLenNumHighBits);
}
}
- TREE_DECODE(probLen, lim, len);
+ TREE_DECODE(probLen, lim, len)
len += offset;
}
#else
@@ -427,32 +427,32 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaDec *p, SizeT limit, const Byte *bufLimit
CLzmaProb *probLen = prob + LenChoice;
IF_BIT_0(probLen)
{
- UPDATE_0(probLen);
+ UPDATE_0(probLen)
probLen = prob + LenLow + GET_LEN_STATE;
len = 1;
- TREE_GET_BIT(probLen, len);
- TREE_GET_BIT(probLen, len);
- TREE_GET_BIT(probLen, len);
+ TREE_GET_BIT(probLen, len)
+ TREE_GET_BIT(probLen, len)
+ TREE_GET_BIT(probLen, len)
len -= 8;
}
else
{
- UPDATE_1(probLen);
+ UPDATE_1(probLen)
probLen = prob + LenChoice2;
IF_BIT_0(probLen)
{
- UPDATE_0(probLen);
+ UPDATE_0(probLen)
probLen = prob + LenLow + GET_LEN_STATE + (1 << kLenNumLowBits);
len = 1;
- TREE_GET_BIT(probLen, len);
- TREE_GET_BIT(probLen, len);
- TREE_GET_BIT(probLen, len);
+ TREE_GET_BIT(probLen, len)
+ TREE_GET_BIT(probLen, len)
+ TREE_GET_BIT(probLen, len)
}
else
{
- UPDATE_1(probLen);
+ UPDATE_1(probLen)
probLen = prob + LenHigh;
- TREE_DECODE(probLen, (1 << kLenNumHighBits), len);
+ TREE_DECODE(probLen, (1 << kLenNumHighBits), len)
len += kLenNumLowSymbols * 2;
}
}
@@ -464,7 +464,7 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaDec *p, SizeT limit, const Byte *bufLimit
UInt32 distance;
prob = probs + PosSlot +
((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << kNumPosSlotBits);
- TREE_6_DECODE(prob, distance);
+ TREE_6_DECODE(prob, distance)
if (distance >= kStartPosModelIndex)
{
unsigned posSlot = (unsigned)distance;
@@ -479,7 +479,7 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaDec *p, SizeT limit, const Byte *bufLimit
distance++;
do
{
- REV_BIT_VAR(prob, distance, m);
+ REV_BIT_VAR(prob, distance, m)
}
while (--numDirectBits);
distance -= m;
@@ -514,10 +514,10 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaDec *p, SizeT limit, const Byte *bufLimit
distance <<= kNumAlignBits;
{
unsigned i = 1;
- REV_BIT_CONST(prob, i, 1);
- REV_BIT_CONST(prob, i, 2);
- REV_BIT_CONST(prob, i, 4);
- REV_BIT_LAST (prob, i, 8);
+ REV_BIT_CONST(prob, i, 1)
+ REV_BIT_CONST(prob, i, 2)
+ REV_BIT_CONST(prob, i, 4)
+ REV_BIT_LAST (prob, i, 8)
distance |= i;
}
if (distance == (UInt32)0xFFFFFFFF)
@@ -592,7 +592,7 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaDec *p, SizeT limit, const Byte *bufLimit
}
while (dicPos < limit && buf < bufLimit);
- NORMALIZE;
+ NORMALIZE
p->buf = buf;
p->range = range;
@@ -613,7 +613,7 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaDec *p, SizeT limit, const Byte *bufLimit
-static void MY_FAST_CALL LzmaDec_WriteRem(CLzmaDec *p, SizeT limit)
+static void Z7_FASTCALL LzmaDec_WriteRem(CLzmaDec *p, SizeT limit)
{
unsigned len = (unsigned)p->remainLen;
if (len == 0 /* || len >= kMatchSpecLenStart */)
@@ -683,7 +683,7 @@ and we support the following state of (p->checkDicSize):
(p->checkDicSize == p->prop.dicSize)
*/
-static int MY_FAST_CALL LzmaDec_DecodeReal2(CLzmaDec *p, SizeT limit, const Byte *bufLimit)
+static int Z7_FASTCALL LzmaDec_DecodeReal2(CLzmaDec *p, SizeT limit, const Byte *bufLimit)
{
if (p->checkDicSize == 0)
{
@@ -767,54 +767,54 @@ static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, const Byt
else
{
unsigned len;
- UPDATE_1_CHECK;
+ UPDATE_1_CHECK
prob = probs + IsRep + state;
IF_BIT_0_CHECK(prob)
{
- UPDATE_0_CHECK;
+ UPDATE_0_CHECK
state = 0;
prob = probs + LenCoder;
res = DUMMY_MATCH;
}
else
{
- UPDATE_1_CHECK;
+ UPDATE_1_CHECK
res = DUMMY_REP;
prob = probs + IsRepG0 + state;
IF_BIT_0_CHECK(prob)
{
- UPDATE_0_CHECK;
+ UPDATE_0_CHECK
prob = probs + IsRep0Long + COMBINED_PS_STATE;
IF_BIT_0_CHECK(prob)
{
- UPDATE_0_CHECK;
+ UPDATE_0_CHECK
break;
}
else
{
- UPDATE_1_CHECK;
+ UPDATE_1_CHECK
}
}
else
{
- UPDATE_1_CHECK;
+ UPDATE_1_CHECK
prob = probs + IsRepG1 + state;
IF_BIT_0_CHECK(prob)
{
- UPDATE_0_CHECK;
+ UPDATE_0_CHECK
}
else
{
- UPDATE_1_CHECK;
+ UPDATE_1_CHECK
prob = probs + IsRepG2 + state;
IF_BIT_0_CHECK(prob)
{
- UPDATE_0_CHECK;
+ UPDATE_0_CHECK
}
else
{
- UPDATE_1_CHECK;
+ UPDATE_1_CHECK
}
}
}
@@ -826,31 +826,31 @@ static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, const Byt
const CLzmaProb *probLen = prob + LenChoice;
IF_BIT_0_CHECK(probLen)
{
- UPDATE_0_CHECK;
+ UPDATE_0_CHECK
probLen = prob + LenLow + GET_LEN_STATE;
offset = 0;
limit = 1 << kLenNumLowBits;
}
else
{
- UPDATE_1_CHECK;
+ UPDATE_1_CHECK
probLen = prob + LenChoice2;
IF_BIT_0_CHECK(probLen)
{
- UPDATE_0_CHECK;
+ UPDATE_0_CHECK
probLen = prob + LenLow + GET_LEN_STATE + (1 << kLenNumLowBits);
offset = kLenNumLowSymbols;
limit = 1 << kLenNumLowBits;
}
else
{
- UPDATE_1_CHECK;
+ UPDATE_1_CHECK
probLen = prob + LenHigh;
offset = kLenNumLowSymbols * 2;
limit = 1 << kLenNumHighBits;
}
}
- TREE_DECODE_CHECK(probLen, limit, len);
+ TREE_DECODE_CHECK(probLen, limit, len)
len += offset;
}
@@ -860,7 +860,7 @@ static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, const Byt
prob = probs + PosSlot +
((len < kNumLenToPosStates - 1 ? len : kNumLenToPosStates - 1) <<
kNumPosSlotBits);
- TREE_DECODE_CHECK(prob, 1 << kNumPosSlotBits, posSlot);
+ TREE_DECODE_CHECK(prob, 1 << kNumPosSlotBits, posSlot)
if (posSlot >= kStartPosModelIndex)
{
unsigned numDirectBits = ((posSlot >> 1) - 1);
@@ -888,7 +888,7 @@ static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, const Byt
unsigned m = 1;
do
{
- REV_BIT_CHECK(prob, i, m);
+ REV_BIT_CHECK(prob, i, m)
}
while (--numDirectBits);
}
@@ -897,7 +897,7 @@ static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, const Byt
}
break;
}
- NORMALIZE_CHECK;
+ NORMALIZE_CHECK
*bufOut = buf;
return res;
@@ -943,7 +943,7 @@ When the decoder lookahead, and the lookahead symbol is not end_marker, we have
*/
-#define RETURN__NOT_FINISHED__FOR_FINISH \
+#define RETURN_NOT_FINISHED_FOR_FINISH \
*status = LZMA_STATUS_NOT_FINISHED; \
return SZ_ERROR_DATA; // for strict mode
// return SZ_OK; // for relaxed mode
@@ -1029,7 +1029,7 @@ SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *sr
}
if (p->remainLen != 0)
{
- RETURN__NOT_FINISHED__FOR_FINISH;
+ RETURN_NOT_FINISHED_FOR_FINISH
}
checkEndMarkNow = 1;
}
@@ -1072,7 +1072,7 @@ SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *sr
for (i = 0; i < (unsigned)dummyProcessed; i++)
p->tempBuf[i] = src[i];
// p->remainLen = kMatchSpecLen_Error_Data;
- RETURN__NOT_FINISHED__FOR_FINISH;
+ RETURN_NOT_FINISHED_FOR_FINISH
}
bufLimit = src;
@@ -1150,7 +1150,7 @@ SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *sr
(*srcLen) += (unsigned)dummyProcessed - p->tempBufSize;
p->tempBufSize = (unsigned)dummyProcessed;
// p->remainLen = kMatchSpecLen_Error_Data;
- RETURN__NOT_FINISHED__FOR_FINISH;
+ RETURN_NOT_FINISHED_FOR_FINISH
}
}
@@ -1299,8 +1299,8 @@ static SRes LzmaDec_AllocateProbs2(CLzmaDec *p, const CLzmaProps *propNew, ISzAl
SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAllocPtr alloc)
{
CLzmaProps propNew;
- RINOK(LzmaProps_Decode(&propNew, props, propsSize));
- RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc));
+ RINOK(LzmaProps_Decode(&propNew, props, propsSize))
+ RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc))
p->prop = propNew;
return SZ_OK;
}
@@ -1309,14 +1309,14 @@ SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAll
{
CLzmaProps propNew;
SizeT dicBufSize;
- RINOK(LzmaProps_Decode(&propNew, props, propsSize));
- RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc));
+ RINOK(LzmaProps_Decode(&propNew, props, propsSize))
+ RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc))
{
UInt32 dictSize = propNew.dicSize;
SizeT mask = ((UInt32)1 << 12) - 1;
if (dictSize >= ((UInt32)1 << 30)) mask = ((UInt32)1 << 22) - 1;
- else if (dictSize >= ((UInt32)1 << 22)) mask = ((UInt32)1 << 20) - 1;;
+ else if (dictSize >= ((UInt32)1 << 22)) mask = ((UInt32)1 << 20) - 1;
dicBufSize = ((SizeT)dictSize + mask) & ~mask;
if (dicBufSize < dictSize)
dicBufSize = dictSize;
@@ -1348,8 +1348,8 @@ SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
*status = LZMA_STATUS_NOT_SPECIFIED;
if (inSize < RC_INIT_SIZE)
return SZ_ERROR_INPUT_EOF;
- LzmaDec_Construct(&p);
- RINOK(LzmaDec_AllocateProbs(&p, propData, propSize, alloc));
+ LzmaDec_CONSTRUCT(&p)
+ RINOK(LzmaDec_AllocateProbs(&p, propData, propSize, alloc))
p.dic = dest;
p.dicBufSize = outSize;
LzmaDec_Init(&p);
diff --git a/src/Common/lzma/LzmaDec.h b/src/Common/lzma/LzmaDec.h
index 6f129625..b0ce28fa 100644
--- a/src/Common/lzma/LzmaDec.h
+++ b/src/Common/lzma/LzmaDec.h
@@ -1,19 +1,19 @@
/* LzmaDec.h -- LZMA Decoder
-2020-03-19 : Igor Pavlov : Public domain */
+2023-04-02 : Igor Pavlov : Public domain */
-#ifndef __LZMA_DEC_H
-#define __LZMA_DEC_H
+#ifndef ZIP7_INC_LZMA_DEC_H
+#define ZIP7_INC_LZMA_DEC_H
#include "7zTypes.h"
EXTERN_C_BEGIN
-/* #define _LZMA_PROB32 */
-/* _LZMA_PROB32 can increase the speed on some CPUs,
+/* #define Z7_LZMA_PROB32 */
+/* Z7_LZMA_PROB32 can increase the speed on some CPUs,
but memory usage for CLzmaDec::probs will be doubled in that case */
typedef
-#ifdef _LZMA_PROB32
+#ifdef Z7_LZMA_PROB32
UInt32
#else
UInt16
@@ -25,7 +25,7 @@ typedef
#define LZMA_PROPS_SIZE 5
-typedef struct _CLzmaProps
+typedef struct
{
Byte lc;
Byte lp;
@@ -73,7 +73,8 @@ typedef struct
Byte tempBuf[LZMA_REQUIRED_INPUT_MAX];
} CLzmaDec;
-#define LzmaDec_Construct(p) { (p)->dic = NULL; (p)->probs = NULL; }
+#define LzmaDec_CONSTRUCT(p) { (p)->dic = NULL; (p)->probs = NULL; }
+#define LzmaDec_Construct(p) LzmaDec_CONSTRUCT(p)
void LzmaDec_Init(CLzmaDec *p);
diff --git a/src/Common/lzma/LzmaEnc.c b/src/Common/lzma/LzmaEnc.c
index b04a7b7b..6d13cac8 100644
--- a/src/Common/lzma/LzmaEnc.c
+++ b/src/Common/lzma/LzmaEnc.c
@@ -1,5 +1,5 @@
/* LzmaEnc.c -- LZMA Encoder
-2021-11-18: Igor Pavlov : Public domain */
+2023-04-13: Igor Pavlov : Public domain */
#include "Precomp.h"
@@ -16,22 +16,22 @@
#include "LzmaEnc.h"
#include "LzFind.h"
-#ifndef _7ZIP_ST
+#ifndef Z7_ST
#include "LzFindMt.h"
#endif
/* the following LzmaEnc_* declarations is internal LZMA interface for LZMA2 encoder */
-SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp, ISeqInStream *inStream, UInt32 keepWindowSize,
+SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle p, ISeqInStreamPtr inStream, UInt32 keepWindowSize,
ISzAllocPtr alloc, ISzAllocPtr allocBig);
-SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen,
+SRes LzmaEnc_MemPrepare(CLzmaEncHandle p, const Byte *src, SizeT srcLen,
UInt32 keepWindowSize, ISzAllocPtr alloc, ISzAllocPtr allocBig);
-SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, BoolInt reInit,
+SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle p, BoolInt reInit,
Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize);
-const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp);
-void LzmaEnc_Finish(CLzmaEncHandle pp);
-void LzmaEnc_SaveState(CLzmaEncHandle pp);
-void LzmaEnc_RestoreState(CLzmaEncHandle pp);
+const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle p);
+void LzmaEnc_Finish(CLzmaEncHandle p);
+void LzmaEnc_SaveState(CLzmaEncHandle p);
+void LzmaEnc_RestoreState(CLzmaEncHandle p);
#ifdef SHOW_STAT
static unsigned g_STAT_OFFSET = 0;
@@ -40,8 +40,8 @@ static unsigned g_STAT_OFFSET = 0;
/* for good normalization speed we still reserve 256 MB before 4 GB range */
#define kLzmaMaxHistorySize ((UInt32)15 << 28)
-#define kNumTopBits 24
-#define kTopValue ((UInt32)1 << kNumTopBits)
+// #define kNumTopBits 24
+#define kTopValue ((UInt32)1 << 24)
#define kNumBitModelTotalBits 11
#define kBitModelTotal (1 << kNumBitModelTotalBits)
@@ -60,6 +60,7 @@ void LzmaEncProps_Init(CLzmaEncProps *p)
p->dictSize = p->mc = 0;
p->reduceSize = (UInt64)(Int64)-1;
p->lc = p->lp = p->pb = p->algo = p->fb = p->btMode = p->numHashBytes = p->numThreads = -1;
+ p->numHashOutBits = 0;
p->writeEndMark = 0;
p->affinity = 0;
}
@@ -99,7 +100,7 @@ void LzmaEncProps_Normalize(CLzmaEncProps *p)
if (p->numThreads < 0)
p->numThreads =
- #ifndef _7ZIP_ST
+ #ifndef Z7_ST
((p->btMode && p->algo) ? 2 : 1);
#else
1;
@@ -293,7 +294,7 @@ typedef struct
#define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
typedef
-#ifdef _LZMA_PROB32
+#ifdef Z7_LZMA_PROB32
UInt32
#else
UInt16
@@ -350,7 +351,7 @@ typedef struct
Byte *buf;
Byte *bufLim;
Byte *bufBase;
- ISeqOutStream *outStream;
+ ISeqOutStreamPtr outStream;
UInt64 processed;
SRes res;
} CRangeEnc;
@@ -383,7 +384,7 @@ typedef struct
typedef UInt32 CProbPrice;
-typedef struct
+struct CLzmaEnc
{
void *matchFinderObj;
IMatchFinder2 matchFinder;
@@ -426,7 +427,7 @@ typedef struct
UInt32 dictSize;
SRes result;
- #ifndef _7ZIP_ST
+ #ifndef Z7_ST
BoolInt mtMode;
// begin of CMatchFinderMt is used in LZ thread
CMatchFinderMt matchFinderMt;
@@ -439,7 +440,7 @@ typedef struct
// we suppose that we have 8-bytes alignment after CMatchFinder
- #ifndef _7ZIP_ST
+ #ifndef Z7_ST
Byte pad[128];
#endif
@@ -479,77 +480,59 @@ typedef struct
CSaveState saveState;
// BoolInt mf_Failure;
- #ifndef _7ZIP_ST
+ #ifndef Z7_ST
Byte pad2[128];
#endif
-} CLzmaEnc;
+};
#define MFB (p->matchFinderBase)
/*
-#ifndef _7ZIP_ST
+#ifndef Z7_ST
#define MFB (p->matchFinderMt.MatchFinder)
#endif
*/
-#define COPY_ARR(dest, src, arr) memcpy(dest->arr, src->arr, sizeof(src->arr));
-
-void LzmaEnc_SaveState(CLzmaEncHandle pp)
-{
- CLzmaEnc *p = (CLzmaEnc *)pp;
- CSaveState *dest = &p->saveState;
-
- dest->state = p->state;
-
- dest->lenProbs = p->lenProbs;
- dest->repLenProbs = p->repLenProbs;
-
- COPY_ARR(dest, p, reps);
-
- COPY_ARR(dest, p, posAlignEncoder);
- COPY_ARR(dest, p, isRep);
- COPY_ARR(dest, p, isRepG0);
- COPY_ARR(dest, p, isRepG1);
- COPY_ARR(dest, p, isRepG2);
- COPY_ARR(dest, p, isMatch);
- COPY_ARR(dest, p, isRep0Long);
- COPY_ARR(dest, p, posSlotEncoder);
- COPY_ARR(dest, p, posEncoders);
-
- memcpy(dest->litProbs, p->litProbs, ((UInt32)0x300 << p->lclp) * sizeof(CLzmaProb));
+// #define GET_CLzmaEnc_p CLzmaEnc *p = (CLzmaEnc*)(void *)p;
+// #define GET_const_CLzmaEnc_p const CLzmaEnc *p = (const CLzmaEnc*)(const void *)p;
+
+#define COPY_ARR(dest, src, arr) memcpy((dest)->arr, (src)->arr, sizeof((src)->arr));
+
+#define COPY_LZMA_ENC_STATE(d, s, p) \
+ (d)->state = (s)->state; \
+ COPY_ARR(d, s, reps) \
+ COPY_ARR(d, s, posAlignEncoder) \
+ COPY_ARR(d, s, isRep) \
+ COPY_ARR(d, s, isRepG0) \
+ COPY_ARR(d, s, isRepG1) \
+ COPY_ARR(d, s, isRepG2) \
+ COPY_ARR(d, s, isMatch) \
+ COPY_ARR(d, s, isRep0Long) \
+ COPY_ARR(d, s, posSlotEncoder) \
+ COPY_ARR(d, s, posEncoders) \
+ (d)->lenProbs = (s)->lenProbs; \
+ (d)->repLenProbs = (s)->repLenProbs; \
+ memcpy((d)->litProbs, (s)->litProbs, ((UInt32)0x300 << (p)->lclp) * sizeof(CLzmaProb));
+
+void LzmaEnc_SaveState(CLzmaEncHandle p)
+{
+ // GET_CLzmaEnc_p
+ CSaveState *v = &p->saveState;
+ COPY_LZMA_ENC_STATE(v, p, p)
}
-
-void LzmaEnc_RestoreState(CLzmaEncHandle pp)
+void LzmaEnc_RestoreState(CLzmaEncHandle p)
{
- CLzmaEnc *dest = (CLzmaEnc *)pp;
- const CSaveState *p = &dest->saveState;
-
- dest->state = p->state;
-
- dest->lenProbs = p->lenProbs;
- dest->repLenProbs = p->repLenProbs;
-
- COPY_ARR(dest, p, reps);
-
- COPY_ARR(dest, p, posAlignEncoder);
- COPY_ARR(dest, p, isRep);
- COPY_ARR(dest, p, isRepG0);
- COPY_ARR(dest, p, isRepG1);
- COPY_ARR(dest, p, isRepG2);
- COPY_ARR(dest, p, isMatch);
- COPY_ARR(dest, p, isRep0Long);
- COPY_ARR(dest, p, posSlotEncoder);
- COPY_ARR(dest, p, posEncoders);
-
- memcpy(dest->litProbs, p->litProbs, ((UInt32)0x300 << dest->lclp) * sizeof(CLzmaProb));
+ // GET_CLzmaEnc_p
+ const CSaveState *v = &p->saveState;
+ COPY_LZMA_ENC_STATE(p, v, p)
}
-
-SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2)
+Z7_NO_INLINE
+SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props2)
{
- CLzmaEnc *p = (CLzmaEnc *)pp;
+ // GET_CLzmaEnc_p
CLzmaEncProps props = *props2;
LzmaEncProps_Normalize(&props);
@@ -585,6 +568,7 @@ SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2)
p->fastMode = (props.algo == 0);
// p->_maxMode = True;
MFB.btMode = (Byte)(props.btMode ? 1 : 0);
+ // MFB.btMode = (Byte)(props.btMode);
{
unsigned numHashBytes = 4;
if (props.btMode)
@@ -595,13 +579,15 @@ SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2)
if (props.numHashBytes >= 5) numHashBytes = 5;
MFB.numHashBytes = numHashBytes;
+ // MFB.numHashBytes_Min = 2;
+ MFB.numHashOutBits = (Byte)props.numHashOutBits;
}
MFB.cutValue = props.mc;
p->writeEndMark = (BoolInt)props.writeEndMark;
- #ifndef _7ZIP_ST
+ #ifndef Z7_ST
/*
if (newMultiThread != _multiThread)
{
@@ -618,9 +604,9 @@ SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2)
}
-void LzmaEnc_SetDataSize(CLzmaEncHandle pp, UInt64 expectedDataSiize)
+void LzmaEnc_SetDataSize(CLzmaEncHandle p, UInt64 expectedDataSiize)
{
- CLzmaEnc *p = (CLzmaEnc *)pp;
+ // GET_CLzmaEnc_p
MFB.expectedDataSize = expectedDataSiize;
}
@@ -684,7 +670,7 @@ static void RangeEnc_Init(CRangeEnc *p)
p->res = SZ_OK;
}
-MY_NO_INLINE static void RangeEnc_FlushStream(CRangeEnc *p)
+Z7_NO_INLINE static void RangeEnc_FlushStream(CRangeEnc *p)
{
const size_t num = (size_t)(p->buf - p->bufBase);
if (p->res == SZ_OK)
@@ -696,7 +682,7 @@ MY_NO_INLINE static void RangeEnc_FlushStream(CRangeEnc *p)
p->buf = p->bufBase;
}
-MY_NO_INLINE static void MY_FAST_CALL RangeEnc_ShiftLow(CRangeEnc *p)
+Z7_NO_INLINE static void Z7_FASTCALL RangeEnc_ShiftLow(CRangeEnc *p)
{
UInt32 low = (UInt32)p->low;
unsigned high = (unsigned)(p->low >> 32);
@@ -741,9 +727,9 @@ static void RangeEnc_FlushData(CRangeEnc *p)
ttt = *(prob); \
newBound = (range >> kNumBitModelTotalBits) * ttt;
-// #define _LZMA_ENC_USE_BRANCH
+// #define Z7_LZMA_ENC_USE_BRANCH
-#ifdef _LZMA_ENC_USE_BRANCH
+#ifdef Z7_LZMA_ENC_USE_BRANCH
#define RC_BIT(p, prob, bit) { \
RC_BIT_PRE(p, prob) \
@@ -811,7 +797,7 @@ static void LitEnc_Encode(CRangeEnc *p, CLzmaProb *probs, UInt32 sym)
CLzmaProb *prob = probs + (sym >> 8);
UInt32 bit = (sym >> 7) & 1;
sym <<= 1;
- RC_BIT(p, prob, bit);
+ RC_BIT(p, prob, bit)
}
while (sym < 0x10000);
p->range = range;
@@ -833,7 +819,7 @@ static void LitEnc_EncodeMatched(CRangeEnc *p, CLzmaProb *probs, UInt32 sym, UIn
bit = (sym >> 7) & 1;
sym <<= 1;
offs &= ~(matchByte ^ sym);
- RC_BIT(p, prob, bit);
+ RC_BIT(p, prob, bit)
}
while (sym < 0x10000);
p->range = range;
@@ -867,10 +853,10 @@ static void LzmaEnc_InitPriceTables(CProbPrice *ProbPrices)
#define GET_PRICE(prob, bit) \
- p->ProbPrices[((prob) ^ (unsigned)(((-(int)(bit))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits];
+ p->ProbPrices[((prob) ^ (unsigned)(((-(int)(bit))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits]
#define GET_PRICEa(prob, bit) \
- ProbPrices[((prob) ^ (unsigned)((-((int)(bit))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits];
+ ProbPrices[((prob) ^ (unsigned)((-((int)(bit))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits]
#define GET_PRICE_0(prob) p->ProbPrices[(prob) >> kNumMoveReducingBits]
#define GET_PRICE_1(prob) p->ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits]
@@ -921,7 +907,7 @@ static void RcTree_ReverseEncode(CRangeEnc *rc, CLzmaProb *probs, unsigned numBi
unsigned bit = sym & 1;
// RangeEnc_EncodeBit(rc, probs + m, bit);
sym >>= 1;
- RC_BIT(rc, probs + m, bit);
+ RC_BIT(rc, probs + m, bit)
m = (m << 1) | bit;
}
while (--numBits);
@@ -944,15 +930,15 @@ static void LenEnc_Encode(CLenEnc *p, CRangeEnc *rc, unsigned sym, unsigned posS
UInt32 range, ttt, newBound;
CLzmaProb *probs = p->low;
range = rc->range;
- RC_BIT_PRE(rc, probs);
+ RC_BIT_PRE(rc, probs)
if (sym >= kLenNumLowSymbols)
{
- RC_BIT_1(rc, probs);
+ RC_BIT_1(rc, probs)
probs += kLenNumLowSymbols;
- RC_BIT_PRE(rc, probs);
+ RC_BIT_PRE(rc, probs)
if (sym >= kLenNumLowSymbols * 2)
{
- RC_BIT_1(rc, probs);
+ RC_BIT_1(rc, probs)
rc->range = range;
// RcTree_Encode(rc, p->high, kLenNumHighBits, sym - kLenNumLowSymbols * 2);
LitEnc_Encode(rc, p->high, sym - kLenNumLowSymbols * 2);
@@ -965,11 +951,11 @@ static void LenEnc_Encode(CLenEnc *p, CRangeEnc *rc, unsigned sym, unsigned posS
{
unsigned m;
unsigned bit;
- RC_BIT_0(rc, probs);
+ RC_BIT_0(rc, probs)
probs += (posState << (1 + kLenNumLowBits));
- bit = (sym >> 2) ; RC_BIT(rc, probs + 1, bit); m = (1 << 1) + bit;
- bit = (sym >> 1) & 1; RC_BIT(rc, probs + m, bit); m = (m << 1) + bit;
- bit = sym & 1; RC_BIT(rc, probs + m, bit);
+ bit = (sym >> 2) ; RC_BIT(rc, probs + 1, bit) m = (1 << 1) + bit;
+ bit = (sym >> 1) & 1; RC_BIT(rc, probs + m, bit) m = (m << 1) + bit;
+ bit = sym & 1; RC_BIT(rc, probs + m, bit)
rc->range = range;
}
}
@@ -990,7 +976,7 @@ static void SetPrices_3(const CLzmaProb *probs, UInt32 startPrice, UInt32 *price
}
-MY_NO_INLINE static void MY_FAST_CALL LenPriceEnc_UpdateTables(
+Z7_NO_INLINE static void Z7_FASTCALL LenPriceEnc_UpdateTables(
CLenPriceEnc *p,
unsigned numPosStates,
const CLenEnc *enc,
@@ -1152,7 +1138,7 @@ static unsigned ReadMatchDistances(CLzmaEnc *p, unsigned *numPairsRes)
+ GET_PRICE_1(p->isRep[state]) \
+ GET_PRICE_0(p->isRepG0[state])
-MY_FORCE_INLINE
+Z7_FORCE_INLINE
static UInt32 GetPrice_PureRep(const CLzmaEnc *p, unsigned repIndex, size_t state, size_t posState)
{
UInt32 price;
@@ -1331,7 +1317,7 @@ static unsigned GetOptimum(CLzmaEnc *p, UInt32 position)
LitEnc_GetPrice(probs, curByte, p->ProbPrices));
}
- MakeAs_Lit(&p->opt[1]);
+ MakeAs_Lit(&p->opt[1])
matchPrice = GET_PRICE_1(p->isMatch[p->state][posState]);
repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[p->state]);
@@ -1343,7 +1329,7 @@ static unsigned GetOptimum(CLzmaEnc *p, UInt32 position)
if (shortRepPrice < p->opt[1].price)
{
p->opt[1].price = shortRepPrice;
- MakeAs_ShortRep(&p->opt[1]);
+ MakeAs_ShortRep(&p->opt[1])
}
if (last < 2)
{
@@ -1410,7 +1396,7 @@ static unsigned GetOptimum(CLzmaEnc *p, UInt32 position)
else
{
unsigned slot;
- GetPosSlot2(dist, slot);
+ GetPosSlot2(dist, slot)
price += p->alignPrices[dist & kAlignMask];
price += p->posSlotPrices[lenToPosState][slot];
}
@@ -1486,7 +1472,7 @@ static unsigned GetOptimum(CLzmaEnc *p, UInt32 position)
unsigned delta = best - cur;
if (delta != 0)
{
- MOVE_POS(p, delta);
+ MOVE_POS(p, delta)
}
}
cur = best;
@@ -1633,7 +1619,7 @@ static unsigned GetOptimum(CLzmaEnc *p, UInt32 position)
{
nextOpt->price = litPrice;
nextOpt->len = 1;
- MakeAs_Lit(nextOpt);
+ MakeAs_Lit(nextOpt)
nextIsLit = True;
}
}
@@ -1667,7 +1653,7 @@ static unsigned GetOptimum(CLzmaEnc *p, UInt32 position)
{
nextOpt->price = shortRepPrice;
nextOpt->len = 1;
- MakeAs_ShortRep(nextOpt);
+ MakeAs_ShortRep(nextOpt)
nextIsLit = False;
}
}
@@ -1871,7 +1857,7 @@ static unsigned GetOptimum(CLzmaEnc *p, UInt32 position)
dist = MATCHES[(size_t)offs + 1];
// if (dist >= kNumFullDistances)
- GetPosSlot2(dist, posSlot);
+ GetPosSlot2(dist, posSlot)
for (len = /*2*/ startLen; ; len++)
{
@@ -1962,7 +1948,7 @@ static unsigned GetOptimum(CLzmaEnc *p, UInt32 position)
break;
dist = MATCHES[(size_t)offs + 1];
// if (dist >= kNumFullDistances)
- GetPosSlot2(dist, posSlot);
+ GetPosSlot2(dist, posSlot)
}
}
}
@@ -2138,7 +2124,7 @@ static void WriteEndMarker(CLzmaEnc *p, unsigned posState)
{
UInt32 ttt, newBound;
RC_BIT_PRE(p, probs + m)
- RC_BIT_1(&p->rc, probs + m);
+ RC_BIT_1(&p->rc, probs + m)
m = (m << 1) + 1;
}
while (m < (1 << kNumPosSlotBits));
@@ -2163,7 +2149,7 @@ static void WriteEndMarker(CLzmaEnc *p, unsigned posState)
{
UInt32 ttt, newBound;
RC_BIT_PRE(p, probs + m)
- RC_BIT_1(&p->rc, probs + m);
+ RC_BIT_1(&p->rc, probs + m)
m = (m << 1) + 1;
}
while (m < kAlignTableSize);
@@ -2179,7 +2165,7 @@ static SRes CheckErrors(CLzmaEnc *p)
if (p->rc.res != SZ_OK)
p->result = SZ_ERROR_WRITE;
- #ifndef _7ZIP_ST
+ #ifndef Z7_ST
if (
// p->mf_Failure ||
(p->mtMode &&
@@ -2187,7 +2173,7 @@ static SRes CheckErrors(CLzmaEnc *p)
p->matchFinderMt.failure_LZ_BT))
)
{
- p->result = MY_HRES_ERROR__INTERNAL_ERROR;
+ p->result = MY_HRES_ERROR_INTERNAL_ERROR;
// printf("\nCheckErrors p->matchFinderMt.failureLZ\n");
}
#endif
@@ -2201,7 +2187,7 @@ static SRes CheckErrors(CLzmaEnc *p)
}
-MY_NO_INLINE static SRes Flush(CLzmaEnc *p, UInt32 nowPos)
+Z7_NO_INLINE static SRes Flush(CLzmaEnc *p, UInt32 nowPos)
{
/* ReleaseMFStream(); */
p->finished = True;
@@ -2213,7 +2199,7 @@ MY_NO_INLINE static SRes Flush(CLzmaEnc *p, UInt32 nowPos)
}
-MY_NO_INLINE static void FillAlignPrices(CLzmaEnc *p)
+Z7_NO_INLINE static void FillAlignPrices(CLzmaEnc *p)
{
unsigned i;
const CProbPrice *ProbPrices = p->ProbPrices;
@@ -2237,7 +2223,7 @@ MY_NO_INLINE static void FillAlignPrices(CLzmaEnc *p)
}
-MY_NO_INLINE static void FillDistancesPrices(CLzmaEnc *p)
+Z7_NO_INLINE static void FillDistancesPrices(CLzmaEnc *p)
{
// int y; for (y = 0; y < 100; y++) {
@@ -2337,7 +2323,7 @@ static void LzmaEnc_Construct(CLzmaEnc *p)
RangeEnc_Construct(&p->rc);
MatchFinder_Construct(&MFB);
- #ifndef _7ZIP_ST
+ #ifndef Z7_ST
p->matchFinderMt.MatchFinder = &MFB;
MatchFinderMt_Construct(&p->matchFinderMt);
#endif
@@ -2345,7 +2331,7 @@ static void LzmaEnc_Construct(CLzmaEnc *p)
{
CLzmaEncProps props;
LzmaEncProps_Init(&props);
- LzmaEnc_SetProps(p, &props);
+ LzmaEnc_SetProps((CLzmaEncHandle)(void *)p, &props);
}
#ifndef LZMA_LOG_BSR
@@ -2376,7 +2362,7 @@ static void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAllocPtr alloc)
static void LzmaEnc_Destruct(CLzmaEnc *p, ISzAllocPtr alloc, ISzAllocPtr allocBig)
{
- #ifndef _7ZIP_ST
+ #ifndef Z7_ST
MatchFinderMt_Destruct(&p->matchFinderMt, allocBig);
#endif
@@ -2387,21 +2373,22 @@ static void LzmaEnc_Destruct(CLzmaEnc *p, ISzAllocPtr alloc, ISzAllocPtr allocBi
void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAllocPtr alloc, ISzAllocPtr allocBig)
{
- LzmaEnc_Destruct((CLzmaEnc *)p, alloc, allocBig);
+ // GET_CLzmaEnc_p
+ LzmaEnc_Destruct(p, alloc, allocBig);
ISzAlloc_Free(alloc, p);
}
-MY_NO_INLINE
+Z7_NO_INLINE
static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, UInt32 maxPackSize, UInt32 maxUnpackSize)
{
UInt32 nowPos32, startPos32;
if (p->needInit)
{
- #ifndef _7ZIP_ST
+ #ifndef Z7_ST
if (p->mtMode)
{
- RINOK(MatchFinderMt_InitMt(&p->matchFinderMt));
+ RINOK(MatchFinderMt_InitMt(&p->matchFinderMt))
}
#endif
p->matchFinder.Init(p->matchFinderObj);
@@ -2410,7 +2397,7 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, UInt32 maxPackSize, UInt32 maxUnpa
if (p->finished)
return p->result;
- RINOK(CheckErrors(p));
+ RINOK(CheckErrors(p))
nowPos32 = (UInt32)p->nowPos64;
startPos32 = nowPos32;
@@ -2473,7 +2460,7 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, UInt32 maxPackSize, UInt32 maxUnpa
const Byte *data;
unsigned state;
- RC_BIT_0(&p->rc, probs);
+ RC_BIT_0(&p->rc, probs)
p->rc.range = range;
data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset;
probs = LIT_PROBS(nowPos32, *(data - 1));
@@ -2487,53 +2474,53 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, UInt32 maxPackSize, UInt32 maxUnpa
}
else
{
- RC_BIT_1(&p->rc, probs);
+ RC_BIT_1(&p->rc, probs)
probs = &p->isRep[p->state];
RC_BIT_PRE(&p->rc, probs)
if (dist < LZMA_NUM_REPS)
{
- RC_BIT_1(&p->rc, probs);
+ RC_BIT_1(&p->rc, probs)
probs = &p->isRepG0[p->state];
RC_BIT_PRE(&p->rc, probs)
if (dist == 0)
{
- RC_BIT_0(&p->rc, probs);
+ RC_BIT_0(&p->rc, probs)
probs = &p->isRep0Long[p->state][posState];
RC_BIT_PRE(&p->rc, probs)
if (len != 1)
{
- RC_BIT_1_BASE(&p->rc, probs);
+ RC_BIT_1_BASE(&p->rc, probs)
}
else
{
- RC_BIT_0_BASE(&p->rc, probs);
+ RC_BIT_0_BASE(&p->rc, probs)
p->state = kShortRepNextStates[p->state];
}
}
else
{
- RC_BIT_1(&p->rc, probs);
+ RC_BIT_1(&p->rc, probs)
probs = &p->isRepG1[p->state];
RC_BIT_PRE(&p->rc, probs)
if (dist == 1)
{
- RC_BIT_0_BASE(&p->rc, probs);
+ RC_BIT_0_BASE(&p->rc, probs)
dist = p->reps[1];
}
else
{
- RC_BIT_1(&p->rc, probs);
+ RC_BIT_1(&p->rc, probs)
probs = &p->isRepG2[p->state];
RC_BIT_PRE(&p->rc, probs)
if (dist == 2)
{
- RC_BIT_0_BASE(&p->rc, probs);
+ RC_BIT_0_BASE(&p->rc, probs)
dist = p->reps[2];
}
else
{
- RC_BIT_1_BASE(&p->rc, probs);
+ RC_BIT_1_BASE(&p->rc, probs)
dist = p->reps[3];
p->reps[3] = p->reps[2];
}
@@ -2557,7 +2544,7 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, UInt32 maxPackSize, UInt32 maxUnpa
else
{
unsigned posSlot;
- RC_BIT_0(&p->rc, probs);
+ RC_BIT_0(&p->rc, probs)
p->rc.range = range;
p->state = kMatchNextStates[p->state];
@@ -2571,7 +2558,7 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, UInt32 maxPackSize, UInt32 maxUnpa
p->reps[0] = dist + 1;
p->matchPriceCount++;
- GetPosSlot(dist, posSlot);
+ GetPosSlot(dist, posSlot)
// RcTree_Encode_PosSlot(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], posSlot);
{
UInt32 sym = (UInt32)posSlot + (1 << kNumPosSlotBits);
@@ -2582,7 +2569,7 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, UInt32 maxPackSize, UInt32 maxUnpa
CLzmaProb *prob = probs + (sym >> kNumPosSlotBits);
UInt32 bit = (sym >> (kNumPosSlotBits - 1)) & 1;
sym <<= 1;
- RC_BIT(&p->rc, prob, bit);
+ RC_BIT(&p->rc, prob, bit)
}
while (sym < (1 << kNumPosSlotBits * 2));
p->rc.range = range;
@@ -2626,10 +2613,10 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, UInt32 maxPackSize, UInt32 maxUnpa
{
unsigned m = 1;
unsigned bit;
- bit = dist & 1; dist >>= 1; RC_BIT(&p->rc, p->posAlignEncoder + m, bit); m = (m << 1) + bit;
- bit = dist & 1; dist >>= 1; RC_BIT(&p->rc, p->posAlignEncoder + m, bit); m = (m << 1) + bit;
- bit = dist & 1; dist >>= 1; RC_BIT(&p->rc, p->posAlignEncoder + m, bit); m = (m << 1) + bit;
- bit = dist & 1; RC_BIT(&p->rc, p->posAlignEncoder + m, bit);
+ bit = dist & 1; dist >>= 1; RC_BIT(&p->rc, p->posAlignEncoder + m, bit) m = (m << 1) + bit;
+ bit = dist & 1; dist >>= 1; RC_BIT(&p->rc, p->posAlignEncoder + m, bit) m = (m << 1) + bit;
+ bit = dist & 1; dist >>= 1; RC_BIT(&p->rc, p->posAlignEncoder + m, bit) m = (m << 1) + bit;
+ bit = dist & 1; RC_BIT(&p->rc, p->posAlignEncoder + m, bit)
p->rc.range = range;
// p->alignPriceCount++;
}
@@ -2704,7 +2691,7 @@ static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAllocPtr alloc,
if (!RangeEnc_Alloc(&p->rc, alloc))
return SZ_ERROR_MEM;
- #ifndef _7ZIP_ST
+ #ifndef Z7_ST
p->mtMode = (p->multiThread && !p->fastMode && (MFB.btMode != 0));
#endif
@@ -2748,15 +2735,14 @@ static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAllocPtr alloc,
(numFastBytes + LZMA_MATCH_LEN_MAX + 1)
*/
- #ifndef _7ZIP_ST
+ #ifndef Z7_ST
if (p->mtMode)
{
RINOK(MatchFinderMt_Create(&p->matchFinderMt, dictSize, beforeSize,
p->numFastBytes, LZMA_MATCH_LEN_MAX + 1 /* 18.04 */
- , allocBig));
+ , allocBig))
p->matchFinderObj = &p->matchFinderMt;
- MFB.bigHash = (Byte)(
- (p->dictSize > kBigHashDicLimit && MFB.hashMask >= 0xFFFFFF) ? 1 : 0);
+ MFB.bigHash = (Byte)(MFB.hashMask >= 0xFFFFFF ? 1 : 0);
MatchFinderMt_CreateVTable(&p->matchFinderMt, &p->matchFinder);
}
else
@@ -2872,59 +2858,53 @@ static SRes LzmaEnc_AllocAndInit(CLzmaEnc *p, UInt32 keepWindowSize, ISzAllocPtr
p->finished = False;
p->result = SZ_OK;
- RINOK(LzmaEnc_Alloc(p, keepWindowSize, alloc, allocBig));
+ p->nowPos64 = 0;
+ p->needInit = 1;
+ RINOK(LzmaEnc_Alloc(p, keepWindowSize, alloc, allocBig))
LzmaEnc_Init(p);
LzmaEnc_InitPrices(p);
- p->nowPos64 = 0;
return SZ_OK;
}
-static SRes LzmaEnc_Prepare(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream,
+static SRes LzmaEnc_Prepare(CLzmaEncHandle p,
+ ISeqOutStreamPtr outStream,
+ ISeqInStreamPtr inStream,
ISzAllocPtr alloc, ISzAllocPtr allocBig)
{
- CLzmaEnc *p = (CLzmaEnc *)pp;
- MFB.stream = inStream;
- p->needInit = 1;
+ // GET_CLzmaEnc_p
+ MatchFinder_SET_STREAM(&MFB, inStream)
p->rc.outStream = outStream;
return LzmaEnc_AllocAndInit(p, 0, alloc, allocBig);
}
-SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp,
- ISeqInStream *inStream, UInt32 keepWindowSize,
+SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle p,
+ ISeqInStreamPtr inStream, UInt32 keepWindowSize,
ISzAllocPtr alloc, ISzAllocPtr allocBig)
{
- CLzmaEnc *p = (CLzmaEnc *)pp;
- MFB.stream = inStream;
- p->needInit = 1;
+ // GET_CLzmaEnc_p
+ MatchFinder_SET_STREAM(&MFB, inStream)
return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig);
}
-static void LzmaEnc_SetInputBuf(CLzmaEnc *p, const Byte *src, SizeT srcLen)
-{
- MFB.directInput = 1;
- MFB.bufferBase = (Byte *)src;
- MFB.directInputRem = srcLen;
-}
-
-SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen,
- UInt32 keepWindowSize, ISzAllocPtr alloc, ISzAllocPtr allocBig)
+SRes LzmaEnc_MemPrepare(CLzmaEncHandle p,
+ const Byte *src, SizeT srcLen,
+ UInt32 keepWindowSize,
+ ISzAllocPtr alloc, ISzAllocPtr allocBig)
{
- CLzmaEnc *p = (CLzmaEnc *)pp;
- LzmaEnc_SetInputBuf(p, src, srcLen);
- p->needInit = 1;
-
- LzmaEnc_SetDataSize(pp, srcLen);
+ // GET_CLzmaEnc_p
+ MatchFinder_SET_DIRECT_INPUT_BUF(&MFB, src, srcLen)
+ LzmaEnc_SetDataSize(p, srcLen);
return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig);
}
-void LzmaEnc_Finish(CLzmaEncHandle pp)
+void LzmaEnc_Finish(CLzmaEncHandle p)
{
- #ifndef _7ZIP_ST
- CLzmaEnc *p = (CLzmaEnc *)pp;
+ #ifndef Z7_ST
+ // GET_CLzmaEnc_p
if (p->mtMode)
MatchFinderMt_ReleaseStream(&p->matchFinderMt);
#else
- UNUSED_VAR(pp);
+ UNUSED_VAR(p)
#endif
}
@@ -2933,13 +2913,13 @@ typedef struct
{
ISeqOutStream vt;
Byte *data;
- SizeT rem;
+ size_t rem;
BoolInt overflow;
} CLzmaEnc_SeqOutStreamBuf;
-static size_t SeqOutStreamBuf_Write(const ISeqOutStream *pp, const void *data, size_t size)
+static size_t SeqOutStreamBuf_Write(ISeqOutStreamPtr pp, const void *data, size_t size)
{
- CLzmaEnc_SeqOutStreamBuf *p = CONTAINER_FROM_VTBL(pp, CLzmaEnc_SeqOutStreamBuf, vt);
+ Z7_CONTAINER_FROM_VTBL_TO_DECL_VAR_pp_vt_p(CLzmaEnc_SeqOutStreamBuf)
if (p->rem < size)
{
size = p->rem;
@@ -2956,24 +2936,25 @@ static size_t SeqOutStreamBuf_Write(const ISeqOutStream *pp, const void *data, s
/*
-UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp)
+UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle p)
{
- const CLzmaEnc *p = (CLzmaEnc *)pp;
+ GET_const_CLzmaEnc_p
return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj);
}
*/
-const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp)
+const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle p)
{
- const CLzmaEnc *p = (CLzmaEnc *)pp;
+ // GET_const_CLzmaEnc_p
return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset;
}
-SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, BoolInt reInit,
+// (desiredPackSize == 0) is not allowed
+SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle p, BoolInt reInit,
Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize)
{
- CLzmaEnc *p = (CLzmaEnc *)pp;
+ // GET_CLzmaEnc_p
UInt64 nowPos64;
SRes res;
CLzmaEnc_SeqOutStreamBuf outStream;
@@ -2990,14 +2971,10 @@ SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, BoolInt reInit,
if (reInit)
LzmaEnc_Init(p);
LzmaEnc_InitPrices(p);
-
- nowPos64 = p->nowPos64;
RangeEnc_Init(&p->rc);
p->rc.outStream = &outStream.vt;
-
- if (desiredPackSize == 0)
- return SZ_ERROR_OUTPUT_EOF;
-
+ nowPos64 = p->nowPos64;
+
res = LzmaEnc_CodeOneBlock(p, desiredPackSize, *unpackSize);
*unpackSize = (UInt32)(p->nowPos64 - nowPos64);
@@ -3009,12 +2986,12 @@ SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, BoolInt reInit,
}
-MY_NO_INLINE
-static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgress *progress)
+Z7_NO_INLINE
+static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgressPtr progress)
{
SRes res = SZ_OK;
- #ifndef _7ZIP_ST
+ #ifndef Z7_ST
Byte allocaDummy[0x300];
allocaDummy[0] = 0;
allocaDummy[1] = allocaDummy[0];
@@ -3036,7 +3013,7 @@ static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgress *progress)
}
}
- LzmaEnc_Finish(p);
+ LzmaEnc_Finish((CLzmaEncHandle)(void *)p);
/*
if (res == SZ_OK && !Inline_MatchFinder_IsFinishedOK(&MFB))
@@ -3048,21 +3025,22 @@ static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgress *progress)
}
-SRes LzmaEnc_Encode(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress,
+SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStreamPtr outStream, ISeqInStreamPtr inStream, ICompressProgressPtr progress,
ISzAllocPtr alloc, ISzAllocPtr allocBig)
{
- RINOK(LzmaEnc_Prepare(pp, outStream, inStream, alloc, allocBig));
- return LzmaEnc_Encode2((CLzmaEnc *)pp, progress);
+ // GET_CLzmaEnc_p
+ RINOK(LzmaEnc_Prepare(p, outStream, inStream, alloc, allocBig))
+ return LzmaEnc_Encode2(p, progress);
}
-SRes LzmaEnc_WriteProperties(CLzmaEncHandle pp, Byte *props, SizeT *size)
+SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *props, SizeT *size)
{
if (*size < LZMA_PROPS_SIZE)
return SZ_ERROR_PARAM;
*size = LZMA_PROPS_SIZE;
{
- const CLzmaEnc *p = (const CLzmaEnc *)pp;
+ // GET_CLzmaEnc_p
const UInt32 dictSize = p->dictSize;
UInt32 v;
props[0] = (Byte)((p->pb * 5 + p->lp) * 9 + p->lc);
@@ -3086,23 +3064,24 @@ SRes LzmaEnc_WriteProperties(CLzmaEncHandle pp, Byte *props, SizeT *size)
while (v < dictSize);
}
- SetUi32(props + 1, v);
+ SetUi32(props + 1, v)
return SZ_OK;
}
}
-unsigned LzmaEnc_IsWriteEndMark(CLzmaEncHandle pp)
+unsigned LzmaEnc_IsWriteEndMark(CLzmaEncHandle p)
{
- return (unsigned)((CLzmaEnc *)pp)->writeEndMark;
+ // GET_CLzmaEnc_p
+ return (unsigned)p->writeEndMark;
}
-SRes LzmaEnc_MemEncode(CLzmaEncHandle pp, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
- int writeEndMark, ICompressProgress *progress, ISzAllocPtr alloc, ISzAllocPtr allocBig)
+SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
+ int writeEndMark, ICompressProgressPtr progress, ISzAllocPtr alloc, ISzAllocPtr allocBig)
{
SRes res;
- CLzmaEnc *p = (CLzmaEnc *)pp;
+ // GET_CLzmaEnc_p
CLzmaEnc_SeqOutStreamBuf outStream;
@@ -3114,7 +3093,7 @@ SRes LzmaEnc_MemEncode(CLzmaEncHandle pp, Byte *dest, SizeT *destLen, const Byte
p->writeEndMark = writeEndMark;
p->rc.outStream = &outStream.vt;
- res = LzmaEnc_MemPrepare(pp, src, srcLen, 0, alloc, allocBig);
+ res = LzmaEnc_MemPrepare(p, src, srcLen, 0, alloc, allocBig);
if (res == SZ_OK)
{
@@ -3123,7 +3102,7 @@ SRes LzmaEnc_MemEncode(CLzmaEncHandle pp, Byte *dest, SizeT *destLen, const Byte
res = SZ_ERROR_FAIL;
}
- *destLen -= outStream.rem;
+ *destLen -= (SizeT)outStream.rem;
if (outStream.overflow)
return SZ_ERROR_OUTPUT_EOF;
return res;
@@ -3132,9 +3111,9 @@ SRes LzmaEnc_MemEncode(CLzmaEncHandle pp, Byte *dest, SizeT *destLen, const Byte
SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,
- ICompressProgress *progress, ISzAllocPtr alloc, ISzAllocPtr allocBig)
+ ICompressProgressPtr progress, ISzAllocPtr alloc, ISzAllocPtr allocBig)
{
- CLzmaEnc *p = (CLzmaEnc *)LzmaEnc_Create(alloc);
+ CLzmaEncHandle p = LzmaEnc_Create(alloc);
SRes res;
if (!p)
return SZ_ERROR_MEM;
@@ -3154,10 +3133,10 @@ SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
/*
-#ifndef _7ZIP_ST
-void LzmaEnc_GetLzThreads(CLzmaEncHandle pp, HANDLE lz_threads[2])
+#ifndef Z7_ST
+void LzmaEnc_GetLzThreads(CLzmaEncHandle p, HANDLE lz_threads[2])
{
- const CLzmaEnc *p = (CLzmaEnc *)pp;
+ GET_const_CLzmaEnc_p
lz_threads[0] = p->matchFinderMt.hashSync.thread;
lz_threads[1] = p->matchFinderMt.btSync.thread;
}
diff --git a/src/Common/lzma/LzmaEnc.h b/src/Common/lzma/LzmaEnc.h
index bc2ed504..9f8039a1 100644
--- a/src/Common/lzma/LzmaEnc.h
+++ b/src/Common/lzma/LzmaEnc.h
@@ -1,8 +1,8 @@
/* LzmaEnc.h -- LZMA Encoder
-2019-10-30 : Igor Pavlov : Public domain */
+2023-04-13 : Igor Pavlov : Public domain */
-#ifndef __LZMA_ENC_H
-#define __LZMA_ENC_H
+#ifndef ZIP7_INC_LZMA_ENC_H
+#define ZIP7_INC_LZMA_ENC_H
#include "7zTypes.h"
@@ -10,7 +10,7 @@ EXTERN_C_BEGIN
#define LZMA_PROPS_SIZE 5
-typedef struct _CLzmaEncProps
+typedef struct
{
int level; /* 0 <= level <= 9 */
UInt32 dictSize; /* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version
@@ -23,10 +23,13 @@ typedef struct _CLzmaEncProps
int fb; /* 5 <= fb <= 273, default = 32 */
int btMode; /* 0 - hashChain Mode, 1 - binTree mode - normal, default = 1 */
int numHashBytes; /* 2, 3 or 4, default = 4 */
+ unsigned numHashOutBits; /* default = ? */
UInt32 mc; /* 1 <= mc <= (1 << 30), default = 32 */
unsigned writeEndMark; /* 0 - do not write EOPM, 1 - write EOPM, default = 0 */
int numThreads; /* 1 or 2, default = 2 */
+ // int _pad;
+
UInt64 reduceSize; /* estimated size of data that will be compressed. default = (UInt64)(Int64)-1.
Encoder uses this value to reduce dictionary size */
@@ -51,7 +54,9 @@ SRes:
SZ_ERROR_THREAD - error in multithreading functions (only for Mt version)
*/
-typedef void * CLzmaEncHandle;
+typedef struct CLzmaEnc CLzmaEnc;
+typedef CLzmaEnc * CLzmaEncHandle;
+// Z7_DECLARE_HANDLE(CLzmaEncHandle)
CLzmaEncHandle LzmaEnc_Create(ISzAllocPtr alloc);
void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAllocPtr alloc, ISzAllocPtr allocBig);
@@ -61,17 +66,17 @@ void LzmaEnc_SetDataSize(CLzmaEncHandle p, UInt64 expectedDataSiize);
SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size);
unsigned LzmaEnc_IsWriteEndMark(CLzmaEncHandle p);
-SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream,
- ICompressProgress *progress, ISzAllocPtr alloc, ISzAllocPtr allocBig);
+SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStreamPtr outStream, ISeqInStreamPtr inStream,
+ ICompressProgressPtr progress, ISzAllocPtr alloc, ISzAllocPtr allocBig);
SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
- int writeEndMark, ICompressProgress *progress, ISzAllocPtr alloc, ISzAllocPtr allocBig);
+ int writeEndMark, ICompressProgressPtr progress, ISzAllocPtr alloc, ISzAllocPtr allocBig);
/* ---------- One Call Interface ---------- */
SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,
- ICompressProgress *progress, ISzAllocPtr alloc, ISzAllocPtr allocBig);
+ ICompressProgressPtr progress, ISzAllocPtr alloc, ISzAllocPtr allocBig);
EXTERN_C_END
diff --git a/src/Common/lzma/LzmaLib.c b/src/Common/lzma/LzmaLib.c
index 706e9e58..785e8848 100644
--- a/src/Common/lzma/LzmaLib.c
+++ b/src/Common/lzma/LzmaLib.c
@@ -1,12 +1,14 @@
/* LzmaLib.c -- LZMA library wrapper
-2015-06-13 : Igor Pavlov : Public domain */
+2023-04-02 : Igor Pavlov : Public domain */
+
+#include "Precomp.h"
#include "Alloc.h"
#include "LzmaDec.h"
#include "LzmaEnc.h"
#include "LzmaLib.h"
-MY_STDAPI LzmaCompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen,
+Z7_STDAPI LzmaCompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen,
unsigned char *outProps, size_t *outPropsSize,
int level, /* 0 <= level <= 9, default = 5 */
unsigned dictSize, /* use (1 << N) or (3 << N). 4 KB < dictSize <= 128 MB */
@@ -32,7 +34,7 @@ MY_STDAPI LzmaCompress(unsigned char *dest, size_t *destLen, const unsigned char
}
-MY_STDAPI LzmaUncompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t *srcLen,
+Z7_STDAPI LzmaUncompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t *srcLen,
const unsigned char *props, size_t propsSize)
{
ELzmaStatus status;
diff --git a/src/Common/lzma/LzmaLib.h b/src/Common/lzma/LzmaLib.h
index c343a859..d7c0724d 100644
--- a/src/Common/lzma/LzmaLib.h
+++ b/src/Common/lzma/LzmaLib.h
@@ -1,14 +1,14 @@
/* LzmaLib.h -- LZMA library interface
-2021-04-03 : Igor Pavlov : Public domain */
+2023-04-02 : Igor Pavlov : Public domain */
-#ifndef __LZMA_LIB_H
-#define __LZMA_LIB_H
+#ifndef ZIP7_INC_LZMA_LIB_H
+#define ZIP7_INC_LZMA_LIB_H
#include "7zTypes.h"
EXTERN_C_BEGIN
-#define MY_STDAPI int MY_STD_CALL
+#define Z7_STDAPI int Z7_STDCALL
#define LZMA_PROPS_SIZE 5
@@ -100,7 +100,7 @@ Returns:
SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
*/
-MY_STDAPI LzmaCompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen,
+Z7_STDAPI LzmaCompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen,
unsigned char *outProps, size_t *outPropsSize, /* *outPropsSize must be = 5 */
int level, /* 0 <= level <= 9, default = 5 */
unsigned dictSize, /* default = (1 << 24) */
@@ -130,7 +130,7 @@ Returns:
SZ_ERROR_INPUT_EOF - it needs more bytes in input buffer (src)
*/
-MY_STDAPI LzmaUncompress(unsigned char *dest, size_t *destLen, const unsigned char *src, SizeT *srcLen,
+Z7_STDAPI LzmaUncompress(unsigned char *dest, size_t *destLen, const unsigned char *src, SizeT *srcLen,
const unsigned char *props, size_t propsSize);
EXTERN_C_END
diff --git a/src/Common/lzma/Precomp.h b/src/Common/lzma/Precomp.h
index e8ff8b40..69afb2ff 100644
--- a/src/Common/lzma/Precomp.h
+++ b/src/Common/lzma/Precomp.h
@@ -1,8 +1,8 @@
/* Precomp.h -- StdAfx
-2013-11-12 : Igor Pavlov : Public domain */
+2023-04-02 : Igor Pavlov : Public domain */
-#ifndef __7Z_PRECOMP_H
-#define __7Z_PRECOMP_H
+#ifndef ZIP7_INC_PRECOMP_H
+#define ZIP7_INC_PRECOMP_H
#include "Compiler.h"
/* #include "7zTypes.h" */
diff --git a/src/Common/lzma/Threads.c b/src/Common/lzma/Threads.c
index 58eb90ff..cf52bd30 100644
--- a/src/Common/lzma/Threads.c
+++ b/src/Common/lzma/Threads.c
@@ -1,5 +1,5 @@
/* Threads.c -- multithreading library
-2021-12-21 : Igor Pavlov : Public domain */
+2023-03-04 : Igor Pavlov : Public domain */
#include "Precomp.h"
@@ -11,9 +11,9 @@
#include "Threads.h"
-static WRes GetError()
+static WRes GetError(void)
{
- DWORD res = GetLastError();
+ const DWORD res = GetLastError();
return res ? (WRes)res : 1;
}
@@ -173,6 +173,9 @@ WRes CriticalSection_Init(CCriticalSection *p)
Windows XP, 2003 : can raise a STATUS_NO_MEMORY exception
Windows Vista+ : no exceptions */
#ifdef _MSC_VER
+ #ifdef __clang__
+ #pragma GCC diagnostic ignored "-Wlanguage-extension-token"
+ #endif
__try
#endif
{
@@ -193,18 +196,26 @@ WRes CriticalSection_Init(CCriticalSection *p)
// ---------- POSIX ----------
#ifndef __APPLE__
-#ifndef _7ZIP_AFFINITY_DISABLE
+#ifndef Z7_AFFINITY_DISABLE
// _GNU_SOURCE can be required for pthread_setaffinity_np() / CPU_ZERO / CPU_SET
+// clang < 3.6 : unknown warning group '-Wreserved-id-macro'
+// clang 3.6 - 12.01 : gives warning "macro name is a reserved identifier"
+// clang >= 13 : do not give warning
+#if !defined(_GNU_SOURCE)
+ #if defined(__clang__) && (__clang_major__ >= 4) && (__clang_major__ <= 12)
+ #pragma GCC diagnostic ignored "-Wreserved-id-macro"
+ #endif
#define _GNU_SOURCE
-#endif
-#endif
+#endif // !defined(_GNU_SOURCE)
+#endif // Z7_AFFINITY_DISABLE
+#endif // __APPLE__
#include "Threads.h"
#include <errno.h>
#include <stdlib.h>
#include <string.h>
-#ifdef _7ZIP_AFFINITY_SUPPORTED
+#ifdef Z7_AFFINITY_SUPPORTED
// #include <sched.h>
#endif
@@ -212,15 +223,12 @@ WRes CriticalSection_Init(CCriticalSection *p)
// #include <stdio.h>
// #define PRF(p) p
#define PRF(p)
-
-#define Print(s) PRF(printf("\n%s\n", s))
-
-// #include <stdio.h>
+#define Print(s) PRF(printf("\n%s\n", s);)
WRes Thread_Create_With_CpuSet(CThread *p, THREAD_FUNC_TYPE func, LPVOID param, const CCpuSet *cpuSet)
{
// new thread in Posix probably inherits affinity from parrent thread
- Print("Thread_Create_With_CpuSet");
+ Print("Thread_Create_With_CpuSet")
pthread_attr_t attr;
int ret;
@@ -228,7 +236,7 @@ WRes Thread_Create_With_CpuSet(CThread *p, THREAD_FUNC_TYPE func, LPVOID param,
p->_created = 0;
- RINOK(pthread_attr_init(&attr));
+ RINOK(pthread_attr_init(&attr))
ret = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
@@ -236,7 +244,7 @@ WRes Thread_Create_With_CpuSet(CThread *p, THREAD_FUNC_TYPE func, LPVOID param,
{
if (cpuSet)
{
- #ifdef _7ZIP_AFFINITY_SUPPORTED
+ #ifdef Z7_AFFINITY_SUPPORTED
/*
printf("\n affinity :");
@@ -292,7 +300,7 @@ WRes Thread_Create(CThread *p, THREAD_FUNC_TYPE func, LPVOID param)
WRes Thread_Create_With_Affinity(CThread *p, THREAD_FUNC_TYPE func, LPVOID param, CAffinityMask affinity)
{
- Print("Thread_Create_WithAffinity");
+ Print("Thread_Create_WithAffinity")
CCpuSet cs;
unsigned i;
CpuSet_Zero(&cs);
@@ -312,7 +320,7 @@ WRes Thread_Create_With_Affinity(CThread *p, THREAD_FUNC_TYPE func, LPVOID param
WRes Thread_Close(CThread *p)
{
- // Print("Thread_Close");
+ // Print("Thread_Close")
int ret;
if (!p->_created)
return 0;
@@ -326,7 +334,7 @@ WRes Thread_Close(CThread *p)
WRes Thread_Wait_Close(CThread *p)
{
- // Print("Thread_Wait_Close");
+ // Print("Thread_Wait_Close")
void *thread_return;
int ret;
if (!p->_created)
@@ -343,8 +351,8 @@ WRes Thread_Wait_Close(CThread *p)
static WRes Event_Create(CEvent *p, int manualReset, int signaled)
{
- RINOK(pthread_mutex_init(&p->_mutex, NULL));
- RINOK(pthread_cond_init(&p->_cond, NULL));
+ RINOK(pthread_mutex_init(&p->_mutex, NULL))
+ RINOK(pthread_cond_init(&p->_cond, NULL))
p->_manual_reset = manualReset;
p->_state = (signaled ? True : False);
p->_created = 1;
@@ -363,7 +371,7 @@ WRes AutoResetEvent_CreateNotSignaled(CAutoResetEvent *p)
WRes Event_Set(CEvent *p)
{
- RINOK(pthread_mutex_lock(&p->_mutex));
+ RINOK(pthread_mutex_lock(&p->_mutex))
p->_state = True;
int res1 = pthread_cond_broadcast(&p->_cond);
int res2 = pthread_mutex_unlock(&p->_mutex);
@@ -372,14 +380,14 @@ WRes Event_Set(CEvent *p)
WRes Event_Reset(CEvent *p)
{
- RINOK(pthread_mutex_lock(&p->_mutex));
+ RINOK(pthread_mutex_lock(&p->_mutex))
p->_state = False;
return pthread_mutex_unlock(&p->_mutex);
}
WRes Event_Wait(CEvent *p)
{
- RINOK(pthread_mutex_lock(&p->_mutex));
+ RINOK(pthread_mutex_lock(&p->_mutex))
while (p->_state == False)
{
// ETIMEDOUT
@@ -411,8 +419,8 @@ WRes Semaphore_Create(CSemaphore *p, UInt32 initCount, UInt32 maxCount)
{
if (initCount > maxCount || maxCount < 1)
return EINVAL;
- RINOK(pthread_mutex_init(&p->_mutex, NULL));
- RINOK(pthread_cond_init(&p->_cond, NULL));
+ RINOK(pthread_mutex_init(&p->_mutex, NULL))
+ RINOK(pthread_cond_init(&p->_cond, NULL))
p->_count = initCount;
p->_maxCount = maxCount;
p->_created = 1;
@@ -448,7 +456,7 @@ WRes Semaphore_ReleaseN(CSemaphore *p, UInt32 releaseCount)
if (releaseCount < 1)
return EINVAL;
- RINOK(pthread_mutex_lock(&p->_mutex));
+ RINOK(pthread_mutex_lock(&p->_mutex))
newCount = p->_count + releaseCount;
if (newCount > p->_maxCount)
@@ -458,13 +466,13 @@ WRes Semaphore_ReleaseN(CSemaphore *p, UInt32 releaseCount)
p->_count = newCount;
ret = pthread_cond_broadcast(&p->_cond);
}
- RINOK(pthread_mutex_unlock(&p->_mutex));
+ RINOK(pthread_mutex_unlock(&p->_mutex))
return ret;
}
WRes Semaphore_Wait(CSemaphore *p)
{
- RINOK(pthread_mutex_lock(&p->_mutex));
+ RINOK(pthread_mutex_lock(&p->_mutex))
while (p->_count < 1)
{
pthread_cond_wait(&p->_cond, &p->_mutex);
@@ -489,7 +497,7 @@ WRes Semaphore_Close(CSemaphore *p)
WRes CriticalSection_Init(CCriticalSection *p)
{
- // Print("CriticalSection_Init");
+ // Print("CriticalSection_Init")
if (!p)
return EINTR;
return pthread_mutex_init(&p->_mutex, NULL);
@@ -497,7 +505,7 @@ WRes CriticalSection_Init(CCriticalSection *p)
void CriticalSection_Enter(CCriticalSection *p)
{
- // Print("CriticalSection_Enter");
+ // Print("CriticalSection_Enter")
if (p)
{
// int ret =
@@ -507,7 +515,7 @@ void CriticalSection_Enter(CCriticalSection *p)
void CriticalSection_Leave(CCriticalSection *p)
{
- // Print("CriticalSection_Leave");
+ // Print("CriticalSection_Leave")
if (p)
{
// int ret =
@@ -517,7 +525,7 @@ void CriticalSection_Leave(CCriticalSection *p)
void CriticalSection_Delete(CCriticalSection *p)
{
- // Print("CriticalSection_Delete");
+ // Print("CriticalSection_Delete")
if (p)
{
// int ret =
@@ -527,14 +535,28 @@ void CriticalSection_Delete(CCriticalSection *p)
LONG InterlockedIncrement(LONG volatile *addend)
{
- // Print("InterlockedIncrement");
+ // Print("InterlockedIncrement")
#ifdef USE_HACK_UNSAFE_ATOMIC
LONG val = *addend + 1;
*addend = val;
return val;
#else
+
+ #if defined(__clang__) && (__clang_major__ >= 8)
+ #pragma GCC diagnostic ignored "-Watomic-implicit-seq-cst"
+ #endif
return __sync_add_and_fetch(addend, 1);
#endif
}
#endif // _WIN32
+
+WRes AutoResetEvent_OptCreate_And_Reset(CAutoResetEvent *p)
+{
+ if (Event_IsCreated(p))
+ return Event_Reset(p);
+ return AutoResetEvent_CreateNotSignaled(p);
+}
+
+#undef PRF
+#undef Print
diff --git a/src/Common/lzma/Threads.h b/src/Common/lzma/Threads.h
index 89ecb92b..4028464a 100644
--- a/src/Common/lzma/Threads.h
+++ b/src/Common/lzma/Threads.h
@@ -1,18 +1,19 @@
/* Threads.h -- multithreading library
-2021-12-21 : Igor Pavlov : Public domain */
+2023-04-02 : Igor Pavlov : Public domain */
-#ifndef __7Z_THREADS_H
-#define __7Z_THREADS_H
+#ifndef ZIP7_INC_THREADS_H
+#define ZIP7_INC_THREADS_H
#ifdef _WIN32
-#include <Windows.h>
+#include "7zWindows.h"
+
#else
#if defined(__linux__)
#if !defined(__APPLE__) && !defined(_AIX) && !defined(__ANDROID__)
-#ifndef _7ZIP_AFFINITY_DISABLE
-#define _7ZIP_AFFINITY_SUPPORTED
-// #pragma message(" ==== _7ZIP_AFFINITY_SUPPORTED")
+#ifndef Z7_AFFINITY_DISABLE
+#define Z7_AFFINITY_SUPPORTED
+// #pragma message(" ==== Z7_AFFINITY_SUPPORTED")
// #define _GNU_SOURCE
#endif
#endif
@@ -33,7 +34,7 @@ WRes Handle_WaitObject(HANDLE h);
typedef HANDLE CThread;
-#define Thread_Construct(p) { *(p) = NULL; }
+#define Thread_CONSTRUCT(p) { *(p) = NULL; }
#define Thread_WasCreated(p) (*(p) != NULL)
#define Thread_Close(p) HandlePtr_Close(p)
// #define Thread_Wait(p) Handle_WaitObject(*(p))
@@ -52,42 +53,46 @@ typedef
#endif
THREAD_FUNC_RET_TYPE;
+#define THREAD_FUNC_RET_ZERO 0
+
typedef DWORD_PTR CAffinityMask;
typedef DWORD_PTR CCpuSet;
-#define CpuSet_Zero(p) { *(p) = 0; }
-#define CpuSet_Set(p, cpu) { *(p) |= ((DWORD_PTR)1 << (cpu)); }
+#define CpuSet_Zero(p) *(p) = (0)
+#define CpuSet_Set(p, cpu) *(p) |= ((DWORD_PTR)1 << (cpu))
#else // _WIN32
-typedef struct _CThread
+typedef struct
{
pthread_t _tid;
int _created;
} CThread;
-#define Thread_Construct(p) { (p)->_tid = 0; (p)->_created = 0; }
-#define Thread_WasCreated(p) ((p)->_created != 0)
+#define Thread_CONSTRUCT(p) { (p)->_tid = 0; (p)->_created = 0; }
+#define Thread_WasCreated(p) ((p)->_created != 0)
WRes Thread_Close(CThread *p);
// #define Thread_Wait Thread_Wait_Close
typedef void * THREAD_FUNC_RET_TYPE;
+#define THREAD_FUNC_RET_ZERO NULL
+
typedef UInt64 CAffinityMask;
-#ifdef _7ZIP_AFFINITY_SUPPORTED
+#ifdef Z7_AFFINITY_SUPPORTED
typedef cpu_set_t CCpuSet;
-#define CpuSet_Zero(p) CPU_ZERO(p)
-#define CpuSet_Set(p, cpu) CPU_SET(cpu, p)
-#define CpuSet_IsSet(p, cpu) CPU_ISSET(cpu, p)
+#define CpuSet_Zero(p) CPU_ZERO(p)
+#define CpuSet_Set(p, cpu) CPU_SET(cpu, p)
+#define CpuSet_IsSet(p, cpu) CPU_ISSET(cpu, p)
#else
typedef UInt64 CCpuSet;
-#define CpuSet_Zero(p) { *(p) = 0; }
-#define CpuSet_Set(p, cpu) { *(p) |= ((UInt64)1 << (cpu)); }
-#define CpuSet_IsSet(p, cpu) ((*(p) & ((UInt64)1 << (cpu))) != 0)
+#define CpuSet_Zero(p) *(p) = (0)
+#define CpuSet_Set(p, cpu) *(p) |= ((UInt64)1 << (cpu))
+#define CpuSet_IsSet(p, cpu) ((*(p) & ((UInt64)1 << (cpu))) != 0)
#endif
@@ -95,7 +100,7 @@ typedef UInt64 CCpuSet;
#endif // _WIN32
-#define THREAD_FUNC_CALL_TYPE MY_STD_CALL
+#define THREAD_FUNC_CALL_TYPE Z7_STDCALL
#if defined(_WIN32) && defined(__GNUC__)
/* GCC compiler for x86 32-bit uses the rule:
@@ -187,6 +192,7 @@ WRes ManualResetEvent_Create(CManualResetEvent *p, int signaled);
WRes ManualResetEvent_CreateNotSignaled(CManualResetEvent *p);
WRes AutoResetEvent_Create(CAutoResetEvent *p, int signaled);
WRes AutoResetEvent_CreateNotSignaled(CAutoResetEvent *p);
+
WRes Event_Set(CEvent *p);
WRes Event_Reset(CEvent *p);
WRes Event_Wait(CEvent *p);
@@ -227,6 +233,8 @@ LONG InterlockedIncrement(LONG volatile *addend);
#endif // _WIN32
+WRes AutoResetEvent_OptCreate_And_Reset(CAutoResetEvent *p);
+
EXTERN_C_END
#endif
diff --git a/src/Common/lzma/lzma-history.txt b/src/Common/lzma/lzma-history.txt
index 0963c7bf..a151c4b9 100644
--- a/src/Common/lzma/lzma-history.txt
+++ b/src/Common/lzma/lzma-history.txt
@@ -1,6 +1,46 @@
HISTORY of the LZMA SDK
-----------------------
+23.01 2023-06-20
+-------------------------
+- 7-Zip now can use new ARM64 filter for compression to 7z and xz archives.
+ ARM64 filter can increase compression ratio for data containing executable
+ files compiled for ARM64 (AArch64) architecture.
+ Also 7-Zip now parses executable files (that have exe and dll filename extensions)
+ before compressing, and it selects appropriate filter for each parsed file:
+ - BCJ or BCJ2 filter for x86 executable files,
+ - ARM64 filter for ARM64 executable files.
+ Previous versions by default used x86 filter BCJ or BCJ2 for all exe/dll files.
+- Default section size for BCJ2 filter was changed from 64 MiB to 240 MiB.
+ It can increase compression ratio for executable files larger than 64 MiB.
+- Some optimizations in filters code: BCJ, BCJ2, Swap* and opthers.
+- If 7-Zip uses BCJ2 filter for big datasets compressing, it can use additional temp
+ files in system's TEMP folder. 7-Zip uses temp file for additional compressed
+ data stream, if size of such compressed stream is larger than predefined limit:
+ 16 MiB in 32-bit version, 4 GiB in 64-bit version.
+- When new 7-Zip creates multivolume archive, 7-Zip keeps in open state
+ only volumes that still can be changed. Previous versions kept all volumes
+ in open state until the end of the archive creation.
+- 7-Zip for Linux and macOS now can reduce the number of simultaneously open files,
+ when 7-Zip opens, extracts or creates multivolume archive. It allows to avoid
+ the failures for cases with big number of volumes, bacause there is a limitation
+ for number of open files allowed for a single program in Linux and macOS.
+- Some bugs were fixed.
+- Source code changes:
+- All external macros for compiling C/C++ code of 7-Zip now have Z7_ prefix.
+- 7-Zip COM interfaces now use new macros that allow to declare and implement COM interface.
+- The code has been modified to compile with the maximum diagnostic warning level:
+ -Wall in MSVC and -Weverything in CLANG.
+ And some warning types are disabled in 2 files:
+ - C/Compiler.h for C/C++ code warnings.
+ - CPP/Common/Common.h for C++ code warnings.
+- Linux/macOS versions of 7-Zip: IUnknown interface in new code doesn't use
+ virtual destructor that was used in previous 7-Zip and p7zip:
+ // virtual ~IUnknown() {}
+ So 7-Zip's dynamically linked shared libraries (codecs) are not compatible
+ between new 7-Zip for Linux/macOS and old 7-Zip (and p7zip).
+
+
21.07 2021-12-26
-------------------------
- New switches: -spm and -im!{file_path} to exclude directories from processing
diff --git a/src/Common/lzma/lzma-sdk.txt b/src/Common/lzma/lzma-sdk.txt
index 9621c8d5..141b0fd4 100644
--- a/src/Common/lzma/lzma-sdk.txt
+++ b/src/Common/lzma/lzma-sdk.txt
@@ -1,4 +1,4 @@
-LZMA SDK 21.07
+LZMA SDK 23.01
--------------
LZMA SDK provides the documentation, samples, header files,
diff --git a/src/Common/reader.h b/src/Common/reader.h
new file mode 100644
index 00000000..19fbba87
--- /dev/null
+++ b/src/Common/reader.h
@@ -0,0 +1,271 @@
+/*
+ * MUSCLE SmartCard Development ( https://pcsclite.apdu.fr/ )
+ *
+ * Copyright (C) 1999-2005
+ * David Corcoran <corcoran@musclecard.com>
+ * Copyright (C) 2005-2009
+ * Ludovic Rousseau <ludovic.rousseau@free.fr>
+ *
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file
+ * @brief This keeps a list of defines shared between the driver and the application
+ */
+
+#ifndef __reader_h__
+#define __reader_h__
+
+/*
+ * Tags for requesting card and reader attributes
+ */
+
+#define SCARD_ATTR_VALUE(Class, Tag) ((((ULONG)(Class)) << 16) | ((ULONG)(Tag)))
+
+#define SCARD_CLASS_VENDOR_INFO 1 /**< Vendor information definitions */
+#define SCARD_CLASS_COMMUNICATIONS 2 /**< Communication definitions */
+#define SCARD_CLASS_PROTOCOL 3 /**< Protocol definitions */
+#define SCARD_CLASS_POWER_MGMT 4 /**< Power Management definitions */
+#define SCARD_CLASS_SECURITY 5 /**< Security Assurance definitions */
+#define SCARD_CLASS_MECHANICAL 6 /**< Mechanical characteristic definitions */
+#define SCARD_CLASS_VENDOR_DEFINED 7 /**< Vendor specific definitions */
+#define SCARD_CLASS_IFD_PROTOCOL 8 /**< Interface Device Protocol options */
+#define SCARD_CLASS_ICC_STATE 9 /**< ICC State specific definitions */
+#define SCARD_CLASS_SYSTEM 0x7fff /**< System-specific definitions */
+
+#define SCARD_ATTR_VENDOR_NAME SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_INFO, 0x0100) /**< Vendor name. */
+#define SCARD_ATTR_VENDOR_IFD_TYPE SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_INFO, 0x0101) /**< Vendor-supplied interface device type (model designation of reader). */
+#define SCARD_ATTR_VENDOR_IFD_VERSION SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_INFO, 0x0102) /**< Vendor-supplied interface device version (DWORD in the form 0xMMmmbbbb where MM = major version, mm = minor version, and bbbb = build number). */
+#define SCARD_ATTR_VENDOR_IFD_SERIAL_NO SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_INFO, 0x0103) /**< Vendor-supplied interface device serial number. */
+#define SCARD_ATTR_CHANNEL_ID SCARD_ATTR_VALUE(SCARD_CLASS_COMMUNICATIONS, 0x0110) /**< DWORD encoded as 0xDDDDCCCC, where DDDD = data channel type and CCCC = channel number */
+#define SCARD_ATTR_ASYNC_PROTOCOL_TYPES SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0120) /**< FIXME */
+#define SCARD_ATTR_DEFAULT_CLK SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0121) /**< Default clock rate, in kHz. */
+#define SCARD_ATTR_MAX_CLK SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0122) /**< Maximum clock rate, in kHz. */
+#define SCARD_ATTR_DEFAULT_DATA_RATE SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0123) /**< Default data rate, in bps. */
+#define SCARD_ATTR_MAX_DATA_RATE SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0124) /**< Maximum data rate, in bps. */
+#define SCARD_ATTR_MAX_IFSD SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0125) /**< Maximum bytes for information file size device. */
+#define SCARD_ATTR_SYNC_PROTOCOL_TYPES SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0126) /**< FIXME */
+#define SCARD_ATTR_POWER_MGMT_SUPPORT SCARD_ATTR_VALUE(SCARD_CLASS_POWER_MGMT, 0x0131) /**< Zero if device does not support power down while smart card is inserted. Nonzero otherwise. */
+#define SCARD_ATTR_USER_TO_CARD_AUTH_DEVICE SCARD_ATTR_VALUE(SCARD_CLASS_SECURITY, 0x0140) /**< FIXME */
+#define SCARD_ATTR_USER_AUTH_INPUT_DEVICE SCARD_ATTR_VALUE(SCARD_CLASS_SECURITY, 0x0142) /**< FIXME */
+#define SCARD_ATTR_CHARACTERISTICS SCARD_ATTR_VALUE(SCARD_CLASS_MECHANICAL, 0x0150) /**< DWORD indicating which mechanical characteristics are supported. If zero, no special characteristics are supported. Note that multiple bits can be set */
+
+#define SCARD_ATTR_CURRENT_PROTOCOL_TYPE SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0201) /**< FIXME */
+#define SCARD_ATTR_CURRENT_CLK SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0202) /**< Current clock rate, in kHz. */
+#define SCARD_ATTR_CURRENT_F SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0203) /**< Clock conversion factor. */
+#define SCARD_ATTR_CURRENT_D SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0204) /**< Bit rate conversion factor. */
+#define SCARD_ATTR_CURRENT_N SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0205) /**< Current guard time. */
+#define SCARD_ATTR_CURRENT_W SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0206) /**< Current work waiting time. */
+#define SCARD_ATTR_CURRENT_IFSC SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0207) /**< Current byte size for information field size card. */
+#define SCARD_ATTR_CURRENT_IFSD SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0208) /**< Current byte size for information field size device. */
+#define SCARD_ATTR_CURRENT_BWT SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0209) /**< Current block waiting time. */
+#define SCARD_ATTR_CURRENT_CWT SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x020a) /**< Current character waiting time. */
+#define SCARD_ATTR_CURRENT_EBC_ENCODING SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x020b) /**< Current error block control encoding. */
+#define SCARD_ATTR_EXTENDED_BWT SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x020c) /**< FIXME */
+
+#define SCARD_ATTR_ICC_PRESENCE SCARD_ATTR_VALUE(SCARD_CLASS_ICC_STATE, 0x0300) /**< Single byte indicating smart card presence */
+#define SCARD_ATTR_ICC_INTERFACE_STATUS SCARD_ATTR_VALUE(SCARD_CLASS_ICC_STATE, 0x0301) /**< Single byte. Zero if smart card electrical contact is not active; nonzero if contact is active. */
+#define SCARD_ATTR_CURRENT_IO_STATE SCARD_ATTR_VALUE(SCARD_CLASS_ICC_STATE, 0x0302) /**< FIXME */
+#define SCARD_ATTR_ATR_STRING SCARD_ATTR_VALUE(SCARD_CLASS_ICC_STATE, 0x0303) /**< Answer to reset (ATR) string. */
+#define SCARD_ATTR_ICC_TYPE_PER_ATR SCARD_ATTR_VALUE(SCARD_CLASS_ICC_STATE, 0x0304) /**< Single byte indicating smart card type */
+
+#define SCARD_ATTR_ESC_RESET SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_DEFINED, 0xA000) /**< FIXME */
+#define SCARD_ATTR_ESC_CANCEL SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_DEFINED, 0xA003) /**< FIXME */
+#define SCARD_ATTR_ESC_AUTHREQUEST SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_DEFINED, 0xA005) /**< FIXME */
+#define SCARD_ATTR_MAXINPUT SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_DEFINED, 0xA007) /**< FIXME */
+
+#define SCARD_ATTR_DEVICE_UNIT SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0001) /**< Instance of this vendor's reader attached to the computer. The first instance will be device unit 0, the next will be unit 1 (if it is the same brand of reader) and so on. Two different brands of readers will both have zero for this value. */
+#define SCARD_ATTR_DEVICE_IN_USE SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0002) /**< Reserved for future use. */
+#define SCARD_ATTR_DEVICE_FRIENDLY_NAME_A SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0003)
+#define SCARD_ATTR_DEVICE_SYSTEM_NAME_A SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0004)
+#define SCARD_ATTR_DEVICE_FRIENDLY_NAME_W SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0005)
+#define SCARD_ATTR_DEVICE_SYSTEM_NAME_W SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0006)
+#define SCARD_ATTR_SUPRESS_T1_IFS_REQUEST SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0007) /**< FIXME */
+
+#ifdef UNICODE
+#define SCARD_ATTR_DEVICE_FRIENDLY_NAME SCARD_ATTR_DEVICE_FRIENDLY_NAME_W /**< Reader's display name. */
+#define SCARD_ATTR_DEVICE_SYSTEM_NAME SCARD_ATTR_DEVICE_SYSTEM_NAME_W /**< Reader's system name. */
+#else
+#define SCARD_ATTR_DEVICE_FRIENDLY_NAME SCARD_ATTR_DEVICE_FRIENDLY_NAME_A /**< Reader's display name. */
+#define SCARD_ATTR_DEVICE_SYSTEM_NAME SCARD_ATTR_DEVICE_SYSTEM_NAME_A /**< Reader's system name. */
+#endif
+
+/**
+ * Provide source compatibility on different platforms
+ */
+#define SCARD_CTL_CODE(code) (0x42000000 + (code))
+
+/**
+ * PC/SC part 10 v2.02.07 March 2010 reader tags
+ */
+#define CM_IOCTL_GET_FEATURE_REQUEST SCARD_CTL_CODE(3400)
+
+#define FEATURE_VERIFY_PIN_START 0x01
+#define FEATURE_VERIFY_PIN_FINISH 0x02
+#define FEATURE_MODIFY_PIN_START 0x03
+#define FEATURE_MODIFY_PIN_FINISH 0x04
+#define FEATURE_GET_KEY_PRESSED 0x05
+#define FEATURE_VERIFY_PIN_DIRECT 0x06 /**< Verify PIN */
+#define FEATURE_MODIFY_PIN_DIRECT 0x07 /**< Modify PIN */
+#define FEATURE_MCT_READER_DIRECT 0x08
+#define FEATURE_MCT_UNIVERSAL 0x09
+#define FEATURE_IFD_PIN_PROPERTIES 0x0A /**< retrieve properties of the IFD regarding PIN handling */
+#define FEATURE_ABORT 0x0B
+#define FEATURE_SET_SPE_MESSAGE 0x0C
+#define FEATURE_VERIFY_PIN_DIRECT_APP_ID 0x0D
+#define FEATURE_MODIFY_PIN_DIRECT_APP_ID 0x0E
+#define FEATURE_WRITE_DISPLAY 0x0F
+#define FEATURE_GET_KEY 0x10
+#define FEATURE_IFD_DISPLAY_PROPERTIES 0x11
+#define FEATURE_GET_TLV_PROPERTIES 0x12
+#define FEATURE_CCID_ESC_COMMAND 0x13
+#define FEATURE_EXECUTE_PACE 0x20
+
+/* structures used (but not defined) in PC/SC Part 10:
+ * "IFDs with Secure Pin Entry Capabilities" */
+
+#include <inttypes.h>
+
+/* Set structure elements alignment on bytes
+ * http://gcc.gnu.org/onlinedocs/gcc/Structure_002dPacking-Pragmas.html */
+#if defined(__APPLE__) || defined(sun) || defined(__NetBSD__)
+#pragma pack(1)
+#else
+#pragma pack(push, 1)
+#endif
+
+/** the structure must be 6-bytes long */
+typedef struct
+{
+ uint8_t tag;
+ uint8_t length;
+ uint32_t value; /**< This value is always in BIG ENDIAN format as documented in PCSC v2 part 10 ch 2.2 page 2. You can use ntohl() for example */
+} PCSC_TLV_STRUCTURE;
+
+/** Since CCID 1.4.1 (revision 5252) the byte order is no more important
+ * These macros are now deprecated and should be removed in the future */
+#define HOST_TO_CCID_16(x) (x)
+#define HOST_TO_CCID_32(x) (x)
+
+/** structure used with \ref FEATURE_VERIFY_PIN_DIRECT */
+typedef struct
+{
+ uint8_t bTimerOut; /**< timeout is seconds (00 means use default timeout) */
+ uint8_t bTimerOut2; /**< timeout in seconds after first key stroke */
+ uint8_t bmFormatString; /**< formatting options */
+ uint8_t bmPINBlockString; /**< bits 7-4 bit size of PIN length in APDU,
+ * bits 3-0 PIN block size in bytes after
+ * justification and formatting */
+ uint8_t bmPINLengthFormat; /**< bits 7-5 RFU,
+ * bit 4 set if system units are bytes, clear if
+ * system units are bits,
+ * bits 3-0 PIN length position in system units */
+ uint16_t wPINMaxExtraDigit; /**< 0xXXYY where XX is minimum PIN size in digits,
+ and YY is maximum PIN size in digits */
+ uint8_t bEntryValidationCondition; /**< Conditions under which PIN entry should
+ * be considered complete */
+ uint8_t bNumberMessage; /**< Number of messages to display for PIN verification */
+ uint16_t wLangId; /**< Language for messages. https://docs.microsoft.com/en-us/windows/win32/intl/language-identifier-constants-and-strings */
+ uint8_t bMsgIndex; /**< Message index (should be 00) */
+ uint8_t bTeoPrologue[3]; /**< T=1 block prologue field to use (fill with 00) */
+ uint32_t ulDataLength; /**< length of Data to be sent to the ICC */
+ uint8_t abData
+#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
+ [] /* valid C99 code */
+#else
+ [0] /* non-standard, but usually working code */
+#endif
+ ; /**< Data to send to the ICC */
+} PIN_VERIFY_STRUCTURE;
+
+/** structure used with \ref FEATURE_MODIFY_PIN_DIRECT */
+typedef struct
+{
+ uint8_t bTimerOut; /**< timeout is seconds (00 means use default timeout) */
+ uint8_t bTimerOut2; /**< timeout in seconds after first key stroke */
+ uint8_t bmFormatString; /**< formatting options */
+ uint8_t bmPINBlockString; /**< bits 7-4 bit size of PIN length in APDU,
+ * bits 3-0 PIN block size in bytes after
+ * justification and formatting */
+ uint8_t bmPINLengthFormat; /**< bits 7-5 RFU,
+ * bit 4 set if system units are bytes, clear if
+ * system units are bits,
+ * bits 3-0 PIN length position in system units */
+ uint8_t bInsertionOffsetOld; /**< Insertion position offset in bytes for
+ the current PIN */
+ uint8_t bInsertionOffsetNew; /**< Insertion position offset in bytes for
+ the new PIN */
+ uint16_t wPINMaxExtraDigit;
+ /**< 0xXXYY where XX is minimum PIN size in digits,
+ and YY is maximum PIN size in digits */
+ uint8_t bConfirmPIN; /**< Flags governing need for confirmation of new PIN */
+ uint8_t bEntryValidationCondition; /**< Conditions under which PIN entry should
+ * be considered complete */
+ uint8_t bNumberMessage; /**< Number of messages to display for PIN verification*/
+ uint16_t wLangId; /**< Language for messages. https://docs.microsoft.com/en-us/windows/win32/intl/language-identifier-constants-and-strings */
+ uint8_t bMsgIndex1; /**< index of 1st prompting message */
+ uint8_t bMsgIndex2; /**< index of 2d prompting message */
+ uint8_t bMsgIndex3; /**< index of 3d prompting message */
+ uint8_t bTeoPrologue[3]; /**< T=1 block prologue field to use (fill with 00) */
+ uint32_t ulDataLength; /**< length of Data to be sent to the ICC */
+ uint8_t abData
+#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
+ [] /* valid C99 code */
+#else
+ [0] /* non-standard, but usually working code */
+#endif
+ ; /**< Data to send to the ICC */
+} PIN_MODIFY_STRUCTURE;
+
+/** structure used with \ref FEATURE_IFD_PIN_PROPERTIES */
+typedef struct {
+ uint16_t wLcdLayout; /**< display characteristics */
+ uint8_t bEntryValidationCondition;
+ uint8_t bTimeOut2;
+} PIN_PROPERTIES_STRUCTURE;
+
+/* restore default structure elements alignment */
+#if defined(__APPLE__) || defined(sun) || defined(__NetBSD__)
+#pragma pack()
+#else
+#pragma pack(pop)
+#endif
+
+/* properties returned by FEATURE_GET_TLV_PROPERTIES */
+#define PCSCv2_PART10_PROPERTY_wLcdLayout 1
+#define PCSCv2_PART10_PROPERTY_bEntryValidationCondition 2
+#define PCSCv2_PART10_PROPERTY_bTimeOut2 3
+#define PCSCv2_PART10_PROPERTY_wLcdMaxCharacters 4
+#define PCSCv2_PART10_PROPERTY_wLcdMaxLines 5
+#define PCSCv2_PART10_PROPERTY_bMinPINSize 6
+#define PCSCv2_PART10_PROPERTY_bMaxPINSize 7
+#define PCSCv2_PART10_PROPERTY_sFirmwareID 8
+#define PCSCv2_PART10_PROPERTY_bPPDUSupport 9
+#define PCSCv2_PART10_PROPERTY_dwMaxAPDUDataSize 10
+#define PCSCv2_PART10_PROPERTY_wIdVendor 11
+#define PCSCv2_PART10_PROPERTY_wIdProduct 12
+
+#endif
+
diff --git a/src/Common/zlib/ChangeLog b/src/Common/zlib/ChangeLog
new file mode 100644
index 00000000..b801a103
--- /dev/null
+++ b/src/Common/zlib/ChangeLog
@@ -0,0 +1,1618 @@
+
+ ChangeLog file for zlib
+
+Changes in 1.3.1 (22 Jan 2024)
+- Reject overflows of zip header fields in minizip
+- Fix bug in inflateSync() for data held in bit buffer
+- Add LIT_MEM define to use more memory for a small deflate speedup
+- Fix decision on the emission of Zip64 end records in minizip
+- Add bounds checking to ERR_MSG() macro, used by zError()
+- Neutralize zip file traversal attacks in miniunz
+- Fix a bug in ZLIB_DEBUG compiles in check_match()
+- Various portability and appearance improvements
+
+Changes in 1.3 (18 Aug 2023)
+- Remove K&R function definitions and zlib2ansi
+- Fix bug in deflateBound() for level 0 and memLevel 9
+- Fix bug when gzungetc() is used immediately after gzopen()
+- Fix bug when using gzflush() with a very small buffer
+- Fix crash when gzsetparams() attempted for transparent write
+- Fix test/example.c to work with FORCE_STORED
+- Rewrite of zran in examples (see zran.c version history)
+- Fix minizip to allow it to open an empty zip file
+- Fix reading disk number start on zip64 files in minizip
+- Fix logic error in minizip argument processing
+- Add minizip testing to Makefile
+- Read multiple bytes instead of byte-by-byte in minizip unzip.c
+- Add memory sanitizer to configure (--memory)
+- Various portability improvements
+- Various documentation improvements
+- Various spelling and typo corrections
+
+Changes in 1.2.13 (13 Oct 2022)
+- Fix configure issue that discarded provided CC definition
+- Correct incorrect inputs provided to the CRC functions
+- Repair prototypes and exporting of new CRC functions
+- Fix inflateBack to detect invalid input with distances too far
+- Have infback() deliver all of the available output up to any error
+- Fix a bug when getting a gzip header extra field with inflate()
+- Fix bug in block type selection when Z_FIXED used
+- Tighten deflateBound bounds
+- Remove deleted assembler code references
+- Various portability and appearance improvements
+
+Changes in 1.2.12 (27 Mar 2022)
+- Cygwin does not have _wopen(), so do not create gzopen_w() there
+- Permit a deflateParams() parameter change as soon as possible
+- Limit hash table inserts after switch from stored deflate
+- Fix bug when window full in deflate_stored()
+- Fix CLEAR_HASH macro to be usable as a single statement
+- Avoid a conversion error in gzseek when off_t type too small
+- Have Makefile return non-zero error code on test failure
+- Avoid some conversion warnings in gzread.c and gzwrite.c
+- Update use of errno for newer Windows CE versions
+- Small speedup to inflate [psumbera]
+- Return an error if the gzputs string length can't fit in an int
+- Add address checking in clang to -w option of configure
+- Don't compute check value for raw inflate if asked to validate
+- Handle case where inflateSync used when header never processed
+- Avoid the use of ptrdiff_t
+- Avoid an undefined behavior of memcpy() in gzappend()
+- Avoid undefined behaviors of memcpy() in gz*printf()
+- Avoid an undefined behavior of memcpy() in _tr_stored_block()
+- Make the names in functions declarations identical to definitions
+- Remove old assembler code in which bugs have manifested
+- Fix deflateEnd() to not report an error at start of raw deflate
+- Add legal disclaimer to README
+- Emphasize the need to continue decompressing gzip members
+- Correct the initialization requirements for deflateInit2()
+- Fix a bug that can crash deflate on some input when using Z_FIXED
+- Assure that the number of bits for deflatePrime() is valid
+- Use a structure to make globals in enough.c evident
+- Use a macro for the printf format of big_t in enough.c
+- Clean up code style in enough.c, update version
+- Use inline function instead of macro for index in enough.c
+- Clarify that prefix codes are counted in enough.c
+- Show all the codes for the maximum tables size in enough.c
+- Add gznorm.c example, which normalizes gzip files
+- Fix the zran.c example to work on a multiple-member gzip file
+- Add tables for crc32_combine(), to speed it up by a factor of 200
+- Add crc32_combine_gen() and crc32_combine_op() for fast combines
+- Speed up software CRC-32 computation by a factor of 1.5 to 3
+- Use atomic test and set, if available, for dynamic CRC tables
+- Don't bother computing check value after successful inflateSync()
+- Correct comment in crc32.c
+- Add use of the ARMv8 crc32 instructions when requested
+- Use ARM crc32 instructions if the ARM architecture has them
+- Explicitly note that the 32-bit check values are 32 bits
+- Avoid adding empty gzip member after gzflush with Z_FINISH
+- Fix memory leak on error in gzlog.c
+- Fix error in comment on the polynomial representation of a byte
+- Clarify gz* function interfaces, referring to parameter names
+- Change macro name in inflate.c to avoid collision in VxWorks
+- Correct typo in blast.c
+- Improve portability of contrib/minizip
+- Fix indentation in minizip's zip.c
+- Replace black/white with allow/block. (theresa-m)
+- minizip warning fix if MAXU32 already defined. (gvollant)
+- Fix unztell64() in minizip to work past 4GB. (Daniël Hörchner)
+- Clean up minizip to reduce warnings for testing
+- Add fallthrough comments for gcc
+- Eliminate use of ULL constants
+- Separate out address sanitizing from warnings in configure
+- Remove destructive aspects of make distclean
+- Check for cc masquerading as gcc or clang in configure
+- Fix crc32.c to compile local functions only if used
+
+Changes in 1.2.11 (15 Jan 2017)
+- Fix deflate stored bug when pulling last block from window
+- Permit immediate deflateParams changes before any deflate input
+
+Changes in 1.2.10 (2 Jan 2017)
+- Avoid warnings on snprintf() return value
+- Fix bug in deflate_stored() for zero-length input
+- Fix bug in gzwrite.c that produced corrupt gzip files
+- Remove files to be installed before copying them in Makefile.in
+- Add warnings when compiling with assembler code
+
+Changes in 1.2.9 (31 Dec 2016)
+- Fix contrib/minizip to permit unzipping with desktop API [Zouzou]
+- Improve contrib/blast to return unused bytes
+- Assure that gzoffset() is correct when appending
+- Improve compress() and uncompress() to support large lengths
+- Fix bug in test/example.c where error code not saved
+- Remedy Coverity warning [Randers-Pehrson]
+- Improve speed of gzprintf() in transparent mode
+- Fix inflateInit2() bug when windowBits is 16 or 32
+- Change DEBUG macro to ZLIB_DEBUG
+- Avoid uninitialized access by gzclose_w()
+- Allow building zlib outside of the source directory
+- Fix bug that accepted invalid zlib header when windowBits is zero
+- Fix gzseek() problem on MinGW due to buggy _lseeki64 there
+- Loop on write() calls in gzwrite.c in case of non-blocking I/O
+- Add --warn (-w) option to ./configure for more compiler warnings
+- Reject a window size of 256 bytes if not using the zlib wrapper
+- Fix bug when level 0 used with Z_HUFFMAN or Z_RLE
+- Add --debug (-d) option to ./configure to define ZLIB_DEBUG
+- Fix bugs in creating a very large gzip header
+- Add uncompress2() function, which returns the input size used
+- Assure that deflateParams() will not switch functions mid-block
+- Dramatically speed up deflation for level 0 (storing)
+- Add gzfread(), duplicating the interface of fread()
+- Add gzfwrite(), duplicating the interface of fwrite()
+- Add deflateGetDictionary() function
+- Use snprintf() for later versions of Microsoft C
+- Fix *Init macros to use z_ prefix when requested
+- Replace as400 with os400 for OS/400 support [Monnerat]
+- Add crc32_z() and adler32_z() functions with size_t lengths
+- Update Visual Studio project files [AraHaan]
+
+Changes in 1.2.8 (28 Apr 2013)
+- Update contrib/minizip/iowin32.c for Windows RT [Vollant]
+- Do not force Z_CONST for C++
+- Clean up contrib/vstudio [Roß]
+- Correct spelling error in zlib.h
+- Fix mixed line endings in contrib/vstudio
+
+Changes in 1.2.7.3 (13 Apr 2013)
+- Fix version numbers and DLL names in contrib/vstudio/*/zlib.rc
+
+Changes in 1.2.7.2 (13 Apr 2013)
+- Change check for a four-byte type back to hexadecimal
+- Fix typo in win32/Makefile.msc
+- Add casts in gzwrite.c for pointer differences
+
+Changes in 1.2.7.1 (24 Mar 2013)
+- Replace use of unsafe string functions with snprintf if available
+- Avoid including stddef.h on Windows for Z_SOLO compile [Niessink]
+- Fix gzgetc undefine when Z_PREFIX set [Turk]
+- Eliminate use of mktemp in Makefile (not always available)
+- Fix bug in 'F' mode for gzopen()
+- Add inflateGetDictionary() function
+- Correct comment in deflate.h
+- Use _snprintf for snprintf in Microsoft C
+- On Darwin, only use /usr/bin/libtool if libtool is not Apple
+- Delete "--version" file if created by "ar --version" [Richard G.]
+- Fix configure check for veracity of compiler error return codes
+- Fix CMake compilation of static lib for MSVC2010 x64
+- Remove unused variable in infback9.c
+- Fix argument checks in gzlog_compress() and gzlog_write()
+- Clean up the usage of z_const and respect const usage within zlib
+- Clean up examples/gzlog.[ch] comparisons of different types
+- Avoid shift equal to bits in type (caused endless loop)
+- Fix uninitialized value bug in gzputc() introduced by const patches
+- Fix memory allocation error in examples/zran.c [Nor]
+- Fix bug where gzopen(), gzclose() would write an empty file
+- Fix bug in gzclose() when gzwrite() runs out of memory
+- Check for input buffer malloc failure in examples/gzappend.c
+- Add note to contrib/blast to use binary mode in stdio
+- Fix comparisons of differently signed integers in contrib/blast
+- Check for invalid code length codes in contrib/puff
+- Fix serious but very rare decompression bug in inftrees.c
+- Update inflateBack() comments, since inflate() can be faster
+- Use underscored I/O function names for WINAPI_FAMILY
+- Add _tr_flush_bits to the external symbols prefixed by --zprefix
+- Add contrib/vstudio/vc10 pre-build step for static only
+- Quote --version-script argument in CMakeLists.txt
+- Don't specify --version-script on Apple platforms in CMakeLists.txt
+- Fix casting error in contrib/testzlib/testzlib.c
+- Fix types in contrib/minizip to match result of get_crc_table()
+- Simplify contrib/vstudio/vc10 with 'd' suffix
+- Add TOP support to win32/Makefile.msc
+- Support i686 and amd64 assembler builds in CMakeLists.txt
+- Fix typos in the use of _LARGEFILE64_SOURCE in zconf.h
+- Add vc11 and vc12 build files to contrib/vstudio
+- Add gzvprintf() as an undocumented function in zlib
+- Fix configure for Sun shell
+- Remove runtime check in configure for four-byte integer type
+- Add casts and consts to ease user conversion to C++
+- Add man pages for minizip and miniunzip
+- In Makefile uninstall, don't rm if preceding cd fails
+- Do not return Z_BUF_ERROR if deflateParam() has nothing to write
+
+Changes in 1.2.7 (2 May 2012)
+- Replace use of memmove() with a simple copy for portability
+- Test for existence of strerror
+- Restore gzgetc_ for backward compatibility with 1.2.6
+- Fix build with non-GNU make on Solaris
+- Require gcc 4.0 or later on Mac OS X to use the hidden attribute
+- Include unistd.h for Watcom C
+- Use __WATCOMC__ instead of __WATCOM__
+- Do not use the visibility attribute if NO_VIZ defined
+- Improve the detection of no hidden visibility attribute
+- Avoid using __int64 for gcc or solo compilation
+- Cast to char * in gzprintf to avoid warnings [Zinser]
+- Fix make_vms.com for VAX [Zinser]
+- Don't use library or built-in byte swaps
+- Simplify test and use of gcc hidden attribute
+- Fix bug in gzclose_w() when gzwrite() fails to allocate memory
+- Add "x" (O_EXCL) and "e" (O_CLOEXEC) modes support to gzopen()
+- Fix bug in test/minigzip.c for configure --solo
+- Fix contrib/vstudio project link errors [Mohanathas]
+- Add ability to choose the builder in make_vms.com [Schweda]
+- Add DESTDIR support to mingw32 win32/Makefile.gcc
+- Fix comments in win32/Makefile.gcc for proper usage
+- Allow overriding the default install locations for cmake
+- Generate and install the pkg-config file with cmake
+- Build both a static and a shared version of zlib with cmake
+- Include version symbols for cmake builds
+- If using cmake with MSVC, add the source directory to the includes
+- Remove unneeded EXTRA_CFLAGS from win32/Makefile.gcc [Truta]
+- Move obsolete emx makefile to old [Truta]
+- Allow the use of -Wundef when compiling or using zlib
+- Avoid the use of the -u option with mktemp
+- Improve inflate() documentation on the use of Z_FINISH
+- Recognize clang as gcc
+- Add gzopen_w() in Windows for wide character path names
+- Rename zconf.h in CMakeLists.txt to move it out of the way
+- Add source directory in CMakeLists.txt for building examples
+- Look in build directory for zlib.pc in CMakeLists.txt
+- Remove gzflags from zlibvc.def in vc9 and vc10
+- Fix contrib/minizip compilation in the MinGW environment
+- Update ./configure for Solaris, support --64 [Mooney]
+- Remove -R. from Solaris shared build (possible security issue)
+- Avoid race condition for parallel make (-j) running example
+- Fix type mismatch between get_crc_table() and crc_table
+- Fix parsing of version with "-" in CMakeLists.txt [Snider, Ziegler]
+- Fix the path to zlib.map in CMakeLists.txt
+- Force the native libtool in Mac OS X to avoid GNU libtool [Beebe]
+- Add instructions to win32/Makefile.gcc for shared install [Torri]
+
+Changes in 1.2.6.1 (12 Feb 2012)
+- Avoid the use of the Objective-C reserved name "id"
+- Include io.h in gzguts.h for Microsoft compilers
+- Fix problem with ./configure --prefix and gzgetc macro
+- Include gz_header definition when compiling zlib solo
+- Put gzflags() functionality back in zutil.c
+- Avoid library header include in crc32.c for Z_SOLO
+- Use name in GCC_CLASSIC as C compiler for coverage testing, if set
+- Minor cleanup in contrib/minizip/zip.c [Vollant]
+- Update make_vms.com [Zinser]
+- Remove unnecessary gzgetc_ function
+- Use optimized byte swap operations for Microsoft and GNU [Snyder]
+- Fix minor typo in zlib.h comments [Rzesniowiecki]
+
+Changes in 1.2.6 (29 Jan 2012)
+- Update the Pascal interface in contrib/pascal
+- Fix function numbers for gzgetc_ in zlibvc.def files
+- Fix configure.ac for contrib/minizip [Schiffer]
+- Fix large-entry detection in minizip on 64-bit systems [Schiffer]
+- Have ./configure use the compiler return code for error indication
+- Fix CMakeLists.txt for cross compilation [McClure]
+- Fix contrib/minizip/zip.c for 64-bit architectures [Dalsnes]
+- Fix compilation of contrib/minizip on FreeBSD [Marquez]
+- Correct suggested usages in win32/Makefile.msc [Shachar, Horvath]
+- Include io.h for Turbo C / Borland C on all platforms [Truta]
+- Make version explicit in contrib/minizip/configure.ac [Bosmans]
+- Avoid warning for no encryption in contrib/minizip/zip.c [Vollant]
+- Minor cleanup up contrib/minizip/unzip.c [Vollant]
+- Fix bug when compiling minizip with C++ [Vollant]
+- Protect for long name and extra fields in contrib/minizip [Vollant]
+- Avoid some warnings in contrib/minizip [Vollant]
+- Add -I../.. -L../.. to CFLAGS for minizip and miniunzip
+- Add missing libs to minizip linker command
+- Add support for VPATH builds in contrib/minizip
+- Add an --enable-demos option to contrib/minizip/configure
+- Add the generation of configure.log by ./configure
+- Exit when required parameters not provided to win32/Makefile.gcc
+- Have gzputc return the character written instead of the argument
+- Use the -m option on ldconfig for BSD systems [Tobias]
+- Correct in zlib.map when deflateResetKeep was added
+
+Changes in 1.2.5.3 (15 Jan 2012)
+- Restore gzgetc function for binary compatibility
+- Do not use _lseeki64 under Borland C++ [Truta]
+- Update win32/Makefile.msc to build test/*.c [Truta]
+- Remove old/visualc6 given CMakefile and other alternatives
+- Update AS400 build files and documentation [Monnerat]
+- Update win32/Makefile.gcc to build test/*.c [Truta]
+- Permit stronger flushes after Z_BLOCK flushes
+- Avoid extraneous empty blocks when doing empty flushes
+- Permit Z_NULL arguments to deflatePending
+- Allow deflatePrime() to insert bits in the middle of a stream
+- Remove second empty static block for Z_PARTIAL_FLUSH
+- Write out all of the available bits when using Z_BLOCK
+- Insert the first two strings in the hash table after a flush
+
+Changes in 1.2.5.2 (17 Dec 2011)
+- fix ld error: unable to find version dependency 'ZLIB_1.2.5'
+- use relative symlinks for shared libs
+- Avoid searching past window for Z_RLE strategy
+- Assure that high-water mark initialization is always applied in deflate
+- Add assertions to fill_window() in deflate.c to match comments
+- Update python link in README
+- Correct spelling error in gzread.c
+- Fix bug in gzgets() for a concatenated empty gzip stream
+- Correct error in comment for gz_make()
+- Change gzread() and related to ignore junk after gzip streams
+- Allow gzread() and related to continue after gzclearerr()
+- Allow gzrewind() and gzseek() after a premature end-of-file
+- Simplify gzseek() now that raw after gzip is ignored
+- Change gzgetc() to a macro for speed (~40% speedup in testing)
+- Fix gzclose() to return the actual error last encountered
+- Always add large file support for windows
+- Include zconf.h for windows large file support
+- Include zconf.h.cmakein for windows large file support
+- Update zconf.h.cmakein on make distclean
+- Merge vestigial vsnprintf determination from zutil.h to gzguts.h
+- Clarify how gzopen() appends in zlib.h comments
+- Correct documentation of gzdirect() since junk at end now ignored
+- Add a transparent write mode to gzopen() when 'T' is in the mode
+- Update python link in zlib man page
+- Get inffixed.h and MAKEFIXED result to match
+- Add a ./config --solo option to make zlib subset with no library use
+- Add undocumented inflateResetKeep() function for CAB file decoding
+- Add --cover option to ./configure for gcc coverage testing
+- Add #define ZLIB_CONST option to use const in the z_stream interface
+- Add comment to gzdopen() in zlib.h to use dup() when using fileno()
+- Note behavior of uncompress() to provide as much data as it can
+- Add files in contrib/minizip to aid in building libminizip
+- Split off AR options in Makefile.in and configure
+- Change ON macro to Z_ARG to avoid application conflicts
+- Facilitate compilation with Borland C++ for pragmas and vsnprintf
+- Include io.h for Turbo C / Borland C++
+- Move example.c and minigzip.c to test/
+- Simplify incomplete code table filling in inflate_table()
+- Remove code from inflate.c and infback.c that is impossible to execute
+- Test the inflate code with full coverage
+- Allow deflateSetDictionary, inflateSetDictionary at any time (in raw)
+- Add deflateResetKeep and fix inflateResetKeep to retain dictionary
+- Fix gzwrite.c to accommodate reduced memory zlib compilation
+- Have inflate() with Z_FINISH avoid the allocation of a window
+- Do not set strm->adler when doing raw inflate
+- Fix gzeof() to behave just like feof() when read is not past end of file
+- Fix bug in gzread.c when end-of-file is reached
+- Avoid use of Z_BUF_ERROR in gz* functions except for premature EOF
+- Document gzread() capability to read concurrently written files
+- Remove hard-coding of resource compiler in CMakeLists.txt [Blammo]
+
+Changes in 1.2.5.1 (10 Sep 2011)
+- Update FAQ entry on shared builds (#13)
+- Avoid symbolic argument to chmod in Makefile.in
+- Fix bug and add consts in contrib/puff [Oberhumer]
+- Update contrib/puff/zeros.raw test file to have all block types
+- Add full coverage test for puff in contrib/puff/Makefile
+- Fix static-only-build install in Makefile.in
+- Fix bug in unzGetCurrentFileInfo() in contrib/minizip [Kuno]
+- Add libz.a dependency to shared in Makefile.in for parallel builds
+- Spell out "number" (instead of "nb") in zlib.h for total_in, total_out
+- Replace $(...) with `...` in configure for non-bash sh [Bowler]
+- Add darwin* to Darwin* and solaris* to SunOS\ 5* in configure [Groffen]
+- Add solaris* to Linux* in configure to allow gcc use [Groffen]
+- Add *bsd* to Linux* case in configure [Bar-Lev]
+- Add inffast.obj to dependencies in win32/Makefile.msc
+- Correct spelling error in deflate.h [Kohler]
+- Change libzdll.a again to libz.dll.a (!) in win32/Makefile.gcc
+- Add test to configure for GNU C looking for gcc in output of $cc -v
+- Add zlib.pc generation to win32/Makefile.gcc [Weigelt]
+- Fix bug in zlib.h for _FILE_OFFSET_BITS set and _LARGEFILE64_SOURCE not
+- Add comment in zlib.h that adler32_combine with len2 < 0 makes no sense
+- Make NO_DIVIDE option in adler32.c much faster (thanks to John Reiser)
+- Make stronger test in zconf.h to include unistd.h for LFS
+- Apply Darwin patches for 64-bit file offsets to contrib/minizip [Slack]
+- Fix zlib.h LFS support when Z_PREFIX used
+- Add updated as400 support (removed from old) [Monnerat]
+- Avoid deflate sensitivity to volatile input data
+- Avoid division in adler32_combine for NO_DIVIDE
+- Clarify the use of Z_FINISH with deflateBound() amount of space
+- Set binary for output file in puff.c
+- Use u4 type for crc_table to avoid conversion warnings
+- Apply casts in zlib.h to avoid conversion warnings
+- Add OF to prototypes for adler32_combine_ and crc32_combine_ [Miller]
+- Improve inflateSync() documentation to note indeterminacy
+- Add deflatePending() function to return the amount of pending output
+- Correct the spelling of "specification" in FAQ [Randers-Pehrson]
+- Add a check in configure for stdarg.h, use for gzprintf()
+- Check that pointers fit in ints when gzprint() compiled old style
+- Add dummy name before $(SHAREDLIBV) in Makefile [Bar-Lev, Bowler]
+- Delete line in configure that adds -L. libz.a to LDFLAGS [Weigelt]
+- Add debug records in assembler code [Londer]
+- Update RFC references to use http://tools.ietf.org/html/... [Li]
+- Add --archs option, use of libtool to configure for Mac OS X [Borstel]
+
+Changes in 1.2.5 (19 Apr 2010)
+- Disable visibility attribute in win32/Makefile.gcc [Bar-Lev]
+- Default to libdir as sharedlibdir in configure [Nieder]
+- Update copyright dates on modified source files
+- Update trees.c to be able to generate modified trees.h
+- Exit configure for MinGW, suggesting win32/Makefile.gcc
+- Check for NULL path in gz_open [Homurlu]
+
+Changes in 1.2.4.5 (18 Apr 2010)
+- Set sharedlibdir in configure [Torok]
+- Set LDFLAGS in Makefile.in [Bar-Lev]
+- Avoid mkdir objs race condition in Makefile.in [Bowler]
+- Add ZLIB_INTERNAL in front of internal inter-module functions and arrays
+- Define ZLIB_INTERNAL to hide internal functions and arrays for GNU C
+- Don't use hidden attribute when it is a warning generator (e.g. Solaris)
+
+Changes in 1.2.4.4 (18 Apr 2010)
+- Fix CROSS_PREFIX executable testing, CHOST extract, mingw* [Torok]
+- Undefine _LARGEFILE64_SOURCE in zconf.h if it is zero, but not if empty
+- Try to use bash or ksh regardless of functionality of /bin/sh
+- Fix configure incompatibility with NetBSD sh
+- Remove attempt to run under bash or ksh since have better NetBSD fix
+- Fix win32/Makefile.gcc for MinGW [Bar-Lev]
+- Add diagnostic messages when using CROSS_PREFIX in configure
+- Added --sharedlibdir option to configure [Weigelt]
+- Use hidden visibility attribute when available [Frysinger]
+
+Changes in 1.2.4.3 (10 Apr 2010)
+- Only use CROSS_PREFIX in configure for ar and ranlib if they exist
+- Use CROSS_PREFIX for nm [Bar-Lev]
+- Assume _LARGEFILE64_SOURCE defined is equivalent to true
+- Avoid use of undefined symbols in #if with && and ||
+- Make *64 prototypes in gzguts.h consistent with functions
+- Add -shared load option for MinGW in configure [Bowler]
+- Move z_off64_t to public interface, use instead of off64_t
+- Remove ! from shell test in configure (not portable to Solaris)
+- Change +0 macro tests to -0 for possibly increased portability
+
+Changes in 1.2.4.2 (9 Apr 2010)
+- Add consistent carriage returns to readme.txt's in masmx86 and masmx64
+- Really provide prototypes for *64 functions when building without LFS
+- Only define unlink() in minigzip.c if unistd.h not included
+- Update README to point to contrib/vstudio project files
+- Move projects/vc6 to old/ and remove projects/
+- Include stdlib.h in minigzip.c for setmode() definition under WinCE
+- Clean up assembler builds in win32/Makefile.msc [Rowe]
+- Include sys/types.h for Microsoft for off_t definition
+- Fix memory leak on error in gz_open()
+- Symbolize nm as $NM in configure [Weigelt]
+- Use TEST_LDSHARED instead of LDSHARED to link test programs [Weigelt]
+- Add +0 to _FILE_OFFSET_BITS and _LFS64_LARGEFILE in case not defined
+- Fix bug in gzeof() to take into account unused input data
+- Avoid initialization of structures with variables in puff.c
+- Updated win32/README-WIN32.txt [Rowe]
+
+Changes in 1.2.4.1 (28 Mar 2010)
+- Remove the use of [a-z] constructs for sed in configure [gentoo 310225]
+- Remove $(SHAREDLIB) from LIBS in Makefile.in [Creech]
+- Restore "for debugging" comment on sprintf() in gzlib.c
+- Remove fdopen for MVS from gzguts.h
+- Put new README-WIN32.txt in win32 [Rowe]
+- Add check for shell to configure and invoke another shell if needed
+- Fix big fat stinking bug in gzseek() on uncompressed files
+- Remove vestigial F_OPEN64 define in zutil.h
+- Set and check the value of _LARGEFILE_SOURCE and _LARGEFILE64_SOURCE
+- Avoid errors on non-LFS systems when applications define LFS macros
+- Set EXE to ".exe" in configure for MINGW [Kahle]
+- Match crc32() in crc32.c exactly to the prototype in zlib.h [Sherrill]
+- Add prefix for cross-compilation in win32/makefile.gcc [Bar-Lev]
+- Add DLL install in win32/makefile.gcc [Bar-Lev]
+- Allow Linux* or linux* from uname in configure [Bar-Lev]
+- Allow ldconfig to be redefined in configure and Makefile.in [Bar-Lev]
+- Add cross-compilation prefixes to configure [Bar-Lev]
+- Match type exactly in gz_load() invocation in gzread.c
+- Match type exactly of zcalloc() in zutil.c to zlib.h alloc_func
+- Provide prototypes for *64 functions when building zlib without LFS
+- Don't use -lc when linking shared library on MinGW
+- Remove errno.h check in configure and vestigial errno code in zutil.h
+
+Changes in 1.2.4 (14 Mar 2010)
+- Fix VER3 extraction in configure for no fourth subversion
+- Update zlib.3, add docs to Makefile.in to make .pdf out of it
+- Add zlib.3.pdf to distribution
+- Don't set error code in gzerror() if passed pointer is NULL
+- Apply destination directory fixes to CMakeLists.txt [Lowman]
+- Move #cmakedefine's to a new zconf.in.cmakein
+- Restore zconf.h for builds that don't use configure or cmake
+- Add distclean to dummy Makefile for convenience
+- Update and improve INDEX, README, and FAQ
+- Update CMakeLists.txt for the return of zconf.h [Lowman]
+- Update contrib/vstudio/vc9 and vc10 [Vollant]
+- Change libz.dll.a back to libzdll.a in win32/Makefile.gcc
+- Apply license and readme changes to contrib/asm686 [Raiter]
+- Check file name lengths and add -c option in minigzip.c [Li]
+- Update contrib/amd64 and contrib/masmx86/ [Vollant]
+- Avoid use of "eof" parameter in trees.c to not shadow library variable
+- Update make_vms.com for removal of zlibdefs.h [Zinser]
+- Update assembler code and vstudio projects in contrib [Vollant]
+- Remove outdated assembler code contrib/masm686 and contrib/asm586
+- Remove old vc7 and vc8 from contrib/vstudio
+- Update win32/Makefile.msc, add ZLIB_VER_SUBREVISION [Rowe]
+- Fix memory leaks in gzclose_r() and gzclose_w(), file leak in gz_open()
+- Add contrib/gcc_gvmat64 for longest_match and inflate_fast [Vollant]
+- Remove *64 functions from win32/zlib.def (they're not 64-bit yet)
+- Fix bug in void-returning vsprintf() case in gzwrite.c
+- Fix name change from inflate.h in contrib/inflate86/inffas86.c
+- Check if temporary file exists before removing in make_vms.com [Zinser]
+- Fix make install and uninstall for --static option
+- Fix usage of _MSC_VER in gzguts.h and zutil.h [Truta]
+- Update readme.txt in contrib/masmx64 and masmx86 to assemble
+
+Changes in 1.2.3.9 (21 Feb 2010)
+- Expunge gzio.c
+- Move as400 build information to old
+- Fix updates in contrib/minizip and contrib/vstudio
+- Add const to vsnprintf test in configure to avoid warnings [Weigelt]
+- Delete zconf.h (made by configure) [Weigelt]
+- Change zconf.in.h to zconf.h.in per convention [Weigelt]
+- Check for NULL buf in gzgets()
+- Return empty string for gzgets() with len == 1 (like fgets())
+- Fix description of gzgets() in zlib.h for end-of-file, NULL return
+- Update minizip to 1.1 [Vollant]
+- Avoid MSVC loss of data warnings in gzread.c, gzwrite.c
+- Note in zlib.h that gzerror() should be used to distinguish from EOF
+- Remove use of snprintf() from gzlib.c
+- Fix bug in gzseek()
+- Update contrib/vstudio, adding vc9 and vc10 [Kuno, Vollant]
+- Fix zconf.h generation in CMakeLists.txt [Lowman]
+- Improve comments in zconf.h where modified by configure
+
+Changes in 1.2.3.8 (13 Feb 2010)
+- Clean up text files (tabs, trailing whitespace, etc.) [Oberhumer]
+- Use z_off64_t in gz_zero() and gz_skip() to match state->skip
+- Avoid comparison problem when sizeof(int) == sizeof(z_off64_t)
+- Revert to Makefile.in from 1.2.3.6 (live with the clutter)
+- Fix missing error return in gzflush(), add zlib.h note
+- Add *64 functions to zlib.map [Levin]
+- Fix signed/unsigned comparison in gz_comp()
+- Use SFLAGS when testing shared linking in configure
+- Add --64 option to ./configure to use -m64 with gcc
+- Fix ./configure --help to correctly name options
+- Have make fail if a test fails [Levin]
+- Avoid buffer overrun in contrib/masmx64/gvmat64.asm [Simpson]
+- Remove assembler object files from contrib
+
+Changes in 1.2.3.7 (24 Jan 2010)
+- Always gzopen() with O_LARGEFILE if available
+- Fix gzdirect() to work immediately after gzopen() or gzdopen()
+- Make gzdirect() more precise when the state changes while reading
+- Improve zlib.h documentation in many places
+- Catch memory allocation failure in gz_open()
+- Complete close operation if seek forward in gzclose_w() fails
+- Return Z_ERRNO from gzclose_r() if close() fails
+- Return Z_STREAM_ERROR instead of EOF for gzclose() being passed NULL
+- Return zero for gzwrite() errors to match zlib.h description
+- Return -1 on gzputs() error to match zlib.h description
+- Add zconf.in.h to allow recovery from configure modification [Weigelt]
+- Fix static library permissions in Makefile.in [Weigelt]
+- Avoid warnings in configure tests that hide functionality [Weigelt]
+- Add *BSD and DragonFly to Linux case in configure [gentoo 123571]
+- Change libzdll.a to libz.dll.a in win32/Makefile.gcc [gentoo 288212]
+- Avoid access of uninitialized data for first inflateReset2 call [Gomes]
+- Keep object files in subdirectories to reduce the clutter somewhat
+- Remove default Makefile and zlibdefs.h, add dummy Makefile
+- Add new external functions to Z_PREFIX, remove duplicates, z_z_ -> z_
+- Remove zlibdefs.h completely -- modify zconf.h instead
+
+Changes in 1.2.3.6 (17 Jan 2010)
+- Avoid void * arithmetic in gzread.c and gzwrite.c
+- Make compilers happier with const char * for gz_error message
+- Avoid unused parameter warning in inflate.c
+- Avoid signed-unsigned comparison warning in inflate.c
+- Indent #pragma's for traditional C
+- Fix usage of strwinerror() in glib.c, change to gz_strwinerror()
+- Correct email address in configure for system options
+- Update make_vms.com and add make_vms.com to contrib/minizip [Zinser]
+- Update zlib.map [Brown]
+- Fix Makefile.in for Solaris 10 make of example64 and minizip64 [Torok]
+- Apply various fixes to CMakeLists.txt [Lowman]
+- Add checks on len in gzread() and gzwrite()
+- Add error message for no more room for gzungetc()
+- Remove zlib version check in gzwrite()
+- Defer compression of gzprintf() result until need to
+- Use snprintf() in gzdopen() if available
+- Remove USE_MMAP configuration determination (only used by minigzip)
+- Remove examples/pigz.c (available separately)
+- Update examples/gun.c to 1.6
+
+Changes in 1.2.3.5 (8 Jan 2010)
+- Add space after #if in zutil.h for some compilers
+- Fix relatively harmless bug in deflate_fast() [Exarevsky]
+- Fix same problem in deflate_slow()
+- Add $(SHAREDLIBV) to LIBS in Makefile.in [Brown]
+- Add deflate_rle() for faster Z_RLE strategy run-length encoding
+- Add deflate_huff() for faster Z_HUFFMAN_ONLY encoding
+- Change name of "write" variable in inffast.c to avoid library collisions
+- Fix premature EOF from gzread() in gzio.c [Brown]
+- Use zlib header window size if windowBits is 0 in inflateInit2()
+- Remove compressBound() call in deflate.c to avoid linking compress.o
+- Replace use of errno in gz* with functions, support WinCE [Alves]
+- Provide alternative to perror() in minigzip.c for WinCE [Alves]
+- Don't use _vsnprintf on later versions of MSVC [Lowman]
+- Add CMake build script and input file [Lowman]
+- Update contrib/minizip to 1.1 [Svensson, Vollant]
+- Moved nintendods directory from contrib to root
+- Replace gzio.c with a new set of routines with the same functionality
+- Add gzbuffer(), gzoffset(), gzclose_r(), gzclose_w() as part of above
+- Update contrib/minizip to 1.1b
+- Change gzeof() to return 0 on error instead of -1 to agree with zlib.h
+
+Changes in 1.2.3.4 (21 Dec 2009)
+- Use old school .SUFFIXES in Makefile.in for FreeBSD compatibility
+- Update comments in configure and Makefile.in for default --shared
+- Fix test -z's in configure [Marquess]
+- Build examplesh and minigzipsh when not testing
+- Change NULL's to Z_NULL's in deflate.c and in comments in zlib.h
+- Import LDFLAGS from the environment in configure
+- Fix configure to populate SFLAGS with discovered CFLAGS options
+- Adapt make_vms.com to the new Makefile.in [Zinser]
+- Add zlib2ansi script for C++ compilation [Marquess]
+- Add _FILE_OFFSET_BITS=64 test to make test (when applicable)
+- Add AMD64 assembler code for longest match to contrib [Teterin]
+- Include options from $SFLAGS when doing $LDSHARED
+- Simplify 64-bit file support by introducing z_off64_t type
+- Make shared object files in objs directory to work around old Sun cc
+- Use only three-part version number for Darwin shared compiles
+- Add rc option to ar in Makefile.in for when ./configure not run
+- Add -WI,-rpath,. to LDFLAGS for OSF 1 V4*
+- Set LD_LIBRARYN32_PATH for SGI IRIX shared compile
+- Protect against _FILE_OFFSET_BITS being defined when compiling zlib
+- Rename Makefile.in targets allstatic to static and allshared to shared
+- Fix static and shared Makefile.in targets to be independent
+- Correct error return bug in gz_open() by setting state [Brown]
+- Put spaces before ;;'s in configure for better sh compatibility
+- Add pigz.c (parallel implementation of gzip) to examples/
+- Correct constant in crc32.c to UL [Leventhal]
+- Reject negative lengths in crc32_combine()
+- Add inflateReset2() function to work like inflateEnd()/inflateInit2()
+- Include sys/types.h for _LARGEFILE64_SOURCE [Brown]
+- Correct typo in doc/algorithm.txt [Janik]
+- Fix bug in adler32_combine() [Zhu]
+- Catch missing-end-of-block-code error in all inflates and in puff
+ Assures that random input to inflate eventually results in an error
+- Added enough.c (calculation of ENOUGH for inftrees.h) to examples/
+- Update ENOUGH and its usage to reflect discovered bounds
+- Fix gzerror() error report on empty input file [Brown]
+- Add ush casts in trees.c to avoid pedantic runtime errors
+- Fix typo in zlib.h uncompress() description [Reiss]
+- Correct inflate() comments with regard to automatic header detection
+- Remove deprecation comment on Z_PARTIAL_FLUSH (it stays)
+- Put new version of gzlog (2.0) in examples with interruption recovery
+- Add puff compile option to permit invalid distance-too-far streams
+- Add puff TEST command options, ability to read piped input
+- Prototype the *64 functions in zlib.h when _FILE_OFFSET_BITS == 64, but
+ _LARGEFILE64_SOURCE not defined
+- Fix Z_FULL_FLUSH to truly erase the past by resetting s->strstart
+- Fix deflateSetDictionary() to use all 32K for output consistency
+- Remove extraneous #define MIN_LOOKAHEAD in deflate.c (in deflate.h)
+- Clear bytes after deflate lookahead to avoid use of uninitialized data
+- Change a limit in inftrees.c to be more transparent to Coverity Prevent
+- Update win32/zlib.def with exported symbols from zlib.h
+- Correct spelling errors in zlib.h [Willem, Sobrado]
+- Allow Z_BLOCK for deflate() to force a new block
+- Allow negative bits in inflatePrime() to delete existing bit buffer
+- Add Z_TREES flush option to inflate() to return at end of trees
+- Add inflateMark() to return current state information for random access
+- Add Makefile for NintendoDS to contrib [Costa]
+- Add -w in configure compile tests to avoid spurious warnings [Beucler]
+- Fix typos in zlib.h comments for deflateSetDictionary()
+- Fix EOF detection in transparent gzread() [Maier]
+
+Changes in 1.2.3.3 (2 October 2006)
+- Make --shared the default for configure, add a --static option
+- Add compile option to permit invalid distance-too-far streams
+- Add inflateUndermine() function which is required to enable above
+- Remove use of "this" variable name for C++ compatibility [Marquess]
+- Add testing of shared library in make test, if shared library built
+- Use ftello() and fseeko() if available instead of ftell() and fseek()
+- Provide two versions of all functions that use the z_off_t type for
+ binary compatibility -- a normal version and a 64-bit offset version,
+ per the Large File Support Extension when _LARGEFILE64_SOURCE is
+ defined; use the 64-bit versions by default when _FILE_OFFSET_BITS
+ is defined to be 64
+- Add a --uname= option to configure to perhaps help with cross-compiling
+
+Changes in 1.2.3.2 (3 September 2006)
+- Turn off silly Borland warnings [Hay]
+- Use off64_t and define _LARGEFILE64_SOURCE when present
+- Fix missing dependency on inffixed.h in Makefile.in
+- Rig configure --shared to build both shared and static [Teredesai, Truta]
+- Remove zconf.in.h and instead create a new zlibdefs.h file
+- Fix contrib/minizip/unzip.c non-encrypted after encrypted [Vollant]
+- Add treebuild.xml (see http://treebuild.metux.de/) [Weigelt]
+
+Changes in 1.2.3.1 (16 August 2006)
+- Add watcom directory with OpenWatcom make files [Daniel]
+- Remove #undef of FAR in zconf.in.h for MVS [Fedtke]
+- Update make_vms.com [Zinser]
+- Use -fPIC for shared build in configure [Teredesai, Nicholson]
+- Use only major version number for libz.so on IRIX and OSF1 [Reinholdtsen]
+- Use fdopen() (not _fdopen()) for Interix in zutil.h [Bäck]
+- Add some FAQ entries about the contrib directory
+- Update the MVS question in the FAQ
+- Avoid extraneous reads after EOF in gzio.c [Brown]
+- Correct spelling of "successfully" in gzio.c [Randers-Pehrson]
+- Add comments to zlib.h about gzerror() usage [Brown]
+- Set extra flags in gzip header in gzopen() like deflate() does
+- Make configure options more compatible with double-dash conventions
+ [Weigelt]
+- Clean up compilation under Solaris SunStudio cc [Rowe, Reinholdtsen]
+- Fix uninstall target in Makefile.in [Truta]
+- Add pkgconfig support [Weigelt]
+- Use $(DESTDIR) macro in Makefile.in [Reinholdtsen, Weigelt]
+- Replace set_data_type() with a more accurate detect_data_type() in
+ trees.c, according to the txtvsbin.txt document [Truta]
+- Swap the order of #include <stdio.h> and #include "zlib.h" in
+ gzio.c, example.c and minigzip.c [Truta]
+- Shut up annoying VS2005 warnings about standard C deprecation [Rowe,
+ Truta] (where?)
+- Fix target "clean" from win32/Makefile.bor [Truta]
+- Create .pdb and .manifest files in win32/makefile.msc [Ziegler, Rowe]
+- Update zlib www home address in win32/DLL_FAQ.txt [Truta]
+- Update contrib/masmx86/inffas32.asm for VS2005 [Vollant, Van Wassenhove]
+- Enable browse info in the "Debug" and "ASM Debug" configurations in
+ the Visual C++ 6 project, and set (non-ASM) "Debug" as default [Truta]
+- Add pkgconfig support [Weigelt]
+- Add ZLIB_VER_MAJOR, ZLIB_VER_MINOR and ZLIB_VER_REVISION in zlib.h,
+ for use in win32/zlib1.rc [Polushin, Rowe, Truta]
+- Add a document that explains the new text detection scheme to
+ doc/txtvsbin.txt [Truta]
+- Add rfc1950.txt, rfc1951.txt and rfc1952.txt to doc/ [Truta]
+- Move algorithm.txt into doc/ [Truta]
+- Synchronize FAQ with website
+- Fix compressBound(), was low for some pathological cases [Fearnley]
+- Take into account wrapper variations in deflateBound()
+- Set examples/zpipe.c input and output to binary mode for Windows
+- Update examples/zlib_how.html with new zpipe.c (also web site)
+- Fix some warnings in examples/gzlog.c and examples/zran.c (it seems
+ that gcc became pickier in 4.0)
+- Add zlib.map for Linux: "All symbols from zlib-1.1.4 remain
+ un-versioned, the patch adds versioning only for symbols introduced in
+ zlib-1.2.0 or later. It also declares as local those symbols which are
+ not designed to be exported." [Levin]
+- Update Z_PREFIX list in zconf.in.h, add --zprefix option to configure
+- Do not initialize global static by default in trees.c, add a response
+ NO_INIT_GLOBAL_POINTERS to initialize them if needed [Marquess]
+- Don't use strerror() in gzio.c under WinCE [Yakimov]
+- Don't use errno.h in zutil.h under WinCE [Yakimov]
+- Move arguments for AR to its usage to allow replacing ar [Marot]
+- Add HAVE_VISIBILITY_PRAGMA in zconf.in.h for Mozilla [Randers-Pehrson]
+- Improve inflateInit() and inflateInit2() documentation
+- Fix structure size comment in inflate.h
+- Change configure help option from --h* to --help [Santos]
+
+Changes in 1.2.3 (18 July 2005)
+- Apply security vulnerability fixes to contrib/infback9 as well
+- Clean up some text files (carriage returns, trailing space)
+- Update testzlib, vstudio, masmx64, and masmx86 in contrib [Vollant]
+
+Changes in 1.2.2.4 (11 July 2005)
+- Add inflatePrime() function for starting inflation at bit boundary
+- Avoid some Visual C warnings in deflate.c
+- Avoid more silly Visual C warnings in inflate.c and inftrees.c for 64-bit
+ compile
+- Fix some spelling errors in comments [Betts]
+- Correct inflateInit2() error return documentation in zlib.h
+- Add zran.c example of compressed data random access to examples
+ directory, shows use of inflatePrime()
+- Fix cast for assignments to strm->state in inflate.c and infback.c
+- Fix zlibCompileFlags() in zutil.c to use 1L for long shifts [Oberhumer]
+- Move declarations of gf2 functions to right place in crc32.c [Oberhumer]
+- Add cast in trees.c t avoid a warning [Oberhumer]
+- Avoid some warnings in fitblk.c, gun.c, gzjoin.c in examples [Oberhumer]
+- Update make_vms.com [Zinser]
+- Initialize state->write in inflateReset() since copied in inflate_fast()
+- Be more strict on incomplete code sets in inflate_table() and increase
+ ENOUGH and MAXD -- this repairs a possible security vulnerability for
+ invalid inflate input. Thanks to Tavis Ormandy and Markus Oberhumer for
+ discovering the vulnerability and providing test cases
+- Add ia64 support to configure for HP-UX [Smith]
+- Add error return to gzread() for format or i/o error [Levin]
+- Use malloc.h for OS/2 [Necasek]
+
+Changes in 1.2.2.3 (27 May 2005)
+- Replace 1U constants in inflate.c and inftrees.c for 64-bit compile
+- Typecast fread() return values in gzio.c [Vollant]
+- Remove trailing space in minigzip.c outmode (VC++ can't deal with it)
+- Fix crc check bug in gzread() after gzungetc() [Heiner]
+- Add the deflateTune() function to adjust internal compression parameters
+- Add a fast gzip decompressor, gun.c, to examples (use of inflateBack)
+- Remove an incorrect assertion in examples/zpipe.c
+- Add C++ wrapper in infback9.h [Donais]
+- Fix bug in inflateCopy() when decoding fixed codes
+- Note in zlib.h how much deflateSetDictionary() actually uses
+- Remove USE_DICT_HEAD in deflate.c (would mess up inflate if used)
+- Add _WIN32_WCE to define WIN32 in zconf.in.h [Spencer]
+- Don't include stderr.h or errno.h for _WIN32_WCE in zutil.h [Spencer]
+- Add gzdirect() function to indicate transparent reads
+- Update contrib/minizip [Vollant]
+- Fix compilation of deflate.c when both ASMV and FASTEST [Oberhumer]
+- Add casts in crc32.c to avoid warnings [Oberhumer]
+- Add contrib/masmx64 [Vollant]
+- Update contrib/asm586, asm686, masmx86, testzlib, vstudio [Vollant]
+
+Changes in 1.2.2.2 (30 December 2004)
+- Replace structure assignments in deflate.c and inflate.c with zmemcpy to
+ avoid implicit memcpy calls (portability for no-library compilation)
+- Increase sprintf() buffer size in gzdopen() to allow for large numbers
+- Add INFLATE_STRICT to check distances against zlib header
+- Improve WinCE errno handling and comments [Chang]
+- Remove comment about no gzip header processing in FAQ
+- Add Z_FIXED strategy option to deflateInit2() to force fixed trees
+- Add updated make_vms.com [Coghlan], update README
+- Create a new "examples" directory, move gzappend.c there, add zpipe.c,
+ fitblk.c, gzlog.[ch], gzjoin.c, and zlib_how.html
+- Add FAQ entry and comments in deflate.c on uninitialized memory access
+- Add Solaris 9 make options in configure [Gilbert]
+- Allow strerror() usage in gzio.c for STDC
+- Fix DecompressBuf in contrib/delphi/ZLib.pas [ManChesTer]
+- Update contrib/masmx86/inffas32.asm and gvmat32.asm [Vollant]
+- Use z_off_t for adler32_combine() and crc32_combine() lengths
+- Make adler32() much faster for small len
+- Use OS_CODE in deflate() default gzip header
+
+Changes in 1.2.2.1 (31 October 2004)
+- Allow inflateSetDictionary() call for raw inflate
+- Fix inflate header crc check bug for file names and comments
+- Add deflateSetHeader() and gz_header structure for custom gzip headers
+- Add inflateGetheader() to retrieve gzip headers
+- Add crc32_combine() and adler32_combine() functions
+- Add alloc_func, free_func, in_func, out_func to Z_PREFIX list
+- Use zstreamp consistently in zlib.h (inflate_back functions)
+- Remove GUNZIP condition from definition of inflate_mode in inflate.h
+ and in contrib/inflate86/inffast.S [Truta, Anderson]
+- Add support for AMD64 in contrib/inflate86/inffas86.c [Anderson]
+- Update projects/README.projects and projects/visualc6 [Truta]
+- Update win32/DLL_FAQ.txt [Truta]
+- Avoid warning under NO_GZCOMPRESS in gzio.c; fix typo [Truta]
+- Deprecate Z_ASCII; use Z_TEXT instead [Truta]
+- Use a new algorithm for setting strm->data_type in trees.c [Truta]
+- Do not define an exit() prototype in zutil.c unless DEBUG defined
+- Remove prototype of exit() from zutil.c, example.c, minigzip.c [Truta]
+- Add comment in zlib.h for Z_NO_FLUSH parameter to deflate()
+- Fix Darwin build version identification [Peterson]
+
+Changes in 1.2.2 (3 October 2004)
+- Update zlib.h comments on gzip in-memory processing
+- Set adler to 1 in inflateReset() to support Java test suite [Walles]
+- Add contrib/dotzlib [Ravn]
+- Update win32/DLL_FAQ.txt [Truta]
+- Update contrib/minizip [Vollant]
+- Move contrib/visual-basic.txt to old/ [Truta]
+- Fix assembler builds in projects/visualc6/ [Truta]
+
+Changes in 1.2.1.2 (9 September 2004)
+- Update INDEX file
+- Fix trees.c to update strm->data_type (no one ever noticed!)
+- Fix bug in error case in inflate.c, infback.c, and infback9.c [Brown]
+- Add "volatile" to crc table flag declaration (for DYNAMIC_CRC_TABLE)
+- Add limited multitasking protection to DYNAMIC_CRC_TABLE
+- Add NO_vsnprintf for VMS in zutil.h [Mozilla]
+- Don't declare strerror() under VMS [Mozilla]
+- Add comment to DYNAMIC_CRC_TABLE to use get_crc_table() to initialize
+- Update contrib/ada [Anisimkov]
+- Update contrib/minizip [Vollant]
+- Fix configure to not hardcode directories for Darwin [Peterson]
+- Fix gzio.c to not return error on empty files [Brown]
+- Fix indentation; update version in contrib/delphi/ZLib.pas and
+ contrib/pascal/zlibpas.pas [Truta]
+- Update mkasm.bat in contrib/masmx86 [Truta]
+- Update contrib/untgz [Truta]
+- Add projects/README.projects [Truta]
+- Add project for MS Visual C++ 6.0 in projects/visualc6 [Cadieux, Truta]
+- Update win32/DLL_FAQ.txt [Truta]
+- Update list of Z_PREFIX symbols in zconf.h [Randers-Pehrson, Truta]
+- Remove an unnecessary assignment to curr in inftrees.c [Truta]
+- Add OS/2 to exe builds in configure [Poltorak]
+- Remove err dummy parameter in zlib.h [Kientzle]
+
+Changes in 1.2.1.1 (9 January 2004)
+- Update email address in README
+- Several FAQ updates
+- Fix a big fat bug in inftrees.c that prevented decoding valid
+ dynamic blocks with only literals and no distance codes --
+ Thanks to "Hot Emu" for the bug report and sample file
+- Add a note to puff.c on no distance codes case
+
+Changes in 1.2.1 (17 November 2003)
+- Remove a tab in contrib/gzappend/gzappend.c
+- Update some interfaces in contrib for new zlib functions
+- Update zlib version number in some contrib entries
+- Add Windows CE definition for ptrdiff_t in zutil.h [Mai, Truta]
+- Support shared libraries on Hurd and KFreeBSD [Brown]
+- Fix error in NO_DIVIDE option of adler32.c
+
+Changes in 1.2.0.8 (4 November 2003)
+- Update version in contrib/delphi/ZLib.pas and contrib/pascal/zlibpas.pas
+- Add experimental NO_DIVIDE #define in adler32.c
+ - Possibly faster on some processors (let me know if it is)
+- Correct Z_BLOCK to not return on first inflate call if no wrap
+- Fix strm->data_type on inflate() return to correctly indicate EOB
+- Add deflatePrime() function for appending in the middle of a byte
+- Add contrib/gzappend for an example of appending to a stream
+- Update win32/DLL_FAQ.txt [Truta]
+- Delete Turbo C comment in README [Truta]
+- Improve some indentation in zconf.h [Truta]
+- Fix infinite loop on bad input in configure script [Church]
+- Fix gzeof() for concatenated gzip files [Johnson]
+- Add example to contrib/visual-basic.txt [Michael B.]
+- Add -p to mkdir's in Makefile.in [vda]
+- Fix configure to properly detect presence or lack of printf functions
+- Add AS400 support [Monnerat]
+- Add a little Cygwin support [Wilson]
+
+Changes in 1.2.0.7 (21 September 2003)
+- Correct some debug formats in contrib/infback9
+- Cast a type in a debug statement in trees.c
+- Change search and replace delimiter in configure from % to # [Beebe]
+- Update contrib/untgz to 0.2 with various fixes [Truta]
+- Add build support for Amiga [Nikl]
+- Remove some directories in old that have been updated to 1.2
+- Add dylib building for Mac OS X in configure and Makefile.in
+- Remove old distribution stuff from Makefile
+- Update README to point to DLL_FAQ.txt, and add comment on Mac OS X
+- Update links in README
+
+Changes in 1.2.0.6 (13 September 2003)
+- Minor FAQ updates
+- Update contrib/minizip to 1.00 [Vollant]
+- Remove test of gz functions in example.c when GZ_COMPRESS defined [Truta]
+- Update POSTINC comment for 68060 [Nikl]
+- Add contrib/infback9 with deflate64 decoding (unsupported)
+- For MVS define NO_vsnprintf and undefine FAR [van Burik]
+- Add pragma for fdopen on MVS [van Burik]
+
+Changes in 1.2.0.5 (8 September 2003)
+- Add OF to inflateBackEnd() declaration in zlib.h
+- Remember start when using gzdopen in the middle of a file
+- Use internal off_t counters in gz* functions to properly handle seeks
+- Perform more rigorous check for distance-too-far in inffast.c
+- Add Z_BLOCK flush option to return from inflate at block boundary
+- Set strm->data_type on return from inflate
+ - Indicate bits unused, if at block boundary, and if in last block
+- Replace size_t with ptrdiff_t in crc32.c, and check for correct size
+- Add condition so old NO_DEFLATE define still works for compatibility
+- FAQ update regarding the Windows DLL [Truta]
+- INDEX update: add qnx entry, remove aix entry [Truta]
+- Install zlib.3 into mandir [Wilson]
+- Move contrib/zlib_dll_FAQ.txt to win32/DLL_FAQ.txt; update [Truta]
+- Adapt the zlib interface to the new DLL convention guidelines [Truta]
+- Introduce ZLIB_WINAPI macro to allow the export of functions using
+ the WINAPI calling convention, for Visual Basic [Vollant, Truta]
+- Update msdos and win32 scripts and makefiles [Truta]
+- Export symbols by name, not by ordinal, in win32/zlib.def [Truta]
+- Add contrib/ada [Anisimkov]
+- Move asm files from contrib/vstudio/vc70_32 to contrib/asm386 [Truta]
+- Rename contrib/asm386 to contrib/masmx86 [Truta, Vollant]
+- Add contrib/masm686 [Truta]
+- Fix offsets in contrib/inflate86 and contrib/masmx86/inffas32.asm
+ [Truta, Vollant]
+- Update contrib/delphi; rename to contrib/pascal; add example [Truta]
+- Remove contrib/delphi2; add a new contrib/delphi [Truta]
+- Avoid inclusion of the nonstandard <memory.h> in contrib/iostream,
+ and fix some method prototypes [Truta]
+- Fix the ZCR_SEED2 constant to avoid warnings in contrib/minizip
+ [Truta]
+- Avoid the use of backslash (\) in contrib/minizip [Vollant]
+- Fix file time handling in contrib/untgz; update makefiles [Truta]
+- Update contrib/vstudio/vc70_32 to comply with the new DLL guidelines
+ [Vollant]
+- Remove contrib/vstudio/vc15_16 [Vollant]
+- Rename contrib/vstudio/vc70_32 to contrib/vstudio/vc7 [Truta]
+- Update README.contrib [Truta]
+- Invert the assignment order of match_head and s->prev[...] in
+ INSERT_STRING [Truta]
+- Compare TOO_FAR with 32767 instead of 32768, to avoid 16-bit warnings
+ [Truta]
+- Compare function pointers with 0, not with NULL or Z_NULL [Truta]
+- Fix prototype of syncsearch in inflate.c [Truta]
+- Introduce ASMINF macro to be enabled when using an ASM implementation
+ of inflate_fast [Truta]
+- Change NO_DEFLATE to NO_GZCOMPRESS [Truta]
+- Modify test_gzio in example.c to take a single file name as a
+ parameter [Truta]
+- Exit the example.c program if gzopen fails [Truta]
+- Add type casts around strlen in example.c [Truta]
+- Remove casting to sizeof in minigzip.c; give a proper type
+ to the variable compared with SUFFIX_LEN [Truta]
+- Update definitions of STDC and STDC99 in zconf.h [Truta]
+- Synchronize zconf.h with the new Windows DLL interface [Truta]
+- Use SYS16BIT instead of __32BIT__ to distinguish between
+ 16- and 32-bit platforms [Truta]
+- Use far memory allocators in small 16-bit memory models for
+ Turbo C [Truta]
+- Add info about the use of ASMV, ASMINF and ZLIB_WINAPI in
+ zlibCompileFlags [Truta]
+- Cygwin has vsnprintf [Wilson]
+- In Windows16, OS_CODE is 0, as in MSDOS [Truta]
+- In Cygwin, OS_CODE is 3 (Unix), not 11 (Windows32) [Wilson]
+
+Changes in 1.2.0.4 (10 August 2003)
+- Minor FAQ updates
+- Be more strict when checking inflateInit2's windowBits parameter
+- Change NO_GUNZIP compile option to NO_GZIP to cover deflate as well
+- Add gzip wrapper option to deflateInit2 using windowBits
+- Add updated QNX rule in configure and qnx directory [Bonnefoy]
+- Make inflate distance-too-far checks more rigorous
+- Clean up FAR usage in inflate
+- Add casting to sizeof() in gzio.c and minigzip.c
+
+Changes in 1.2.0.3 (19 July 2003)
+- Fix silly error in gzungetc() implementation [Vollant]
+- Update contrib/minizip and contrib/vstudio [Vollant]
+- Fix printf format in example.c
+- Correct cdecl support in zconf.in.h [Anisimkov]
+- Minor FAQ updates
+
+Changes in 1.2.0.2 (13 July 2003)
+- Add ZLIB_VERNUM in zlib.h for numerical preprocessor comparisons
+- Attempt to avoid warnings in crc32.c for pointer-int conversion
+- Add AIX to configure, remove aix directory [Bakker]
+- Add some casts to minigzip.c
+- Improve checking after insecure sprintf() or vsprintf() calls
+- Remove #elif's from crc32.c
+- Change leave label to inf_leave in inflate.c and infback.c to avoid
+ library conflicts
+- Remove inflate gzip decoding by default--only enable gzip decoding by
+ special request for stricter backward compatibility
+- Add zlibCompileFlags() function to return compilation information
+- More typecasting in deflate.c to avoid warnings
+- Remove leading underscore from _Capital #defines [Truta]
+- Fix configure to link shared library when testing
+- Add some Windows CE target adjustments [Mai]
+- Remove #define ZLIB_DLL in zconf.h [Vollant]
+- Add zlib.3 [Rodgers]
+- Update RFC URL in deflate.c and algorithm.txt [Mai]
+- Add zlib_dll_FAQ.txt to contrib [Truta]
+- Add UL to some constants [Truta]
+- Update minizip and vstudio [Vollant]
+- Remove vestigial NEED_DUMMY_RETURN from zconf.in.h
+- Expand use of NO_DUMMY_DECL to avoid all dummy structures
+- Added iostream3 to contrib [Schwardt]
+- Replace rewind() with fseek() for WinCE [Truta]
+- Improve setting of zlib format compression level flags
+ - Report 0 for huffman and rle strategies and for level == 0 or 1
+ - Report 2 only for level == 6
+- Only deal with 64K limit when necessary at compile time [Truta]
+- Allow TOO_FAR check to be turned off at compile time [Truta]
+- Add gzclearerr() function [Souza]
+- Add gzungetc() function
+
+Changes in 1.2.0.1 (17 March 2003)
+- Add Z_RLE strategy for run-length encoding [Truta]
+ - When Z_RLE requested, restrict matches to distance one
+ - Update zlib.h, minigzip.c, gzopen(), gzdopen() for Z_RLE
+- Correct FASTEST compilation to allow level == 0
+- Clean up what gets compiled for FASTEST
+- Incorporate changes to zconf.in.h [Vollant]
+ - Refine detection of Turbo C need for dummy returns
+ - Refine ZLIB_DLL compilation
+ - Include additional header file on VMS for off_t typedef
+- Try to use _vsnprintf where it supplants vsprintf [Vollant]
+- Add some casts in inffast.c
+- Enhance comments in zlib.h on what happens if gzprintf() tries to
+ write more than 4095 bytes before compression
+- Remove unused state from inflateBackEnd()
+- Remove exit(0) from minigzip.c, example.c
+- Get rid of all those darn tabs
+- Add "check" target to Makefile.in that does the same thing as "test"
+- Add "mostlyclean" and "maintainer-clean" targets to Makefile.in
+- Update contrib/inflate86 [Anderson]
+- Update contrib/testzlib, contrib/vstudio, contrib/minizip [Vollant]
+- Add msdos and win32 directories with makefiles [Truta]
+- More additions and improvements to the FAQ
+
+Changes in 1.2.0 (9 March 2003)
+- New and improved inflate code
+ - About 20% faster
+ - Does not allocate 32K window unless and until needed
+ - Automatically detects and decompresses gzip streams
+ - Raw inflate no longer needs an extra dummy byte at end
+ - Added inflateBack functions using a callback interface--even faster
+ than inflate, useful for file utilities (gzip, zip)
+ - Added inflateCopy() function to record state for random access on
+ externally generated deflate streams (e.g. in gzip files)
+ - More readable code (I hope)
+- New and improved crc32()
+ - About 50% faster, thanks to suggestions from Rodney Brown
+- Add deflateBound() and compressBound() functions
+- Fix memory leak in deflateInit2()
+- Permit setting dictionary for raw deflate (for parallel deflate)
+- Fix const declaration for gzwrite()
+- Check for some malloc() failures in gzio.c
+- Fix bug in gzopen() on single-byte file 0x1f
+- Fix bug in gzread() on concatenated file with 0x1f at end of buffer
+ and next buffer doesn't start with 0x8b
+- Fix uncompress() to return Z_DATA_ERROR on truncated input
+- Free memory at end of example.c
+- Remove MAX #define in trees.c (conflicted with some libraries)
+- Fix static const's in deflate.c, gzio.c, and zutil.[ch]
+- Declare malloc() and free() in gzio.c if STDC not defined
+- Use malloc() instead of calloc() in zutil.c if int big enough
+- Define STDC for AIX
+- Add aix/ with approach for compiling shared library on AIX
+- Add HP-UX support for shared libraries in configure
+- Add OpenUNIX support for shared libraries in configure
+- Use $cc instead of gcc to build shared library
+- Make prefix directory if needed when installing
+- Correct Macintosh avoidance of typedef Byte in zconf.h
+- Correct Turbo C memory allocation when under Linux
+- Use libz.a instead of -lz in Makefile (assure use of compiled library)
+- Update configure to check for snprintf or vsnprintf functions and their
+ return value, warn during make if using an insecure function
+- Fix configure problem with compile-time knowledge of HAVE_UNISTD_H that
+ is lost when library is used--resolution is to build new zconf.h
+- Documentation improvements (in zlib.h):
+ - Document raw deflate and inflate
+ - Update RFCs URL
+ - Point out that zlib and gzip formats are different
+ - Note that Z_BUF_ERROR is not fatal
+ - Document string limit for gzprintf() and possible buffer overflow
+ - Note requirement on avail_out when flushing
+ - Note permitted values of flush parameter of inflate()
+- Add some FAQs (and even answers) to the FAQ
+- Add contrib/inflate86/ for x86 faster inflate
+- Add contrib/blast/ for PKWare Data Compression Library decompression
+- Add contrib/puff/ simple inflate for deflate format description
+
+Changes in 1.1.4 (11 March 2002)
+- ZFREE was repeated on same allocation on some error conditions
+ This creates a security problem described in
+ http://www.zlib.org/advisory-2002-03-11.txt
+- Returned incorrect error (Z_MEM_ERROR) on some invalid data
+- Avoid accesses before window for invalid distances with inflate window
+ less than 32K
+- force windowBits > 8 to avoid a bug in the encoder for a window size
+ of 256 bytes. (A complete fix will be available in 1.1.5)
+
+Changes in 1.1.3 (9 July 1998)
+- fix "an inflate input buffer bug that shows up on rare but persistent
+ occasions" (Mark)
+- fix gzread and gztell for concatenated .gz files (Didier Le Botlan)
+- fix gzseek(..., SEEK_SET) in write mode
+- fix crc check after a gzeek (Frank Faubert)
+- fix miniunzip when the last entry in a zip file is itself a zip file
+ (J Lillge)
+- add contrib/asm586 and contrib/asm686 (Brian Raiter)
+ See http://www.muppetlabs.com/~breadbox/software/assembly.html
+- add support for Delphi 3 in contrib/delphi (Bob Dellaca)
+- add support for C++Builder 3 and Delphi 3 in contrib/delphi2 (Davide Moretti)
+- do not exit prematurely in untgz if 0 at start of block (Magnus Holmgren)
+- use macro EXTERN instead of extern to support DLL for BeOS (Sander Stoks)
+- added a FAQ file
+
+- Support gzdopen on Mac with Metrowerks (Jason Linhart)
+- Do not redefine Byte on Mac (Brad Pettit & Jason Linhart)
+- define SEEK_END too if SEEK_SET is not defined (Albert Chin-A-Young)
+- avoid some warnings with Borland C (Tom Tanner)
+- fix a problem in contrib/minizip/zip.c for 16-bit MSDOS (Gilles Vollant)
+- emulate utime() for WIN32 in contrib/untgz (Gilles Vollant)
+- allow several arguments to configure (Tim Mooney, Frodo Looijaard)
+- use libdir and includedir in Makefile.in (Tim Mooney)
+- support shared libraries on OSF1 V4 (Tim Mooney)
+- remove so_locations in "make clean" (Tim Mooney)
+- fix maketree.c compilation error (Glenn, Mark)
+- Python interface to zlib now in Python 1.5 (Jeremy Hylton)
+- new Makefile.riscos (Rich Walker)
+- initialize static descriptors in trees.c for embedded targets (Nick Smith)
+- use "foo-gz" in example.c for RISCOS and VMS (Nick Smith)
+- add the OS/2 files in Makefile.in too (Andrew Zabolotny)
+- fix fdopen and halloc macros for Microsoft C 6.0 (Tom Lane)
+- fix maketree.c to allow clean compilation of inffixed.h (Mark)
+- fix parameter check in deflateCopy (Gunther Nikl)
+- cleanup trees.c, use compressed_len only in debug mode (Christian Spieler)
+- Many portability patches by Christian Spieler:
+ . zutil.c, zutil.h: added "const" for zmem*
+ . Make_vms.com: fixed some typos
+ . Make_vms.com: msdos/Makefile.*: removed zutil.h from some dependency lists
+ . msdos/Makefile.msc: remove "default rtl link library" info from obj files
+ . msdos/Makefile.*: use model-dependent name for the built zlib library
+ . msdos/Makefile.emx, nt/Makefile.emx, nt/Makefile.gcc:
+ new makefiles, for emx (DOS/OS2), emx&rsxnt and mingw32 (Windows 9x / NT)
+- use define instead of typedef for Bytef also for MSC small/medium (Tom Lane)
+- replace __far with _far for better portability (Christian Spieler, Tom Lane)
+- fix test for errno.h in configure (Tim Newsham)
+
+Changes in 1.1.2 (19 March 98)
+- added contrib/minzip, mini zip and unzip based on zlib (Gilles Vollant)
+ See http://www.winimage.com/zLibDll/unzip.html
+- preinitialize the inflate tables for fixed codes, to make the code
+ completely thread safe (Mark)
+- some simplifications and slight speed-up to the inflate code (Mark)
+- fix gzeof on non-compressed files (Allan Schrum)
+- add -std1 option in configure for OSF1 to fix gzprintf (Martin Mokrejs)
+- use default value of 4K for Z_BUFSIZE for 16-bit MSDOS (Tim Wegner + Glenn)
+- added os2/Makefile.def and os2/zlib.def (Andrew Zabolotny)
+- add shared lib support for UNIX_SV4.2MP (MATSUURA Takanori)
+- do not wrap extern "C" around system includes (Tom Lane)
+- mention zlib binding for TCL in README (Andreas Kupries)
+- added amiga/Makefile.pup for Amiga powerUP SAS/C PPC (Andreas Kleinert)
+- allow "make install prefix=..." even after configure (Glenn Randers-Pehrson)
+- allow "configure --prefix $HOME" (Tim Mooney)
+- remove warnings in example.c and gzio.c (Glenn Randers-Pehrson)
+- move Makefile.sas to amiga/Makefile.sas
+
+Changes in 1.1.1 (27 Feb 98)
+- fix macros _tr_tally_* in deflate.h for debug mode (Glenn Randers-Pehrson)
+- remove block truncation heuristic which had very marginal effect for zlib
+ (smaller lit_bufsize than in gzip 1.2.4) and degraded a little the
+ compression ratio on some files. This also allows inlining _tr_tally for
+ matches in deflate_slow
+- added msdos/Makefile.w32 for WIN32 Microsoft Visual C++ (Bob Frazier)
+
+Changes in 1.1.0 (24 Feb 98)
+- do not return STREAM_END prematurely in inflate (John Bowler)
+- revert to the zlib 1.0.8 inflate to avoid the gcc 2.8.0 bug (Jeremy Buhler)
+- compile with -DFASTEST to get compression code optimized for speed only
+- in minigzip, try mmap'ing the input file first (Miguel Albrecht)
+- increase size of I/O buffers in minigzip.c and gzio.c (not a big gain
+ on Sun but significant on HP)
+
+- add a pointer to experimental unzip library in README (Gilles Vollant)
+- initialize variable gcc in configure (Chris Herborth)
+
+Changes in 1.0.9 (17 Feb 1998)
+- added gzputs and gzgets functions
+- do not clear eof flag in gzseek (Mark Diekhans)
+- fix gzseek for files in transparent mode (Mark Diekhans)
+- do not assume that vsprintf returns the number of bytes written (Jens Krinke)
+- replace EXPORT with ZEXPORT to avoid conflict with other programs
+- added compress2 in zconf.h, zlib.def, zlib.dnt
+- new asm code from Gilles Vollant in contrib/asm386
+- simplify the inflate code (Mark):
+ . Replace ZALLOC's in huft_build() with single ZALLOC in inflate_blocks_new()
+ . ZALLOC the length list in inflate_trees_fixed() instead of using stack
+ . ZALLOC the value area for huft_build() instead of using stack
+ . Simplify Z_FINISH check in inflate()
+
+- Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8
+- in inftrees.c, avoid cc -O bug on HP (Farshid Elahi)
+- in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with
+ the declaration of FAR (Gilles Vollant)
+- install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann)
+- read_buf buf parameter of type Bytef* instead of charf*
+- zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout)
+- do not redeclare unlink in minigzip.c for WIN32 (John Bowler)
+- fix check for presence of directories in "make install" (Ian Willis)
+
+Changes in 1.0.8 (27 Jan 1998)
+- fixed offsets in contrib/asm386/gvmat32.asm (Gilles Vollant)
+- fix gzgetc and gzputc for big endian systems (Markus Oberhumer)
+- added compress2() to allow setting the compression level
+- include sys/types.h to get off_t on some systems (Marc Lehmann & QingLong)
+- use constant arrays for the static trees in trees.c instead of computing
+ them at run time (thanks to Ken Raeburn for this suggestion). To create
+ trees.h, compile with GEN_TREES_H and run "make test"
+- check return code of example in "make test" and display result
+- pass minigzip command line options to file_compress
+- simplifying code of inflateSync to avoid gcc 2.8 bug
+
+- support CC="gcc -Wall" in configure -s (QingLong)
+- avoid a flush caused by ftell in gzopen for write mode (Ken Raeburn)
+- fix test for shared library support to avoid compiler warnings
+- zlib.lib -> zlib.dll in msdos/zlib.rc (Gilles Vollant)
+- check for TARGET_OS_MAC in addition to MACOS (Brad Pettit)
+- do not use fdopen for Metrowerks on Mac (Brad Pettit))
+- add checks for gzputc and gzputc in example.c
+- avoid warnings in gzio.c and deflate.c (Andreas Kleinert)
+- use const for the CRC table (Ken Raeburn)
+- fixed "make uninstall" for shared libraries
+- use Tracev instead of Trace in infblock.c
+- in example.c use correct compressed length for test_sync
+- suppress +vnocompatwarnings in configure for HPUX (not always supported)
+
+Changes in 1.0.7 (20 Jan 1998)
+- fix gzseek which was broken in write mode
+- return error for gzseek to negative absolute position
+- fix configure for Linux (Chun-Chung Chen)
+- increase stack space for MSC (Tim Wegner)
+- get_crc_table and inflateSyncPoint are EXPORTed (Gilles Vollant)
+- define EXPORTVA for gzprintf (Gilles Vollant)
+- added man page zlib.3 (Rick Rodgers)
+- for contrib/untgz, fix makedir() and improve Makefile
+
+- check gzseek in write mode in example.c
+- allocate extra buffer for seeks only if gzseek is actually called
+- avoid signed/unsigned comparisons (Tim Wegner, Gilles Vollant)
+- add inflateSyncPoint in zconf.h
+- fix list of exported functions in nt/zlib.dnt and mdsos/zlib.def
+
+Changes in 1.0.6 (19 Jan 1998)
+- add functions gzprintf, gzputc, gzgetc, gztell, gzeof, gzseek, gzrewind and
+ gzsetparams (thanks to Roland Giersig and Kevin Ruland for some of this code)
+- Fix a deflate bug occurring only with compression level 0 (thanks to
+ Andy Buckler for finding this one)
+- In minigzip, pass transparently also the first byte for .Z files
+- return Z_BUF_ERROR instead of Z_OK if output buffer full in uncompress()
+- check Z_FINISH in inflate (thanks to Marc Schluper)
+- Implement deflateCopy (thanks to Adam Costello)
+- make static libraries by default in configure, add --shared option
+- move MSDOS or Windows specific files to directory msdos
+- suppress the notion of partial flush to simplify the interface
+ (but the symbol Z_PARTIAL_FLUSH is kept for compatibility with 1.0.4)
+- suppress history buffer provided by application to simplify the interface
+ (this feature was not implemented anyway in 1.0.4)
+- next_in and avail_in must be initialized before calling inflateInit or
+ inflateInit2
+- add EXPORT in all exported functions (for Windows DLL)
+- added Makefile.nt (thanks to Stephen Williams)
+- added the unsupported "contrib" directory:
+ contrib/asm386/ by Gilles Vollant <info@winimage.com>
+ 386 asm code replacing longest_match()
+ contrib/iostream/ by Kevin Ruland <kevin@rodin.wustl.edu>
+ A C++ I/O streams interface to the zlib gz* functions
+ contrib/iostream2/ by Tyge Løvset <Tyge.Lovset@cmr.no>
+ Another C++ I/O streams interface
+ contrib/untgz/ by "Pedro A. Aranda Guti\irrez" <paag@tid.es>
+ A very simple tar.gz file extractor using zlib
+ contrib/visual-basic.txt by Carlos Rios <c_rios@sonda.cl>
+ How to use compress(), uncompress() and the gz* functions from VB
+- pass params -f (filtered data), -h (huffman only), -1 to -9 (compression
+ level) in minigzip (thanks to Tom Lane)
+
+- use const for rommable constants in deflate
+- added test for gzseek and gztell in example.c
+- add undocumented function inflateSyncPoint() (hack for Paul Mackerras)
+- add undocumented function zError to convert error code to string
+ (for Tim Smithers)
+- Allow compilation of gzio with -DNO_DEFLATE to avoid the compression code
+- Use default memcpy for Symantec MSDOS compiler
+- Add EXPORT keyword for check_func (needed for Windows DLL)
+- add current directory to LD_LIBRARY_PATH for "make test"
+- create also a link for libz.so.1
+- added support for FUJITSU UXP/DS (thanks to Toshiaki Nomura)
+- use $(SHAREDLIB) instead of libz.so in Makefile.in (for HPUX)
+- added -soname for Linux in configure (Chun-Chung Chen,
+- assign numbers to the exported functions in zlib.def (for Windows DLL)
+- add advice in zlib.h for best usage of deflateSetDictionary
+- work around compiler bug on Atari (cast Z_NULL in call of s->checkfn)
+- allow compilation with ANSI keywords only enabled for TurboC in large model
+- avoid "versionString"[0] (Borland bug)
+- add NEED_DUMMY_RETURN for Borland
+- use variable z_verbose for tracing in debug mode (L. Peter Deutsch)
+- allow compilation with CC
+- defined STDC for OS/2 (David Charlap)
+- limit external names to 8 chars for MVS (Thomas Lund)
+- in minigzip.c, use static buffers only for 16-bit systems
+- fix suffix check for "minigzip -d foo.gz"
+- do not return an error for the 2nd of two consecutive gzflush() (Felix Lee)
+- use _fdopen instead of fdopen for MSC >= 6.0 (Thomas Fanslau)
+- added makelcc.bat for lcc-win32 (Tom St Denis)
+- in Makefile.dj2, use copy and del instead of install and rm (Frank Donahoe)
+- Avoid expanded $Id$. Use "rcs -kb" or "cvs admin -kb" to avoid Id expansion
+- check for unistd.h in configure (for off_t)
+- remove useless check parameter in inflate_blocks_free
+- avoid useless assignment of s->check to itself in inflate_blocks_new
+- do not flush twice in gzclose (thanks to Ken Raeburn)
+- rename FOPEN as F_OPEN to avoid clash with /usr/include/sys/file.h
+- use NO_ERRNO_H instead of enumeration of operating systems with errno.h
+- work around buggy fclose on pipes for HP/UX
+- support zlib DLL with BORLAND C++ 5.0 (thanks to Glenn Randers-Pehrson)
+- fix configure if CC is already equal to gcc
+
+Changes in 1.0.5 (3 Jan 98)
+- Fix inflate to terminate gracefully when fed corrupted or invalid data
+- Use const for rommable constants in inflate
+- Eliminate memory leaks on error conditions in inflate
+- Removed some vestigial code in inflate
+- Update web address in README
+
+Changes in 1.0.4 (24 Jul 96)
+- In very rare conditions, deflate(s, Z_FINISH) could fail to produce an EOF
+ bit, so the decompressor could decompress all the correct data but went
+ on to attempt decompressing extra garbage data. This affected minigzip too
+- zlibVersion and gzerror return const char* (needed for DLL)
+- port to RISCOS (no fdopen, no multiple dots, no unlink, no fileno)
+- use z_error only for DEBUG (avoid problem with DLLs)
+
+Changes in 1.0.3 (2 Jul 96)
+- use z_streamp instead of z_stream *, which is now a far pointer in MSDOS
+ small and medium models; this makes the library incompatible with previous
+ versions for these models. (No effect in large model or on other systems.)
+- return OK instead of BUF_ERROR if previous deflate call returned with
+ avail_out as zero but there is nothing to do
+- added memcmp for non STDC compilers
+- define NO_DUMMY_DECL for more Mac compilers (.h files merged incorrectly)
+- define __32BIT__ if __386__ or i386 is defined (pb. with Watcom and SCO)
+- better check for 16-bit mode MSC (avoids problem with Symantec)
+
+Changes in 1.0.2 (23 May 96)
+- added Windows DLL support
+- added a function zlibVersion (for the DLL support)
+- fixed declarations using Bytef in infutil.c (pb with MSDOS medium model)
+- Bytef is define's instead of typedef'd only for Borland C
+- avoid reading uninitialized memory in example.c
+- mention in README that the zlib format is now RFC1950
+- updated Makefile.dj2
+- added algorithm.doc
+
+Changes in 1.0.1 (20 May 96) [1.0 skipped to avoid confusion]
+- fix array overlay in deflate.c which sometimes caused bad compressed data
+- fix inflate bug with empty stored block
+- fix MSDOS medium model which was broken in 0.99
+- fix deflateParams() which could generate bad compressed data
+- Bytef is define'd instead of typedef'ed (work around Borland bug)
+- added an INDEX file
+- new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32),
+ Watcom (Makefile.wat), Amiga SAS/C (Makefile.sas)
+- speed up adler32 for modern machines without auto-increment
+- added -ansi for IRIX in configure
+- static_init_done in trees.c is an int
+- define unlink as delete for VMS
+- fix configure for QNX
+- add configure branch for SCO and HPUX
+- avoid many warnings (unused variables, dead assignments, etc...)
+- no fdopen for BeOS
+- fix the Watcom fix for 32 bit mode (define FAR as empty)
+- removed redefinition of Byte for MKWERKS
+- work around an MWKERKS bug (incorrect merge of all .h files)
+
+Changes in 0.99 (27 Jan 96)
+- allow preset dictionary shared between compressor and decompressor
+- allow compression level 0 (no compression)
+- add deflateParams in zlib.h: allow dynamic change of compression level
+ and compression strategy
+- test large buffers and deflateParams in example.c
+- add optional "configure" to build zlib as a shared library
+- suppress Makefile.qnx, use configure instead
+- fixed deflate for 64-bit systems (detected on Cray)
+- fixed inflate_blocks for 64-bit systems (detected on Alpha)
+- declare Z_DEFLATED in zlib.h (possible parameter for deflateInit2)
+- always return Z_BUF_ERROR when deflate() has nothing to do
+- deflateInit and inflateInit are now macros to allow version checking
+- prefix all global functions and types with z_ with -DZ_PREFIX
+- make falloc completely reentrant (inftrees.c)
+- fixed very unlikely race condition in ct_static_init
+- free in reverse order of allocation to help memory manager
+- use zlib-1.0/* instead of zlib/* inside the tar.gz
+- make zlib warning-free with "gcc -O3 -Wall -Wwrite-strings -Wpointer-arith
+ -Wconversion -Wstrict-prototypes -Wmissing-prototypes"
+- allow gzread on concatenated .gz files
+- deflateEnd now returns Z_DATA_ERROR if it was premature
+- deflate is finally (?) fully deterministic (no matches beyond end of input)
+- Document Z_SYNC_FLUSH
+- add uninstall in Makefile
+- Check for __cpluplus in zlib.h
+- Better test in ct_align for partial flush
+- avoid harmless warnings for Borland C++
+- initialize hash_head in deflate.c
+- avoid warning on fdopen (gzio.c) for HP cc -Aa
+- include stdlib.h for STDC compilers
+- include errno.h for Cray
+- ignore error if ranlib doesn't exist
+- call ranlib twice for NeXTSTEP
+- use exec_prefix instead of prefix for libz.a
+- renamed ct_* as _tr_* to avoid conflict with applications
+- clear z->msg in inflateInit2 before any error return
+- initialize opaque in example.c, gzio.c, deflate.c and inflate.c
+- fixed typo in zconf.h (_GNUC__ => __GNUC__)
+- check for WIN32 in zconf.h and zutil.c (avoid farmalloc in 32-bit mode)
+- fix typo in Make_vms.com (f$trnlnm -> f$getsyi)
+- in fcalloc, normalize pointer if size > 65520 bytes
+- don't use special fcalloc for 32 bit Borland C++
+- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc.
+- use Z_BINARY instead of BINARY
+- document that gzclose after gzdopen will close the file
+- allow "a" as mode in gzopen
+- fix error checking in gzread
+- allow skipping .gz extra-field on pipes
+- added reference to Perl interface in README
+- put the crc table in FAR data (I dislike more and more the medium model :)
+- added get_crc_table
+- added a dimension to all arrays (Borland C can't count)
+- workaround Borland C bug in declaration of inflate_codes_new & inflate_fast
+- guard against multiple inclusion of *.h (for precompiled header on Mac)
+- Watcom C pretends to be Microsoft C small model even in 32 bit mode
+- don't use unsized arrays to avoid silly warnings by Visual C++:
+ warning C4746: 'inflate_mask' : unsized array treated as '__far'
+ (what's wrong with far data in far model?)
+- define enum out of inflate_blocks_state to allow compilation with C++
+
+Changes in 0.95 (16 Aug 95)
+- fix MSDOS small and medium model (now easier to adapt to any compiler)
+- inlined send_bits
+- fix the final (:-) bug for deflate with flush (output was correct but
+ not completely flushed in rare occasions)
+- default window size is same for compression and decompression
+ (it's now sufficient to set MAX_WBITS in zconf.h)
+- voidp -> voidpf and voidnp -> voidp (for consistency with other
+ typedefs and because voidnp was not near in large model)
+
+Changes in 0.94 (13 Aug 95)
+- support MSDOS medium model
+- fix deflate with flush (could sometimes generate bad output)
+- fix deflateReset (zlib header was incorrectly suppressed)
+- added support for VMS
+- allow a compression level in gzopen()
+- gzflush now calls fflush
+- For deflate with flush, flush even if no more input is provided
+- rename libgz.a as libz.a
+- avoid complex expression in infcodes.c triggering Turbo C bug
+- work around a problem with gcc on Alpha (in INSERT_STRING)
+- don't use inline functions (problem with some gcc versions)
+- allow renaming of Byte, uInt, etc... with #define
+- avoid warning about (unused) pointer before start of array in deflate.c
+- avoid various warnings in gzio.c, example.c, infblock.c, adler32.c, zutil.c
+- avoid reserved word 'new' in trees.c
+
+Changes in 0.93 (25 June 95)
+- temporarily disable inline functions
+- make deflate deterministic
+- give enough lookahead for PARTIAL_FLUSH
+- Set binary mode for stdin/stdout in minigzip.c for OS/2
+- don't even use signed char in inflate (not portable enough)
+- fix inflate memory leak for segmented architectures
+
+Changes in 0.92 (3 May 95)
+- don't assume that char is signed (problem on SGI)
+- Clear bit buffer when starting a stored block
+- no memcpy on Pyramid
+- suppressed inftest.c
+- optimized fill_window, put longest_match inline for gcc
+- optimized inflate on stored blocks
+- untabify all sources to simplify patches
+
+Changes in 0.91 (2 May 95)
+- Default MEM_LEVEL is 8 (not 9 for Unix) as documented in zlib.h
+- Document the memory requirements in zconf.h
+- added "make install"
+- fix sync search logic in inflateSync
+- deflate(Z_FULL_FLUSH) now works even if output buffer too short
+- after inflateSync, don't scare people with just "lo world"
+- added support for DJGPP
+
+Changes in 0.9 (1 May 95)
+- don't assume that zalloc clears the allocated memory (the TurboC bug
+ was Mark's bug after all :)
+- let again gzread copy uncompressed data unchanged (was working in 0.71)
+- deflate(Z_FULL_FLUSH), inflateReset and inflateSync are now fully implemented
+- added a test of inflateSync in example.c
+- moved MAX_WBITS to zconf.h because users might want to change that
+- document explicitly that zalloc(64K) on MSDOS must return a normalized
+ pointer (zero offset)
+- added Makefiles for Microsoft C, Turbo C, Borland C++
+- faster crc32()
+
+Changes in 0.8 (29 April 95)
+- added fast inflate (inffast.c)
+- deflate(Z_FINISH) now returns Z_STREAM_END when done. Warning: this
+ is incompatible with previous versions of zlib which returned Z_OK
+- work around a TurboC compiler bug (bad code for b << 0, see infutil.h)
+ (actually that was not a compiler bug, see 0.81 above)
+- gzread no longer reads one extra byte in certain cases
+- In gzio destroy(), don't reference a freed structure
+- avoid many warnings for MSDOS
+- avoid the ERROR symbol which is used by MS Windows
+
+Changes in 0.71 (14 April 95)
+- Fixed more MSDOS compilation problems :( There is still a bug with
+ TurboC large model
+
+Changes in 0.7 (14 April 95)
+- Added full inflate support
+- Simplified the crc32() interface. The pre- and post-conditioning
+ (one's complement) is now done inside crc32(). WARNING: this is
+ incompatible with previous versions; see zlib.h for the new usage
+
+Changes in 0.61 (12 April 95)
+- workaround for a bug in TurboC. example and minigzip now work on MSDOS
+
+Changes in 0.6 (11 April 95)
+- added minigzip.c
+- added gzdopen to reopen a file descriptor as gzFile
+- added transparent reading of non-gziped files in gzread
+- fixed bug in gzread (don't read crc as data)
+- fixed bug in destroy (gzio.c) (don't return Z_STREAM_END for gzclose)
+- don't allocate big arrays in the stack (for MSDOS)
+- fix some MSDOS compilation problems
+
+Changes in 0.5:
+- do real compression in deflate.c. Z_PARTIAL_FLUSH is supported but
+ not yet Z_FULL_FLUSH
+- support decompression but only in a single step (forced Z_FINISH)
+- added opaque object for zalloc and zfree
+- added deflateReset and inflateReset
+- added a variable zlib_version for consistency checking
+- renamed the 'filter' parameter of deflateInit2 as 'strategy'
+ Added Z_FILTERED and Z_HUFFMAN_ONLY constants
+
+Changes in 0.4:
+- avoid "zip" everywhere, use zlib instead of ziplib
+- suppress Z_BLOCK_FLUSH, interpret Z_PARTIAL_FLUSH as block flush
+ if compression method == 8
+- added adler32 and crc32
+- renamed deflateOptions as deflateInit2, call one or the other but not both
+- added the method parameter for deflateInit2
+- added inflateInit2
+- simplified considerably deflateInit and inflateInit by not supporting
+ user-provided history buffer. This is supported only in deflateInit2
+ and inflateInit2
+
+Changes in 0.3:
+- prefix all macro names with Z_
+- use Z_FINISH instead of deflateEnd to finish compression
+- added Z_HUFFMAN_ONLY
+- added gzerror()
diff --git a/src/Common/zlib/README b/src/Common/zlib/README
index 024b79d3..c5f91754 100644
--- a/src/Common/zlib/README
+++ b/src/Common/zlib/README
@@ -1,6 +1,6 @@
ZLIB DATA COMPRESSION LIBRARY
-zlib 1.2.12 is a general purpose data compression library. All the code is
+zlib 1.3.1 is a general purpose data compression library. All the code is
thread safe. The data format used by the zlib library is described by RFCs
(Request for Comments) 1950 to 1952 in the files
http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
@@ -29,18 +29,17 @@ PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help.
Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
issue of Dr. Dobb's Journal; a copy of the article is available at
-http://marknelson.us/1997/01/01/zlib-engine/ .
+https://marknelson.us/posts/1997/01/01/zlib-engine.html .
-The changes made in version 1.2.12 are documented in the file ChangeLog.
+The changes made in version 1.3.1 are documented in the file ChangeLog.
Unsupported third party contributions are provided in directory contrib/ .
-zlib is available in Java using the java.util.zip package, documented at
-http://java.sun.com/developer/technicalArticles/Programming/compression/ .
+zlib is available in Java using the java.util.zip package. Follow the API
+Documentation link at: https://docs.oracle.com/search/?q=java.util.zip .
-A Perl interface to zlib written by Paul Marquess <pmqs@cpan.org> is available
-at CPAN (Comprehensive Perl Archive Network) sites, including
-http://search.cpan.org/~pmqs/IO-Compress-Zlib/ .
+A Perl interface to zlib and bzip2 written by Paul Marquess <pmqs@cpan.org>
+can be found at https://github.com/pmqs/IO-Compress .
A Python interface to zlib written by A.M. Kuchling <amk@amk.ca> is
available in Python 1.5 and later versions, see
@@ -64,7 +63,7 @@ Notes for some targets:
- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works
when compiled with cc.
-- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is
+- On Digital Unix 4.0D (formerly OSF/1) on AlphaServer, the cc option -std1 is
necessary to get gzprintf working correctly. This is done by configure.
- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
@@ -84,7 +83,7 @@ Acknowledgments:
Copyright notice:
- (C) 1995-2022 Jean-loup Gailly and Mark Adler
+ (C) 1995-2024 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
diff --git a/src/Common/zlib/adler32.c b/src/Common/zlib/adler32.c
index d0be4380..04b81d29 100644
--- a/src/Common/zlib/adler32.c
+++ b/src/Common/zlib/adler32.c
@@ -7,8 +7,6 @@
#include "zutil.h"
-local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
-
#define BASE 65521U /* largest prime smaller than 65536 */
#define NMAX 5552
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
@@ -60,11 +58,7 @@ local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
#endif
/* ========================================================================= */
-uLong ZEXPORT adler32_z(adler, buf, len)
- uLong adler;
- const Bytef *buf;
- z_size_t len;
-{
+uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf, z_size_t len) {
unsigned long sum2;
unsigned n;
@@ -131,20 +125,12 @@ uLong ZEXPORT adler32_z(adler, buf, len)
}
/* ========================================================================= */
-uLong ZEXPORT adler32(adler, buf, len)
- uLong adler;
- const Bytef *buf;
- uInt len;
-{
+uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len) {
return adler32_z(adler, buf, len);
}
/* ========================================================================= */
-local uLong adler32_combine_(adler1, adler2, len2)
- uLong adler1;
- uLong adler2;
- z_off64_t len2;
-{
+local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2) {
unsigned long sum1;
unsigned long sum2;
unsigned rem;
@@ -169,18 +155,10 @@ local uLong adler32_combine_(adler1, adler2, len2)
}
/* ========================================================================= */
-uLong ZEXPORT adler32_combine(adler1, adler2, len2)
- uLong adler1;
- uLong adler2;
- z_off_t len2;
-{
+uLong ZEXPORT adler32_combine(uLong adler1, uLong adler2, z_off_t len2) {
return adler32_combine_(adler1, adler2, len2);
}
-uLong ZEXPORT adler32_combine64(adler1, adler2, len2)
- uLong adler1;
- uLong adler2;
- z_off64_t len2;
-{
+uLong ZEXPORT adler32_combine64(uLong adler1, uLong adler2, z_off64_t len2) {
return adler32_combine_(adler1, adler2, len2);
}
diff --git a/src/Common/zlib/compress.c b/src/Common/zlib/compress.c
index e2db404a..f43bacf7 100644
--- a/src/Common/zlib/compress.c
+++ b/src/Common/zlib/compress.c
@@ -19,13 +19,8 @@
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
Z_STREAM_ERROR if the level parameter is invalid.
*/
-int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
- Bytef *dest;
- uLongf *destLen;
- const Bytef *source;
- uLong sourceLen;
- int level;
-{
+int ZEXPORT compress2(Bytef *dest, uLongf *destLen, const Bytef *source,
+ uLong sourceLen, int level) {
z_stream stream;
int err;
const uInt max = (uInt)-1;
@@ -65,12 +60,8 @@ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
/* ===========================================================================
*/
-int ZEXPORT compress (dest, destLen, source, sourceLen)
- Bytef *dest;
- uLongf *destLen;
- const Bytef *source;
- uLong sourceLen;
-{
+int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source,
+ uLong sourceLen) {
return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
}
@@ -78,9 +69,7 @@ int ZEXPORT compress (dest, destLen, source, sourceLen)
If the default memLevel or windowBits for deflateInit() is changed, then
this function needs to be updated.
*/
-uLong ZEXPORT compressBound (sourceLen)
- uLong sourceLen;
-{
+uLong ZEXPORT compressBound(uLong sourceLen) {
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
(sourceLen >> 25) + 13;
}
diff --git a/src/Common/zlib/crc32.c b/src/Common/zlib/crc32.c
index a1bdce5c..6c38f5c0 100644
--- a/src/Common/zlib/crc32.c
+++ b/src/Common/zlib/crc32.c
@@ -98,10 +98,6 @@
# endif
#endif
-/* Local functions. */
-local z_crc_t multmodp OF((z_crc_t a, z_crc_t b));
-local z_crc_t x2nmodp OF((z_off64_t n, unsigned k));
-
/* If available, use the ARM processor CRC32 instruction. */
#if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32) && W == 8
# define ARMCRC32
@@ -114,9 +110,7 @@ local z_crc_t x2nmodp OF((z_off64_t n, unsigned k));
instruction, if one is available. This assumes that word_t is either 32 bits
or 64 bits.
*/
-local z_word_t byte_swap(word)
- z_word_t word;
-{
+local z_word_t byte_swap(z_word_t word) {
# if W == 8
return
(word & 0xff00000000000000) >> 56 |
@@ -137,24 +131,77 @@ local z_word_t byte_swap(word)
}
#endif
+#ifdef DYNAMIC_CRC_TABLE
+/* =========================================================================
+ * Table of powers of x for combining CRC-32s, filled in by make_crc_table()
+ * below.
+ */
+ local z_crc_t FAR x2n_table[32];
+#else
+/* =========================================================================
+ * Tables for byte-wise and braided CRC-32 calculations, and a table of powers
+ * of x for combining CRC-32s, all made by make_crc_table().
+ */
+# include "crc32.h"
+#endif
+
/* CRC polynomial. */
#define POLY 0xedb88320 /* p(x) reflected, with x^32 implied */
-#ifdef DYNAMIC_CRC_TABLE
+/*
+ Return a(x) multiplied by b(x) modulo p(x), where p(x) is the CRC polynomial,
+ reflected. For speed, this requires that a not be zero.
+ */
+local z_crc_t multmodp(z_crc_t a, z_crc_t b) {
+ z_crc_t m, p;
+
+ m = (z_crc_t)1 << 31;
+ p = 0;
+ for (;;) {
+ if (a & m) {
+ p ^= b;
+ if ((a & (m - 1)) == 0)
+ break;
+ }
+ m >>= 1;
+ b = b & 1 ? (b >> 1) ^ POLY : b >> 1;
+ }
+ return p;
+}
+
+/*
+ Return x^(n * 2^k) modulo p(x). Requires that x2n_table[] has been
+ initialized.
+ */
+local z_crc_t x2nmodp(z_off64_t n, unsigned k) {
+ z_crc_t p;
+
+ p = (z_crc_t)1 << 31; /* x^0 == 1 */
+ while (n) {
+ if (n & 1)
+ p = multmodp(x2n_table[k & 31], p);
+ n >>= 1;
+ k++;
+ }
+ return p;
+}
+#ifdef DYNAMIC_CRC_TABLE
+/* =========================================================================
+ * Build the tables for byte-wise and braided CRC-32 calculations, and a table
+ * of powers of x for combining CRC-32s.
+ */
local z_crc_t FAR crc_table[256];
-local z_crc_t FAR x2n_table[32];
-local void make_crc_table OF((void));
#ifdef W
local z_word_t FAR crc_big_table[256];
local z_crc_t FAR crc_braid_table[W][256];
local z_word_t FAR crc_braid_big_table[W][256];
- local void braid OF((z_crc_t [][256], z_word_t [][256], int, int));
+ local void braid(z_crc_t [][256], z_word_t [][256], int, int);
#endif
#ifdef MAKECRCH
- local void write_table OF((FILE *, const z_crc_t FAR *, int));
- local void write_table32hi OF((FILE *, const z_word_t FAR *, int));
- local void write_table64 OF((FILE *, const z_word_t FAR *, int));
+ local void write_table(FILE *, const z_crc_t FAR *, int);
+ local void write_table32hi(FILE *, const z_word_t FAR *, int);
+ local void write_table64(FILE *, const z_word_t FAR *, int);
#endif /* MAKECRCH */
/*
@@ -167,7 +214,6 @@ local void make_crc_table OF((void));
/* Definition of once functionality. */
typedef struct once_s once_t;
-local void once OF((once_t *, void (*)(void)));
/* Check for the availability of atomics. */
#if defined(__STDC__) && __STDC_VERSION__ >= 201112L && \
@@ -187,10 +233,7 @@ struct once_s {
invoke once() at the same time. The state must be a once_t initialized with
ONCE_INIT.
*/
-local void once(state, init)
- once_t *state;
- void (*init)(void);
-{
+local void once(once_t *state, void (*init)(void)) {
if (!atomic_load(&state->done)) {
if (atomic_flag_test_and_set(&state->begun))
while (!atomic_load(&state->done))
@@ -213,10 +256,7 @@ struct once_s {
/* Test and set. Alas, not atomic, but tries to minimize the period of
vulnerability. */
-local int test_and_set OF((int volatile *));
-local int test_and_set(flag)
- int volatile *flag;
-{
+local int test_and_set(int volatile *flag) {
int was;
was = *flag;
@@ -225,10 +265,7 @@ local int test_and_set(flag)
}
/* Run the provided init() function once. This is not thread-safe. */
-local void once(state, init)
- once_t *state;
- void (*init)(void);
-{
+local void once(once_t *state, void (*init)(void)) {
if (!state->done) {
if (test_and_set(&state->begun))
while (!state->done)
@@ -270,8 +307,7 @@ local once_t made = ONCE_INIT;
combinations of CRC register values and incoming bytes.
*/
-local void make_crc_table()
-{
+local void make_crc_table(void) {
unsigned i, j, n;
z_crc_t p;
@@ -438,11 +474,7 @@ local void make_crc_table()
Write the 32-bit values in table[0..k-1] to out, five per line in
hexadecimal separated by commas.
*/
-local void write_table(out, table, k)
- FILE *out;
- const z_crc_t FAR *table;
- int k;
-{
+local void write_table(FILE *out, const z_crc_t FAR *table, int k) {
int n;
for (n = 0; n < k; n++)
@@ -455,11 +487,7 @@ local void write_table(out, table, k)
Write the high 32-bits of each value in table[0..k-1] to out, five per line
in hexadecimal separated by commas.
*/
-local void write_table32hi(out, table, k)
-FILE *out;
-const z_word_t FAR *table;
-int k;
-{
+local void write_table32hi(FILE *out, const z_word_t FAR *table, int k) {
int n;
for (n = 0; n < k; n++)
@@ -475,11 +503,7 @@ int k;
bits. If not, then the type cast and format string can be adjusted
accordingly.
*/
-local void write_table64(out, table, k)
- FILE *out;
- const z_word_t FAR *table;
- int k;
-{
+local void write_table64(FILE *out, const z_word_t FAR *table, int k) {
int n;
for (n = 0; n < k; n++)
@@ -489,8 +513,7 @@ local void write_table64(out, table, k)
}
/* Actually do the deed. */
-int main()
-{
+int main(void) {
make_crc_table();
return 0;
}
@@ -502,12 +525,7 @@ int main()
Generate the little and big-endian braid tables for the given n and z_word_t
size w. Each array must have room for w blocks of 256 elements.
*/
-local void braid(ltl, big, n, w)
- z_crc_t ltl[][256];
- z_word_t big[][256];
- int n;
- int w;
-{
+local void braid(z_crc_t ltl[][256], z_word_t big[][256], int n, int w) {
int k;
z_crc_t i, p, q;
for (k = 0; k < w; k++) {
@@ -522,69 +540,13 @@ local void braid(ltl, big, n, w)
}
#endif
-#else /* !DYNAMIC_CRC_TABLE */
-/* ========================================================================
- * Tables for byte-wise and braided CRC-32 calculations, and a table of powers
- * of x for combining CRC-32s, all made by make_crc_table().
- */
-#include "crc32.h"
#endif /* DYNAMIC_CRC_TABLE */
-/* ========================================================================
- * Routines used for CRC calculation. Some are also required for the table
- * generation above.
- */
-
-/*
- Return a(x) multiplied by b(x) modulo p(x), where p(x) is the CRC polynomial,
- reflected. For speed, this requires that a not be zero.
- */
-local z_crc_t multmodp(a, b)
- z_crc_t a;
- z_crc_t b;
-{
- z_crc_t m, p;
-
- m = (z_crc_t)1 << 31;
- p = 0;
- for (;;) {
- if (a & m) {
- p ^= b;
- if ((a & (m - 1)) == 0)
- break;
- }
- m >>= 1;
- b = b & 1 ? (b >> 1) ^ POLY : b >> 1;
- }
- return p;
-}
-
-/*
- Return x^(n * 2^k) modulo p(x). Requires that x2n_table[] has been
- initialized.
- */
-local z_crc_t x2nmodp(n, k)
- z_off64_t n;
- unsigned k;
-{
- z_crc_t p;
-
- p = (z_crc_t)1 << 31; /* x^0 == 1 */
- while (n) {
- if (n & 1)
- p = multmodp(x2n_table[k & 31], p);
- n >>= 1;
- k++;
- }
- return p;
-}
-
/* =========================================================================
* This function can be used by asm versions of crc32(), and to force the
* generation of the CRC tables in a threaded application.
*/
-const z_crc_t FAR * ZEXPORT get_crc_table()
-{
+const z_crc_t FAR * ZEXPORT get_crc_table(void) {
#ifdef DYNAMIC_CRC_TABLE
once(&made, make_crc_table);
#endif /* DYNAMIC_CRC_TABLE */
@@ -610,11 +572,8 @@ const z_crc_t FAR * ZEXPORT get_crc_table()
#define Z_BATCH_ZEROS 0xa10d3d0c /* computed from Z_BATCH = 3990 */
#define Z_BATCH_MIN 800 /* fewest words in a final batch */
-unsigned long ZEXPORT crc32_z(crc, buf, len)
- unsigned long crc;
- const unsigned char FAR *buf;
- z_size_t len;
-{
+unsigned long ZEXPORT crc32_z(unsigned long crc, const unsigned char FAR *buf,
+ z_size_t len) {
z_crc_t val;
z_word_t crc1, crc2;
const z_word_t *word;
@@ -630,7 +589,7 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
#endif /* DYNAMIC_CRC_TABLE */
/* Pre-condition the CRC */
- crc ^= 0xffffffff;
+ crc = (~crc) & 0xffffffff;
/* Compute the CRC up to a word boundary. */
while (len && ((z_size_t)buf & 7) != 0) {
@@ -645,8 +604,8 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
len &= 7;
/* Do three interleaved CRCs to realize the throughput of one crc32x
- instruction per cycle. Each CRC is calcuated on Z_BATCH words. The three
- CRCs are combined into a single CRC after each set of batches. */
+ instruction per cycle. Each CRC is calculated on Z_BATCH words. The
+ three CRCs are combined into a single CRC after each set of batches. */
while (num >= 3 * Z_BATCH) {
crc1 = 0;
crc2 = 0;
@@ -714,18 +673,14 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
least-significant byte of the word as the first byte of data, without any pre
or post conditioning. This is used to combine the CRCs of each braid.
*/
-local z_crc_t crc_word(data)
- z_word_t data;
-{
+local z_crc_t crc_word(z_word_t data) {
int k;
for (k = 0; k < W; k++)
data = (data >> 8) ^ crc_table[data & 0xff];
return (z_crc_t)data;
}
-local z_word_t crc_word_big(data)
- z_word_t data;
-{
+local z_word_t crc_word_big(z_word_t data) {
int k;
for (k = 0; k < W; k++)
data = (data << 8) ^
@@ -736,11 +691,8 @@ local z_word_t crc_word_big(data)
#endif
/* ========================================================================= */
-unsigned long ZEXPORT crc32_z(crc, buf, len)
- unsigned long crc;
- const unsigned char FAR *buf;
- z_size_t len;
-{
+unsigned long ZEXPORT crc32_z(unsigned long crc, const unsigned char FAR *buf,
+ z_size_t len) {
/* Return initial CRC, if requested. */
if (buf == Z_NULL) return 0;
@@ -749,7 +701,7 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
#endif /* DYNAMIC_CRC_TABLE */
/* Pre-condition the CRC */
- crc ^= 0xffffffff;
+ crc = (~crc) & 0xffffffff;
#ifdef W
@@ -772,8 +724,8 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
words = (z_word_t const *)buf;
/* Do endian check at execution time instead of compile time, since ARM
- processors can change the endianess at execution time. If the
- compiler knows what the endianess will be, it can optimize out the
+ processors can change the endianness at execution time. If the
+ compiler knows what the endianness will be, it can optimize out the
check and the unused branch. */
endian = 1;
if (*(unsigned char *)&endian) {
@@ -1060,39 +1012,26 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
#endif
/* ========================================================================= */
-unsigned long ZEXPORT crc32(crc, buf, len)
- unsigned long crc;
- const unsigned char FAR *buf;
- uInt len;
-{
+unsigned long ZEXPORT crc32(unsigned long crc, const unsigned char FAR *buf,
+ uInt len) {
return crc32_z(crc, buf, len);
}
/* ========================================================================= */
-uLong ZEXPORT crc32_combine64(crc1, crc2, len2)
- uLong crc1;
- uLong crc2;
- z_off64_t len2;
-{
+uLong ZEXPORT crc32_combine64(uLong crc1, uLong crc2, z_off64_t len2) {
#ifdef DYNAMIC_CRC_TABLE
once(&made, make_crc_table);
#endif /* DYNAMIC_CRC_TABLE */
- return multmodp(x2nmodp(len2, 3), crc1) ^ crc2;
+ return multmodp(x2nmodp(len2, 3), crc1) ^ (crc2 & 0xffffffff);
}
/* ========================================================================= */
-uLong ZEXPORT crc32_combine(crc1, crc2, len2)
- uLong crc1;
- uLong crc2;
- z_off_t len2;
-{
- return crc32_combine64(crc1, crc2, len2);
+uLong ZEXPORT crc32_combine(uLong crc1, uLong crc2, z_off_t len2) {
+ return crc32_combine64(crc1, crc2, (z_off64_t)len2);
}
/* ========================================================================= */
-uLong ZEXPORT crc32_combine_gen64(len2)
- z_off64_t len2;
-{
+uLong ZEXPORT crc32_combine_gen64(z_off64_t len2) {
#ifdef DYNAMIC_CRC_TABLE
once(&made, make_crc_table);
#endif /* DYNAMIC_CRC_TABLE */
@@ -1100,17 +1039,11 @@ uLong ZEXPORT crc32_combine_gen64(len2)
}
/* ========================================================================= */
-uLong ZEXPORT crc32_combine_gen(len2)
- z_off_t len2;
-{
- return crc32_combine_gen64(len2);
+uLong ZEXPORT crc32_combine_gen(z_off_t len2) {
+ return crc32_combine_gen64((z_off64_t)len2);
}
/* ========================================================================= */
-uLong crc32_combine_op(crc1, crc2, op)
- uLong crc1;
- uLong crc2;
- uLong op;
-{
- return multmodp(op, crc1) ^ crc2;
+uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op) {
+ return multmodp(op, crc1) ^ (crc2 & 0xffffffff);
}
diff --git a/src/Common/zlib/deflate.c b/src/Common/zlib/deflate.c
index 799fb93c..012ea814 100644
--- a/src/Common/zlib/deflate.c
+++ b/src/Common/zlib/deflate.c
@@ -1,5 +1,5 @@
/* deflate.c -- compress data using the deflation algorithm
- * Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler
+ * Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -52,7 +52,7 @@
#include "deflate.h"
const char deflate_copyright[] =
- " deflate 1.2.12 Copyright 1995-2022 Jean-loup Gailly and Mark Adler ";
+ " deflate 1.3.1 Copyright 1995-2024 Jean-loup Gailly and Mark Adler ";
/*
If you use the zlib library in a product, an acknowledgment is welcome
in the documentation of your product. If for some reason you cannot
@@ -60,9 +60,6 @@ const char deflate_copyright[] =
copyright string in the executable of your product.
*/
-/* ===========================================================================
- * Function prototypes.
- */
typedef enum {
need_more, /* block not completed, need more input or more output */
block_done, /* block flush performed */
@@ -70,35 +67,16 @@ typedef enum {
finish_done /* finish done, accept no more input or output */
} block_state;
-typedef block_state (*compress_func) OF((deflate_state *s, int flush));
+typedef block_state (*compress_func)(deflate_state *s, int flush);
/* Compression function. Returns the block state after the call. */
-local int deflateStateCheck OF((z_streamp strm));
-local void slide_hash OF((deflate_state *s));
-local void fill_window OF((deflate_state *s));
-local block_state deflate_stored OF((deflate_state *s, int flush));
-local block_state deflate_fast OF((deflate_state *s, int flush));
+local block_state deflate_stored(deflate_state *s, int flush);
+local block_state deflate_fast(deflate_state *s, int flush);
#ifndef FASTEST
-local block_state deflate_slow OF((deflate_state *s, int flush));
-#endif
-local block_state deflate_rle OF((deflate_state *s, int flush));
-local block_state deflate_huff OF((deflate_state *s, int flush));
-local void lm_init OF((deflate_state *s));
-local void putShortMSB OF((deflate_state *s, uInt b));
-local void flush_pending OF((z_streamp strm));
-local unsigned read_buf OF((z_streamp strm, Bytef *buf, unsigned size));
-#ifdef ASMV
-# pragma message("Assembler code may have bugs -- use at your own risk")
- void match_init OF((void)); /* asm code initialization */
- uInt longest_match OF((deflate_state *s, IPos cur_match));
-#else
-local uInt longest_match OF((deflate_state *s, IPos cur_match));
-#endif
-
-#ifdef ZLIB_DEBUG
-local void check_match OF((deflate_state *s, IPos start, IPos match,
- int length));
+local block_state deflate_slow(deflate_state *s, int flush);
#endif
+local block_state deflate_rle(deflate_state *s, int flush);
+local block_state deflate_huff(deflate_state *s, int flush);
/* ===========================================================================
* Local data
@@ -160,7 +138,7 @@ local const config configuration_table[10] = {
* characters, so that a running hash key can be computed from the previous
* key instead of complete recalculation each time.
*/
-#define UPDATE_HASH(s,h,c) (h = (((h)<<s->hash_shift) ^ (c)) & s->hash_mask)
+#define UPDATE_HASH(s,h,c) (h = (((h) << s->hash_shift) ^ (c)) & s->hash_mask)
/* ===========================================================================
@@ -191,9 +169,9 @@ local const config configuration_table[10] = {
*/
#define CLEAR_HASH(s) \
do { \
- s->head[s->hash_size-1] = NIL; \
+ s->head[s->hash_size - 1] = NIL; \
zmemzero((Bytef *)s->head, \
- (unsigned)(s->hash_size-1)*sizeof(*s->head)); \
+ (unsigned)(s->hash_size - 1)*sizeof(*s->head)); \
} while (0)
/* ===========================================================================
@@ -201,9 +179,12 @@ local const config configuration_table[10] = {
* bit values at the expense of memory usage). We slide even when level == 0 to
* keep the hash table consistent if we switch back to level > 0 later.
*/
-local void slide_hash(s)
- deflate_state *s;
-{
+#if defined(__has_feature)
+# if __has_feature(memory_sanitizer)
+ __attribute__((no_sanitize("memory")))
+# endif
+#endif
+local void slide_hash(deflate_state *s) {
unsigned n, m;
Posf *p;
uInt wsize = s->w_size;
@@ -227,30 +208,177 @@ local void slide_hash(s)
#endif
}
+/* ===========================================================================
+ * Read a new buffer from the current input stream, update the adler32
+ * and total number of bytes read. All deflate() input goes through
+ * this function so some applications may wish to modify it to avoid
+ * allocating a large strm->next_in buffer and copying from it.
+ * (See also flush_pending()).
+ */
+local unsigned read_buf(z_streamp strm, Bytef *buf, unsigned size) {
+ unsigned len = strm->avail_in;
+
+ if (len > size) len = size;
+ if (len == 0) return 0;
+
+ strm->avail_in -= len;
+
+ zmemcpy(buf, strm->next_in, len);
+ if (strm->state->wrap == 1) {
+ strm->adler = adler32(strm->adler, buf, len);
+ }
+#ifdef GZIP
+ else if (strm->state->wrap == 2) {
+ strm->adler = crc32(strm->adler, buf, len);
+ }
+#endif
+ strm->next_in += len;
+ strm->total_in += len;
+
+ return len;
+}
+
+/* ===========================================================================
+ * Fill the window when the lookahead becomes insufficient.
+ * Updates strstart and lookahead.
+ *
+ * IN assertion: lookahead < MIN_LOOKAHEAD
+ * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
+ * At least one byte has been read, or avail_in == 0; reads are
+ * performed for at least two bytes (required for the zip translate_eol
+ * option -- not supported here).
+ */
+local void fill_window(deflate_state *s) {
+ unsigned n;
+ unsigned more; /* Amount of free space at the end of the window. */
+ uInt wsize = s->w_size;
+
+ Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
+
+ do {
+ more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
+
+ /* Deal with !@#$% 64K limit: */
+ if (sizeof(int) <= 2) {
+ if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
+ more = wsize;
+
+ } else if (more == (unsigned)(-1)) {
+ /* Very unlikely, but possible on 16 bit machine if
+ * strstart == 0 && lookahead == 1 (input done a byte at time)
+ */
+ more--;
+ }
+ }
+
+ /* If the window is almost full and there is insufficient lookahead,
+ * move the upper half to the lower one to make room in the upper half.
+ */
+ if (s->strstart >= wsize + MAX_DIST(s)) {
+
+ zmemcpy(s->window, s->window + wsize, (unsigned)wsize - more);
+ s->match_start -= wsize;
+ s->strstart -= wsize; /* we now have strstart >= MAX_DIST */
+ s->block_start -= (long) wsize;
+ if (s->insert > s->strstart)
+ s->insert = s->strstart;
+ slide_hash(s);
+ more += wsize;
+ }
+ if (s->strm->avail_in == 0) break;
+
+ /* If there was no sliding:
+ * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
+ * more == window_size - lookahead - strstart
+ * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
+ * => more >= window_size - 2*WSIZE + 2
+ * In the BIG_MEM or MMAP case (not yet supported),
+ * window_size == input_size + MIN_LOOKAHEAD &&
+ * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
+ * Otherwise, window_size == 2*WSIZE so more >= 2.
+ * If there was sliding, more >= WSIZE. So in all cases, more >= 2.
+ */
+ Assert(more >= 2, "more < 2");
+
+ n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
+ s->lookahead += n;
+
+ /* Initialize the hash value now that we have some input: */
+ if (s->lookahead + s->insert >= MIN_MATCH) {
+ uInt str = s->strstart - s->insert;
+ s->ins_h = s->window[str];
+ UPDATE_HASH(s, s->ins_h, s->window[str + 1]);
+#if MIN_MATCH != 3
+ Call UPDATE_HASH() MIN_MATCH-3 more times
+#endif
+ while (s->insert) {
+ UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]);
+#ifndef FASTEST
+ s->prev[str & s->w_mask] = s->head[s->ins_h];
+#endif
+ s->head[s->ins_h] = (Pos)str;
+ str++;
+ s->insert--;
+ if (s->lookahead + s->insert < MIN_MATCH)
+ break;
+ }
+ }
+ /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
+ * but this is not important since only literal bytes will be emitted.
+ */
+
+ } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
+
+ /* If the WIN_INIT bytes after the end of the current data have never been
+ * written, then zero those bytes in order to avoid memory check reports of
+ * the use of uninitialized (or uninitialised as Julian writes) bytes by
+ * the longest match routines. Update the high water mark for the next
+ * time through here. WIN_INIT is set to MAX_MATCH since the longest match
+ * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.
+ */
+ if (s->high_water < s->window_size) {
+ ulg curr = s->strstart + (ulg)(s->lookahead);
+ ulg init;
+
+ if (s->high_water < curr) {
+ /* Previous high water mark below current data -- zero WIN_INIT
+ * bytes or up to end of window, whichever is less.
+ */
+ init = s->window_size - curr;
+ if (init > WIN_INIT)
+ init = WIN_INIT;
+ zmemzero(s->window + curr, (unsigned)init);
+ s->high_water = curr + init;
+ }
+ else if (s->high_water < (ulg)curr + WIN_INIT) {
+ /* High water mark at or above current data, but below current data
+ * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up
+ * to end of window, whichever is less.
+ */
+ init = (ulg)curr + WIN_INIT - s->high_water;
+ if (init > s->window_size - s->high_water)
+ init = s->window_size - s->high_water;
+ zmemzero(s->window + s->high_water, (unsigned)init);
+ s->high_water += init;
+ }
+ }
+
+ Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
+ "not enough room for search");
+}
+
/* ========================================================================= */
-int ZEXPORT deflateInit_(strm, level, version, stream_size)
- z_streamp strm;
- int level;
- const char *version;
- int stream_size;
-{
+int ZEXPORT deflateInit_(z_streamp strm, int level, const char *version,
+ int stream_size) {
return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
Z_DEFAULT_STRATEGY, version, stream_size);
/* To do: ignore strm->next_in if we use it as window */
}
/* ========================================================================= */
-int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
- version, stream_size)
- z_streamp strm;
- int level;
- int method;
- int windowBits;
- int memLevel;
- int strategy;
- const char *version;
- int stream_size;
-{
+int ZEXPORT deflateInit2_(z_streamp strm, int level, int method,
+ int windowBits, int memLevel, int strategy,
+ const char *version, int stream_size) {
deflate_state *s;
int wrap = 1;
static const char my_version[] = ZLIB_VERSION;
@@ -285,6 +413,8 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
if (windowBits < 0) { /* suppress zlib wrapper */
wrap = 0;
+ if (windowBits < -15)
+ return Z_STREAM_ERROR;
windowBits = -windowBits;
}
#ifdef GZIP
@@ -314,7 +444,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
s->hash_bits = (uInt)memLevel + 7;
s->hash_size = 1 << s->hash_bits;
s->hash_mask = s->hash_size - 1;
- s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH);
+ s->hash_shift = ((s->hash_bits + MIN_MATCH-1) / MIN_MATCH);
s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte));
s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos));
@@ -340,11 +470,11 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
* sym_buf value to read moves forward three bytes. From that symbol, up to
* 31 bits are written to pending_buf. The closest the written pending_buf
* bits gets to the next sym_buf symbol to read is just before the last
- * code is written. At that time, 31*(n-2) bits have been written, just
- * after 24*(n-2) bits have been consumed from sym_buf. sym_buf starts at
- * 8*n bits into pending_buf. (Note that the symbol buffer fills when n-1
+ * code is written. At that time, 31*(n - 2) bits have been written, just
+ * after 24*(n - 2) bits have been consumed from sym_buf. sym_buf starts at
+ * 8*n bits into pending_buf. (Note that the symbol buffer fills when n - 1
* symbols are written.) The closest the writing gets to what is unread is
- * then n+14 bits. Here n is lit_bufsize, which is 16384 by default, and
+ * then n + 14 bits. Here n is lit_bufsize, which is 16384 by default, and
* can range from 128 to 32768.
*
* Therefore, at a minimum, there are 142 bits of space between what is
@@ -363,7 +493,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
* symbols from which it is being constructed.
*/
- s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, 4);
+ s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, LIT_BUFS);
s->pending_buf_size = (ulg)s->lit_bufsize * 4;
if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
@@ -373,8 +503,14 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
deflateEnd (strm);
return Z_MEM_ERROR;
}
+#ifdef LIT_MEM
+ s->d_buf = (ushf *)(s->pending_buf + (s->lit_bufsize << 1));
+ s->l_buf = s->pending_buf + (s->lit_bufsize << 2);
+ s->sym_end = s->lit_bufsize - 1;
+#else
s->sym_buf = s->pending_buf + s->lit_bufsize;
s->sym_end = (s->lit_bufsize - 1) * 3;
+#endif
/* We avoid equality with lit_bufsize*3 because of wraparound at 64K
* on 16 bit machines and because stored blocks are restricted to
* 64K-1 bytes.
@@ -390,9 +526,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
/* =========================================================================
* Check for a valid deflate stream state. Return 0 if ok, 1 if not.
*/
-local int deflateStateCheck (strm)
- z_streamp strm;
-{
+local int deflateStateCheck(z_streamp strm) {
deflate_state *s;
if (strm == Z_NULL ||
strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
@@ -413,11 +547,8 @@ local int deflateStateCheck (strm)
}
/* ========================================================================= */
-int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
- z_streamp strm;
- const Bytef *dictionary;
- uInt dictLength;
-{
+int ZEXPORT deflateSetDictionary(z_streamp strm, const Bytef *dictionary,
+ uInt dictLength) {
deflate_state *s;
uInt str, n;
int wrap;
@@ -482,11 +613,8 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
}
/* ========================================================================= */
-int ZEXPORT deflateGetDictionary (strm, dictionary, dictLength)
- z_streamp strm;
- Bytef *dictionary;
- uInt *dictLength;
-{
+int ZEXPORT deflateGetDictionary(z_streamp strm, Bytef *dictionary,
+ uInt *dictLength) {
deflate_state *s;
uInt len;
@@ -504,9 +632,7 @@ int ZEXPORT deflateGetDictionary (strm, dictionary, dictLength)
}
/* ========================================================================= */
-int ZEXPORT deflateResetKeep (strm)
- z_streamp strm;
-{
+int ZEXPORT deflateResetKeep(z_streamp strm) {
deflate_state *s;
if (deflateStateCheck(strm)) {
@@ -541,10 +667,32 @@ int ZEXPORT deflateResetKeep (strm)
return Z_OK;
}
+/* ===========================================================================
+ * Initialize the "longest match" routines for a new zlib stream
+ */
+local void lm_init(deflate_state *s) {
+ s->window_size = (ulg)2L*s->w_size;
+
+ CLEAR_HASH(s);
+
+ /* Set the default configuration parameters:
+ */
+ s->max_lazy_match = configuration_table[s->level].max_lazy;
+ s->good_match = configuration_table[s->level].good_length;
+ s->nice_match = configuration_table[s->level].nice_length;
+ s->max_chain_length = configuration_table[s->level].max_chain;
+
+ s->strstart = 0;
+ s->block_start = 0L;
+ s->lookahead = 0;
+ s->insert = 0;
+ s->match_length = s->prev_length = MIN_MATCH-1;
+ s->match_available = 0;
+ s->ins_h = 0;
+}
+
/* ========================================================================= */
-int ZEXPORT deflateReset (strm)
- z_streamp strm;
-{
+int ZEXPORT deflateReset(z_streamp strm) {
int ret;
ret = deflateResetKeep(strm);
@@ -554,10 +702,7 @@ int ZEXPORT deflateReset (strm)
}
/* ========================================================================= */
-int ZEXPORT deflateSetHeader (strm, head)
- z_streamp strm;
- gz_headerp head;
-{
+int ZEXPORT deflateSetHeader(z_streamp strm, gz_headerp head) {
if (deflateStateCheck(strm) || strm->state->wrap != 2)
return Z_STREAM_ERROR;
strm->state->gzhead = head;
@@ -565,11 +710,7 @@ int ZEXPORT deflateSetHeader (strm, head)
}
/* ========================================================================= */
-int ZEXPORT deflatePending (strm, pending, bits)
- unsigned *pending;
- int *bits;
- z_streamp strm;
-{
+int ZEXPORT deflatePending(z_streamp strm, unsigned *pending, int *bits) {
if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
if (pending != Z_NULL)
*pending = strm->state->pending;
@@ -579,19 +720,21 @@ int ZEXPORT deflatePending (strm, pending, bits)
}
/* ========================================================================= */
-int ZEXPORT deflatePrime (strm, bits, value)
- z_streamp strm;
- int bits;
- int value;
-{
+int ZEXPORT deflatePrime(z_streamp strm, int bits, int value) {
deflate_state *s;
int put;
if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
s = strm->state;
+#ifdef LIT_MEM
+ if (bits < 0 || bits > 16 ||
+ (uchf *)s->d_buf < s->pending_out + ((Buf_size + 7) >> 3))
+ return Z_BUF_ERROR;
+#else
if (bits < 0 || bits > 16 ||
s->sym_buf < s->pending_out + ((Buf_size + 7) >> 3))
return Z_BUF_ERROR;
+#endif
do {
put = Buf_size - s->bi_valid;
if (put > bits)
@@ -606,11 +749,7 @@ int ZEXPORT deflatePrime (strm, bits, value)
}
/* ========================================================================= */
-int ZEXPORT deflateParams(strm, level, strategy)
- z_streamp strm;
- int level;
- int strategy;
-{
+int ZEXPORT deflateParams(z_streamp strm, int level, int strategy) {
deflate_state *s;
compress_func func;
@@ -655,13 +794,8 @@ int ZEXPORT deflateParams(strm, level, strategy)
}
/* ========================================================================= */
-int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain)
- z_streamp strm;
- int good_length;
- int max_lazy;
- int nice_length;
- int max_chain;
-{
+int ZEXPORT deflateTune(z_streamp strm, int good_length, int max_lazy,
+ int nice_length, int max_chain) {
deflate_state *s;
if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
@@ -674,36 +808,47 @@ int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain)
}
/* =========================================================================
- * For the default windowBits of 15 and memLevel of 8, this function returns
- * a close to exact, as well as small, upper bound on the compressed size.
- * They are coded as constants here for a reason--if the #define's are
- * changed, then this function needs to be changed as well. The return
- * value for 15 and 8 only works for those exact settings.
+ * For the default windowBits of 15 and memLevel of 8, this function returns a
+ * close to exact, as well as small, upper bound on the compressed size. This
+ * is an expansion of ~0.03%, plus a small constant.
+ *
+ * For any setting other than those defaults for windowBits and memLevel, one
+ * of two worst case bounds is returned. This is at most an expansion of ~4% or
+ * ~13%, plus a small constant.
*
- * For any setting other than those defaults for windowBits and memLevel,
- * the value returned is a conservative worst case for the maximum expansion
- * resulting from using fixed blocks instead of stored blocks, which deflate
- * can emit on compressed data for some combinations of the parameters.
+ * Both the 0.03% and 4% derive from the overhead of stored blocks. The first
+ * one is for stored blocks of 16383 bytes (memLevel == 8), whereas the second
+ * is for stored blocks of 127 bytes (the worst case memLevel == 1). The
+ * expansion results from five bytes of header for each stored block.
*
- * This function could be more sophisticated to provide closer upper bounds for
- * every combination of windowBits and memLevel. But even the conservative
- * upper bound of about 14% expansion does not seem onerous for output buffer
- * allocation.
+ * The larger expansion of 13% results from a window size less than or equal to
+ * the symbols buffer size (windowBits <= memLevel + 7). In that case some of
+ * the data being compressed may have slid out of the sliding window, impeding
+ * a stored block from being emitted. Then the only choice is a fixed or
+ * dynamic block, where a fixed block limits the maximum expansion to 9 bits
+ * per 8-bit byte, plus 10 bits for every block. The smallest block size for
+ * which this can occur is 255 (memLevel == 2).
+ *
+ * Shifts are used to approximate divisions, for speed.
*/
-uLong ZEXPORT deflateBound(strm, sourceLen)
- z_streamp strm;
- uLong sourceLen;
-{
+uLong ZEXPORT deflateBound(z_streamp strm, uLong sourceLen) {
deflate_state *s;
- uLong complen, wraplen;
+ uLong fixedlen, storelen, wraplen;
+
+ /* upper bound for fixed blocks with 9-bit literals and length 255
+ (memLevel == 2, which is the lowest that may not use stored blocks) --
+ ~13% overhead plus a small constant */
+ fixedlen = sourceLen + (sourceLen >> 3) + (sourceLen >> 8) +
+ (sourceLen >> 9) + 4;
- /* conservative upper bound for compressed data */
- complen = sourceLen +
- ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5;
+ /* upper bound for stored blocks with length 127 (memLevel == 1) --
+ ~4% overhead plus a small constant */
+ storelen = sourceLen + (sourceLen >> 5) + (sourceLen >> 7) +
+ (sourceLen >> 11) + 7;
- /* if can't get parameters, return conservative bound plus zlib wrapper */
+ /* if can't get parameters, return larger bound plus a zlib wrapper */
if (deflateStateCheck(strm))
- return complen + 6;
+ return (fixedlen > storelen ? fixedlen : storelen) + 6;
/* compute wrapper length */
s = strm->state;
@@ -740,11 +885,13 @@ uLong ZEXPORT deflateBound(strm, sourceLen)
wraplen = 6;
}
- /* if not default parameters, return conservative bound */
+ /* if not default parameters, return one of the conservative bounds */
if (s->w_bits != 15 || s->hash_bits != 8 + 7)
- return complen + wraplen;
+ return (s->w_bits <= s->hash_bits && s->level ? fixedlen : storelen) +
+ wraplen;
- /* default settings: return tight bound for that case */
+ /* default settings: return tight bound for that case -- ~0.03% overhead
+ plus a small constant */
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
(sourceLen >> 25) + 13 - 6 + wraplen;
}
@@ -754,10 +901,7 @@ uLong ZEXPORT deflateBound(strm, sourceLen)
* IN assertion: the stream state is correct and there is enough room in
* pending_buf.
*/
-local void putShortMSB (s, b)
- deflate_state *s;
- uInt b;
-{
+local void putShortMSB(deflate_state *s, uInt b) {
put_byte(s, (Byte)(b >> 8));
put_byte(s, (Byte)(b & 0xff));
}
@@ -768,9 +912,7 @@ local void putShortMSB (s, b)
* applications may wish to modify it to avoid allocating a large
* strm->next_out buffer and copying into it. (See also read_buf()).
*/
-local void flush_pending(strm)
- z_streamp strm;
-{
+local void flush_pending(z_streamp strm) {
unsigned len;
deflate_state *s = strm->state;
@@ -801,10 +943,7 @@ local void flush_pending(strm)
} while (0)
/* ========================================================================= */
-int ZEXPORT deflate (strm, flush)
- z_streamp strm;
- int flush;
-{
+int ZEXPORT deflate(z_streamp strm, int flush) {
int old_flush; /* value of flush param for previous deflate call */
deflate_state *s;
@@ -856,7 +995,7 @@ int ZEXPORT deflate (strm, flush)
s->status = BUSY_STATE;
if (s->status == INIT_STATE) {
/* zlib header */
- uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8;
+ uInt header = (Z_DEFLATED + ((s->w_bits - 8) << 4)) << 8;
uInt level_flags;
if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2)
@@ -1116,9 +1255,7 @@ int ZEXPORT deflate (strm, flush)
}
/* ========================================================================= */
-int ZEXPORT deflateEnd (strm)
- z_streamp strm;
-{
+int ZEXPORT deflateEnd(z_streamp strm) {
int status;
if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
@@ -1142,11 +1279,10 @@ int ZEXPORT deflateEnd (strm)
* To simplify the source, this is not supported for 16-bit MSDOS (which
* doesn't have enough memory anyway to duplicate compression states).
*/
-int ZEXPORT deflateCopy (dest, source)
- z_streamp dest;
- z_streamp source;
-{
+int ZEXPORT deflateCopy(z_streamp dest, z_streamp source) {
#ifdef MAXSEG_64K
+ (void)dest;
+ (void)source;
return Z_STREAM_ERROR;
#else
deflate_state *ds;
@@ -1170,7 +1306,7 @@ int ZEXPORT deflateCopy (dest, source)
ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos));
ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos));
- ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, 4);
+ ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, LIT_BUFS);
if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
ds->pending_buf == Z_NULL) {
@@ -1181,10 +1317,15 @@ int ZEXPORT deflateCopy (dest, source)
zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte));
zmemcpy((voidpf)ds->prev, (voidpf)ss->prev, ds->w_size * sizeof(Pos));
zmemcpy((voidpf)ds->head, (voidpf)ss->head, ds->hash_size * sizeof(Pos));
- zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
+ zmemcpy(ds->pending_buf, ss->pending_buf, ds->lit_bufsize * LIT_BUFS);
ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
+#ifdef LIT_MEM
+ ds->d_buf = (ushf *)(ds->pending_buf + (ds->lit_bufsize << 1));
+ ds->l_buf = ds->pending_buf + (ds->lit_bufsize << 2);
+#else
ds->sym_buf = ds->pending_buf + ds->lit_bufsize;
+#endif
ds->l_desc.dyn_tree = ds->dyn_ltree;
ds->d_desc.dyn_tree = ds->dyn_dtree;
@@ -1194,71 +1335,6 @@ int ZEXPORT deflateCopy (dest, source)
#endif /* MAXSEG_64K */
}
-/* ===========================================================================
- * Read a new buffer from the current input stream, update the adler32
- * and total number of bytes read. All deflate() input goes through
- * this function so some applications may wish to modify it to avoid
- * allocating a large strm->next_in buffer and copying from it.
- * (See also flush_pending()).
- */
-local unsigned read_buf(strm, buf, size)
- z_streamp strm;
- Bytef *buf;
- unsigned size;
-{
- unsigned len = strm->avail_in;
-
- if (len > size) len = size;
- if (len == 0) return 0;
-
- strm->avail_in -= len;
-
- zmemcpy(buf, strm->next_in, len);
- if (strm->state->wrap == 1) {
- strm->adler = adler32(strm->adler, buf, len);
- }
-#ifdef GZIP
- else if (strm->state->wrap == 2) {
- strm->adler = crc32(strm->adler, buf, len);
- }
-#endif
- strm->next_in += len;
- strm->total_in += len;
-
- return len;
-}
-
-/* ===========================================================================
- * Initialize the "longest match" routines for a new zlib stream
- */
-local void lm_init (s)
- deflate_state *s;
-{
- s->window_size = (ulg)2L*s->w_size;
-
- CLEAR_HASH(s);
-
- /* Set the default configuration parameters:
- */
- s->max_lazy_match = configuration_table[s->level].max_lazy;
- s->good_match = configuration_table[s->level].good_length;
- s->nice_match = configuration_table[s->level].nice_length;
- s->max_chain_length = configuration_table[s->level].max_chain;
-
- s->strstart = 0;
- s->block_start = 0L;
- s->lookahead = 0;
- s->insert = 0;
- s->match_length = s->prev_length = MIN_MATCH-1;
- s->match_available = 0;
- s->ins_h = 0;
-#ifndef FASTEST
-#ifdef ASMV
- match_init(); /* initialize the asm code */
-#endif
-#endif
-}
-
#ifndef FASTEST
/* ===========================================================================
* Set match_start to the longest match starting at the given string and
@@ -1269,14 +1345,7 @@ local void lm_init (s)
* string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
* OUT assertion: the match length is not greater than s->lookahead.
*/
-#ifndef ASMV
-/* For 80x86 and 680x0, an optimized version will be provided in match.asm or
- * match.S. The code will be functionally equivalent.
- */
-local uInt longest_match(s, cur_match)
- deflate_state *s;
- IPos cur_match; /* current match */
-{
+local uInt longest_match(deflate_state *s, IPos cur_match) {
unsigned chain_length = s->max_chain_length;/* max hash chain length */
register Bytef *scan = s->window + s->strstart; /* current string */
register Bytef *match; /* matched string */
@@ -1297,10 +1366,10 @@ local uInt longest_match(s, cur_match)
*/
register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1;
register ush scan_start = *(ushf*)scan;
- register ush scan_end = *(ushf*)(scan+best_len-1);
+ register ush scan_end = *(ushf*)(scan + best_len - 1);
#else
register Bytef *strend = s->window + s->strstart + MAX_MATCH;
- register Byte scan_end1 = scan[best_len-1];
+ register Byte scan_end1 = scan[best_len - 1];
register Byte scan_end = scan[best_len];
#endif
@@ -1318,7 +1387,8 @@ local uInt longest_match(s, cur_match)
*/
if ((uInt)nice_match > s->lookahead) nice_match = (int)s->lookahead;
- Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
+ Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
+ "need lookahead");
do {
Assert(cur_match < s->strstart, "no future");
@@ -1336,43 +1406,44 @@ local uInt longest_match(s, cur_match)
/* This code assumes sizeof(unsigned short) == 2. Do not use
* UNALIGNED_OK if your compiler uses a different size.
*/
- if (*(ushf*)(match+best_len-1) != scan_end ||
+ if (*(ushf*)(match + best_len - 1) != scan_end ||
*(ushf*)match != scan_start) continue;
/* It is not necessary to compare scan[2] and match[2] since they are
* always equal when the other bytes match, given that the hash keys
* are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at
- * strstart+3, +5, ... up to strstart+257. We check for insufficient
+ * strstart + 3, + 5, up to strstart + 257. We check for insufficient
* lookahead only every 4th comparison; the 128th check will be made
- * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is
+ * at strstart + 257. If MAX_MATCH-2 is not a multiple of 8, it is
* necessary to put more guard bytes at the end of the window, or
* to check more often for insufficient lookahead.
*/
Assert(scan[2] == match[2], "scan[2]?");
scan++, match++;
do {
- } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
- *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
- *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
- *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+ } while (*(ushf*)(scan += 2) == *(ushf*)(match += 2) &&
+ *(ushf*)(scan += 2) == *(ushf*)(match += 2) &&
+ *(ushf*)(scan += 2) == *(ushf*)(match += 2) &&
+ *(ushf*)(scan += 2) == *(ushf*)(match += 2) &&
scan < strend);
/* The funny "do {}" generates better code on most compilers */
- /* Here, scan <= window+strstart+257 */
- Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
+ /* Here, scan <= window + strstart + 257 */
+ Assert(scan <= s->window + (unsigned)(s->window_size - 1),
+ "wild scan");
if (*scan == *match) scan++;
- len = (MAX_MATCH - 1) - (int)(strend-scan);
+ len = (MAX_MATCH - 1) - (int)(strend - scan);
scan = strend - (MAX_MATCH-1);
#else /* UNALIGNED_OK */
- if (match[best_len] != scan_end ||
- match[best_len-1] != scan_end1 ||
- *match != *scan ||
- *++match != scan[1]) continue;
+ if (match[best_len] != scan_end ||
+ match[best_len - 1] != scan_end1 ||
+ *match != *scan ||
+ *++match != scan[1]) continue;
- /* The check at best_len-1 can be removed because it will be made
+ /* The check at best_len - 1 can be removed because it will be made
* again later. (This heuristic is not always a win.)
* It is not necessary to compare scan[2] and match[2] since they
* are always equal when the other bytes match, given that
@@ -1382,7 +1453,7 @@ local uInt longest_match(s, cur_match)
Assert(*scan == *match, "match[2]?");
/* We check for insufficient lookahead only every 8th comparison;
- * the 256th check will be made at strstart+258.
+ * the 256th check will be made at strstart + 258.
*/
do {
} while (*++scan == *++match && *++scan == *++match &&
@@ -1391,7 +1462,8 @@ local uInt longest_match(s, cur_match)
*++scan == *++match && *++scan == *++match &&
scan < strend);
- Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
+ Assert(scan <= s->window + (unsigned)(s->window_size - 1),
+ "wild scan");
len = MAX_MATCH - (int)(strend - scan);
scan = strend - MAX_MATCH;
@@ -1403,9 +1475,9 @@ local uInt longest_match(s, cur_match)
best_len = len;
if (len >= nice_match) break;
#ifdef UNALIGNED_OK
- scan_end = *(ushf*)(scan+best_len-1);
+ scan_end = *(ushf*)(scan + best_len - 1);
#else
- scan_end1 = scan[best_len-1];
+ scan_end1 = scan[best_len - 1];
scan_end = scan[best_len];
#endif
}
@@ -1415,17 +1487,13 @@ local uInt longest_match(s, cur_match)
if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
return s->lookahead;
}
-#endif /* ASMV */
#else /* FASTEST */
/* ---------------------------------------------------------------------------
* Optimized version for FASTEST only
*/
-local uInt longest_match(s, cur_match)
- deflate_state *s;
- IPos cur_match; /* current match */
-{
+local uInt longest_match(deflate_state *s, IPos cur_match) {
register Bytef *scan = s->window + s->strstart; /* current string */
register Bytef *match; /* matched string */
register int len; /* length of current match */
@@ -1436,7 +1504,8 @@ local uInt longest_match(s, cur_match)
*/
Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
- Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
+ Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
+ "need lookahead");
Assert(cur_match < s->strstart, "no future");
@@ -1446,7 +1515,7 @@ local uInt longest_match(s, cur_match)
*/
if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1;
- /* The check at best_len-1 can be removed because it will be made
+ /* The check at best_len - 1 can be removed because it will be made
* again later. (This heuristic is not always a win.)
* It is not necessary to compare scan[2] and match[2] since they
* are always equal when the other bytes match, given that
@@ -1456,7 +1525,7 @@ local uInt longest_match(s, cur_match)
Assert(*scan == *match, "match[2]?");
/* We check for insufficient lookahead only every 8th comparison;
- * the 256th check will be made at strstart+258.
+ * the 256th check will be made at strstart + 258.
*/
do {
} while (*++scan == *++match && *++scan == *++match &&
@@ -1465,7 +1534,7 @@ local uInt longest_match(s, cur_match)
*++scan == *++match && *++scan == *++match &&
scan < strend);
- Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
+ Assert(scan <= s->window + (unsigned)(s->window_size - 1), "wild scan");
len = MAX_MATCH - (int)(strend - scan);
@@ -1485,23 +1554,27 @@ local uInt longest_match(s, cur_match)
/* ===========================================================================
* Check that the match at match_start is indeed a match.
*/
-local void check_match(s, start, match, length)
- deflate_state *s;
- IPos start, match;
- int length;
-{
+local void check_match(deflate_state *s, IPos start, IPos match, int length) {
/* check that the match is indeed a match */
- if (zmemcmp(s->window + match,
- s->window + start, length) != EQUAL) {
- fprintf(stderr, " start %u, match %u, length %d\n",
- start, match, length);
+ Bytef *back = s->window + (int)match, *here = s->window + start;
+ IPos len = length;
+ if (match == (IPos)-1) {
+ /* match starts one byte before the current window -- just compare the
+ subsequent length-1 bytes */
+ back++;
+ here++;
+ len--;
+ }
+ if (zmemcmp(back, here, len) != EQUAL) {
+ fprintf(stderr, " start %u, match %d, length %d\n",
+ start, (int)match, length);
do {
- fprintf(stderr, "%c%c", s->window[match++], s->window[start++]);
- } while (--length != 0);
+ fprintf(stderr, "(%02x %02x)", *back++, *here++);
+ } while (--len != 0);
z_error("invalid match");
}
if (z_verbose > 1) {
- fprintf(stderr,"\\[%d,%d]", start-match, length);
+ fprintf(stderr,"\\[%d,%d]", start - match, length);
do { putc(s->window[start++], stderr); } while (--length != 0);
}
}
@@ -1510,137 +1583,6 @@ local void check_match(s, start, match, length)
#endif /* ZLIB_DEBUG */
/* ===========================================================================
- * Fill the window when the lookahead becomes insufficient.
- * Updates strstart and lookahead.
- *
- * IN assertion: lookahead < MIN_LOOKAHEAD
- * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
- * At least one byte has been read, or avail_in == 0; reads are
- * performed for at least two bytes (required for the zip translate_eol
- * option -- not supported here).
- */
-local void fill_window(s)
- deflate_state *s;
-{
- unsigned n;
- unsigned more; /* Amount of free space at the end of the window. */
- uInt wsize = s->w_size;
-
- Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
-
- do {
- more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
-
- /* Deal with !@#$% 64K limit: */
- if (sizeof(int) <= 2) {
- if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
- more = wsize;
-
- } else if (more == (unsigned)(-1)) {
- /* Very unlikely, but possible on 16 bit machine if
- * strstart == 0 && lookahead == 1 (input done a byte at time)
- */
- more--;
- }
- }
-
- /* If the window is almost full and there is insufficient lookahead,
- * move the upper half to the lower one to make room in the upper half.
- */
- if (s->strstart >= wsize+MAX_DIST(s)) {
-
- zmemcpy(s->window, s->window+wsize, (unsigned)wsize - more);
- s->match_start -= wsize;
- s->strstart -= wsize; /* we now have strstart >= MAX_DIST */
- s->block_start -= (long) wsize;
- if (s->insert > s->strstart)
- s->insert = s->strstart;
- slide_hash(s);
- more += wsize;
- }
- if (s->strm->avail_in == 0) break;
-
- /* If there was no sliding:
- * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
- * more == window_size - lookahead - strstart
- * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
- * => more >= window_size - 2*WSIZE + 2
- * In the BIG_MEM or MMAP case (not yet supported),
- * window_size == input_size + MIN_LOOKAHEAD &&
- * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
- * Otherwise, window_size == 2*WSIZE so more >= 2.
- * If there was sliding, more >= WSIZE. So in all cases, more >= 2.
- */
- Assert(more >= 2, "more < 2");
-
- n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
- s->lookahead += n;
-
- /* Initialize the hash value now that we have some input: */
- if (s->lookahead + s->insert >= MIN_MATCH) {
- uInt str = s->strstart - s->insert;
- s->ins_h = s->window[str];
- UPDATE_HASH(s, s->ins_h, s->window[str + 1]);
-#if MIN_MATCH != 3
- Call UPDATE_HASH() MIN_MATCH-3 more times
-#endif
- while (s->insert) {
- UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]);
-#ifndef FASTEST
- s->prev[str & s->w_mask] = s->head[s->ins_h];
-#endif
- s->head[s->ins_h] = (Pos)str;
- str++;
- s->insert--;
- if (s->lookahead + s->insert < MIN_MATCH)
- break;
- }
- }
- /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
- * but this is not important since only literal bytes will be emitted.
- */
-
- } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
-
- /* If the WIN_INIT bytes after the end of the current data have never been
- * written, then zero those bytes in order to avoid memory check reports of
- * the use of uninitialized (or uninitialised as Julian writes) bytes by
- * the longest match routines. Update the high water mark for the next
- * time through here. WIN_INIT is set to MAX_MATCH since the longest match
- * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.
- */
- if (s->high_water < s->window_size) {
- ulg curr = s->strstart + (ulg)(s->lookahead);
- ulg init;
-
- if (s->high_water < curr) {
- /* Previous high water mark below current data -- zero WIN_INIT
- * bytes or up to end of window, whichever is less.
- */
- init = s->window_size - curr;
- if (init > WIN_INIT)
- init = WIN_INIT;
- zmemzero(s->window + curr, (unsigned)init);
- s->high_water = curr + init;
- }
- else if (s->high_water < (ulg)curr + WIN_INIT) {
- /* High water mark at or above current data, but below current data
- * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up
- * to end of window, whichever is less.
- */
- init = (ulg)curr + WIN_INIT - s->high_water;
- if (init > s->window_size - s->high_water)
- init = s->window_size - s->high_water;
- zmemzero(s->window + s->high_water, (unsigned)init);
- s->high_water += init;
- }
- }
-
- Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
- "not enough room for search");
-}
-
-/* ===========================================================================
* Flush the current block, with given end-of-file flag.
* IN assertion: strstart is set to the end of the current match.
*/
@@ -1680,12 +1622,9 @@ local void fill_window(s)
*
* deflate_stored() is written to minimize the number of times an input byte is
* copied. It is most efficient with large input and output buffers, which
- * maximizes the opportunites to have a single copy from next_in to next_out.
+ * maximizes the opportunities to have a single copy from next_in to next_out.
*/
-local block_state deflate_stored(s, flush)
- deflate_state *s;
- int flush;
-{
+local block_state deflate_stored(deflate_state *s, int flush) {
/* Smallest worthy block size when not flushing or finishing. By default
* this is 32K. This can be as small as 507 bytes for memLevel == 1. For
* large input and output buffers, the stored block size will be larger.
@@ -1869,10 +1808,7 @@ local block_state deflate_stored(s, flush)
* new strings in the dictionary only for unmatched strings or for short
* matches. It is used only for the fast compression options.
*/
-local block_state deflate_fast(s, flush)
- deflate_state *s;
- int flush;
-{
+local block_state deflate_fast(deflate_state *s, int flush) {
IPos hash_head; /* head of the hash chain */
int bflush; /* set if current block must be flushed */
@@ -1890,7 +1826,7 @@ local block_state deflate_fast(s, flush)
if (s->lookahead == 0) break; /* flush the current block */
}
- /* Insert the string window[strstart .. strstart+2] in the
+ /* Insert the string window[strstart .. strstart + 2] in the
* dictionary, and set hash_head to the head of the hash chain:
*/
hash_head = NIL;
@@ -1938,7 +1874,7 @@ local block_state deflate_fast(s, flush)
s->strstart += s->match_length;
s->match_length = 0;
s->ins_h = s->window[s->strstart];
- UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
+ UPDATE_HASH(s, s->ins_h, s->window[s->strstart + 1]);
#if MIN_MATCH != 3
Call UPDATE_HASH() MIN_MATCH-3 more times
#endif
@@ -1949,7 +1885,7 @@ local block_state deflate_fast(s, flush)
} else {
/* No match, output a literal byte */
Tracevv((stderr,"%c", s->window[s->strstart]));
- _tr_tally_lit (s, s->window[s->strstart], bflush);
+ _tr_tally_lit(s, s->window[s->strstart], bflush);
s->lookahead--;
s->strstart++;
}
@@ -1971,10 +1907,7 @@ local block_state deflate_fast(s, flush)
* evaluation for matches: a match is finally adopted only if there is
* no better match at the next window position.
*/
-local block_state deflate_slow(s, flush)
- deflate_state *s;
- int flush;
-{
+local block_state deflate_slow(deflate_state *s, int flush) {
IPos hash_head; /* head of hash chain */
int bflush; /* set if current block must be flushed */
@@ -1993,7 +1926,7 @@ local block_state deflate_slow(s, flush)
if (s->lookahead == 0) break; /* flush the current block */
}
- /* Insert the string window[strstart .. strstart+2] in the
+ /* Insert the string window[strstart .. strstart + 2] in the
* dictionary, and set hash_head to the head of the hash chain:
*/
hash_head = NIL;
@@ -2035,17 +1968,17 @@ local block_state deflate_slow(s, flush)
uInt max_insert = s->strstart + s->lookahead - MIN_MATCH;
/* Do not insert strings in hash table beyond this. */
- check_match(s, s->strstart-1, s->prev_match, s->prev_length);
+ check_match(s, s->strstart - 1, s->prev_match, s->prev_length);
- _tr_tally_dist(s, s->strstart -1 - s->prev_match,
+ _tr_tally_dist(s, s->strstart - 1 - s->prev_match,
s->prev_length - MIN_MATCH, bflush);
/* Insert in hash table all strings up to the end of the match.
- * strstart-1 and strstart are already inserted. If there is not
+ * strstart - 1 and strstart are already inserted. If there is not
* enough lookahead, the last two strings are not inserted in
* the hash table.
*/
- s->lookahead -= s->prev_length-1;
+ s->lookahead -= s->prev_length - 1;
s->prev_length -= 2;
do {
if (++s->strstart <= max_insert) {
@@ -2063,8 +1996,8 @@ local block_state deflate_slow(s, flush)
* single literal. If there was a match but the current match
* is longer, truncate the previous match to a single literal.
*/
- Tracevv((stderr,"%c", s->window[s->strstart-1]));
- _tr_tally_lit(s, s->window[s->strstart-1], bflush);
+ Tracevv((stderr,"%c", s->window[s->strstart - 1]));
+ _tr_tally_lit(s, s->window[s->strstart - 1], bflush);
if (bflush) {
FLUSH_BLOCK_ONLY(s, 0);
}
@@ -2082,8 +2015,8 @@ local block_state deflate_slow(s, flush)
}
Assert (flush != Z_NO_FLUSH, "no flush?");
if (s->match_available) {
- Tracevv((stderr,"%c", s->window[s->strstart-1]));
- _tr_tally_lit(s, s->window[s->strstart-1], bflush);
+ Tracevv((stderr,"%c", s->window[s->strstart - 1]));
+ _tr_tally_lit(s, s->window[s->strstart - 1], bflush);
s->match_available = 0;
}
s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1;
@@ -2102,10 +2035,7 @@ local block_state deflate_slow(s, flush)
* one. Do not maintain a hash table. (It will be regenerated if this run of
* deflate switches away from Z_RLE.)
*/
-local block_state deflate_rle(s, flush)
- deflate_state *s;
- int flush;
-{
+local block_state deflate_rle(deflate_state *s, int flush) {
int bflush; /* set if current block must be flushed */
uInt prev; /* byte at distance one to match */
Bytef *scan, *strend; /* scan goes up to strend for length of run */
@@ -2140,7 +2070,8 @@ local block_state deflate_rle(s, flush)
if (s->match_length > s->lookahead)
s->match_length = s->lookahead;
}
- Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan");
+ Assert(scan <= s->window + (uInt)(s->window_size - 1),
+ "wild scan");
}
/* Emit match if have run of MIN_MATCH or longer, else emit literal */
@@ -2155,7 +2086,7 @@ local block_state deflate_rle(s, flush)
} else {
/* No match, output a literal byte */
Tracevv((stderr,"%c", s->window[s->strstart]));
- _tr_tally_lit (s, s->window[s->strstart], bflush);
+ _tr_tally_lit(s, s->window[s->strstart], bflush);
s->lookahead--;
s->strstart++;
}
@@ -2175,10 +2106,7 @@ local block_state deflate_rle(s, flush)
* For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.
* (It will be regenerated if this run of deflate switches away from Huffman.)
*/
-local block_state deflate_huff(s, flush)
- deflate_state *s;
- int flush;
-{
+local block_state deflate_huff(deflate_state *s, int flush) {
int bflush; /* set if current block must be flushed */
for (;;) {
@@ -2195,7 +2123,7 @@ local block_state deflate_huff(s, flush)
/* Output a literal byte */
s->match_length = 0;
Tracevv((stderr,"%c", s->window[s->strstart]));
- _tr_tally_lit (s, s->window[s->strstart], bflush);
+ _tr_tally_lit(s, s->window[s->strstart], bflush);
s->lookahead--;
s->strstart++;
if (bflush) FLUSH_BLOCK(s, 0);
diff --git a/src/Common/zlib/deflate.h b/src/Common/zlib/deflate.h
index 17c22611..300c6ada 100644
--- a/src/Common/zlib/deflate.h
+++ b/src/Common/zlib/deflate.h
@@ -1,5 +1,5 @@
/* deflate.h -- internal compression state
- * Copyright (C) 1995-2018 Jean-loup Gailly
+ * Copyright (C) 1995-2024 Jean-loup Gailly
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -23,6 +23,10 @@
# define GZIP
#endif
+/* define LIT_MEM to slightly increase the speed of deflate (order 1% to 2%) at
+ the cost of a larger memory footprint */
+/* #define LIT_MEM */
+
/* ===========================================================================
* Internal compression state.
*/
@@ -217,7 +221,14 @@ typedef struct internal_state {
/* Depth of each subtree used as tie breaker for trees of equal frequency
*/
+#ifdef LIT_MEM
+# define LIT_BUFS 5
+ ushf *d_buf; /* buffer for distances */
+ uchf *l_buf; /* buffer for literals/lengths */
+#else
+# define LIT_BUFS 4
uchf *sym_buf; /* buffer for distances and literals/lengths */
+#endif
uInt lit_bufsize;
/* Size of match buffer for literals/lengths. There are 4 reasons for
@@ -239,7 +250,7 @@ typedef struct internal_state {
* - I can't count above 4
*/
- uInt sym_next; /* running index in sym_buf */
+ uInt sym_next; /* running index in symbol buffer */
uInt sym_end; /* symbol table full when sym_next reaches this */
ulg opt_len; /* bit length of current block with optimal trees */
@@ -291,14 +302,14 @@ typedef struct internal_state {
memory checker errors from longest match routines */
/* in trees.c */
-void ZLIB_INTERNAL _tr_init OF((deflate_state *s));
-int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
-void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf,
- ulg stored_len, int last));
-void ZLIB_INTERNAL _tr_flush_bits OF((deflate_state *s));
-void ZLIB_INTERNAL _tr_align OF((deflate_state *s));
-void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
- ulg stored_len, int last));
+void ZLIB_INTERNAL _tr_init(deflate_state *s);
+int ZLIB_INTERNAL _tr_tally(deflate_state *s, unsigned dist, unsigned lc);
+void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, charf *buf,
+ ulg stored_len, int last);
+void ZLIB_INTERNAL _tr_flush_bits(deflate_state *s);
+void ZLIB_INTERNAL _tr_align(deflate_state *s);
+void ZLIB_INTERNAL _tr_stored_block(deflate_state *s, charf *buf,
+ ulg stored_len, int last);
#define d_code(dist) \
((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
@@ -318,6 +329,25 @@ void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
extern const uch ZLIB_INTERNAL _dist_code[];
#endif
+#ifdef LIT_MEM
+# define _tr_tally_lit(s, c, flush) \
+ { uch cc = (c); \
+ s->d_buf[s->sym_next] = 0; \
+ s->l_buf[s->sym_next++] = cc; \
+ s->dyn_ltree[cc].Freq++; \
+ flush = (s->sym_next == s->sym_end); \
+ }
+# define _tr_tally_dist(s, distance, length, flush) \
+ { uch len = (uch)(length); \
+ ush dist = (ush)(distance); \
+ s->d_buf[s->sym_next] = dist; \
+ s->l_buf[s->sym_next++] = len; \
+ dist--; \
+ s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
+ s->dyn_dtree[d_code(dist)].Freq++; \
+ flush = (s->sym_next == s->sym_end); \
+ }
+#else
# define _tr_tally_lit(s, c, flush) \
{ uch cc = (c); \
s->sym_buf[s->sym_next++] = 0; \
@@ -329,14 +359,15 @@ void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
# define _tr_tally_dist(s, distance, length, flush) \
{ uch len = (uch)(length); \
ush dist = (ush)(distance); \
- s->sym_buf[s->sym_next++] = dist; \
- s->sym_buf[s->sym_next++] = dist >> 8; \
+ s->sym_buf[s->sym_next++] = (uch)dist; \
+ s->sym_buf[s->sym_next++] = (uch)(dist >> 8); \
s->sym_buf[s->sym_next++] = len; \
dist--; \
s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
s->dyn_dtree[d_code(dist)].Freq++; \
flush = (s->sym_next == s->sym_end); \
}
+#endif
#else
# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
# define _tr_tally_dist(s, distance, length, flush) \
diff --git a/src/Common/zlib/gzclose.c b/src/Common/zlib/gzclose.c
index caeb99a3..48d6a86f 100644
--- a/src/Common/zlib/gzclose.c
+++ b/src/Common/zlib/gzclose.c
@@ -8,9 +8,7 @@
/* gzclose() is in a separate file so that it is linked in only if it is used.
That way the other gzclose functions can be used instead to avoid linking in
unneeded compression or decompression routines. */
-int ZEXPORT gzclose(file)
- gzFile file;
-{
+int ZEXPORT gzclose(gzFile file) {
#ifndef NO_GZCOMPRESS
gz_statep state;
diff --git a/src/Common/zlib/gzguts.h b/src/Common/zlib/gzguts.h
index 57faf371..eba72085 100644
--- a/src/Common/zlib/gzguts.h
+++ b/src/Common/zlib/gzguts.h
@@ -1,5 +1,5 @@
/* gzguts.h -- zlib internal header definitions for gz* operations
- * Copyright (C) 2004-2019 Mark Adler
+ * Copyright (C) 2004-2024 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -7,9 +7,8 @@
# ifndef _LARGEFILE_SOURCE
# define _LARGEFILE_SOURCE 1
# endif
-# ifdef _FILE_OFFSET_BITS
-# undef _FILE_OFFSET_BITS
-# endif
+# undef _FILE_OFFSET_BITS
+# undef _TIME_BITS
#endif
#ifdef HAVE_HIDDEN
@@ -119,8 +118,8 @@
/* gz* functions always use library allocation functions */
#ifndef STDC
- extern voidp malloc OF((uInt size));
- extern void free OF((voidpf ptr));
+ extern voidp malloc(uInt size);
+ extern void free(voidpf ptr);
#endif
/* get errno and strerror definition */
@@ -138,10 +137,10 @@
/* provide prototypes for these when building zlib without LFS */
#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
- ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
- ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
- ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
- ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
+ ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *);
+ ZEXTERN z_off64_t ZEXPORT gzseek64(gzFile, z_off64_t, int);
+ ZEXTERN z_off64_t ZEXPORT gztell64(gzFile);
+ ZEXTERN z_off64_t ZEXPORT gzoffset64(gzFile);
#endif
/* default memLevel */
@@ -203,17 +202,13 @@ typedef struct {
typedef gz_state FAR *gz_statep;
/* shared functions */
-void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *));
+void ZLIB_INTERNAL gz_error(gz_statep, int, const char *);
#if defined UNDER_CE
-char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error));
+char ZLIB_INTERNAL *gz_strwinerror(DWORD error);
#endif
/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t
value -- needed when comparing unsigned to z_off64_t, which is signed
(possible z_off64_t types off_t, off64_t, and long are all signed) */
-#ifdef INT_MAX
-# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX)
-#else
-unsigned ZLIB_INTERNAL gz_intmax OF((void));
-# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
-#endif
+unsigned ZLIB_INTERNAL gz_intmax(void);
+#define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
diff --git a/src/Common/zlib/gzlib.c b/src/Common/zlib/gzlib.c
index dddaf268..983153cc 100644
--- a/src/Common/zlib/gzlib.c
+++ b/src/Common/zlib/gzlib.c
@@ -1,5 +1,5 @@
/* gzlib.c -- zlib functions common to reading and writing gzip files
- * Copyright (C) 2004-2019 Mark Adler
+ * Copyright (C) 2004-2024 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -15,10 +15,6 @@
#endif
#endif
-/* Local functions */
-local void gz_reset OF((gz_statep));
-local gzFile gz_open OF((const void *, int, const char *));
-
#if defined UNDER_CE
/* Map the Windows error number in ERROR to a locale-dependent error message
@@ -30,9 +26,7 @@ local gzFile gz_open OF((const void *, int, const char *));
The gz_strwinerror function does not change the current setting of
GetLastError. */
-char ZLIB_INTERNAL *gz_strwinerror (error)
- DWORD error;
-{
+char ZLIB_INTERNAL *gz_strwinerror(DWORD error) {
static char buf[1024];
wchar_t *msgbuf;
@@ -72,9 +66,7 @@ char ZLIB_INTERNAL *gz_strwinerror (error)
#endif /* UNDER_CE */
/* Reset gzip file state */
-local void gz_reset(state)
- gz_statep state;
-{
+local void gz_reset(gz_statep state) {
state->x.have = 0; /* no output data available */
if (state->mode == GZ_READ) { /* for reading ... */
state->eof = 0; /* not at end of file */
@@ -90,11 +82,7 @@ local void gz_reset(state)
}
/* Open a gzip file either by name or file descriptor. */
-local gzFile gz_open(path, fd, mode)
- const void *path;
- int fd;
- const char *mode;
-{
+local gzFile gz_open(const void *path, int fd, const char *mode) {
gz_statep state;
z_size_t len;
int oflag;
@@ -269,26 +257,17 @@ local gzFile gz_open(path, fd, mode)
}
/* -- see zlib.h -- */
-gzFile ZEXPORT gzopen(path, mode)
- const char *path;
- const char *mode;
-{
+gzFile ZEXPORT gzopen(const char *path, const char *mode) {
return gz_open(path, -1, mode);
}
/* -- see zlib.h -- */
-gzFile ZEXPORT gzopen64(path, mode)
- const char *path;
- const char *mode;
-{
+gzFile ZEXPORT gzopen64(const char *path, const char *mode) {
return gz_open(path, -1, mode);
}
/* -- see zlib.h -- */
-gzFile ZEXPORT gzdopen(fd, mode)
- int fd;
- const char *mode;
-{
+gzFile ZEXPORT gzdopen(int fd, const char *mode) {
char *path; /* identifier for error messages */
gzFile gz;
@@ -306,19 +285,13 @@ gzFile ZEXPORT gzdopen(fd, mode)
/* -- see zlib.h -- */
#ifdef WIDECHAR
-gzFile ZEXPORT gzopen_w(path, mode)
- const wchar_t *path;
- const char *mode;
-{
+gzFile ZEXPORT gzopen_w(const wchar_t *path, const char *mode) {
return gz_open(path, -2, mode);
}
#endif
/* -- see zlib.h -- */
-int ZEXPORT gzbuffer(file, size)
- gzFile file;
- unsigned size;
-{
+int ZEXPORT gzbuffer(gzFile file, unsigned size) {
gz_statep state;
/* get internal structure and check integrity */
@@ -335,16 +308,14 @@ int ZEXPORT gzbuffer(file, size)
/* check and set requested size */
if ((size << 1) < size)
return -1; /* need to be able to double it */
- if (size < 2)
- size = 2; /* need two bytes to check magic header */
+ if (size < 8)
+ size = 8; /* needed to behave well with flushing */
state->want = size;
return 0;
}
/* -- see zlib.h -- */
-int ZEXPORT gzrewind(file)
- gzFile file;
-{
+int ZEXPORT gzrewind(gzFile file) {
gz_statep state;
/* get internal structure */
@@ -365,11 +336,7 @@ int ZEXPORT gzrewind(file)
}
/* -- see zlib.h -- */
-z_off64_t ZEXPORT gzseek64(file, offset, whence)
- gzFile file;
- z_off64_t offset;
- int whence;
-{
+z_off64_t ZEXPORT gzseek64(gzFile file, z_off64_t offset, int whence) {
unsigned n;
z_off64_t ret;
gz_statep state;
@@ -442,11 +409,7 @@ z_off64_t ZEXPORT gzseek64(file, offset, whence)
}
/* -- see zlib.h -- */
-z_off_t ZEXPORT gzseek(file, offset, whence)
- gzFile file;
- z_off_t offset;
- int whence;
-{
+z_off_t ZEXPORT gzseek(gzFile file, z_off_t offset, int whence) {
z_off64_t ret;
ret = gzseek64(file, (z_off64_t)offset, whence);
@@ -454,9 +417,7 @@ z_off_t ZEXPORT gzseek(file, offset, whence)
}
/* -- see zlib.h -- */
-z_off64_t ZEXPORT gztell64(file)
- gzFile file;
-{
+z_off64_t ZEXPORT gztell64(gzFile file) {
gz_statep state;
/* get internal structure and check integrity */
@@ -471,9 +432,7 @@ z_off64_t ZEXPORT gztell64(file)
}
/* -- see zlib.h -- */
-z_off_t ZEXPORT gztell(file)
- gzFile file;
-{
+z_off_t ZEXPORT gztell(gzFile file) {
z_off64_t ret;
ret = gztell64(file);
@@ -481,9 +440,7 @@ z_off_t ZEXPORT gztell(file)
}
/* -- see zlib.h -- */
-z_off64_t ZEXPORT gzoffset64(file)
- gzFile file;
-{
+z_off64_t ZEXPORT gzoffset64(gzFile file) {
z_off64_t offset;
gz_statep state;
@@ -504,9 +461,7 @@ z_off64_t ZEXPORT gzoffset64(file)
}
/* -- see zlib.h -- */
-z_off_t ZEXPORT gzoffset(file)
- gzFile file;
-{
+z_off_t ZEXPORT gzoffset(gzFile file) {
z_off64_t ret;
ret = gzoffset64(file);
@@ -514,9 +469,7 @@ z_off_t ZEXPORT gzoffset(file)
}
/* -- see zlib.h -- */
-int ZEXPORT gzeof(file)
- gzFile file;
-{
+int ZEXPORT gzeof(gzFile file) {
gz_statep state;
/* get internal structure and check integrity */
@@ -531,10 +484,7 @@ int ZEXPORT gzeof(file)
}
/* -- see zlib.h -- */
-const char * ZEXPORT gzerror(file, errnum)
- gzFile file;
- int *errnum;
-{
+const char * ZEXPORT gzerror(gzFile file, int *errnum) {
gz_statep state;
/* get internal structure and check integrity */
@@ -552,9 +502,7 @@ const char * ZEXPORT gzerror(file, errnum)
}
/* -- see zlib.h -- */
-void ZEXPORT gzclearerr(file)
- gzFile file;
-{
+void ZEXPORT gzclearerr(gzFile file) {
gz_statep state;
/* get internal structure and check integrity */
@@ -578,11 +526,7 @@ void ZEXPORT gzclearerr(file)
memory). Simply save the error message as a static string. If there is an
allocation failure constructing the error message, then convert the error to
out of memory. */
-void ZLIB_INTERNAL gz_error(state, err, msg)
- gz_statep state;
- int err;
- const char *msg;
-{
+void ZLIB_INTERNAL gz_error(gz_statep state, int err, const char *msg) {
/* free previously allocated message and clear */
if (state->msg != NULL) {
if (state->err != Z_MEM_ERROR)
@@ -619,21 +563,20 @@ void ZLIB_INTERNAL gz_error(state, err, msg)
#endif
}
-#ifndef INT_MAX
/* portably return maximum value for an int (when limits.h presumed not
available) -- we need to do this to cover cases where 2's complement not
used, since C standard permits 1's complement and sign-bit representations,
otherwise we could just use ((unsigned)-1) >> 1 */
-unsigned ZLIB_INTERNAL gz_intmax()
-{
- unsigned p, q;
-
- p = 1;
+unsigned ZLIB_INTERNAL gz_intmax(void) {
+#ifdef INT_MAX
+ return INT_MAX;
+#else
+ unsigned p = 1, q;
do {
q = p;
p <<= 1;
p++;
} while (p > q);
return q >> 1;
-}
#endif
+}
diff --git a/src/Common/zlib/gzread.c b/src/Common/zlib/gzread.c
index 884c9bfe..4168cbc8 100644
--- a/src/Common/zlib/gzread.c
+++ b/src/Common/zlib/gzread.c
@@ -5,25 +5,12 @@
#include "gzguts.h"
-/* Local functions */
-local int gz_load OF((gz_statep, unsigned char *, unsigned, unsigned *));
-local int gz_avail OF((gz_statep));
-local int gz_look OF((gz_statep));
-local int gz_decomp OF((gz_statep));
-local int gz_fetch OF((gz_statep));
-local int gz_skip OF((gz_statep, z_off64_t));
-local z_size_t gz_read OF((gz_statep, voidp, z_size_t));
-
/* Use read() to load a buffer -- return -1 on error, otherwise 0. Read from
state->fd, and update state->eof, state->err, and state->msg as appropriate.
This function needs to loop on read(), since read() is not guaranteed to
read the number of bytes requested, depending on the type of descriptor. */
-local int gz_load(state, buf, len, have)
- gz_statep state;
- unsigned char *buf;
- unsigned len;
- unsigned *have;
-{
+local int gz_load(gz_statep state, unsigned char *buf, unsigned len,
+ unsigned *have) {
int ret;
unsigned get, max = ((unsigned)-1 >> 2) + 1;
@@ -53,9 +40,7 @@ local int gz_load(state, buf, len, have)
If strm->avail_in != 0, then the current data is moved to the beginning of
the input buffer, and then the remainder of the buffer is loaded with the
available data from the input file. */
-local int gz_avail(state)
- gz_statep state;
-{
+local int gz_avail(gz_statep state) {
unsigned got;
z_streamp strm = &(state->strm);
@@ -88,9 +73,7 @@ local int gz_avail(state)
case, all further file reads will be directly to either the output buffer or
a user buffer. If decompressing, the inflate state will be initialized.
gz_look() will return 0 on success or -1 on failure. */
-local int gz_look(state)
- gz_statep state;
-{
+local int gz_look(gz_statep state) {
z_streamp strm = &(state->strm);
/* allocate read buffers and inflate memory */
@@ -157,11 +140,9 @@ local int gz_look(state)
the output buffer is larger than the input buffer, which also assures
space for gzungetc() */
state->x.next = state->out;
- if (strm->avail_in) {
- memcpy(state->x.next, strm->next_in, strm->avail_in);
- state->x.have = strm->avail_in;
- strm->avail_in = 0;
- }
+ memcpy(state->x.next, strm->next_in, strm->avail_in);
+ state->x.have = strm->avail_in;
+ strm->avail_in = 0;
state->how = COPY;
state->direct = 1;
return 0;
@@ -172,9 +153,7 @@ local int gz_look(state)
data. If the gzip stream completes, state->how is reset to LOOK to look for
the next gzip stream or raw data, once state->x.have is depleted. Returns 0
on success, -1 on failure. */
-local int gz_decomp(state)
- gz_statep state;
-{
+local int gz_decomp(gz_statep state) {
int ret = Z_OK;
unsigned had;
z_streamp strm = &(state->strm);
@@ -226,9 +205,7 @@ local int gz_decomp(state)
looked for to determine whether to copy or decompress. Returns -1 on error,
otherwise 0. gz_fetch() will leave state->how as COPY or GZIP unless the
end of the input file has been reached and all data has been processed. */
-local int gz_fetch(state)
- gz_statep state;
-{
+local int gz_fetch(gz_statep state) {
z_streamp strm = &(state->strm);
do {
@@ -256,10 +233,7 @@ local int gz_fetch(state)
}
/* Skip len uncompressed bytes of output. Return -1 on error, 0 on success. */
-local int gz_skip(state, len)
- gz_statep state;
- z_off64_t len;
-{
+local int gz_skip(gz_statep state, z_off64_t len) {
unsigned n;
/* skip over len bytes or reach end-of-file, whichever comes first */
@@ -291,11 +265,7 @@ local int gz_skip(state, len)
input. Return the number of bytes read. If zero is returned, either the
end of file was reached, or there was an error. state->err must be
consulted in that case to determine which. */
-local z_size_t gz_read(state, buf, len)
- gz_statep state;
- voidp buf;
- z_size_t len;
-{
+local z_size_t gz_read(gz_statep state, voidp buf, z_size_t len) {
z_size_t got;
unsigned n;
@@ -372,11 +342,7 @@ local z_size_t gz_read(state, buf, len)
}
/* -- see zlib.h -- */
-int ZEXPORT gzread(file, buf, len)
- gzFile file;
- voidp buf;
- unsigned len;
-{
+int ZEXPORT gzread(gzFile file, voidp buf, unsigned len) {
gz_statep state;
/* get internal structure */
@@ -408,12 +374,7 @@ int ZEXPORT gzread(file, buf, len)
}
/* -- see zlib.h -- */
-z_size_t ZEXPORT gzfread(buf, size, nitems, file)
- voidp buf;
- z_size_t size;
- z_size_t nitems;
- gzFile file;
-{
+z_size_t ZEXPORT gzfread(voidp buf, z_size_t size, z_size_t nitems, gzFile file) {
z_size_t len;
gz_statep state;
@@ -444,9 +405,7 @@ z_size_t ZEXPORT gzfread(buf, size, nitems, file)
#else
# undef gzgetc
#endif
-int ZEXPORT gzgetc(file)
- gzFile file;
-{
+int ZEXPORT gzgetc(gzFile file) {
unsigned char buf[1];
gz_statep state;
@@ -471,17 +430,12 @@ int ZEXPORT gzgetc(file)
return gz_read(state, buf, 1) < 1 ? -1 : buf[0];
}
-int ZEXPORT gzgetc_(file)
-gzFile file;
-{
+int ZEXPORT gzgetc_(gzFile file) {
return gzgetc(file);
}
/* -- see zlib.h -- */
-int ZEXPORT gzungetc(c, file)
- int c;
- gzFile file;
-{
+int ZEXPORT gzungetc(int c, gzFile file) {
gz_statep state;
/* get internal structure */
@@ -489,6 +443,10 @@ int ZEXPORT gzungetc(c, file)
return -1;
state = (gz_statep)file;
+ /* in case this was just opened, set up the input buffer */
+ if (state->mode == GZ_READ && state->how == LOOK && state->x.have == 0)
+ (void)gz_look(state);
+
/* check that we're reading and that there's no (serious) error */
if (state->mode != GZ_READ ||
(state->err != Z_OK && state->err != Z_BUF_ERROR))
@@ -538,11 +496,7 @@ int ZEXPORT gzungetc(c, file)
}
/* -- see zlib.h -- */
-char * ZEXPORT gzgets(file, buf, len)
- gzFile file;
- char *buf;
- int len;
-{
+char * ZEXPORT gzgets(gzFile file, char *buf, int len) {
unsigned left, n;
char *str;
unsigned char *eol;
@@ -602,9 +556,7 @@ char * ZEXPORT gzgets(file, buf, len)
}
/* -- see zlib.h -- */
-int ZEXPORT gzdirect(file)
- gzFile file;
-{
+int ZEXPORT gzdirect(gzFile file) {
gz_statep state;
/* get internal structure */
@@ -622,9 +574,7 @@ int ZEXPORT gzdirect(file)
}
/* -- see zlib.h -- */
-int ZEXPORT gzclose_r(file)
- gzFile file;
-{
+int ZEXPORT gzclose_r(gzFile file) {
int ret, err;
gz_statep state;
diff --git a/src/Common/zlib/gzwrite.c b/src/Common/zlib/gzwrite.c
index a8ffc8f5..435b4621 100644
--- a/src/Common/zlib/gzwrite.c
+++ b/src/Common/zlib/gzwrite.c
@@ -5,18 +5,10 @@
#include "gzguts.h"
-/* Local functions */
-local int gz_init OF((gz_statep));
-local int gz_comp OF((gz_statep, int));
-local int gz_zero OF((gz_statep, z_off64_t));
-local z_size_t gz_write OF((gz_statep, voidpc, z_size_t));
-
/* Initialize state for writing a gzip file. Mark initialization by setting
state->size to non-zero. Return -1 on a memory allocation failure, or 0 on
success. */
-local int gz_init(state)
- gz_statep state;
-{
+local int gz_init(gz_statep state) {
int ret;
z_streamp strm = &(state->strm);
@@ -70,10 +62,7 @@ local int gz_init(state)
deflate() flush value. If flush is Z_FINISH, then the deflate() state is
reset to start a new gzip stream. If gz->direct is true, then simply write
to the output file without compressing, and ignore flush. */
-local int gz_comp(state, flush)
- gz_statep state;
- int flush;
-{
+local int gz_comp(gz_statep state, int flush) {
int ret, writ;
unsigned have, put, max = ((unsigned)-1 >> 2) + 1;
z_streamp strm = &(state->strm);
@@ -151,10 +140,7 @@ local int gz_comp(state, flush)
/* Compress len zeros to output. Return -1 on a write error or memory
allocation failure by gz_comp(), or 0 on success. */
-local int gz_zero(state, len)
- gz_statep state;
- z_off64_t len;
-{
+local int gz_zero(gz_statep state, z_off64_t len) {
int first;
unsigned n;
z_streamp strm = &(state->strm);
@@ -184,11 +170,7 @@ local int gz_zero(state, len)
/* Write len bytes from buf to file. Return the number of bytes written. If
the returned value is less than len, then there was an error. */
-local z_size_t gz_write(state, buf, len)
- gz_statep state;
- voidpc buf;
- z_size_t len;
-{
+local z_size_t gz_write(gz_statep state, voidpc buf, z_size_t len) {
z_size_t put = len;
/* if len is zero, avoid unnecessary operations */
@@ -252,11 +234,7 @@ local z_size_t gz_write(state, buf, len)
}
/* -- see zlib.h -- */
-int ZEXPORT gzwrite(file, buf, len)
- gzFile file;
- voidpc buf;
- unsigned len;
-{
+int ZEXPORT gzwrite(gzFile file, voidpc buf, unsigned len) {
gz_statep state;
/* get internal structure */
@@ -280,12 +258,8 @@ int ZEXPORT gzwrite(file, buf, len)
}
/* -- see zlib.h -- */
-z_size_t ZEXPORT gzfwrite(buf, size, nitems, file)
- voidpc buf;
- z_size_t size;
- z_size_t nitems;
- gzFile file;
-{
+z_size_t ZEXPORT gzfwrite(voidpc buf, z_size_t size, z_size_t nitems,
+ gzFile file) {
z_size_t len;
gz_statep state;
@@ -310,10 +284,7 @@ z_size_t ZEXPORT gzfwrite(buf, size, nitems, file)
}
/* -- see zlib.h -- */
-int ZEXPORT gzputc(file, c)
- gzFile file;
- int c;
-{
+int ZEXPORT gzputc(gzFile file, int c) {
unsigned have;
unsigned char buf[1];
gz_statep state;
@@ -358,10 +329,7 @@ int ZEXPORT gzputc(file, c)
}
/* -- see zlib.h -- */
-int ZEXPORT gzputs(file, s)
- gzFile file;
- const char *s;
-{
+int ZEXPORT gzputs(gzFile file, const char *s) {
z_size_t len, put;
gz_statep state;
@@ -388,8 +356,7 @@ int ZEXPORT gzputs(file, s)
#include <stdarg.h>
/* -- see zlib.h -- */
-int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va)
-{
+int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va) {
int len;
unsigned left;
char *next;
@@ -460,8 +427,7 @@ int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va)
return len;
}
-int ZEXPORTVA gzprintf(gzFile file, const char *format, ...)
-{
+int ZEXPORTVA gzprintf(gzFile file, const char *format, ...) {
va_list va;
int ret;
@@ -474,13 +440,10 @@ int ZEXPORTVA gzprintf(gzFile file, const char *format, ...)
#else /* !STDC && !Z_HAVE_STDARG_H */
/* -- see zlib.h -- */
-int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
- a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
- gzFile file;
- const char *format;
- int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
- a11, a12, a13, a14, a15, a16, a17, a18, a19, a20;
-{
+int ZEXPORTVA gzprintf(gzFile file, const char *format, int a1, int a2, int a3,
+ int a4, int a5, int a6, int a7, int a8, int a9, int a10,
+ int a11, int a12, int a13, int a14, int a15, int a16,
+ int a17, int a18, int a19, int a20) {
unsigned len, left;
char *next;
gz_statep state;
@@ -562,10 +525,7 @@ int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
#endif
/* -- see zlib.h -- */
-int ZEXPORT gzflush(file, flush)
- gzFile file;
- int flush;
-{
+int ZEXPORT gzflush(gzFile file, int flush) {
gz_statep state;
/* get internal structure */
@@ -594,11 +554,7 @@ int ZEXPORT gzflush(file, flush)
}
/* -- see zlib.h -- */
-int ZEXPORT gzsetparams(file, level, strategy)
- gzFile file;
- int level;
- int strategy;
-{
+int ZEXPORT gzsetparams(gzFile file, int level, int strategy) {
gz_statep state;
z_streamp strm;
@@ -609,7 +565,7 @@ int ZEXPORT gzsetparams(file, level, strategy)
strm = &(state->strm);
/* check that we're writing and that there's no error */
- if (state->mode != GZ_WRITE || state->err != Z_OK)
+ if (state->mode != GZ_WRITE || state->err != Z_OK || state->direct)
return Z_STREAM_ERROR;
/* if no change is requested, then do nothing */
@@ -636,9 +592,7 @@ int ZEXPORT gzsetparams(file, level, strategy)
}
/* -- see zlib.h -- */
-int ZEXPORT gzclose_w(file)
- gzFile file;
-{
+int ZEXPORT gzclose_w(gzFile file) {
int ret = Z_OK;
gz_statep state;
diff --git a/src/Common/zlib/infback.c b/src/Common/zlib/infback.c
index a390c58e..e7b25b30 100644
--- a/src/Common/zlib/infback.c
+++ b/src/Common/zlib/infback.c
@@ -15,9 +15,6 @@
#include "inflate.h"
#include "inffast.h"
-/* function prototypes */
-local void fixedtables OF((struct inflate_state FAR *state));
-
/*
strm provides memory allocation functions in zalloc and zfree, or
Z_NULL to use the library memory allocation functions.
@@ -25,13 +22,9 @@ local void fixedtables OF((struct inflate_state FAR *state));
windowBits is in the range 8..15, and window is a user-supplied
window and output buffer that is 2**windowBits bytes.
*/
-int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size)
-z_streamp strm;
-int windowBits;
-unsigned char FAR *window;
-const char *version;
-int stream_size;
-{
+int ZEXPORT inflateBackInit_(z_streamp strm, int windowBits,
+ unsigned char FAR *window, const char *version,
+ int stream_size) {
struct inflate_state FAR *state;
if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
@@ -66,6 +59,7 @@ int stream_size;
state->window = window;
state->wnext = 0;
state->whave = 0;
+ state->sane = 1;
return Z_OK;
}
@@ -79,9 +73,7 @@ int stream_size;
used for threaded applications, since the rewriting of the tables and virgin
may not be thread-safe.
*/
-local void fixedtables(state)
-struct inflate_state FAR *state;
-{
+local void fixedtables(struct inflate_state FAR *state) {
#ifdef BUILDFIXED
static int virgin = 1;
static code *lenfix, *distfix;
@@ -247,13 +239,8 @@ struct inflate_state FAR *state;
inflateBack() can also return Z_STREAM_ERROR if the input parameters
are not correct, i.e. strm is Z_NULL or the state was not initialized.
*/
-int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc)
-z_streamp strm;
-in_func in;
-void FAR *in_desc;
-out_func out;
-void FAR *out_desc;
-{
+int ZEXPORT inflateBack(z_streamp strm, in_func in, void FAR *in_desc,
+ out_func out, void FAR *out_desc) {
struct inflate_state FAR *state;
z_const unsigned char FAR *next; /* next input */
unsigned char FAR *put; /* next output */
@@ -605,33 +592,33 @@ void FAR *out_desc;
break;
case DONE:
- /* inflate stream terminated properly -- write leftover output */
+ /* inflate stream terminated properly */
ret = Z_STREAM_END;
- if (left < state->wsize) {
- if (out(out_desc, state->window, state->wsize - left))
- ret = Z_BUF_ERROR;
- }
goto inf_leave;
case BAD:
ret = Z_DATA_ERROR;
goto inf_leave;
- default: /* can't happen, but makes compilers happy */
+ default:
+ /* can't happen, but makes compilers happy */
ret = Z_STREAM_ERROR;
goto inf_leave;
}
- /* Return unused input */
+ /* Write leftover output and return unused input */
inf_leave:
+ if (left < state->wsize) {
+ if (out(out_desc, state->window, state->wsize - left) &&
+ ret == Z_STREAM_END)
+ ret = Z_BUF_ERROR;
+ }
strm->next_in = next;
strm->avail_in = have;
return ret;
}
-int ZEXPORT inflateBackEnd(strm)
-z_streamp strm;
-{
+int ZEXPORT inflateBackEnd(z_streamp strm) {
if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
return Z_STREAM_ERROR;
ZFREE(strm, strm->state);
diff --git a/src/Common/zlib/inffast.c b/src/Common/zlib/inffast.c
index 1fec7f36..9354676e 100644
--- a/src/Common/zlib/inffast.c
+++ b/src/Common/zlib/inffast.c
@@ -47,10 +47,7 @@
requires strm->avail_out >= 258 for each loop to avoid checking for
output space.
*/
-void ZLIB_INTERNAL inflate_fast(strm, start)
-z_streamp strm;
-unsigned start; /* inflate()'s starting value for strm->avail_out */
-{
+void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start) {
struct inflate_state FAR *state;
z_const unsigned char FAR *in; /* local strm->next_in */
z_const unsigned char FAR *last; /* have enough input while in < last */
diff --git a/src/Common/zlib/inffast.h b/src/Common/zlib/inffast.h
index e5c1aa4c..49c6d156 100644
--- a/src/Common/zlib/inffast.h
+++ b/src/Common/zlib/inffast.h
@@ -8,4 +8,4 @@
subject to change. Applications should only use zlib.h.
*/
-void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start));
+void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start);
diff --git a/src/Common/zlib/inflate.c b/src/Common/zlib/inflate.c
index 7be8c636..94ecff01 100644
--- a/src/Common/zlib/inflate.c
+++ b/src/Common/zlib/inflate.c
@@ -91,20 +91,7 @@
# endif
#endif
-/* function prototypes */
-local int inflateStateCheck OF((z_streamp strm));
-local void fixedtables OF((struct inflate_state FAR *state));
-local int updatewindow OF((z_streamp strm, const unsigned char FAR *end,
- unsigned copy));
-#ifdef BUILDFIXED
- void makefixed OF((void));
-#endif
-local unsigned syncsearch OF((unsigned FAR *have, const unsigned char FAR *buf,
- unsigned len));
-
-local int inflateStateCheck(strm)
-z_streamp strm;
-{
+local int inflateStateCheck(z_streamp strm) {
struct inflate_state FAR *state;
if (strm == Z_NULL ||
strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
@@ -116,9 +103,7 @@ z_streamp strm;
return 0;
}
-int ZEXPORT inflateResetKeep(strm)
-z_streamp strm;
-{
+int ZEXPORT inflateResetKeep(z_streamp strm) {
struct inflate_state FAR *state;
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
@@ -142,9 +127,7 @@ z_streamp strm;
return Z_OK;
}
-int ZEXPORT inflateReset(strm)
-z_streamp strm;
-{
+int ZEXPORT inflateReset(z_streamp strm) {
struct inflate_state FAR *state;
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
@@ -155,10 +138,7 @@ z_streamp strm;
return inflateResetKeep(strm);
}
-int ZEXPORT inflateReset2(strm, windowBits)
-z_streamp strm;
-int windowBits;
-{
+int ZEXPORT inflateReset2(z_streamp strm, int windowBits) {
int wrap;
struct inflate_state FAR *state;
@@ -168,6 +148,8 @@ int windowBits;
/* extract wrap request from windowBits parameter */
if (windowBits < 0) {
+ if (windowBits < -15)
+ return Z_STREAM_ERROR;
wrap = 0;
windowBits = -windowBits;
}
@@ -193,12 +175,8 @@ int windowBits;
return inflateReset(strm);
}
-int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size)
-z_streamp strm;
-int windowBits;
-const char *version;
-int stream_size;
-{
+int ZEXPORT inflateInit2_(z_streamp strm, int windowBits,
+ const char *version, int stream_size) {
int ret;
struct inflate_state FAR *state;
@@ -237,22 +215,17 @@ int stream_size;
return ret;
}
-int ZEXPORT inflateInit_(strm, version, stream_size)
-z_streamp strm;
-const char *version;
-int stream_size;
-{
+int ZEXPORT inflateInit_(z_streamp strm, const char *version,
+ int stream_size) {
return inflateInit2_(strm, DEF_WBITS, version, stream_size);
}
-int ZEXPORT inflatePrime(strm, bits, value)
-z_streamp strm;
-int bits;
-int value;
-{
+int ZEXPORT inflatePrime(z_streamp strm, int bits, int value) {
struct inflate_state FAR *state;
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
+ if (bits == 0)
+ return Z_OK;
state = (struct inflate_state FAR *)strm->state;
if (bits < 0) {
state->hold = 0;
@@ -276,9 +249,7 @@ int value;
used for threaded applications, since the rewriting of the tables and virgin
may not be thread-safe.
*/
-local void fixedtables(state)
-struct inflate_state FAR *state;
-{
+local void fixedtables(struct inflate_state FAR *state) {
#ifdef BUILDFIXED
static int virgin = 1;
static code *lenfix, *distfix;
@@ -340,7 +311,7 @@ struct inflate_state FAR *state;
a.out > inffixed.h
*/
-void makefixed()
+void makefixed(void)
{
unsigned low, size;
struct inflate_state state;
@@ -394,11 +365,7 @@ void makefixed()
output will fall in the output data, making match copies simpler and faster.
The advantage may be dependent on the size of the processor's data caches.
*/
-local int updatewindow(strm, end, copy)
-z_streamp strm;
-const Bytef *end;
-unsigned copy;
-{
+local int updatewindow(z_streamp strm, const Bytef *end, unsigned copy) {
struct inflate_state FAR *state;
unsigned dist;
@@ -620,10 +587,7 @@ unsigned copy;
will return Z_BUF_ERROR if it has not reached the end of the stream.
*/
-int ZEXPORT inflate(strm, flush)
-z_streamp strm;
-int flush;
-{
+int ZEXPORT inflate(z_streamp strm, int flush) {
struct inflate_state FAR *state;
z_const unsigned char FAR *next; /* next input */
unsigned char FAR *put; /* next output */
@@ -764,8 +728,9 @@ int flush;
if (copy > have) copy = have;
if (copy) {
if (state->head != Z_NULL &&
- state->head->extra != Z_NULL) {
- len = state->head->extra_len - state->length;
+ state->head->extra != Z_NULL &&
+ (len = state->head->extra_len - state->length) <
+ state->head->extra_max) {
zmemcpy(state->head->extra + len, next,
len + copy > state->head->extra_max ?
state->head->extra_max - len : copy);
@@ -1298,9 +1263,7 @@ int flush;
return ret;
}
-int ZEXPORT inflateEnd(strm)
-z_streamp strm;
-{
+int ZEXPORT inflateEnd(z_streamp strm) {
struct inflate_state FAR *state;
if (inflateStateCheck(strm))
return Z_STREAM_ERROR;
@@ -1312,11 +1275,8 @@ z_streamp strm;
return Z_OK;
}
-int ZEXPORT inflateGetDictionary(strm, dictionary, dictLength)
-z_streamp strm;
-Bytef *dictionary;
-uInt *dictLength;
-{
+int ZEXPORT inflateGetDictionary(z_streamp strm, Bytef *dictionary,
+ uInt *dictLength) {
struct inflate_state FAR *state;
/* check state */
@@ -1335,11 +1295,8 @@ uInt *dictLength;
return Z_OK;
}
-int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength)
-z_streamp strm;
-const Bytef *dictionary;
-uInt dictLength;
-{
+int ZEXPORT inflateSetDictionary(z_streamp strm, const Bytef *dictionary,
+ uInt dictLength) {
struct inflate_state FAR *state;
unsigned long dictid;
int ret;
@@ -1370,10 +1327,7 @@ uInt dictLength;
return Z_OK;
}
-int ZEXPORT inflateGetHeader(strm, head)
-z_streamp strm;
-gz_headerp head;
-{
+int ZEXPORT inflateGetHeader(z_streamp strm, gz_headerp head) {
struct inflate_state FAR *state;
/* check state */
@@ -1398,11 +1352,8 @@ gz_headerp head;
called again with more data and the *have state. *have is initialized to
zero for the first call.
*/
-local unsigned syncsearch(have, buf, len)
-unsigned FAR *have;
-const unsigned char FAR *buf;
-unsigned len;
-{
+local unsigned syncsearch(unsigned FAR *have, const unsigned char FAR *buf,
+ unsigned len) {
unsigned got;
unsigned next;
@@ -1421,9 +1372,7 @@ unsigned len;
return next;
}
-int ZEXPORT inflateSync(strm)
-z_streamp strm;
-{
+int ZEXPORT inflateSync(z_streamp strm) {
unsigned len; /* number of bytes to look at or looked at */
int flags; /* temporary to save header status */
unsigned long in, out; /* temporary to save total_in and total_out */
@@ -1438,7 +1387,7 @@ z_streamp strm;
/* if first time, start search in bit buffer */
if (state->mode != SYNC) {
state->mode = SYNC;
- state->hold <<= state->bits & 7;
+ state->hold >>= state->bits & 7;
state->bits -= state->bits & 7;
len = 0;
while (state->bits >= 8) {
@@ -1479,9 +1428,7 @@ z_streamp strm;
block. When decompressing, PPP checks that at the end of input packet,
inflate is waiting for these length bytes.
*/
-int ZEXPORT inflateSyncPoint(strm)
-z_streamp strm;
-{
+int ZEXPORT inflateSyncPoint(z_streamp strm) {
struct inflate_state FAR *state;
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
@@ -1489,10 +1436,7 @@ z_streamp strm;
return state->mode == STORED && state->bits == 0;
}
-int ZEXPORT inflateCopy(dest, source)
-z_streamp dest;
-z_streamp source;
-{
+int ZEXPORT inflateCopy(z_streamp dest, z_streamp source) {
struct inflate_state FAR *state;
struct inflate_state FAR *copy;
unsigned char FAR *window;
@@ -1536,10 +1480,7 @@ z_streamp source;
return Z_OK;
}
-int ZEXPORT inflateUndermine(strm, subvert)
-z_streamp strm;
-int subvert;
-{
+int ZEXPORT inflateUndermine(z_streamp strm, int subvert) {
struct inflate_state FAR *state;
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
@@ -1554,10 +1495,7 @@ int subvert;
#endif
}
-int ZEXPORT inflateValidate(strm, check)
-z_streamp strm;
-int check;
-{
+int ZEXPORT inflateValidate(z_streamp strm, int check) {
struct inflate_state FAR *state;
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
@@ -1569,9 +1507,7 @@ int check;
return Z_OK;
}
-long ZEXPORT inflateMark(strm)
-z_streamp strm;
-{
+long ZEXPORT inflateMark(z_streamp strm) {
struct inflate_state FAR *state;
if (inflateStateCheck(strm))
@@ -1582,9 +1518,7 @@ z_streamp strm;
(state->mode == MATCH ? state->was - state->length : 0));
}
-unsigned long ZEXPORT inflateCodesUsed(strm)
-z_streamp strm;
-{
+unsigned long ZEXPORT inflateCodesUsed(z_streamp strm) {
struct inflate_state FAR *state;
if (inflateStateCheck(strm)) return (unsigned long)-1;
state = (struct inflate_state FAR *)strm->state;
diff --git a/src/Common/zlib/inftrees.c b/src/Common/zlib/inftrees.c
index 09462a74..98cfe164 100644
--- a/src/Common/zlib/inftrees.c
+++ b/src/Common/zlib/inftrees.c
@@ -1,5 +1,5 @@
/* inftrees.c -- generate Huffman trees for efficient decoding
- * Copyright (C) 1995-2022 Mark Adler
+ * Copyright (C) 1995-2024 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -9,7 +9,7 @@
#define MAXBITS 15
const char inflate_copyright[] =
- " inflate 1.2.12 Copyright 1995-2022 Mark Adler ";
+ " inflate 1.3.1 Copyright 1995-2024 Mark Adler ";
/*
If you use the zlib library in a product, an acknowledgment is welcome
in the documentation of your product. If for some reason you cannot
@@ -29,14 +29,9 @@ const char inflate_copyright[] =
table index bits. It will differ if the request is greater than the
longest code or if it is less than the shortest code.
*/
-int ZLIB_INTERNAL inflate_table(type, lens, codes, table, bits, work)
-codetype type;
-unsigned short FAR *lens;
-unsigned codes;
-code FAR * FAR *table;
-unsigned FAR *bits;
-unsigned short FAR *work;
-{
+int ZLIB_INTERNAL inflate_table(codetype type, unsigned short FAR *lens,
+ unsigned codes, code FAR * FAR *table,
+ unsigned FAR *bits, unsigned short FAR *work) {
unsigned len; /* a code's length in bits */
unsigned sym; /* index of code symbols */
unsigned min, max; /* minimum and maximum code lengths */
@@ -62,7 +57,7 @@ unsigned short FAR *work;
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
- 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 199, 202};
+ 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 203, 77};
static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
diff --git a/src/Common/zlib/inftrees.h b/src/Common/zlib/inftrees.h
index baa53a0b..396f74b5 100644
--- a/src/Common/zlib/inftrees.h
+++ b/src/Common/zlib/inftrees.h
@@ -38,11 +38,11 @@ typedef struct {
/* Maximum size of the dynamic table. The maximum number of code structures is
1444, which is the sum of 852 for literal/length codes and 592 for distance
codes. These values were found by exhaustive searches using the program
- examples/enough.c found in the zlib distribtution. The arguments to that
+ examples/enough.c found in the zlib distribution. The arguments to that
program are the number of symbols, the initial root table size, and the
maximum bit length of a code. "enough 286 9 15" for literal/length codes
- returns returns 852, and "enough 30 6 15" for distance codes returns 592.
- The initial root table size (9 or 6) is found in the fifth argument of the
+ returns 852, and "enough 30 6 15" for distance codes returns 592. The
+ initial root table size (9 or 6) is found in the fifth argument of the
inflate_table() calls in inflate.c and infback.c. If the root table size is
changed, then these maximum sizes would be need to be recalculated and
updated. */
@@ -57,6 +57,6 @@ typedef enum {
DISTS
} codetype;
-int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
- unsigned codes, code FAR * FAR *table,
- unsigned FAR *bits, unsigned short FAR *work));
+int ZLIB_INTERNAL inflate_table(codetype type, unsigned short FAR *lens,
+ unsigned codes, code FAR * FAR *table,
+ unsigned FAR *bits, unsigned short FAR *work);
diff --git a/src/Common/zlib/trees.c b/src/Common/zlib/trees.c
index f73fd99c..6a523ef3 100644
--- a/src/Common/zlib/trees.c
+++ b/src/Common/zlib/trees.c
@@ -1,5 +1,5 @@
/* trees.c -- output deflated data using Huffman coding
- * Copyright (C) 1995-2021 Jean-loup Gailly
+ * Copyright (C) 1995-2024 Jean-loup Gailly
* detect_data_type() function provided freely by Cosmin Truta, 2006
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -122,39 +122,116 @@ struct static_tree_desc_s {
int max_length; /* max bit length for the codes */
};
-local const static_tree_desc static_l_desc =
+#ifdef NO_INIT_GLOBAL_POINTERS
+# define TCONST
+#else
+# define TCONST const
+#endif
+
+local TCONST static_tree_desc static_l_desc =
{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS};
-local const static_tree_desc static_d_desc =
+local TCONST static_tree_desc static_d_desc =
{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS};
-local const static_tree_desc static_bl_desc =
+local TCONST static_tree_desc static_bl_desc =
{(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS};
/* ===========================================================================
- * Local (static) routines in this file.
+ * Output a short LSB first on the stream.
+ * IN assertion: there is enough room in pendingBuf.
+ */
+#define put_short(s, w) { \
+ put_byte(s, (uch)((w) & 0xff)); \
+ put_byte(s, (uch)((ush)(w) >> 8)); \
+}
+
+/* ===========================================================================
+ * Reverse the first len bits of a code, using straightforward code (a faster
+ * method would use a table)
+ * IN assertion: 1 <= len <= 15
+ */
+local unsigned bi_reverse(unsigned code, int len) {
+ register unsigned res = 0;
+ do {
+ res |= code & 1;
+ code >>= 1, res <<= 1;
+ } while (--len > 0);
+ return res >> 1;
+}
+
+/* ===========================================================================
+ * Flush the bit buffer, keeping at most 7 bits in it.
+ */
+local void bi_flush(deflate_state *s) {
+ if (s->bi_valid == 16) {
+ put_short(s, s->bi_buf);
+ s->bi_buf = 0;
+ s->bi_valid = 0;
+ } else if (s->bi_valid >= 8) {
+ put_byte(s, (Byte)s->bi_buf);
+ s->bi_buf >>= 8;
+ s->bi_valid -= 8;
+ }
+}
+
+/* ===========================================================================
+ * Flush the bit buffer and align the output on a byte boundary
+ */
+local void bi_windup(deflate_state *s) {
+ if (s->bi_valid > 8) {
+ put_short(s, s->bi_buf);
+ } else if (s->bi_valid > 0) {
+ put_byte(s, (Byte)s->bi_buf);
+ }
+ s->bi_buf = 0;
+ s->bi_valid = 0;
+#ifdef ZLIB_DEBUG
+ s->bits_sent = (s->bits_sent + 7) & ~7;
+#endif
+}
+
+/* ===========================================================================
+ * Generate the codes for a given tree and bit counts (which need not be
+ * optimal).
+ * IN assertion: the array bl_count contains the bit length statistics for
+ * the given tree and the field len is set for all tree elements.
+ * OUT assertion: the field code is set for all tree elements of non
+ * zero code length.
*/
+local void gen_codes(ct_data *tree, int max_code, ushf *bl_count) {
+ ush next_code[MAX_BITS+1]; /* next code value for each bit length */
+ unsigned code = 0; /* running code value */
+ int bits; /* bit index */
+ int n; /* code index */
-local void tr_static_init OF((void));
-local void init_block OF((deflate_state *s));
-local void pqdownheap OF((deflate_state *s, ct_data *tree, int k));
-local void gen_bitlen OF((deflate_state *s, tree_desc *desc));
-local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count));
-local void build_tree OF((deflate_state *s, tree_desc *desc));
-local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code));
-local void send_tree OF((deflate_state *s, ct_data *tree, int max_code));
-local int build_bl_tree OF((deflate_state *s));
-local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,
- int blcodes));
-local void compress_block OF((deflate_state *s, const ct_data *ltree,
- const ct_data *dtree));
-local int detect_data_type OF((deflate_state *s));
-local unsigned bi_reverse OF((unsigned code, int len));
-local void bi_windup OF((deflate_state *s));
-local void bi_flush OF((deflate_state *s));
+ /* The distribution counts are first used to generate the code values
+ * without bit reversal.
+ */
+ for (bits = 1; bits <= MAX_BITS; bits++) {
+ code = (code + bl_count[bits - 1]) << 1;
+ next_code[bits] = (ush)code;
+ }
+ /* Check that the bit counts in bl_count are consistent. The last code
+ * must be all ones.
+ */
+ Assert (code + bl_count[MAX_BITS] - 1 == (1 << MAX_BITS) - 1,
+ "inconsistent bit counts");
+ Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
+
+ for (n = 0; n <= max_code; n++) {
+ int len = tree[n].Len;
+ if (len == 0) continue;
+ /* Now reverse the bits */
+ tree[n].Code = (ush)bi_reverse(next_code[len]++, len);
+
+ Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
+ n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len] - 1));
+ }
+}
#ifdef GEN_TREES_H
-local void gen_trees_header OF((void));
+local void gen_trees_header(void);
#endif
#ifndef ZLIB_DEBUG
@@ -168,32 +245,17 @@ local void gen_trees_header OF((void));
#endif
/* ===========================================================================
- * Output a short LSB first on the stream.
- * IN assertion: there is enough room in pendingBuf.
- */
-#define put_short(s, w) { \
- put_byte(s, (uch)((w) & 0xff)); \
- put_byte(s, (uch)((ush)(w) >> 8)); \
-}
-
-/* ===========================================================================
* Send a value on a given number of bits.
* IN assertion: length <= 16 and value fits in length bits.
*/
#ifdef ZLIB_DEBUG
-local void send_bits OF((deflate_state *s, int value, int length));
-
-local void send_bits(s, value, length)
- deflate_state *s;
- int value; /* value to send */
- int length; /* number of bits */
-{
+local void send_bits(deflate_state *s, int value, int length) {
Tracevv((stderr," l %2d v %4x ", length, value));
Assert(length > 0 && length <= 15, "invalid length");
s->bits_sent += (ulg)length;
/* If not enough room in bi_buf, use (valid) bits from bi_buf and
- * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid))
+ * (16 - bi_valid) bits from value, leaving (width - (16 - bi_valid))
* unused bits in value.
*/
if (s->bi_valid > (int)Buf_size - length) {
@@ -229,8 +291,7 @@ local void send_bits(s, value, length)
/* ===========================================================================
* Initialize the various 'constant' tables.
*/
-local void tr_static_init()
-{
+local void tr_static_init(void) {
#if defined(GEN_TREES_H) || !defined(STDC)
static int static_init_done = 0;
int n; /* iterates over tree elements */
@@ -256,7 +317,7 @@ local void tr_static_init()
length = 0;
for (code = 0; code < LENGTH_CODES-1; code++) {
base_length[code] = length;
- for (n = 0; n < (1<<extra_lbits[code]); n++) {
+ for (n = 0; n < (1 << extra_lbits[code]); n++) {
_length_code[length++] = (uch)code;
}
}
@@ -265,13 +326,13 @@ local void tr_static_init()
* in two different ways: code 284 + 5 bits or code 285, so we
* overwrite length_code[255] to use the best encoding:
*/
- _length_code[length-1] = (uch)code;
+ _length_code[length - 1] = (uch)code;
/* Initialize the mapping dist (0..32K) -> dist code (0..29) */
dist = 0;
for (code = 0 ; code < 16; code++) {
base_dist[code] = dist;
- for (n = 0; n < (1<<extra_dbits[code]); n++) {
+ for (n = 0; n < (1 << extra_dbits[code]); n++) {
_dist_code[dist++] = (uch)code;
}
}
@@ -279,11 +340,11 @@ local void tr_static_init()
dist >>= 7; /* from now on, all distances are divided by 128 */
for ( ; code < D_CODES; code++) {
base_dist[code] = dist << 7;
- for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {
+ for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) {
_dist_code[256 + dist++] = (uch)code;
}
}
- Assert (dist == 256, "tr_static_init: 256+dist != 512");
+ Assert (dist == 256, "tr_static_init: 256 + dist != 512");
/* Construct the codes of the static literal tree */
for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0;
@@ -312,7 +373,7 @@ local void tr_static_init()
}
/* ===========================================================================
- * Genererate the file trees.h describing the static trees.
+ * Generate the file trees.h describing the static trees.
*/
#ifdef GEN_TREES_H
# ifndef ZLIB_DEBUG
@@ -321,10 +382,9 @@ local void tr_static_init()
# define SEPARATOR(i, last, width) \
((i) == (last)? "\n};\n\n" : \
- ((i) % (width) == (width)-1 ? ",\n" : ", "))
+ ((i) % (width) == (width) - 1 ? ",\n" : ", "))
-void gen_trees_header()
-{
+void gen_trees_header(void) {
FILE *header = fopen("trees.h", "w");
int i;
@@ -374,11 +434,25 @@ void gen_trees_header()
#endif /* GEN_TREES_H */
/* ===========================================================================
+ * Initialize a new block.
+ */
+local void init_block(deflate_state *s) {
+ int n; /* iterates over tree elements */
+
+ /* Initialize the trees. */
+ for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0;
+ for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0;
+ for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0;
+
+ s->dyn_ltree[END_BLOCK].Freq = 1;
+ s->opt_len = s->static_len = 0L;
+ s->sym_next = s->matches = 0;
+}
+
+/* ===========================================================================
* Initialize the tree data structures for a new zlib stream.
*/
-void ZLIB_INTERNAL _tr_init(s)
- deflate_state *s;
-{
+void ZLIB_INTERNAL _tr_init(deflate_state *s) {
tr_static_init();
s->l_desc.dyn_tree = s->dyn_ltree;
@@ -401,24 +475,6 @@ void ZLIB_INTERNAL _tr_init(s)
init_block(s);
}
-/* ===========================================================================
- * Initialize a new block.
- */
-local void init_block(s)
- deflate_state *s;
-{
- int n; /* iterates over tree elements */
-
- /* Initialize the trees. */
- for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0;
- for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0;
- for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0;
-
- s->dyn_ltree[END_BLOCK].Freq = 1;
- s->opt_len = s->static_len = 0L;
- s->sym_next = s->matches = 0;
-}
-
#define SMALLEST 1
/* Index within the heap array of least frequent node in the Huffman tree */
@@ -448,17 +504,13 @@ local void init_block(s)
* when the heap property is re-established (each father smaller than its
* two sons).
*/
-local void pqdownheap(s, tree, k)
- deflate_state *s;
- ct_data *tree; /* the tree to restore */
- int k; /* node to move down */
-{
+local void pqdownheap(deflate_state *s, ct_data *tree, int k) {
int v = s->heap[k];
int j = k << 1; /* left son of k */
while (j <= s->heap_len) {
/* Set j to the smallest of the two sons: */
if (j < s->heap_len &&
- smaller(tree, s->heap[j+1], s->heap[j], s->depth)) {
+ smaller(tree, s->heap[j + 1], s->heap[j], s->depth)) {
j++;
}
/* Exit if v is smaller than both sons */
@@ -483,10 +535,7 @@ local void pqdownheap(s, tree, k)
* The length opt_len is updated; static_len is also updated if stree is
* not null.
*/
-local void gen_bitlen(s, desc)
- deflate_state *s;
- tree_desc *desc; /* the tree descriptor */
-{
+local void gen_bitlen(deflate_state *s, tree_desc *desc) {
ct_data *tree = desc->dyn_tree;
int max_code = desc->max_code;
const ct_data *stree = desc->stat_desc->static_tree;
@@ -507,7 +556,7 @@ local void gen_bitlen(s, desc)
*/
tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */
- for (h = s->heap_max+1; h < HEAP_SIZE; h++) {
+ for (h = s->heap_max + 1; h < HEAP_SIZE; h++) {
n = s->heap[h];
bits = tree[tree[n].Dad].Len + 1;
if (bits > max_length) bits = max_length, overflow++;
@@ -518,7 +567,7 @@ local void gen_bitlen(s, desc)
s->bl_count[bits]++;
xbits = 0;
- if (n >= base) xbits = extra[n-base];
+ if (n >= base) xbits = extra[n - base];
f = tree[n].Freq;
s->opt_len += (ulg)f * (unsigned)(bits + xbits);
if (stree) s->static_len += (ulg)f * (unsigned)(stree[n].Len + xbits);
@@ -530,10 +579,10 @@ local void gen_bitlen(s, desc)
/* Find the first bit length which could increase: */
do {
- bits = max_length-1;
+ bits = max_length - 1;
while (s->bl_count[bits] == 0) bits--;
- s->bl_count[bits]--; /* move one leaf down the tree */
- s->bl_count[bits+1] += 2; /* move one overflow item as its brother */
+ s->bl_count[bits]--; /* move one leaf down the tree */
+ s->bl_count[bits + 1] += 2; /* move one overflow item as its brother */
s->bl_count[max_length]--;
/* The brother of the overflow item also moves one step up,
* but this does not affect bl_count[max_length]
@@ -561,48 +610,9 @@ local void gen_bitlen(s, desc)
}
}
-/* ===========================================================================
- * Generate the codes for a given tree and bit counts (which need not be
- * optimal).
- * IN assertion: the array bl_count contains the bit length statistics for
- * the given tree and the field len is set for all tree elements.
- * OUT assertion: the field code is set for all tree elements of non
- * zero code length.
- */
-local void gen_codes (tree, max_code, bl_count)
- ct_data *tree; /* the tree to decorate */
- int max_code; /* largest code with non zero frequency */
- ushf *bl_count; /* number of codes at each bit length */
-{
- ush next_code[MAX_BITS+1]; /* next code value for each bit length */
- unsigned code = 0; /* running code value */
- int bits; /* bit index */
- int n; /* code index */
-
- /* The distribution counts are first used to generate the code values
- * without bit reversal.
- */
- for (bits = 1; bits <= MAX_BITS; bits++) {
- code = (code + bl_count[bits-1]) << 1;
- next_code[bits] = (ush)code;
- }
- /* Check that the bit counts in bl_count are consistent. The last code
- * must be all ones.
- */
- Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
- "inconsistent bit counts");
- Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
-
- for (n = 0; n <= max_code; n++) {
- int len = tree[n].Len;
- if (len == 0) continue;
- /* Now reverse the bits */
- tree[n].Code = (ush)bi_reverse(next_code[len]++, len);
-
- Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
- n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
- }
-}
+#ifdef DUMP_BL_TREE
+# include <stdio.h>
+#endif
/* ===========================================================================
* Construct one Huffman tree and assigns the code bit strings and lengths.
@@ -612,10 +622,7 @@ local void gen_codes (tree, max_code, bl_count)
* and corresponding code. The length opt_len is updated; static_len is
* also updated if stree is not null. The field max_code is set.
*/
-local void build_tree(s, desc)
- deflate_state *s;
- tree_desc *desc; /* the tree descriptor */
-{
+local void build_tree(deflate_state *s, tree_desc *desc) {
ct_data *tree = desc->dyn_tree;
const ct_data *stree = desc->stat_desc->static_tree;
int elems = desc->stat_desc->elems;
@@ -624,7 +631,7 @@ local void build_tree(s, desc)
int node; /* new node being created */
/* Construct the initial heap, with least frequent element in
- * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
+ * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n + 1].
* heap[0] is not used.
*/
s->heap_len = 0, s->heap_max = HEAP_SIZE;
@@ -652,7 +659,7 @@ local void build_tree(s, desc)
}
desc->max_code = max_code;
- /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
+ /* The elements heap[heap_len/2 + 1 .. heap_len] are leaves of the tree,
* establish sub-heaps of increasing lengths:
*/
for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n);
@@ -700,11 +707,7 @@ local void build_tree(s, desc)
* Scan a literal or distance tree to determine the frequencies of the codes
* in the bit length tree.
*/
-local void scan_tree (s, tree, max_code)
- deflate_state *s;
- ct_data *tree; /* the tree to be scanned */
- int max_code; /* and its largest code of non zero frequency */
-{
+local void scan_tree(deflate_state *s, ct_data *tree, int max_code) {
int n; /* iterates over all tree elements */
int prevlen = -1; /* last emitted length */
int curlen; /* length of current code */
@@ -714,10 +717,10 @@ local void scan_tree (s, tree, max_code)
int min_count = 4; /* min repeat count */
if (nextlen == 0) max_count = 138, min_count = 3;
- tree[max_code+1].Len = (ush)0xffff; /* guard */
+ tree[max_code + 1].Len = (ush)0xffff; /* guard */
for (n = 0; n <= max_code; n++) {
- curlen = nextlen; nextlen = tree[n+1].Len;
+ curlen = nextlen; nextlen = tree[n + 1].Len;
if (++count < max_count && curlen == nextlen) {
continue;
} else if (count < min_count) {
@@ -745,11 +748,7 @@ local void scan_tree (s, tree, max_code)
* Send a literal or distance tree in compressed form, using the codes in
* bl_tree.
*/
-local void send_tree (s, tree, max_code)
- deflate_state *s;
- ct_data *tree; /* the tree to be scanned */
- int max_code; /* and its largest code of non zero frequency */
-{
+local void send_tree(deflate_state *s, ct_data *tree, int max_code) {
int n; /* iterates over all tree elements */
int prevlen = -1; /* last emitted length */
int curlen; /* length of current code */
@@ -758,11 +757,11 @@ local void send_tree (s, tree, max_code)
int max_count = 7; /* max repeat count */
int min_count = 4; /* min repeat count */
- /* tree[max_code+1].Len = -1; */ /* guard already set */
+ /* tree[max_code + 1].Len = -1; */ /* guard already set */
if (nextlen == 0) max_count = 138, min_count = 3;
for (n = 0; n <= max_code; n++) {
- curlen = nextlen; nextlen = tree[n+1].Len;
+ curlen = nextlen; nextlen = tree[n + 1].Len;
if (++count < max_count && curlen == nextlen) {
continue;
} else if (count < min_count) {
@@ -773,13 +772,13 @@ local void send_tree (s, tree, max_code)
send_code(s, curlen, s->bl_tree); count--;
}
Assert(count >= 3 && count <= 6, " 3_6?");
- send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2);
+ send_code(s, REP_3_6, s->bl_tree); send_bits(s, count - 3, 2);
} else if (count <= 10) {
- send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3);
+ send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count - 3, 3);
} else {
- send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7);
+ send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count - 11, 7);
}
count = 0; prevlen = curlen;
if (nextlen == 0) {
@@ -796,9 +795,7 @@ local void send_tree (s, tree, max_code)
* Construct the Huffman tree for the bit lengths and return the index in
* bl_order of the last bit length code to send.
*/
-local int build_bl_tree(s)
- deflate_state *s;
-{
+local int build_bl_tree(deflate_state *s) {
int max_blindex; /* index of last bit length code of non zero freq */
/* Determine the bit length frequencies for literal and distance trees */
@@ -807,8 +804,8 @@ local int build_bl_tree(s)
/* Build the bit length tree: */
build_tree(s, (tree_desc *)(&(s->bl_desc)));
- /* opt_len now includes the length of the tree representations, except
- * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
+ /* opt_len now includes the length of the tree representations, except the
+ * lengths of the bit lengths codes and the 5 + 5 + 4 bits for the counts.
*/
/* Determine the number of bit length codes to send. The pkzip format
@@ -819,7 +816,7 @@ local int build_bl_tree(s)
if (s->bl_tree[bl_order[max_blindex]].Len != 0) break;
}
/* Update opt_len to include the bit length tree and counts */
- s->opt_len += 3*((ulg)max_blindex+1) + 5+5+4;
+ s->opt_len += 3*((ulg)max_blindex + 1) + 5 + 5 + 4;
Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld",
s->opt_len, s->static_len));
@@ -831,42 +828,36 @@ local int build_bl_tree(s)
* lengths of the bit length codes, the literal tree and the distance tree.
* IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
*/
-local void send_all_trees(s, lcodes, dcodes, blcodes)
- deflate_state *s;
- int lcodes, dcodes, blcodes; /* number of codes for each tree */
-{
+local void send_all_trees(deflate_state *s, int lcodes, int dcodes,
+ int blcodes) {
int rank; /* index in bl_order */
Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,
"too many codes");
Tracev((stderr, "\nbl counts: "));
- send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */
- send_bits(s, dcodes-1, 5);
- send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */
+ send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */
+ send_bits(s, dcodes - 1, 5);
+ send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */
for (rank = 0; rank < blcodes; rank++) {
Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
send_bits(s, s->bl_tree[bl_order[rank]].Len, 3);
}
Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent));
- send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */
+ send_tree(s, (ct_data *)s->dyn_ltree, lcodes - 1); /* literal tree */
Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent));
- send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */
+ send_tree(s, (ct_data *)s->dyn_dtree, dcodes - 1); /* distance tree */
Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent));
}
/* ===========================================================================
* Send a stored block
*/
-void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last)
- deflate_state *s;
- charf *buf; /* input block */
- ulg stored_len; /* length of input block */
- int last; /* one if this is the last block for a file */
-{
- send_bits(s, (STORED_BLOCK<<1)+last, 3); /* send block type */
+void ZLIB_INTERNAL _tr_stored_block(deflate_state *s, charf *buf,
+ ulg stored_len, int last) {
+ send_bits(s, (STORED_BLOCK<<1) + last, 3); /* send block type */
bi_windup(s); /* align on byte boundary */
put_short(s, (ush)stored_len);
put_short(s, (ush)~stored_len);
@@ -877,16 +868,14 @@ void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last)
s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
s->compressed_len += (stored_len + 4) << 3;
s->bits_sent += 2*16;
- s->bits_sent += stored_len<<3;
+ s->bits_sent += stored_len << 3;
#endif
}
/* ===========================================================================
* Flush the bits in the bit buffer to pending output (leaves at most 7 bits)
*/
-void ZLIB_INTERNAL _tr_flush_bits(s)
- deflate_state *s;
-{
+void ZLIB_INTERNAL _tr_flush_bits(deflate_state *s) {
bi_flush(s);
}
@@ -894,9 +883,7 @@ void ZLIB_INTERNAL _tr_flush_bits(s)
* Send one empty static block to give enough lookahead for inflate.
* This takes 10 bits, of which 7 may remain in the bit buffer.
*/
-void ZLIB_INTERNAL _tr_align(s)
- deflate_state *s;
-{
+void ZLIB_INTERNAL _tr_align(deflate_state *s) {
send_bits(s, STATIC_TREES<<1, 3);
send_code(s, END_BLOCK, static_ltree);
#ifdef ZLIB_DEBUG
@@ -906,15 +893,107 @@ void ZLIB_INTERNAL _tr_align(s)
}
/* ===========================================================================
+ * Send the block data compressed using the given Huffman trees
+ */
+local void compress_block(deflate_state *s, const ct_data *ltree,
+ const ct_data *dtree) {
+ unsigned dist; /* distance of matched string */
+ int lc; /* match length or unmatched char (if dist == 0) */
+ unsigned sx = 0; /* running index in symbol buffers */
+ unsigned code; /* the code to send */
+ int extra; /* number of extra bits to send */
+
+ if (s->sym_next != 0) do {
+#ifdef LIT_MEM
+ dist = s->d_buf[sx];
+ lc = s->l_buf[sx++];
+#else
+ dist = s->sym_buf[sx++] & 0xff;
+ dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8;
+ lc = s->sym_buf[sx++];
+#endif
+ if (dist == 0) {
+ send_code(s, lc, ltree); /* send a literal byte */
+ Tracecv(isgraph(lc), (stderr," '%c' ", lc));
+ } else {
+ /* Here, lc is the match length - MIN_MATCH */
+ code = _length_code[lc];
+ send_code(s, code + LITERALS + 1, ltree); /* send length code */
+ extra = extra_lbits[code];
+ if (extra != 0) {
+ lc -= base_length[code];
+ send_bits(s, lc, extra); /* send the extra length bits */
+ }
+ dist--; /* dist is now the match distance - 1 */
+ code = d_code(dist);
+ Assert (code < D_CODES, "bad d_code");
+
+ send_code(s, code, dtree); /* send the distance code */
+ extra = extra_dbits[code];
+ if (extra != 0) {
+ dist -= (unsigned)base_dist[code];
+ send_bits(s, dist, extra); /* send the extra distance bits */
+ }
+ } /* literal or match pair ? */
+
+ /* Check for no overlay of pending_buf on needed symbols */
+#ifdef LIT_MEM
+ Assert(s->pending < 2 * (s->lit_bufsize + sx), "pendingBuf overflow");
+#else
+ Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow");
+#endif
+
+ } while (sx < s->sym_next);
+
+ send_code(s, END_BLOCK, ltree);
+}
+
+/* ===========================================================================
+ * Check if the data type is TEXT or BINARY, using the following algorithm:
+ * - TEXT if the two conditions below are satisfied:
+ * a) There are no non-portable control characters belonging to the
+ * "block list" (0..6, 14..25, 28..31).
+ * b) There is at least one printable character belonging to the
+ * "allow list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).
+ * - BINARY otherwise.
+ * - The following partially-portable control characters form a
+ * "gray list" that is ignored in this detection algorithm:
+ * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).
+ * IN assertion: the fields Freq of dyn_ltree are set.
+ */
+local int detect_data_type(deflate_state *s) {
+ /* block_mask is the bit mask of block-listed bytes
+ * set bits 0..6, 14..25, and 28..31
+ * 0xf3ffc07f = binary 11110011111111111100000001111111
+ */
+ unsigned long block_mask = 0xf3ffc07fUL;
+ int n;
+
+ /* Check for non-textual ("block-listed") bytes. */
+ for (n = 0; n <= 31; n++, block_mask >>= 1)
+ if ((block_mask & 1) && (s->dyn_ltree[n].Freq != 0))
+ return Z_BINARY;
+
+ /* Check for textual ("allow-listed") bytes. */
+ if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0
+ || s->dyn_ltree[13].Freq != 0)
+ return Z_TEXT;
+ for (n = 32; n < LITERALS; n++)
+ if (s->dyn_ltree[n].Freq != 0)
+ return Z_TEXT;
+
+ /* There are no "block-listed" or "allow-listed" bytes:
+ * this stream either is empty or has tolerated ("gray-listed") bytes only.
+ */
+ return Z_BINARY;
+}
+
+/* ===========================================================================
* Determine the best encoding for the current block: dynamic trees, static
* trees or store, and write out the encoded block.
*/
-void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
- deflate_state *s;
- charf *buf; /* input block, or NULL if too old */
- ulg stored_len; /* length of input block */
- int last; /* one if this is the last block for a file */
-{
+void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, charf *buf,
+ ulg stored_len, int last) {
ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
int max_blindex = 0; /* index of last bit length code of non zero freq */
@@ -943,14 +1022,17 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
max_blindex = build_bl_tree(s);
/* Determine the best encoding. Compute the block lengths in bytes. */
- opt_lenb = (s->opt_len+3+7)>>3;
- static_lenb = (s->static_len+3+7)>>3;
+ opt_lenb = (s->opt_len + 3 + 7) >> 3;
+ static_lenb = (s->static_len + 3 + 7) >> 3;
Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
s->sym_next / 3));
- if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
+#ifndef FORCE_STATIC
+ if (static_lenb <= opt_lenb || s->strategy == Z_FIXED)
+#endif
+ opt_lenb = static_lenb;
} else {
Assert(buf != (char*)0, "lost buf");
@@ -960,7 +1042,7 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
#ifdef FORCE_STORED
if (buf != (char*)0) { /* force stored block */
#else
- if (stored_len+4 <= opt_lenb && buf != (char*)0) {
+ if (stored_len + 4 <= opt_lenb && buf != (char*)0) {
/* 4: two words for the lengths */
#endif
/* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
@@ -971,21 +1053,17 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
*/
_tr_stored_block(s, buf, stored_len, last);
-#ifdef FORCE_STATIC
- } else if (static_lenb >= 0) { /* force static trees */
-#else
- } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) {
-#endif
- send_bits(s, (STATIC_TREES<<1)+last, 3);
+ } else if (static_lenb == opt_lenb) {
+ send_bits(s, (STATIC_TREES<<1) + last, 3);
compress_block(s, (const ct_data *)static_ltree,
(const ct_data *)static_dtree);
#ifdef ZLIB_DEBUG
s->compressed_len += 3 + s->static_len;
#endif
} else {
- send_bits(s, (DYN_TREES<<1)+last, 3);
- send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1,
- max_blindex+1);
+ send_bits(s, (DYN_TREES<<1) + last, 3);
+ send_all_trees(s, s->l_desc.max_code + 1, s->d_desc.max_code + 1,
+ max_blindex + 1);
compress_block(s, (const ct_data *)s->dyn_ltree,
(const ct_data *)s->dyn_dtree);
#ifdef ZLIB_DEBUG
@@ -1004,22 +1082,23 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
s->compressed_len += 7; /* align on byte boundary */
#endif
}
- Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
- s->compressed_len-7*last));
+ Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len >> 3,
+ s->compressed_len - 7*last));
}
/* ===========================================================================
* Save the match info and tally the frequency counts. Return true if
* the current block must be flushed.
*/
-int ZLIB_INTERNAL _tr_tally (s, dist, lc)
- deflate_state *s;
- unsigned dist; /* distance of matched string */
- unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
-{
- s->sym_buf[s->sym_next++] = dist;
- s->sym_buf[s->sym_next++] = dist >> 8;
- s->sym_buf[s->sym_next++] = lc;
+int ZLIB_INTERNAL _tr_tally(deflate_state *s, unsigned dist, unsigned lc) {
+#ifdef LIT_MEM
+ s->d_buf[s->sym_next] = (ush)dist;
+ s->l_buf[s->sym_next++] = (uch)lc;
+#else
+ s->sym_buf[s->sym_next++] = (uch)dist;
+ s->sym_buf[s->sym_next++] = (uch)(dist >> 8);
+ s->sym_buf[s->sym_next++] = (uch)lc;
+#endif
if (dist == 0) {
/* lc is the unmatched char */
s->dyn_ltree[lc].Freq++;
@@ -1031,152 +1110,8 @@ int ZLIB_INTERNAL _tr_tally (s, dist, lc)
(ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&
(ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match");
- s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++;
+ s->dyn_ltree[_length_code[lc] + LITERALS + 1].Freq++;
s->dyn_dtree[d_code(dist)].Freq++;
}
return (s->sym_next == s->sym_end);
}
-
-/* ===========================================================================
- * Send the block data compressed using the given Huffman trees
- */
-local void compress_block(s, ltree, dtree)
- deflate_state *s;
- const ct_data *ltree; /* literal tree */
- const ct_data *dtree; /* distance tree */
-{
- unsigned dist; /* distance of matched string */
- int lc; /* match length or unmatched char (if dist == 0) */
- unsigned sx = 0; /* running index in sym_buf */
- unsigned code; /* the code to send */
- int extra; /* number of extra bits to send */
-
- if (s->sym_next != 0) do {
- dist = s->sym_buf[sx++] & 0xff;
- dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8;
- lc = s->sym_buf[sx++];
- if (dist == 0) {
- send_code(s, lc, ltree); /* send a literal byte */
- Tracecv(isgraph(lc), (stderr," '%c' ", lc));
- } else {
- /* Here, lc is the match length - MIN_MATCH */
- code = _length_code[lc];
- send_code(s, code+LITERALS+1, ltree); /* send the length code */
- extra = extra_lbits[code];
- if (extra != 0) {
- lc -= base_length[code];
- send_bits(s, lc, extra); /* send the extra length bits */
- }
- dist--; /* dist is now the match distance - 1 */
- code = d_code(dist);
- Assert (code < D_CODES, "bad d_code");
-
- send_code(s, code, dtree); /* send the distance code */
- extra = extra_dbits[code];
- if (extra != 0) {
- dist -= (unsigned)base_dist[code];
- send_bits(s, dist, extra); /* send the extra distance bits */
- }
- } /* literal or match pair ? */
-
- /* Check that the overlay between pending_buf and sym_buf is ok: */
- Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow");
-
- } while (sx < s->sym_next);
-
- send_code(s, END_BLOCK, ltree);
-}
-
-/* ===========================================================================
- * Check if the data type is TEXT or BINARY, using the following algorithm:
- * - TEXT if the two conditions below are satisfied:
- * a) There are no non-portable control characters belonging to the
- * "block list" (0..6, 14..25, 28..31).
- * b) There is at least one printable character belonging to the
- * "allow list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).
- * - BINARY otherwise.
- * - The following partially-portable control characters form a
- * "gray list" that is ignored in this detection algorithm:
- * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).
- * IN assertion: the fields Freq of dyn_ltree are set.
- */
-local int detect_data_type(s)
- deflate_state *s;
-{
- /* block_mask is the bit mask of block-listed bytes
- * set bits 0..6, 14..25, and 28..31
- * 0xf3ffc07f = binary 11110011111111111100000001111111
- */
- unsigned long block_mask = 0xf3ffc07fUL;
- int n;
-
- /* Check for non-textual ("block-listed") bytes. */
- for (n = 0; n <= 31; n++, block_mask >>= 1)
- if ((block_mask & 1) && (s->dyn_ltree[n].Freq != 0))
- return Z_BINARY;
-
- /* Check for textual ("allow-listed") bytes. */
- if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0
- || s->dyn_ltree[13].Freq != 0)
- return Z_TEXT;
- for (n = 32; n < LITERALS; n++)
- if (s->dyn_ltree[n].Freq != 0)
- return Z_TEXT;
-
- /* There are no "block-listed" or "allow-listed" bytes:
- * this stream either is empty or has tolerated ("gray-listed") bytes only.
- */
- return Z_BINARY;
-}
-
-/* ===========================================================================
- * Reverse the first len bits of a code, using straightforward code (a faster
- * method would use a table)
- * IN assertion: 1 <= len <= 15
- */
-local unsigned bi_reverse(code, len)
- unsigned code; /* the value to invert */
- int len; /* its bit length */
-{
- register unsigned res = 0;
- do {
- res |= code & 1;
- code >>= 1, res <<= 1;
- } while (--len > 0);
- return res >> 1;
-}
-
-/* ===========================================================================
- * Flush the bit buffer, keeping at most 7 bits in it.
- */
-local void bi_flush(s)
- deflate_state *s;
-{
- if (s->bi_valid == 16) {
- put_short(s, s->bi_buf);
- s->bi_buf = 0;
- s->bi_valid = 0;
- } else if (s->bi_valid >= 8) {
- put_byte(s, (Byte)s->bi_buf);
- s->bi_buf >>= 8;
- s->bi_valid -= 8;
- }
-}
-
-/* ===========================================================================
- * Flush the bit buffer and align the output on a byte boundary
- */
-local void bi_windup(s)
- deflate_state *s;
-{
- if (s->bi_valid > 8) {
- put_short(s, s->bi_buf);
- } else if (s->bi_valid > 0) {
- put_byte(s, (Byte)s->bi_buf);
- }
- s->bi_buf = 0;
- s->bi_valid = 0;
-#ifdef ZLIB_DEBUG
- s->bits_sent = (s->bits_sent+7) & ~7;
-#endif
-}
diff --git a/src/Common/zlib/uncompr.c b/src/Common/zlib/uncompr.c
index f03a1a86..5e256663 100644
--- a/src/Common/zlib/uncompr.c
+++ b/src/Common/zlib/uncompr.c
@@ -24,12 +24,8 @@
Z_DATA_ERROR if the input data was corrupted, including if the input data is
an incomplete zlib stream.
*/
-int ZEXPORT uncompress2 (dest, destLen, source, sourceLen)
- Bytef *dest;
- uLongf *destLen;
- const Bytef *source;
- uLong *sourceLen;
-{
+int ZEXPORT uncompress2(Bytef *dest, uLongf *destLen, const Bytef *source,
+ uLong *sourceLen) {
z_stream stream;
int err;
const uInt max = (uInt)-1;
@@ -83,11 +79,7 @@ int ZEXPORT uncompress2 (dest, destLen, source, sourceLen)
err;
}
-int ZEXPORT uncompress (dest, destLen, source, sourceLen)
- Bytef *dest;
- uLongf *destLen;
- const Bytef *source;
- uLong sourceLen;
-{
+int ZEXPORT uncompress(Bytef *dest, uLongf *destLen, const Bytef *source,
+ uLong sourceLen) {
return uncompress2(dest, destLen, source, &sourceLen);
}
diff --git a/src/Common/zlib/zconf.h b/src/Common/zlib/zconf.h
index 5e1d68a0..62adc8d8 100644
--- a/src/Common/zlib/zconf.h
+++ b/src/Common/zlib/zconf.h
@@ -1,5 +1,5 @@
/* zconf.h -- configuration of the zlib compression library
- * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler
+ * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -38,6 +38,9 @@
# define crc32 z_crc32
# define crc32_combine z_crc32_combine
# define crc32_combine64 z_crc32_combine64
+# define crc32_combine_gen z_crc32_combine_gen
+# define crc32_combine_gen64 z_crc32_combine_gen64
+# define crc32_combine_op z_crc32_combine_op
# define crc32_z z_crc32_z
# define deflate z_deflate
# define deflateBound z_deflateBound
@@ -238,7 +241,11 @@
#endif
#ifdef Z_SOLO
- typedef unsigned long z_size_t;
+# ifdef _WIN64
+ typedef unsigned long long z_size_t;
+# else
+ typedef unsigned long z_size_t;
+# endif
#else
# define z_longlong long long
# if defined(NO_SIZE_T)
@@ -293,14 +300,6 @@
# endif
#endif
-#ifndef Z_ARG /* function prototypes for stdarg */
-# if defined(STDC) || defined(Z_HAVE_STDARG_H)
-# define Z_ARG(args) args
-# else
-# define Z_ARG(args) ()
-# endif
-#endif
-
/* The following definitions for FAR are needed only for MSDOS mixed
* model programming (small or medium model with some far allocations).
* This was tested only with MSC; for other MSDOS compilers you may have
@@ -349,6 +348,9 @@
# ifdef FAR
# undef FAR
# endif
+# ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+# endif
# include <windows.h>
/* No need for _export, use ZLIB.DEF instead. */
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
@@ -467,11 +469,18 @@ typedef uLong FAR uLongf;
# undef _LARGEFILE64_SOURCE
#endif
-#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H)
-# define Z_HAVE_UNISTD_H
+#ifndef Z_HAVE_UNISTD_H
+# ifdef __WATCOMC__
+# define Z_HAVE_UNISTD_H
+# endif
+#endif
+#ifndef Z_HAVE_UNISTD_H
+# if defined(_LARGEFILE64_SOURCE) && !defined(_WIN32)
+# define Z_HAVE_UNISTD_H
+# endif
#endif
#ifndef Z_SOLO
-# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
+# if defined(Z_HAVE_UNISTD_H)
# include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
# ifdef VMS
# include <unixio.h> /* for off_t */
@@ -507,7 +516,7 @@ typedef uLong FAR uLongf;
#if !defined(_WIN32) && defined(Z_LARGE64)
# define z_off64_t off64_t
#else
-# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO)
+# if defined(_WIN32) && !defined(__GNUC__)
# define z_off64_t __int64
# else
# define z_off64_t z_off_t
diff --git a/src/Common/zlib/zlib.h b/src/Common/zlib/zlib.h
index 4a98e38b..8d4b932e 100644
--- a/src/Common/zlib/zlib.h
+++ b/src/Common/zlib/zlib.h
@@ -1,7 +1,7 @@
/* zlib.h -- interface of the 'zlib' general purpose compression library
- version 1.2.12, March 11th, 2022
+ version 1.3.1, January 22nd, 2024
- Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler
+ Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -37,11 +37,11 @@
extern "C" {
#endif
-#define ZLIB_VERSION "1.2.12"
-#define ZLIB_VERNUM 0x12c0
+#define ZLIB_VERSION "1.3.1"
+#define ZLIB_VERNUM 0x1310
#define ZLIB_VER_MAJOR 1
-#define ZLIB_VER_MINOR 2
-#define ZLIB_VER_REVISION 12
+#define ZLIB_VER_MINOR 3
+#define ZLIB_VER_REVISION 1
#define ZLIB_VER_SUBREVISION 0
/*
@@ -78,8 +78,8 @@ extern "C" {
even in the case of corrupted input.
*/
-typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
-typedef void (*free_func) OF((voidpf opaque, voidpf address));
+typedef voidpf (*alloc_func)(voidpf opaque, uInt items, uInt size);
+typedef void (*free_func)(voidpf opaque, voidpf address);
struct internal_state;
@@ -217,7 +217,7 @@ typedef gz_header FAR *gz_headerp;
/* basic functions */
-ZEXTERN const char * ZEXPORT zlibVersion OF((void));
+ZEXTERN const char * ZEXPORT zlibVersion(void);
/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
If the first character differs, the library code actually used is not
compatible with the zlib.h header file used by the application. This check
@@ -225,12 +225,12 @@ ZEXTERN const char * ZEXPORT zlibVersion OF((void));
*/
/*
-ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
+ZEXTERN int ZEXPORT deflateInit(z_streamp strm, int level);
Initializes the internal stream state for compression. The fields
zalloc, zfree and opaque must be initialized before by the caller. If
zalloc and zfree are set to Z_NULL, deflateInit updates them to use default
- allocation functions.
+ allocation functions. total_in, total_out, adler, and msg are initialized.
The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
1 gives best speed, 9 gives best compression, 0 gives no compression at all
@@ -247,7 +247,7 @@ ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
*/
-ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
+ZEXTERN int ZEXPORT deflate(z_streamp strm, int flush);
/*
deflate compresses as much data as possible, and stops when the input
buffer becomes empty or the output buffer becomes full. It may introduce
@@ -276,7 +276,7 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
== 0), or after each call of deflate(). If deflate returns Z_OK and with
zero avail_out, it must be called again after making room in the output
buffer because there might be more output pending. See deflatePending(),
- which can be used if desired to determine whether or not there is more ouput
+ which can be used if desired to determine whether or not there is more output
in that case.
Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to
@@ -320,8 +320,8 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
with the same value of the flush parameter and more output space (updated
avail_out), until the flush is complete (deflate returns with non-zero
avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that
- avail_out is greater than six to avoid repeated flush markers due to
- avail_out == 0 on return.
+ avail_out is greater than six when the flush marker begins, in order to avoid
+ repeated flush markers upon calling deflate() again when avail_out == 0.
If the parameter flush is set to Z_FINISH, pending input is processed,
pending output is flushed and deflate returns with Z_STREAM_END if there was
@@ -360,7 +360,7 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
*/
-ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
+ZEXTERN int ZEXPORT deflateEnd(z_streamp strm);
/*
All dynamically allocated data structures for this stream are freed.
This function discards any unprocessed input and does not flush any pending
@@ -375,7 +375,7 @@ ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
/*
-ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
+ZEXTERN int ZEXPORT inflateInit(z_streamp strm);
Initializes the internal stream state for decompression. The fields
next_in, avail_in, zalloc, zfree and opaque must be initialized before by
@@ -383,7 +383,8 @@ ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
read or consumed. The allocation of a sliding window will be deferred to
the first call of inflate (if the decompression does not complete on the
first call). If zalloc and zfree are set to Z_NULL, inflateInit updates
- them to use default allocation functions.
+ them to use default allocation functions. total_in, total_out, adler, and
+ msg are initialized.
inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
@@ -397,7 +398,7 @@ ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
*/
-ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
+ZEXTERN int ZEXPORT inflate(z_streamp strm, int flush);
/*
inflate decompresses as much data as possible, and stops when the input
buffer becomes empty or the output buffer becomes full. It may introduce
@@ -517,7 +518,7 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
*/
-ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
+ZEXTERN int ZEXPORT inflateEnd(z_streamp strm);
/*
All dynamically allocated data structures for this stream are freed.
This function discards any unprocessed input and does not flush any pending
@@ -535,12 +536,12 @@ ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
*/
/*
-ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
- int level,
- int method,
- int windowBits,
- int memLevel,
- int strategy));
+ZEXTERN int ZEXPORT deflateInit2(z_streamp strm,
+ int level,
+ int method,
+ int windowBits,
+ int memLevel,
+ int strategy);
This is another version of deflateInit with more compression options. The
fields zalloc, zfree and opaque must be initialized before by the caller.
@@ -607,9 +608,9 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
compression: this will be done by deflate().
*/
-ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
- const Bytef *dictionary,
- uInt dictLength));
+ZEXTERN int ZEXPORT deflateSetDictionary(z_streamp strm,
+ const Bytef *dictionary,
+ uInt dictLength);
/*
Initializes the compression dictionary from the given byte sequence
without producing any compressed output. When using the zlib format, this
@@ -651,16 +652,16 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
not perform any compression: this will be done by deflate().
*/
-ZEXTERN int ZEXPORT deflateGetDictionary OF((z_streamp strm,
- Bytef *dictionary,
- uInt *dictLength));
+ZEXTERN int ZEXPORT deflateGetDictionary(z_streamp strm,
+ Bytef *dictionary,
+ uInt *dictLength);
/*
Returns the sliding dictionary being maintained by deflate. dictLength is
set to the number of bytes in the dictionary, and that many bytes are copied
to dictionary. dictionary must have enough space, where 32768 bytes is
always enough. If deflateGetDictionary() is called with dictionary equal to
Z_NULL, then only the dictionary length is returned, and nothing is copied.
- Similary, if dictLength is Z_NULL, then it is not set.
+ Similarly, if dictLength is Z_NULL, then it is not set.
deflateGetDictionary() may return a length less than the window size, even
when more than the window size in input has been provided. It may return up
@@ -673,8 +674,8 @@ ZEXTERN int ZEXPORT deflateGetDictionary OF((z_streamp strm,
stream state is inconsistent.
*/
-ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
- z_streamp source));
+ZEXTERN int ZEXPORT deflateCopy(z_streamp dest,
+ z_streamp source);
/*
Sets the destination stream as a complete copy of the source stream.
@@ -691,20 +692,20 @@ ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
destination.
*/
-ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
+ZEXTERN int ZEXPORT deflateReset(z_streamp strm);
/*
This function is equivalent to deflateEnd followed by deflateInit, but
does not free and reallocate the internal compression state. The stream
will leave the compression level and any other attributes that may have been
- set unchanged.
+ set unchanged. total_in, total_out, adler, and msg are initialized.
deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent (such as zalloc or state being Z_NULL).
*/
-ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
- int level,
- int strategy));
+ZEXTERN int ZEXPORT deflateParams(z_streamp strm,
+ int level,
+ int strategy);
/*
Dynamically update the compression level and compression strategy. The
interpretation of level and strategy is as in deflateInit2(). This can be
@@ -729,7 +730,7 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
Then no more input data should be provided before the deflateParams() call.
If this is done, the old level and strategy will be applied to the data
compressed before deflateParams(), and the new level and strategy will be
- applied to the the data compressed after deflateParams().
+ applied to the data compressed after deflateParams().
deflateParams returns Z_OK on success, Z_STREAM_ERROR if the source stream
state was inconsistent or if a parameter was invalid, or Z_BUF_ERROR if
@@ -740,11 +741,11 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
retried with more output space.
*/
-ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
- int good_length,
- int max_lazy,
- int nice_length,
- int max_chain));
+ZEXTERN int ZEXPORT deflateTune(z_streamp strm,
+ int good_length,
+ int max_lazy,
+ int nice_length,
+ int max_chain);
/*
Fine tune deflate's internal compression parameters. This should only be
used by someone who understands the algorithm used by zlib's deflate for
@@ -757,8 +758,8 @@ ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.
*/
-ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
- uLong sourceLen));
+ZEXTERN uLong ZEXPORT deflateBound(z_streamp strm,
+ uLong sourceLen);
/*
deflateBound() returns an upper bound on the compressed size after
deflation of sourceLen bytes. It must be called after deflateInit() or
@@ -772,9 +773,9 @@ ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
than Z_FINISH or Z_NO_FLUSH are used.
*/
-ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm,
- unsigned *pending,
- int *bits));
+ZEXTERN int ZEXPORT deflatePending(z_streamp strm,
+ unsigned *pending,
+ int *bits);
/*
deflatePending() returns the number of bytes and bits of output that have
been generated, but not yet provided in the available output. The bytes not
@@ -787,9 +788,9 @@ ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm,
stream state was inconsistent.
*/
-ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
- int bits,
- int value));
+ZEXTERN int ZEXPORT deflatePrime(z_streamp strm,
+ int bits,
+ int value);
/*
deflatePrime() inserts bits in the deflate output stream. The intent
is that this function is used to start off the deflate output with the bits
@@ -804,8 +805,8 @@ ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
source stream state was inconsistent.
*/
-ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
- gz_headerp head));
+ZEXTERN int ZEXPORT deflateSetHeader(z_streamp strm,
+ gz_headerp head);
/*
deflateSetHeader() provides gzip header information for when a gzip
stream is requested by deflateInit2(). deflateSetHeader() may be called
@@ -821,16 +822,17 @@ ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
gzip file" and give up.
If deflateSetHeader is not used, the default gzip header has text false,
- the time set to zero, and os set to 255, with no extra, name, or comment
- fields. The gzip header is returned to the default state by deflateReset().
+ the time set to zero, and os set to the current operating system, with no
+ extra, name, or comment fields. The gzip header is returned to the default
+ state by deflateReset().
deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent.
*/
/*
-ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
- int windowBits));
+ZEXTERN int ZEXPORT inflateInit2(z_streamp strm,
+ int windowBits);
This is another version of inflateInit with an extra parameter. The
fields next_in, avail_in, zalloc, zfree and opaque must be initialized
@@ -883,9 +885,9 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
deferred until inflate() is called.
*/
-ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
- const Bytef *dictionary,
- uInt dictLength));
+ZEXTERN int ZEXPORT inflateSetDictionary(z_streamp strm,
+ const Bytef *dictionary,
+ uInt dictLength);
/*
Initializes the decompression dictionary from the given uncompressed byte
sequence. This function must be called immediately after a call of inflate,
@@ -906,22 +908,22 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
inflate().
*/
-ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm,
- Bytef *dictionary,
- uInt *dictLength));
+ZEXTERN int ZEXPORT inflateGetDictionary(z_streamp strm,
+ Bytef *dictionary,
+ uInt *dictLength);
/*
Returns the sliding dictionary being maintained by inflate. dictLength is
set to the number of bytes in the dictionary, and that many bytes are copied
to dictionary. dictionary must have enough space, where 32768 bytes is
always enough. If inflateGetDictionary() is called with dictionary equal to
Z_NULL, then only the dictionary length is returned, and nothing is copied.
- Similary, if dictLength is Z_NULL, then it is not set.
+ Similarly, if dictLength is Z_NULL, then it is not set.
inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the
stream state is inconsistent.
*/
-ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
+ZEXTERN int ZEXPORT inflateSync(z_streamp strm);
/*
Skips invalid compressed data until a possible full flush point (see above
for the description of deflate with Z_FULL_FLUSH) can be found, or until all
@@ -934,14 +936,14 @@ ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
inflateSync returns Z_OK if a possible full flush point has been found,
Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point
has been found, or Z_STREAM_ERROR if the stream structure was inconsistent.
- In the success case, the application may save the current current value of
- total_in which indicates where valid compressed data was found. In the
- error case, the application may repeatedly call inflateSync, providing more
- input each time, until success or end of the input data.
+ In the success case, the application may save the current value of total_in
+ which indicates where valid compressed data was found. In the error case,
+ the application may repeatedly call inflateSync, providing more input each
+ time, until success or end of the input data.
*/
-ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
- z_streamp source));
+ZEXTERN int ZEXPORT inflateCopy(z_streamp dest,
+ z_streamp source);
/*
Sets the destination stream as a complete copy of the source stream.
@@ -956,18 +958,19 @@ ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
destination.
*/
-ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
+ZEXTERN int ZEXPORT inflateReset(z_streamp strm);
/*
This function is equivalent to inflateEnd followed by inflateInit,
but does not free and reallocate the internal decompression state. The
stream will keep attributes that may have been set by inflateInit2.
+ total_in, total_out, adler, and msg are initialized.
inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent (such as zalloc or state being Z_NULL).
*/
-ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm,
- int windowBits));
+ZEXTERN int ZEXPORT inflateReset2(z_streamp strm,
+ int windowBits);
/*
This function is the same as inflateReset, but it also permits changing
the wrap and window size requests. The windowBits parameter is interpreted
@@ -980,9 +983,9 @@ ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm,
the windowBits parameter is invalid.
*/
-ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
- int bits,
- int value));
+ZEXTERN int ZEXPORT inflatePrime(z_streamp strm,
+ int bits,
+ int value);
/*
This function inserts bits in the inflate input stream. The intent is
that this function is used to start inflating at a bit position in the
@@ -1001,7 +1004,7 @@ ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
stream state was inconsistent.
*/
-ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm));
+ZEXTERN long ZEXPORT inflateMark(z_streamp strm);
/*
This function returns two values, one in the lower 16 bits of the return
value, and the other in the remaining upper bits, obtained by shifting the
@@ -1029,8 +1032,8 @@ ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm));
source stream state was inconsistent.
*/
-ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
- gz_headerp head));
+ZEXTERN int ZEXPORT inflateGetHeader(z_streamp strm,
+ gz_headerp head);
/*
inflateGetHeader() requests that gzip header information be stored in the
provided gz_header structure. inflateGetHeader() may be called after
@@ -1070,8 +1073,8 @@ ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
*/
/*
-ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
- unsigned char FAR *window));
+ZEXTERN int ZEXPORT inflateBackInit(z_streamp strm, int windowBits,
+ unsigned char FAR *window);
Initialize the internal stream state for decompression using inflateBack()
calls. The fields zalloc, zfree and opaque in strm must be initialized
@@ -1091,13 +1094,13 @@ ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
the version of the header file.
*/
-typedef unsigned (*in_func) OF((void FAR *,
- z_const unsigned char FAR * FAR *));
-typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
+typedef unsigned (*in_func)(void FAR *,
+ z_const unsigned char FAR * FAR *);
+typedef int (*out_func)(void FAR *, unsigned char FAR *, unsigned);
-ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
- in_func in, void FAR *in_desc,
- out_func out, void FAR *out_desc));
+ZEXTERN int ZEXPORT inflateBack(z_streamp strm,
+ in_func in, void FAR *in_desc,
+ out_func out, void FAR *out_desc);
/*
inflateBack() does a raw inflate with a single call using a call-back
interface for input and output. This is potentially more efficient than
@@ -1165,7 +1168,7 @@ ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
cannot return Z_OK.
*/
-ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));
+ZEXTERN int ZEXPORT inflateBackEnd(z_streamp strm);
/*
All memory allocated by inflateBackInit() is freed.
@@ -1173,7 +1176,7 @@ ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));
state was inconsistent.
*/
-ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
+ZEXTERN uLong ZEXPORT zlibCompileFlags(void);
/* Return flags indicating compile-time options.
Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:
@@ -1226,8 +1229,8 @@ ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
you need special options.
*/
-ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen));
+ZEXTERN int ZEXPORT compress(Bytef *dest, uLongf *destLen,
+ const Bytef *source, uLong sourceLen);
/*
Compresses the source buffer into the destination buffer. sourceLen is
the byte length of the source buffer. Upon entry, destLen is the total size
@@ -1241,9 +1244,9 @@ ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
buffer.
*/
-ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen,
- int level));
+ZEXTERN int ZEXPORT compress2(Bytef *dest, uLongf *destLen,
+ const Bytef *source, uLong sourceLen,
+ int level);
/*
Compresses the source buffer into the destination buffer. The level
parameter has the same meaning as in deflateInit. sourceLen is the byte
@@ -1257,15 +1260,15 @@ ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
Z_STREAM_ERROR if the level parameter is invalid.
*/
-ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));
+ZEXTERN uLong ZEXPORT compressBound(uLong sourceLen);
/*
compressBound() returns an upper bound on the compressed size after
compress() or compress2() on sourceLen bytes. It would be used before a
compress() or compress2() call to allocate the destination buffer.
*/
-ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen));
+ZEXTERN int ZEXPORT uncompress(Bytef *dest, uLongf *destLen,
+ const Bytef *source, uLong sourceLen);
/*
Decompresses the source buffer into the destination buffer. sourceLen is
the byte length of the source buffer. Upon entry, destLen is the total size
@@ -1282,8 +1285,8 @@ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
buffer with the uncompressed data up to that point.
*/
-ZEXTERN int ZEXPORT uncompress2 OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong *sourceLen));
+ZEXTERN int ZEXPORT uncompress2(Bytef *dest, uLongf *destLen,
+ const Bytef *source, uLong *sourceLen);
/*
Same as uncompress, except that sourceLen is a pointer, where the
length of the source is *sourceLen. On return, *sourceLen is the number of
@@ -1302,7 +1305,7 @@ ZEXTERN int ZEXPORT uncompress2 OF((Bytef *dest, uLongf *destLen,
typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */
/*
-ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
+ZEXTERN gzFile ZEXPORT gzopen(const char *path, const char *mode);
Open the gzip (.gz) file at path for reading and decompressing, or
compressing and writing. The mode parameter is as in fopen ("rb" or "wb")
@@ -1339,7 +1342,7 @@ ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
file could not be opened.
*/
-ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
+ZEXTERN gzFile ZEXPORT gzdopen(int fd, const char *mode);
/*
Associate a gzFile with the file descriptor fd. File descriptors are
obtained from calls like open, dup, creat, pipe or fileno (if the file has
@@ -1362,7 +1365,7 @@ ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
will not detect if fd is invalid (unless fd is -1).
*/
-ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size));
+ZEXTERN int ZEXPORT gzbuffer(gzFile file, unsigned size);
/*
Set the internal buffer size used by this library's functions for file to
size. The default buffer size is 8192 bytes. This function must be called
@@ -1378,7 +1381,7 @@ ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size));
too late.
*/
-ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
+ZEXTERN int ZEXPORT gzsetparams(gzFile file, int level, int strategy);
/*
Dynamically update the compression level and strategy for file. See the
description of deflateInit2 for the meaning of these parameters. Previously
@@ -1389,7 +1392,7 @@ ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
or Z_MEM_ERROR if there is a memory allocation error.
*/
-ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
+ZEXTERN int ZEXPORT gzread(gzFile file, voidp buf, unsigned len);
/*
Read and decompress up to len uncompressed bytes from file into buf. If
the input file is not in gzip format, gzread copies the given number of
@@ -1419,8 +1422,8 @@ ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
Z_STREAM_ERROR.
*/
-ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems,
- gzFile file));
+ZEXTERN z_size_t ZEXPORT gzfread(voidp buf, z_size_t size, z_size_t nitems,
+ gzFile file);
/*
Read and decompress up to nitems items of size size from file into buf,
otherwise operating as gzread() does. This duplicates the interface of
@@ -1437,22 +1440,22 @@ ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems,
In the event that the end of file is reached and only a partial item is
available at the end, i.e. the remaining uncompressed data length is not a
- multiple of size, then the final partial item is nevetheless read into buf
+ multiple of size, then the final partial item is nevertheless read into buf
and the end-of-file flag is set. The length of the partial item read is not
provided, but could be inferred from the result of gztell(). This behavior
is the same as the behavior of fread() implementations in common libraries,
but it prevents the direct use of gzfread() to read a concurrently written
- file, reseting and retrying on end-of-file, when size is not 1.
+ file, resetting and retrying on end-of-file, when size is not 1.
*/
-ZEXTERN int ZEXPORT gzwrite OF((gzFile file, voidpc buf, unsigned len));
+ZEXTERN int ZEXPORT gzwrite(gzFile file, voidpc buf, unsigned len);
/*
Compress and write the len uncompressed bytes at buf to file. gzwrite
returns the number of uncompressed bytes written or 0 in case of error.
*/
-ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size,
- z_size_t nitems, gzFile file));
+ZEXTERN z_size_t ZEXPORT gzfwrite(voidpc buf, z_size_t size,
+ z_size_t nitems, gzFile file);
/*
Compress and write nitems items of size size from buf to file, duplicating
the interface of stdio's fwrite(), with size_t request and return types. If
@@ -1465,7 +1468,7 @@ ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size,
is returned, and the error state is set to Z_STREAM_ERROR.
*/
-ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...));
+ZEXTERN int ZEXPORTVA gzprintf(gzFile file, const char *format, ...);
/*
Convert, format, compress, and write the arguments (...) to file under
control of the string format, as in fprintf. gzprintf returns the number of
@@ -1480,7 +1483,7 @@ ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...));
This can be determined using zlibCompileFlags().
*/
-ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
+ZEXTERN int ZEXPORT gzputs(gzFile file, const char *s);
/*
Compress and write the given null-terminated string s to file, excluding
the terminating null character.
@@ -1488,7 +1491,7 @@ ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
gzputs returns the number of characters written, or -1 in case of error.
*/
-ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
+ZEXTERN char * ZEXPORT gzgets(gzFile file, char *buf, int len);
/*
Read and decompress bytes from file into buf, until len-1 characters are
read, or until a newline character is read and transferred to buf, or an
@@ -1502,13 +1505,13 @@ ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
buf are indeterminate.
*/
-ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
+ZEXTERN int ZEXPORT gzputc(gzFile file, int c);
/*
Compress and write c, converted to an unsigned char, into file. gzputc
returns the value that was written, or -1 in case of error.
*/
-ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
+ZEXTERN int ZEXPORT gzgetc(gzFile file);
/*
Read and decompress one byte from file. gzgetc returns this byte or -1
in case of end of file or error. This is implemented as a macro for speed.
@@ -1517,7 +1520,7 @@ ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
points to has been clobbered or not.
*/
-ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
+ZEXTERN int ZEXPORT gzungetc(int c, gzFile file);
/*
Push c back onto the stream for file to be read as the first character on
the next read. At least one character of push-back is always allowed.
@@ -1529,7 +1532,7 @@ ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
gzseek() or gzrewind().
*/
-ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
+ZEXTERN int ZEXPORT gzflush(gzFile file, int flush);
/*
Flush all pending output to file. The parameter flush is as in the
deflate() function. The return value is the zlib error number (see function
@@ -1545,8 +1548,8 @@ ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
*/
/*
-ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
- z_off_t offset, int whence));
+ZEXTERN z_off_t ZEXPORT gzseek(gzFile file,
+ z_off_t offset, int whence);
Set the starting position to offset relative to whence for the next gzread
or gzwrite on file. The offset represents a number of bytes in the
@@ -1564,7 +1567,7 @@ ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
would be before the current position.
*/
-ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
+ZEXTERN int ZEXPORT gzrewind(gzFile file);
/*
Rewind file. This function is supported only for reading.
@@ -1572,7 +1575,7 @@ ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
*/
/*
-ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
+ZEXTERN z_off_t ZEXPORT gztell(gzFile file);
Return the starting position for the next gzread or gzwrite on file.
This position represents a number of bytes in the uncompressed data stream,
@@ -1583,7 +1586,7 @@ ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
*/
/*
-ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file));
+ZEXTERN z_off_t ZEXPORT gzoffset(gzFile file);
Return the current compressed (actual) read or write offset of file. This
offset includes the count of bytes that precede the gzip stream, for example
@@ -1592,7 +1595,7 @@ ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file));
be used for a progress indicator. On error, gzoffset() returns -1.
*/
-ZEXTERN int ZEXPORT gzeof OF((gzFile file));
+ZEXTERN int ZEXPORT gzeof(gzFile file);
/*
Return true (1) if the end-of-file indicator for file has been set while
reading, false (0) otherwise. Note that the end-of-file indicator is set
@@ -1607,7 +1610,7 @@ ZEXTERN int ZEXPORT gzeof OF((gzFile file));
has grown since the previous end of file was detected.
*/
-ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
+ZEXTERN int ZEXPORT gzdirect(gzFile file);
/*
Return true (1) if file is being copied directly while reading, or false
(0) if file is a gzip stream being decompressed.
@@ -1628,7 +1631,7 @@ ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
gzip file reading and decompression, which may not be desired.)
*/
-ZEXTERN int ZEXPORT gzclose OF((gzFile file));
+ZEXTERN int ZEXPORT gzclose(gzFile file);
/*
Flush all pending output for file, if necessary, close file and
deallocate the (de)compression state. Note that once file is closed, you
@@ -1641,8 +1644,8 @@ ZEXTERN int ZEXPORT gzclose OF((gzFile file));
last read ended in the middle of a gzip stream, or Z_OK on success.
*/
-ZEXTERN int ZEXPORT gzclose_r OF((gzFile file));
-ZEXTERN int ZEXPORT gzclose_w OF((gzFile file));
+ZEXTERN int ZEXPORT gzclose_r(gzFile file);
+ZEXTERN int ZEXPORT gzclose_w(gzFile file);
/*
Same as gzclose(), but gzclose_r() is only for use when reading, and
gzclose_w() is only for use when writing or appending. The advantage to
@@ -1653,7 +1656,7 @@ ZEXTERN int ZEXPORT gzclose_w OF((gzFile file));
zlib library.
*/
-ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
+ZEXTERN const char * ZEXPORT gzerror(gzFile file, int *errnum);
/*
Return the error message for the last error which occurred on file.
errnum is set to zlib error number. If an error occurred in the file system
@@ -1669,7 +1672,7 @@ ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
functions above that do not distinguish those cases in their return values.
*/
-ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
+ZEXTERN void ZEXPORT gzclearerr(gzFile file);
/*
Clear the error and end-of-file flags for file. This is analogous to the
clearerr() function in stdio. This is useful for continuing to read a gzip
@@ -1686,7 +1689,7 @@ ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
library.
*/
-ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
+ZEXTERN uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len);
/*
Update a running Adler-32 checksum with the bytes buf[0..len-1] and
return the updated checksum. An Adler-32 value is in the range of a 32-bit
@@ -1706,15 +1709,15 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
if (adler != original_adler) error();
*/
-ZEXTERN uLong ZEXPORT adler32_z OF((uLong adler, const Bytef *buf,
- z_size_t len));
+ZEXTERN uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf,
+ z_size_t len);
/*
Same as adler32(), but with a size_t length.
*/
/*
-ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
- z_off_t len2));
+ZEXTERN uLong ZEXPORT adler32_combine(uLong adler1, uLong adler2,
+ z_off_t len2);
Combine two Adler-32 checksums into one. For two sequences of bytes, seq1
and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
@@ -1724,7 +1727,7 @@ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
negative, the result has no meaning or utility.
*/
-ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
+ZEXTERN uLong ZEXPORT crc32(uLong crc, const Bytef *buf, uInt len);
/*
Update a running CRC-32 with the bytes buf[0..len-1] and return the
updated CRC-32. A CRC-32 value is in the range of a 32-bit unsigned integer.
@@ -1742,30 +1745,30 @@ ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
if (crc != original_crc) error();
*/
-ZEXTERN uLong ZEXPORT crc32_z OF((uLong crc, const Bytef *buf,
- z_size_t len));
+ZEXTERN uLong ZEXPORT crc32_z(uLong crc, const Bytef *buf,
+ z_size_t len);
/*
Same as crc32(), but with a size_t length.
*/
/*
-ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
+ZEXTERN uLong ZEXPORT crc32_combine(uLong crc1, uLong crc2, z_off_t len2);
Combine two CRC-32 check values into one. For two sequences of bytes,
seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32
check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
- len2.
+ len2. len2 must be non-negative.
*/
/*
-ZEXTERN uLong ZEXPORT crc32_combine_gen OF((z_off_t len2));
+ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t len2);
Return the operator corresponding to length len2, to be used with
- crc32_combine_op().
+ crc32_combine_op(). len2 must be non-negative.
*/
-ZEXTERN uLong ZEXPORT crc32_combine_op OF((uLong crc1, uLong crc2, uLong op));
+ZEXTERN uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op);
/*
Give the same result as crc32_combine(), using op in place of len2. op is
is generated from len2 by crc32_combine_gen(). This will be faster than
@@ -1778,20 +1781,20 @@ ZEXTERN uLong ZEXPORT crc32_combine_op OF((uLong crc1, uLong crc2, uLong op));
/* deflateInit and inflateInit are macros to allow checking the zlib version
* and the compiler's view of z_stream:
*/
-ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
- const char *version, int stream_size));
-ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
- const char *version, int stream_size));
-ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
- int windowBits, int memLevel,
- int strategy, const char *version,
- int stream_size));
-ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
- const char *version, int stream_size));
-ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
- unsigned char FAR *window,
- const char *version,
- int stream_size));
+ZEXTERN int ZEXPORT deflateInit_(z_streamp strm, int level,
+ const char *version, int stream_size);
+ZEXTERN int ZEXPORT inflateInit_(z_streamp strm,
+ const char *version, int stream_size);
+ZEXTERN int ZEXPORT deflateInit2_(z_streamp strm, int level, int method,
+ int windowBits, int memLevel,
+ int strategy, const char *version,
+ int stream_size);
+ZEXTERN int ZEXPORT inflateInit2_(z_streamp strm, int windowBits,
+ const char *version, int stream_size);
+ZEXTERN int ZEXPORT inflateBackInit_(z_streamp strm, int windowBits,
+ unsigned char FAR *window,
+ const char *version,
+ int stream_size);
#ifdef Z_PREFIX_SET
# define z_deflateInit(strm, level) \
deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
@@ -1836,7 +1839,7 @@ struct gzFile_s {
unsigned char *next;
z_off64_t pos;
};
-ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
+ZEXTERN int ZEXPORT gzgetc_(gzFile file); /* backward compatibility */
#ifdef Z_PREFIX_SET
# undef z_gzgetc
# define z_gzgetc(g) \
@@ -1853,13 +1856,13 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
* without large file support, _LFS64_LARGEFILE must also be true
*/
#ifdef Z_LARGE64
- ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
- ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
- ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
- ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
- ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t));
- ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t));
- ZEXTERN uLong ZEXPORT crc32_combine_gen64 OF((z_off64_t));
+ ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *);
+ ZEXTERN z_off64_t ZEXPORT gzseek64(gzFile, z_off64_t, int);
+ ZEXTERN z_off64_t ZEXPORT gztell64(gzFile);
+ ZEXTERN z_off64_t ZEXPORT gzoffset64(gzFile);
+ ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off64_t);
+ ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off64_t);
+ ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off64_t);
#endif
#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64)
@@ -1881,50 +1884,50 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
# define crc32_combine_gen crc32_combine_gen64
# endif
# ifndef Z_LARGE64
- ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
- ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
- ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));
- ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile));
- ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
- ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
- ZEXTERN uLong ZEXPORT crc32_combine_gen64 OF((z_off_t));
+ ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *);
+ ZEXTERN z_off_t ZEXPORT gzseek64(gzFile, z_off_t, int);
+ ZEXTERN z_off_t ZEXPORT gztell64(gzFile);
+ ZEXTERN z_off_t ZEXPORT gzoffset64(gzFile);
+ ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off_t);
+ ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off_t);
+ ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off_t);
# endif
#else
- ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *));
- ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int));
- ZEXTERN z_off_t ZEXPORT gztell OF((gzFile));
- ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile));
- ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
- ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
- ZEXTERN uLong ZEXPORT crc32_combine_gen OF((z_off_t));
+ ZEXTERN gzFile ZEXPORT gzopen(const char *, const char *);
+ ZEXTERN z_off_t ZEXPORT gzseek(gzFile, z_off_t, int);
+ ZEXTERN z_off_t ZEXPORT gztell(gzFile);
+ ZEXTERN z_off_t ZEXPORT gzoffset(gzFile);
+ ZEXTERN uLong ZEXPORT adler32_combine(uLong, uLong, z_off_t);
+ ZEXTERN uLong ZEXPORT crc32_combine(uLong, uLong, z_off_t);
+ ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t);
#endif
#else /* Z_SOLO */
- ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
- ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
- ZEXTERN uLong ZEXPORT crc32_combine_gen OF((z_off_t));
+ ZEXTERN uLong ZEXPORT adler32_combine(uLong, uLong, z_off_t);
+ ZEXTERN uLong ZEXPORT crc32_combine(uLong, uLong, z_off_t);
+ ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t);
#endif /* !Z_SOLO */
/* undocumented functions */
-ZEXTERN const char * ZEXPORT zError OF((int));
-ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp));
-ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void));
-ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int));
-ZEXTERN int ZEXPORT inflateValidate OF((z_streamp, int));
-ZEXTERN unsigned long ZEXPORT inflateCodesUsed OF ((z_streamp));
-ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp));
-ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp));
+ZEXTERN const char * ZEXPORT zError(int);
+ZEXTERN int ZEXPORT inflateSyncPoint(z_streamp);
+ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table(void);
+ZEXTERN int ZEXPORT inflateUndermine(z_streamp, int);
+ZEXTERN int ZEXPORT inflateValidate(z_streamp, int);
+ZEXTERN unsigned long ZEXPORT inflateCodesUsed(z_streamp);
+ZEXTERN int ZEXPORT inflateResetKeep(z_streamp);
+ZEXTERN int ZEXPORT deflateResetKeep(z_streamp);
#if defined(_WIN32) && !defined(Z_SOLO)
-ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path,
- const char *mode));
+ZEXTERN gzFile ZEXPORT gzopen_w(const wchar_t *path,
+ const char *mode);
#endif
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
# ifndef Z_SOLO
-ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file,
- const char *format,
- va_list va));
+ZEXTERN int ZEXPORTVA gzvprintf(gzFile file,
+ const char *format,
+ va_list va);
# endif
#endif
diff --git a/src/Common/zlib/zutil.c b/src/Common/zlib/zutil.c
index dcab28a0..b1c5d2d3 100644
--- a/src/Common/zlib/zutil.c
+++ b/src/Common/zlib/zutil.c
@@ -24,13 +24,11 @@ z_const char * const z_errmsg[10] = {
};
-const char * ZEXPORT zlibVersion()
-{
+const char * ZEXPORT zlibVersion(void) {
return ZLIB_VERSION;
}
-uLong ZEXPORT zlibCompileFlags()
-{
+uLong ZEXPORT zlibCompileFlags(void) {
uLong flags;
flags = 0;
@@ -61,9 +59,11 @@ uLong ZEXPORT zlibCompileFlags()
#ifdef ZLIB_DEBUG
flags += 1 << 8;
#endif
+ /*
#if defined(ASMV) || defined(ASMINF)
flags += 1 << 9;
#endif
+ */
#ifdef ZLIB_WINAPI
flags += 1 << 10;
#endif
@@ -119,9 +119,7 @@ uLong ZEXPORT zlibCompileFlags()
# endif
int ZLIB_INTERNAL z_verbose = verbose;
-void ZLIB_INTERNAL z_error (m)
- char *m;
-{
+void ZLIB_INTERNAL z_error(char *m) {
fprintf(stderr, "%s\n", m);
exit(1);
}
@@ -130,9 +128,7 @@ void ZLIB_INTERNAL z_error (m)
/* exported to allow conversion of error code to string for compress() and
* uncompress()
*/
-const char * ZEXPORT zError(err)
- int err;
-{
+const char * ZEXPORT zError(int err) {
return ERR_MSG(err);
}
@@ -146,22 +142,14 @@ const char * ZEXPORT zError(err)
#ifndef HAVE_MEMCPY
-void ZLIB_INTERNAL zmemcpy(dest, source, len)
- Bytef* dest;
- const Bytef* source;
- uInt len;
-{
+void ZLIB_INTERNAL zmemcpy(Bytef* dest, const Bytef* source, uInt len) {
if (len == 0) return;
do {
*dest++ = *source++; /* ??? to be unrolled */
} while (--len != 0);
}
-int ZLIB_INTERNAL zmemcmp(s1, s2, len)
- const Bytef* s1;
- const Bytef* s2;
- uInt len;
-{
+int ZLIB_INTERNAL zmemcmp(const Bytef* s1, const Bytef* s2, uInt len) {
uInt j;
for (j = 0; j < len; j++) {
@@ -170,10 +158,7 @@ int ZLIB_INTERNAL zmemcmp(s1, s2, len)
return 0;
}
-void ZLIB_INTERNAL zmemzero(dest, len)
- Bytef* dest;
- uInt len;
-{
+void ZLIB_INTERNAL zmemzero(Bytef* dest, uInt len) {
if (len == 0) return;
do {
*dest++ = 0; /* ??? to be unrolled */
@@ -214,8 +199,7 @@ local ptr_table table[MAX_PTR];
* a protected system like OS/2. Use Microsoft C instead.
*/
-voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size)
-{
+voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size) {
voidpf buf;
ulg bsize = (ulg)items*size;
@@ -240,8 +224,7 @@ voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size)
return buf;
}
-void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
-{
+void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) {
int n;
(void)opaque;
@@ -277,14 +260,12 @@ void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
# define _hfree hfree
#endif
-voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size)
-{
+voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, uInt items, uInt size) {
(void)opaque;
return _halloc((long)items, size);
}
-void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
-{
+void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) {
(void)opaque;
_hfree(ptr);
}
@@ -297,25 +278,18 @@ void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
#ifndef MY_ZCALLOC /* Any system without a special alloc function */
#ifndef STDC
-extern voidp malloc OF((uInt size));
-extern voidp calloc OF((uInt items, uInt size));
-extern void free OF((voidpf ptr));
+extern voidp malloc(uInt size);
+extern voidp calloc(uInt items, uInt size);
+extern void free(voidpf ptr);
#endif
-voidpf ZLIB_INTERNAL zcalloc (opaque, items, size)
- voidpf opaque;
- unsigned items;
- unsigned size;
-{
+voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size) {
(void)opaque;
return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
(voidpf)calloc(items, size);
}
-void ZLIB_INTERNAL zcfree (opaque, ptr)
- voidpf opaque;
- voidpf ptr;
-{
+void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) {
(void)opaque;
free(ptr);
}
diff --git a/src/Common/zlib/zutil.h b/src/Common/zlib/zutil.h
index d9a20ae1..48dd7feb 100644
--- a/src/Common/zlib/zutil.h
+++ b/src/Common/zlib/zutil.h
@@ -1,5 +1,5 @@
/* zutil.h -- internal interface and configuration of the compression library
- * Copyright (C) 1995-2022 Jean-loup Gailly, Mark Adler
+ * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -56,7 +56,7 @@ typedef unsigned long ulg;
extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
/* (size given to avoid silly warnings with Visual C++) */
-#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
+#define ERR_MSG(err) z_errmsg[(err) < -6 || (err) > 2 ? 9 : 2 - (err)]
#define ERR_RETURN(strm,err) \
return (strm->msg = ERR_MSG(err), (err))
@@ -137,17 +137,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
# endif
#endif
-#if defined(MACOS) || defined(TARGET_OS_MAC)
+#if defined(MACOS)
# define OS_CODE 7
-# ifndef Z_SOLO
-# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
-# include <unix.h> /* for fdopen */
-# else
-# ifndef fdopen
-# define fdopen(fd,mode) NULL /* No fdopen() */
-# endif
-# endif
-# endif
#endif
#ifdef __acorn
@@ -170,18 +161,6 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
# define OS_CODE 19
#endif
-#if defined(_BEOS_) || defined(RISCOS)
-# define fdopen(fd,mode) NULL /* No fdopen() */
-#endif
-
-#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX
-# if defined(_WIN32_WCE)
-# define fdopen(fd,mode) NULL /* No fdopen() */
-# else
-# define fdopen(fd,type) _fdopen(fd,type)
-# endif
-#endif
-
#if defined(__BORLANDC__) && !defined(MSDOS)
#pragma warn -8004
#pragma warn -8008
@@ -191,8 +170,9 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
/* provide prototypes for these when building zlib without LFS */
#if !defined(_WIN32) && \
(!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
- ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
- ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
+ ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off_t);
+ ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off_t);
+ ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off_t);
#endif
/* common defaults */
@@ -231,16 +211,16 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
# define zmemzero(dest, len) memset(dest, 0, len)
# endif
#else
- void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
- int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
- void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len));
+ void ZLIB_INTERNAL zmemcpy(Bytef* dest, const Bytef* source, uInt len);
+ int ZLIB_INTERNAL zmemcmp(const Bytef* s1, const Bytef* s2, uInt len);
+ void ZLIB_INTERNAL zmemzero(Bytef* dest, uInt len);
#endif
/* Diagnostic functions */
#ifdef ZLIB_DEBUG
# include <stdio.h>
extern int ZLIB_INTERNAL z_verbose;
- extern void ZLIB_INTERNAL z_error OF((char *m));
+ extern void ZLIB_INTERNAL z_error(char *m);
# define Assert(cond,msg) {if(!(cond)) z_error(msg);}
# define Trace(x) {if (z_verbose>=0) fprintf x ;}
# define Tracev(x) {if (z_verbose>0) fprintf x ;}
@@ -257,9 +237,9 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
#endif
#ifndef Z_SOLO
- voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items,
- unsigned size));
- void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr));
+ voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items,
+ unsigned size);
+ void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr);
#endif
#define ZALLOC(strm, items, size) \
diff --git a/src/Core/Core.h b/src/Core/Core.h
index 3a2235a5..65ea5bee 100644
--- a/src/Core/Core.h
+++ b/src/Core/Core.h
@@ -75,16 +75,16 @@ namespace VeraCrypt
shared_ptr <VolumePassword> m_password;
int m_pim;
shared_ptr <Pkcs5Kdf> m_kdf;
- bool m_truecryptMode;
shared_ptr <KeyfileList> m_keyfiles;
shared_ptr <VolumePassword> m_newPassword;
int m_newPim;
shared_ptr <KeyfileList> m_newKeyfiles;
shared_ptr <Pkcs5Kdf> m_newPkcs5Kdf;
int m_wipeCount;
- ChangePasswordThreadRoutine(shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, shared_ptr <Pkcs5Kdf> newPkcs5Kdf, int wipeCount) : m_volumePath(volumePath), m_preserveTimestamps(preserveTimestamps), m_password(password), m_pim(pim), m_kdf(kdf), m_truecryptMode(truecryptMode), m_keyfiles(keyfiles), m_newPassword(newPassword), m_newPim(newPim), m_newKeyfiles(newKeyfiles), m_newPkcs5Kdf(newPkcs5Kdf), m_wipeCount(wipeCount) {}
+ bool m_emvSupportEnabled;
+ ChangePasswordThreadRoutine(shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, shared_ptr <Pkcs5Kdf> newPkcs5Kdf, int wipeCount, bool emvSupportEnabled) : m_volumePath(volumePath), m_preserveTimestamps(preserveTimestamps), m_password(password), m_pim(pim), m_kdf(kdf), m_keyfiles(keyfiles), m_newPassword(newPassword), m_newPim(newPim), m_newKeyfiles(newKeyfiles), m_newPkcs5Kdf(newPkcs5Kdf), m_wipeCount(wipeCount), m_emvSupportEnabled(emvSupportEnabled) {}
virtual ~ChangePasswordThreadRoutine() { }
- virtual void ExecutionCode(void) { Core->ChangePassword(m_volumePath, m_preserveTimestamps, m_password, m_pim, m_kdf, m_truecryptMode, m_keyfiles, m_newPassword, m_newPim, m_newKeyfiles, m_newPkcs5Kdf, m_wipeCount); }
+ virtual void ExecutionCode(void) { Core->ChangePassword(m_volumePath, m_preserveTimestamps, m_password, m_pim, m_kdf, m_keyfiles, m_newPassword, m_newPim, m_newKeyfiles, m_emvSupportEnabled, m_newPkcs5Kdf, m_wipeCount); }
};
class OpenVolumeThreadRoutine : public WaitThreadRoutine
@@ -95,7 +95,6 @@ namespace VeraCrypt
shared_ptr <VolumePassword> m_password;
int m_pim;
shared_ptr<Pkcs5Kdf> m_Kdf;
- bool m_truecryptMode;
shared_ptr <KeyfileList> m_keyfiles;
VolumeProtection::Enum m_protection;
shared_ptr <VolumePassword> m_protectionPassword;
@@ -107,15 +106,16 @@ namespace VeraCrypt
bool m_useBackupHeaders;
bool m_partitionInSystemEncryptionScope;
shared_ptr <Volume> m_pVolume;
+ bool m_emvSupportEnabled;
- OpenVolumeThreadRoutine(shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr<Pkcs5Kdf> Kdf, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, VolumeProtection::Enum protection = VolumeProtection::None, shared_ptr <VolumePassword> protectionPassword = shared_ptr <VolumePassword> (), int protectionPim = 0, shared_ptr<Pkcs5Kdf> protectionKdf = shared_ptr<Pkcs5Kdf> (), shared_ptr <KeyfileList> protectionKeyfiles = shared_ptr <KeyfileList> (), bool sharedAccessAllowed = false, VolumeType::Enum volumeType = VolumeType::Unknown, bool useBackupHeaders = false, bool partitionInSystemEncryptionScope = false):
- m_volumePath(volumePath), m_preserveTimestamps(preserveTimestamps), m_password(password), m_pim(pim), m_Kdf(Kdf), m_truecryptMode(truecryptMode), m_keyfiles(keyfiles),
+ OpenVolumeThreadRoutine(shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr<Pkcs5Kdf> Kdf, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection = VolumeProtection::None, shared_ptr <VolumePassword> protectionPassword = shared_ptr <VolumePassword> (), int protectionPim = 0, shared_ptr<Pkcs5Kdf> protectionKdf = shared_ptr<Pkcs5Kdf> (), shared_ptr <KeyfileList> protectionKeyfiles = shared_ptr <KeyfileList> (), bool sharedAccessAllowed = false, VolumeType::Enum volumeType = VolumeType::Unknown, bool useBackupHeaders = false, bool partitionInSystemEncryptionScope = false):
+ m_volumePath(volumePath), m_preserveTimestamps(preserveTimestamps), m_password(password), m_pim(pim), m_Kdf(Kdf), m_keyfiles(keyfiles),
m_protection(protection), m_protectionPassword(protectionPassword), m_protectionPim(protectionPim), m_protectionKdf(protectionKdf), m_protectionKeyfiles(protectionKeyfiles), m_sharedAccessAllowed(sharedAccessAllowed), m_volumeType(volumeType),m_useBackupHeaders(useBackupHeaders),
- m_partitionInSystemEncryptionScope(partitionInSystemEncryptionScope) {}
+ m_partitionInSystemEncryptionScope(partitionInSystemEncryptionScope), m_emvSupportEnabled(emvSupportEnabled) {}
~OpenVolumeThreadRoutine() {}
- virtual void ExecutionCode(void) { m_pVolume = Core->OpenVolume(m_volumePath,m_preserveTimestamps,m_password,m_pim,m_Kdf,m_truecryptMode,m_keyfiles, m_protection,m_protectionPassword,m_protectionPim,m_protectionKdf, m_protectionKeyfiles,m_sharedAccessAllowed,m_volumeType,m_useBackupHeaders, m_partitionInSystemEncryptionScope); }
+ virtual void ExecutionCode(void) { m_pVolume = Core->OpenVolume(m_volumePath,m_preserveTimestamps,m_password,m_pim,m_Kdf,m_keyfiles, m_emvSupportEnabled, m_protection,m_protectionPassword,m_protectionPim,m_protectionKdf, m_protectionKeyfiles,m_sharedAccessAllowed,m_volumeType,m_useBackupHeaders, m_partitionInSystemEncryptionScope); }
};
@@ -127,10 +127,11 @@ namespace VeraCrypt
shared_ptr <VolumePassword> m_password;
int m_pim;
shared_ptr <KeyfileList> m_keyfiles;
- ReEncryptHeaderThreadRoutine(const BufferPtr &newHeaderBuffer, shared_ptr <VolumeHeader> header, shared_ptr <VolumePassword> password, int pim, shared_ptr <KeyfileList> keyfiles)
- : m_newHeaderBuffer(newHeaderBuffer), m_header(header), m_password(password), m_pim(pim), m_keyfiles(keyfiles) {}
+ bool m_emvSupportEnabled;
+ ReEncryptHeaderThreadRoutine(const BufferPtr &newHeaderBuffer, shared_ptr <VolumeHeader> header, shared_ptr <VolumePassword> password, int pim, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled)
+ : m_newHeaderBuffer(newHeaderBuffer), m_header(header), m_password(password), m_pim(pim), m_keyfiles(keyfiles), m_emvSupportEnabled(emvSupportEnabled) {}
virtual ~ReEncryptHeaderThreadRoutine() { }
- virtual void ExecutionCode(void) { Core->ReEncryptVolumeHeaderWithNewSalt (m_newHeaderBuffer, m_header, m_password, m_pim, m_keyfiles); }
+ virtual void ExecutionCode(void) { Core->ReEncryptVolumeHeaderWithNewSalt (m_newHeaderBuffer, m_header, m_password, m_pim, m_keyfiles, m_emvSupportEnabled); }
};
class DecryptThreadRoutine : public WaitThreadRoutine
@@ -141,15 +142,14 @@ namespace VeraCrypt
const VolumePassword &m_password;
int m_pim;
shared_ptr <Pkcs5Kdf> m_kdf;
- bool m_truecryptMode;
const Pkcs5KdfList &m_keyDerivationFunctions;
const EncryptionAlgorithmList &m_encryptionAlgorithms;
const EncryptionModeList &m_encryptionModes;
bool m_bResult;
- DecryptThreadRoutine(shared_ptr <VolumeHeader> header, const ConstBufferPtr &encryptedData, const VolumePassword &password, int pim, shared_ptr <Pkcs5Kdf> kdf, bool truecryptMode, const Pkcs5KdfList &keyDerivationFunctions, const EncryptionAlgorithmList &encryptionAlgorithms, const EncryptionModeList &encryptionModes)
- : m_pHeader(header), m_encryptedData(encryptedData), m_password(password), m_pim(pim), m_kdf(kdf), m_truecryptMode(truecryptMode), m_keyDerivationFunctions(keyDerivationFunctions), m_encryptionAlgorithms(encryptionAlgorithms), m_encryptionModes(encryptionModes), m_bResult(false){}
+ DecryptThreadRoutine(shared_ptr <VolumeHeader> header, const ConstBufferPtr &encryptedData, const VolumePassword &password, int pim, shared_ptr <Pkcs5Kdf> kdf, const Pkcs5KdfList &keyDerivationFunctions, const EncryptionAlgorithmList &encryptionAlgorithms, const EncryptionModeList &encryptionModes)
+ : m_pHeader(header), m_encryptedData(encryptedData), m_password(password), m_pim(pim), m_kdf(kdf), m_keyDerivationFunctions(keyDerivationFunctions), m_encryptionAlgorithms(encryptionAlgorithms), m_encryptionModes(encryptionModes), m_bResult(false){}
virtual ~DecryptThreadRoutine() { }
- virtual void ExecutionCode(void) { m_bResult = m_pHeader->Decrypt(m_encryptedData, m_password, m_pim, m_kdf, m_truecryptMode, m_keyDerivationFunctions, m_encryptionAlgorithms, m_encryptionModes); }
+ virtual void ExecutionCode(void) { m_bResult = m_pHeader->Decrypt(m_encryptedData, m_password, m_pim, m_kdf, m_keyDerivationFunctions, m_encryptionAlgorithms, m_encryptionModes); }
};
class WaitThreadUI
diff --git a/src/Core/CoreBase.cpp b/src/Core/CoreBase.cpp
index 29bfb74d..c1016726 100644
--- a/src/Core/CoreBase.cpp
+++ b/src/Core/CoreBase.cpp
@@ -30,20 +30,14 @@ namespace VeraCrypt
{
}
- void CoreBase::ChangePassword (shared_ptr <Volume> openVolume, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, shared_ptr <Pkcs5Kdf> newPkcs5Kdf, int wipeCount) const
+ void CoreBase::ChangePassword (shared_ptr <Volume> openVolume, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, bool emvSupportEnabled, shared_ptr <Pkcs5Kdf> newPkcs5Kdf, int wipeCount) const
{
if ((!newPassword || newPassword->Size() < 1) && (!newKeyfiles || newKeyfiles->empty()))
throw PasswordEmpty (SRC_POS);
if (!newPkcs5Kdf)
{
- if (openVolume->GetPkcs5Kdf()->GetTrueCryptMode ())
- {
- newPkcs5Kdf.reset (openVolume->GetPkcs5Kdf()->Clone());
- newPkcs5Kdf->SetTrueCryptMode (false);
- }
- else
- newPkcs5Kdf = openVolume->GetPkcs5Kdf();
+ newPkcs5Kdf = openVolume->GetPkcs5Kdf();
}
if ((openVolume->GetHeader()->GetFlags() & TC_HEADER_FLAG_ENCRYPTED_SYSTEM) != 0
@@ -58,7 +52,7 @@ namespace VeraCrypt
SecureBuffer newSalt (openVolume->GetSaltSize());
SecureBuffer newHeaderKey (VolumeHeader::GetLargestSerializedKeySize());
- shared_ptr <VolumePassword> password (Keyfile::ApplyListToPassword (newKeyfiles, newPassword));
+ shared_ptr <VolumePassword> password (Keyfile::ApplyListToPassword (newKeyfiles, newPassword, emvSupportEnabled));
bool backupHeader = false;
while (true)
@@ -83,10 +77,10 @@ namespace VeraCrypt
}
}
- void CoreBase::ChangePassword (shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, shared_ptr <Pkcs5Kdf> newPkcs5Kdf, int wipeCount) const
+ void CoreBase::ChangePassword (shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, bool emvSupportEnabled, shared_ptr <Pkcs5Kdf> newPkcs5Kdf, int wipeCount) const
{
- shared_ptr <Volume> volume = OpenVolume (volumePath, preserveTimestamps, password, pim, kdf, truecryptMode, keyfiles);
- ChangePassword (volume, newPassword, newPim, newKeyfiles, newPkcs5Kdf, wipeCount);
+ shared_ptr <Volume> volume = OpenVolume (volumePath, preserveTimestamps, password, pim, kdf, keyfiles, emvSupportEnabled);
+ ChangePassword (volume, newPassword, newPim, newKeyfiles, emvSupportEnabled, newPkcs5Kdf, wipeCount);
}
void CoreBase::CoalesceSlotNumberAndMountPoint (MountOptions &options) const
@@ -261,10 +255,10 @@ namespace VeraCrypt
return false;
}
- shared_ptr <Volume> CoreBase::OpenVolume (shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr<Pkcs5Kdf> kdf, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, VolumeProtection::Enum protection, shared_ptr <VolumePassword> protectionPassword, int protectionPim, shared_ptr<Pkcs5Kdf> protectionKdf, shared_ptr <KeyfileList> protectionKeyfiles, bool sharedAccessAllowed, VolumeType::Enum volumeType, bool useBackupHeaders, bool partitionInSystemEncryptionScope) const
+ shared_ptr <Volume> CoreBase::OpenVolume (shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr<Pkcs5Kdf> kdf, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection, shared_ptr <VolumePassword> protectionPassword, int protectionPim, shared_ptr<Pkcs5Kdf> protectionKdf, shared_ptr <KeyfileList> protectionKeyfiles, bool sharedAccessAllowed, VolumeType::Enum volumeType, bool useBackupHeaders, bool partitionInSystemEncryptionScope) const
{
make_shared_auto (Volume, volume);
- volume->Open (*volumePath, preserveTimestamps, password, pim, kdf, truecryptMode, keyfiles, protection, protectionPassword, protectionPim, protectionKdf, protectionKeyfiles, sharedAccessAllowed, volumeType, useBackupHeaders, partitionInSystemEncryptionScope);
+ volume->Open (*volumePath, preserveTimestamps, password, pim, kdf, keyfiles, emvSupportEnabled, protection, protectionPassword, protectionPim, protectionKdf, protectionKeyfiles, sharedAccessAllowed, volumeType, useBackupHeaders, partitionInSystemEncryptionScope);
return volume;
}
@@ -279,7 +273,7 @@ namespace VeraCrypt
encryptionAlgorithm->GetMode()->SetKey (modeKey);
}
- void CoreBase::ReEncryptVolumeHeaderWithNewSalt (const BufferPtr &newHeaderBuffer, shared_ptr <VolumeHeader> header, shared_ptr <VolumePassword> password, int pim, shared_ptr <KeyfileList> keyfiles) const
+ void CoreBase::ReEncryptVolumeHeaderWithNewSalt (const BufferPtr &newHeaderBuffer, shared_ptr <VolumeHeader> header, shared_ptr <VolumePassword> password, int pim, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled) const
{
shared_ptr <Pkcs5Kdf> pkcs5Kdf = header->GetPkcs5Kdf();
@@ -288,7 +282,7 @@ namespace VeraCrypt
SecureBuffer newSalt (header->GetSaltSize());
SecureBuffer newHeaderKey (VolumeHeader::GetLargestSerializedKeySize());
- shared_ptr <VolumePassword> passwordKey (Keyfile::ApplyListToPassword (keyfiles, password));
+ shared_ptr <VolumePassword> passwordKey (Keyfile::ApplyListToPassword (keyfiles, password, emvSupportEnabled));
RandomNumberGenerator::GetData (newSalt);
pkcs5Kdf->DeriveKey (newHeaderKey, *passwordKey, pim, newSalt);
diff --git a/src/Core/CoreBase.h b/src/Core/CoreBase.h
index 8f41ddd8..03aa922a 100644
--- a/src/Core/CoreBase.h
+++ b/src/Core/CoreBase.h
@@ -33,8 +33,8 @@ namespace VeraCrypt
public:
virtual ~CoreBase ();
- virtual void ChangePassword (shared_ptr <Volume> openVolume, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, shared_ptr <Pkcs5Kdf> newPkcs5Kdf = shared_ptr <Pkcs5Kdf> (), int wipeCount = PRAND_HEADER_WIPE_PASSES) const;
- virtual void ChangePassword (shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, shared_ptr <Pkcs5Kdf> newPkcs5Kdf = shared_ptr <Pkcs5Kdf> (), int wipeCount = PRAND_HEADER_WIPE_PASSES) const;
+ virtual void ChangePassword (shared_ptr <Volume> openVolume, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, bool emvSupportEnabled, shared_ptr <Pkcs5Kdf> newPkcs5Kdf = shared_ptr <Pkcs5Kdf> (), int wipeCount = PRAND_HEADER_WIPE_PASSES) const;
+ virtual void ChangePassword (shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, bool emvSupportEnabled, shared_ptr <Pkcs5Kdf> newPkcs5Kdf = shared_ptr <Pkcs5Kdf> (), int wipeCount = PRAND_HEADER_WIPE_PASSES) const;
virtual void CheckFilesystem (shared_ptr <VolumeInfo> mountedVolume, bool repair = false) const = 0;
virtual void CoalesceSlotNumberAndMountPoint (MountOptions &options) const;
virtual void CreateKeyfile (const FilePath &keyfilePath) const;
@@ -69,9 +69,9 @@ namespace VeraCrypt
virtual bool IsVolumeMounted (const VolumePath &volumePath) const;
virtual VolumeSlotNumber MountPointToSlotNumber (const DirectoryPath &mountPoint) const = 0;
virtual shared_ptr <VolumeInfo> MountVolume (MountOptions &options) = 0;
- virtual shared_ptr <Volume> OpenVolume (shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr<Pkcs5Kdf> Kdf, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, VolumeProtection::Enum protection = VolumeProtection::None, shared_ptr <VolumePassword> protectionPassword = shared_ptr <VolumePassword> (), int protectionPim = 0, shared_ptr<Pkcs5Kdf> protectionKdf = shared_ptr<Pkcs5Kdf> (), shared_ptr <KeyfileList> protectionKeyfiles = shared_ptr <KeyfileList> (), bool sharedAccessAllowed = false, VolumeType::Enum volumeType = VolumeType::Unknown, bool useBackupHeaders = false, bool partitionInSystemEncryptionScope = false) const;
+ virtual shared_ptr <Volume> OpenVolume (shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr<Pkcs5Kdf> Kdf, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection = VolumeProtection::None, shared_ptr <VolumePassword> protectionPassword = shared_ptr <VolumePassword> (), int protectionPim = 0, shared_ptr<Pkcs5Kdf> protectionKdf = shared_ptr<Pkcs5Kdf> (), shared_ptr <KeyfileList> protectionKeyfiles = shared_ptr <KeyfileList> (), bool sharedAccessAllowed = false, VolumeType::Enum volumeType = VolumeType::Unknown, bool useBackupHeaders = false, bool partitionInSystemEncryptionScope = false) const;
virtual void RandomizeEncryptionAlgorithmKey (shared_ptr <EncryptionAlgorithm> encryptionAlgorithm) const;
- virtual void ReEncryptVolumeHeaderWithNewSalt (const BufferPtr &newHeaderBuffer, shared_ptr <VolumeHeader> header, shared_ptr <VolumePassword> password, int pim, shared_ptr <KeyfileList> keyfiles) const;
+ virtual void ReEncryptVolumeHeaderWithNewSalt (const BufferPtr &newHeaderBuffer, shared_ptr <VolumeHeader> header, shared_ptr <VolumePassword> password, int pim, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled) const;
virtual void SetAdminPasswordCallback (shared_ptr <GetStringFunctor> functor) { }
virtual void SetApplicationExecutablePath (const FilePath &path) { ApplicationExecutablePath = path; }
virtual void SetFileOwner (const FilesystemPath &path, const UserId &owner) const = 0;
diff --git a/src/Core/MountOptions.cpp b/src/Core/MountOptions.cpp
index 52e12396..2f28c089 100644
--- a/src/Core/MountOptions.cpp
+++ b/src/Core/MountOptions.cpp
@@ -52,7 +52,6 @@ namespace VeraCrypt
TC_CLONE (SharedAccessAllowed);
TC_CLONE (SlotNumber);
TC_CLONE (UseBackupHeaders);
- TC_CLONE (TrueCryptMode);
}
void MountOptions::Deserialize (shared_ptr <Stream> stream)
@@ -101,14 +100,12 @@ namespace VeraCrypt
sr.Deserialize ("SlotNumber", SlotNumber);
sr.Deserialize ("UseBackupHeaders", UseBackupHeaders);
- sr.Deserialize ("TrueCryptMode", TrueCryptMode);
-
try
{
if (!sr.DeserializeBool ("KdfNull"))
{
sr.Deserialize ("Kdf", nameValue);
- Kdf = Pkcs5Kdf::GetAlgorithm (nameValue, TrueCryptMode);
+ Kdf = Pkcs5Kdf::GetAlgorithm (nameValue);
}
}
catch(...) {}
@@ -118,7 +115,7 @@ namespace VeraCrypt
if (!sr.DeserializeBool ("ProtectionKdfNull"))
{
sr.Deserialize ("ProtectionKdf", nameValue);
- ProtectionKdf = Pkcs5Kdf::GetAlgorithm (nameValue, TrueCryptMode);
+ ProtectionKdf = Pkcs5Kdf::GetAlgorithm (nameValue);
}
}
catch(...) {}
@@ -167,8 +164,6 @@ namespace VeraCrypt
sr.Serialize ("SlotNumber", SlotNumber);
sr.Serialize ("UseBackupHeaders", UseBackupHeaders);
- sr.Serialize ("TrueCryptMode", TrueCryptMode);
-
sr.Serialize ("KdfNull", Kdf == nullptr);
if (Kdf)
sr.Serialize ("Kdf", Kdf->GetName());
diff --git a/src/Core/MountOptions.h b/src/Core/MountOptions.h
index 83a8bffc..3dcfa599 100644
--- a/src/Core/MountOptions.h
+++ b/src/Core/MountOptions.h
@@ -37,8 +37,7 @@ namespace VeraCrypt
Removable (false),
SharedAccessAllowed (false),
SlotNumber (0),
- UseBackupHeaders (false),
- TrueCryptMode (false)
+ UseBackupHeaders (false)
{
}
@@ -72,7 +71,7 @@ namespace VeraCrypt
bool SharedAccessAllowed;
VolumeSlotNumber SlotNumber;
bool UseBackupHeaders;
- bool TrueCryptMode;
+ bool EMVSupportEnabled;
protected:
void CopyFrom (const MountOptions &other);
diff --git a/src/Core/RandomNumberGenerator.cpp b/src/Core/RandomNumberGenerator.cpp
index 39753ee8..3fb6062a 100644
--- a/src/Core/RandomNumberGenerator.cpp
+++ b/src/Core/RandomNumberGenerator.cpp
@@ -54,22 +54,20 @@ namespace VeraCrypt
{
int rndCount = read (random, buffer, buffer.Size());
throw_sys_sub_if ((rndCount == -1) && errno != EAGAIN && errno != ERESTART && errno != EINTR, L"/dev/random");
- if (rndCount == -1 && (!DevRandomSucceeded || (DevRandomBytesCount < 32)))
- {
- // wait 250ms before querying /dev/random again
- ::usleep (250 * 1000);
+ if (rndCount != -1) {
+ // We count returned bytes until 32-bytes threshold reached
+ if (DevRandomBytesCount < 32)
+ DevRandomBytesCount += rndCount;
+ break;
}
- else
- {
- if (rndCount != -1)
- {
- // We count returned bytes untill 32-bytes treshold reached
- if (DevRandomBytesCount < 32)
- DevRandomBytesCount += rndCount;
- DevRandomSucceeded = true;
- }
+ else if (DevRandomBytesCount >= 32) {
+ // allow /dev/random to fail gracefully since we have enough bytes
break;
}
+ else {
+ // wait 250ms before querying /dev/random again
+ ::usleep (250 * 1000);
+ }
}
AddToPool (buffer);
@@ -187,18 +185,26 @@ namespace VeraCrypt
void RandomNumberGenerator::HashMixPool ()
{
BytesAddedSincePoolHashMix = 0;
-
- for (size_t poolPos = 0; poolPos < Pool.Size(); )
+ size_t digestSize = PoolHash->GetDigestSize();
+ size_t poolSize = Pool.Size();
+ // pool size must be multiple of digest size
+ // this is always the case with default pool size value (320 bytes)
+ if (poolSize % digestSize)
+ throw AssertionFailed (SRC_POS);
+
+ for (size_t poolPos = 0; poolPos < poolSize; poolPos += digestSize)
{
// Compute the message digest of the entire pool using the selected hash function
- SecureBuffer digest (PoolHash->GetDigestSize());
+ SecureBuffer digest (digestSize);
+ PoolHash->Init();
PoolHash->ProcessData (Pool);
PoolHash->GetDigest (digest);
- // Add the message digest to the pool
- for (size_t digestPos = 0; digestPos < digest.Size() && poolPos < Pool.Size(); ++digestPos)
+ /* XOR the resultant message digest to the pool at the poolIndex position. */
+ /* this matches the documentation: https://veracrypt.fr/en/Random%20Number%20Generator.html */
+ for (size_t digestIndex = 0; digestIndex < digestSize; digestIndex++)
{
- Pool[poolPos++] += digest[digestPos];
+ Pool [poolPos + digestIndex] ^= digest [digestIndex];
}
}
}
@@ -245,14 +251,17 @@ namespace VeraCrypt
EnrichedByUser = false;
Running = false;
- DevRandomSucceeded = false;
DevRandomBytesCount = 0;
}
void RandomNumberGenerator::Test ()
{
shared_ptr <Hash> origPoolHash = PoolHash;
- PoolHash.reset (new Blake2s());
+ #ifndef WOLFCRYPT_BACKEND
+ PoolHash.reset (new Blake2s());
+ #else
+ PoolHash.reset (new Sha256());
+ #endif
Pool.Zero();
Buffer buffer (1);
@@ -262,15 +271,23 @@ namespace VeraCrypt
AddToPool (buffer);
}
- if (Crc32::ProcessBuffer (Pool) != 0x9ae2fff8)
- throw TestFailed (SRC_POS);
+ #ifndef WOLFCRYPT_BACKEND
+ if (Crc32::ProcessBuffer (Pool) != 0x9c743238)
+ #else
+ if (Crc32::ProcessBuffer (Pool) != 0xac95ac1a)
+ #endif
+ throw TestFailed (SRC_POS);
buffer.Allocate (PoolSize);
buffer.CopyFrom (PeekPool());
AddToPool (buffer);
- if (Crc32::ProcessBuffer (Pool) != 0x391135a7)
- throw TestFailed (SRC_POS);
+ #ifndef WOLFCRYPT_BACKEND
+ if (Crc32::ProcessBuffer (Pool) != 0xd2d09c8d)
+ #else
+ if (Crc32::ProcessBuffer (Pool) != 0xb79f3c12)
+ #endif
+ throw TestFailed (SRC_POS);
PoolHash = origPoolHash;
}
@@ -284,6 +301,5 @@ namespace VeraCrypt
bool RandomNumberGenerator::Running = false;
size_t RandomNumberGenerator::WriteOffset;
struct rand_data *RandomNumberGenerator::JitterRngCtx = NULL;
- bool RandomNumberGenerator::DevRandomSucceeded = false;
int RandomNumberGenerator::DevRandomBytesCount = 0;
}
diff --git a/src/Core/RandomNumberGenerator.h b/src/Core/RandomNumberGenerator.h
index 8f440630..333a8e36 100644
--- a/src/Core/RandomNumberGenerator.h
+++ b/src/Core/RandomNumberGenerator.h
@@ -55,7 +55,6 @@ namespace VeraCrypt
static bool Running;
static size_t WriteOffset;
static struct rand_data *JitterRngCtx;
- static bool DevRandomSucceeded;
static int DevRandomBytesCount;
};
}
diff --git a/src/Core/Unix/CoreService.cpp b/src/Core/Unix/CoreService.cpp
index f05d8569..e543652a 100644
--- a/src/Core/Unix/CoreService.cpp
+++ b/src/Core/Unix/CoreService.cpp
@@ -303,12 +303,11 @@ namespace VeraCrypt
// We also use the old way if the user is forcing the use of dummy password for sudo
#if defined(TC_LINUX ) || defined (TC_FREEBSD)
-
+ bool authCheckDone = false;
if (!Core->GetUseDummySudoPassword ())
{
std::vector<char> buffer(128, 0);
std::string result;
- bool authCheckDone = false;
FILE* pipe = popen("sudo -n uptime 2>&1 | grep 'load average' | wc -l", "r"); // We redirect stderr to stdout (2>&1) to be able to catch the result of the command
if (pipe)
@@ -354,7 +353,10 @@ namespace VeraCrypt
}
request.FastElevation = false;
- (*AdminPasswordCallback) (request.AdminPassword);
+#if defined(TC_LINUX ) || defined (TC_FREEBSD)
+ if(!authCheckDone)
+#endif
+ (*AdminPasswordCallback) (request.AdminPassword);
}
}
}
diff --git a/src/Core/Unix/CoreServiceProxy.h b/src/Core/Unix/CoreServiceProxy.h
index f5bbae3d..d57d8163 100644
--- a/src/Core/Unix/CoreServiceProxy.h
+++ b/src/Core/Unix/CoreServiceProxy.h
@@ -98,11 +98,11 @@ namespace VeraCrypt
{
MountOptions newOptions = options;
- newOptions.Password = Keyfile::ApplyListToPassword (options.Keyfiles, options.Password);
+ newOptions.Password = Keyfile::ApplyListToPassword (options.Keyfiles, options.Password, options.EMVSupportEnabled);
if (newOptions.Keyfiles)
newOptions.Keyfiles->clear();
- newOptions.ProtectionPassword = Keyfile::ApplyListToPassword (options.ProtectionKeyfiles, options.ProtectionPassword);
+ newOptions.ProtectionPassword = Keyfile::ApplyListToPassword (options.ProtectionKeyfiles, options.ProtectionPassword, options.EMVSupportEnabled);
if (newOptions.ProtectionKeyfiles)
newOptions.ProtectionKeyfiles->clear();
@@ -126,7 +126,7 @@ namespace VeraCrypt
if (options.CachePassword
&& ((options.Password && !options.Password->IsEmpty()) || (options.Keyfiles && !options.Keyfiles->empty())))
{
- VolumePasswordCache::Store (*Keyfile::ApplyListToPassword (options.Keyfiles, options.Password));
+ VolumePasswordCache::Store (*Keyfile::ApplyListToPassword (options.Keyfiles, options.Password, options.EMVSupportEnabled));
}
}
diff --git a/src/Core/Unix/CoreUnix.cpp b/src/Core/Unix/CoreUnix.cpp
index 2dac4cb5..258979b9 100644
--- a/src/Core/Unix/CoreUnix.cpp
+++ b/src/Core/Unix/CoreUnix.cpp
@@ -78,10 +78,8 @@ namespace VeraCrypt
if (stat("/usr/bin/konsole", &sb) == 0)
{
args.clear ();
- args.push_back ("--title");
- args.push_back ("fsck");
- args.push_back ("--caption");
- args.push_back ("fsck");
+ args.push_back ("-p");
+ args.push_back ("tabtitle=fsck");
args.push_back ("-e");
args.push_back ("sh");
args.push_back ("-c");
@@ -91,8 +89,22 @@ namespace VeraCrypt
Process::Execute ("konsole", args, 1000);
} catch (TimeOut&) { }
}
+ else if (stat("/usr/bin/gnome-terminal", &sb) == 0 && stat("/usr/bin/dbus-launch", &sb) == 0)
+ {
+ args.clear ();
+ args.push_back ("--title");
+ args.push_back ("fsck");
+ args.push_back ("--");
+ args.push_back ("sh");
+ args.push_back ("-c");
+ args.push_back (xargs);
+ try
+ {
+ Process::Execute ("gnome-terminal", args, 1000);
+ } catch (TimeOut&) { }
+ }
else
- throw;
+ throw TerminalNotFound();
}
#endif
}
@@ -534,8 +546,8 @@ namespace VeraCrypt
options.Password,
options.Pim,
options.Kdf,
- options.TrueCryptMode,
options.Keyfiles,
+ options.EMVSupportEnabled,
options.Protection,
options.ProtectionPassword,
options.ProtectionPim,
@@ -679,7 +691,7 @@ namespace VeraCrypt
{
try
{
- chown (mountPoint.c_str(), GetRealUserId(), GetRealGroupId());
+ throw_sys_sub_if (chown (mountPoint.c_str(), GetRealUserId(), GetRealGroupId()) == -1, mountPoint);
} catch (...) { }
}
}
diff --git a/src/Core/Unix/Linux/CoreLinux.cpp b/src/Core/Unix/Linux/CoreLinux.cpp
index e1da6dff..5d5ba38f 100644
--- a/src/Core/Unix/Linux/CoreLinux.cpp
+++ b/src/Core/Unix/Linux/CoreLinux.cpp
@@ -22,6 +22,9 @@
#include "Platform/SystemInfo.h"
#include "Platform/TextReader.h"
#include "Volume/EncryptionModeXTS.h"
+#ifdef WOLFCRYPT_BACKEND
+#include "Volume/EncryptionModeWolfCryptXTS.h"
+#endif
#include "Driver/Fuse/FuseService.h"
#include "Core/Unix/CoreServiceProxy.h"
@@ -302,8 +305,13 @@ namespace VeraCrypt
void CoreLinux::MountVolumeNative (shared_ptr <Volume> volume, MountOptions &options, const DirectoryPath &auxMountPoint) const
{
- bool xts = (typeid (*volume->GetEncryptionMode()) == typeid (EncryptionModeXTS));
- bool algoNotSupported = (typeid (*volume->GetEncryptionAlgorithm()) == typeid (Kuznyechik))
+ bool xts = (typeid (*volume->GetEncryptionMode()) ==
+ #ifdef WOLFCRYPT_BACKEND
+ typeid (EncryptionModeWolfCryptXTS));
+ #else
+ typeid (EncryptionModeXTS));
+ #endif
+ bool algoNotSupported = (typeid (*volume->GetEncryptionAlgorithm()) == typeid (Kuznyechik))
|| (typeid (*volume->GetEncryptionAlgorithm()) == typeid (CamelliaKuznyechik))
|| (typeid (*volume->GetEncryptionAlgorithm()) == typeid (KuznyechikTwofish))
|| (typeid (*volume->GetEncryptionAlgorithm()) == typeid (KuznyechikAES))
diff --git a/src/Core/Unix/MacOSX/CoreMacOSX.cpp b/src/Core/Unix/MacOSX/CoreMacOSX.cpp
index b596e6e8..dde0d949 100644
--- a/src/Core/Unix/MacOSX/CoreMacOSX.cpp
+++ b/src/Core/Unix/MacOSX/CoreMacOSX.cpp
@@ -107,7 +107,13 @@ namespace VeraCrypt
void CoreMacOSX::CheckFilesystem (shared_ptr <VolumeInfo> mountedVolume, bool repair) const
{
list <string> args;
- args.push_back ("/Applications/Utilities/Disk Utility.app");
+ struct stat sb;
+
+ if (stat("/Applications/Utilities/Disk Utility.app", &sb) == 0)
+ args.push_back ("/Applications/Utilities/Disk Utility.app");
+ else
+ args.push_back ("/System/Applications/Utilities/Disk Utility.app");
+
Process::Execute ("open", args);
}
diff --git a/src/Core/Unix/OpenBSD/CoreOpenBSD.cpp b/src/Core/Unix/OpenBSD/CoreOpenBSD.cpp
index 0b55b401..3064103b 100644
--- a/src/Core/Unix/OpenBSD/CoreOpenBSD.cpp
+++ b/src/Core/Unix/OpenBSD/CoreOpenBSD.cpp
@@ -69,8 +69,6 @@ namespace VeraCrypt
if (freeVnd == -1)
throw "couldn't find free vnd";
- args.push_back ("-c");
-
stringstream freePath;
freePath << "vnd" << freeVnd;
args.push_back (freePath.str());
diff --git a/src/Core/VolumeCreator.cpp b/src/Core/VolumeCreator.cpp
index 1cc45b27..fefbddde 100644
--- a/src/Core/VolumeCreator.cpp
+++ b/src/Core/VolumeCreator.cpp
@@ -12,6 +12,9 @@
#include "Volume/EncryptionTest.h"
#include "Volume/EncryptionModeXTS.h"
+#ifdef WOLFCRYPT_BACKEND
+#include "Volume/EncryptionModeWolfCryptXTS.h"
+#endif
#include "Core.h"
#ifdef TC_UNIX
@@ -298,6 +301,11 @@ namespace VeraCrypt
// Master data key
MasterKey.Allocate (options->EA->GetKeySize() * 2);
RandomNumberGenerator::GetData (MasterKey);
+ // check that first half of MasterKey is different from its second half. If they are the same, through an exception
+ // cf CCSS,NSA comment at page 3: https://csrc.nist.gov/csrc/media/Projects/crypto-publication-review-project/documents/initial-comments/sp800-38e-initial-public-comments-2021.pdf
+ if (memcmp (MasterKey.Ptr(), MasterKey.Ptr() + MasterKey.Size() / 2, MasterKey.Size() / 2) == 0)
+ throw AssertionFailed (SRC_POS);
+
headerOptions.DataKey = MasterKey;
// PKCS5 salt
@@ -307,7 +315,7 @@ namespace VeraCrypt
// Header key
HeaderKey.Allocate (VolumeHeader::GetLargestSerializedKeySize());
- PasswordKey = Keyfile::ApplyListToPassword (options->Keyfiles, options->Password);
+ PasswordKey = Keyfile::ApplyListToPassword (options->Keyfiles, options->Password, options->EMVSupportEnabled);
options->VolumeHeaderKdf->DeriveKey (HeaderKey, *PasswordKey, options->Pim, salt);
headerOptions.HeaderKey = HeaderKey;
@@ -355,8 +363,13 @@ namespace VeraCrypt
// Data area keys
options->EA->SetKey (MasterKey.GetRange (0, options->EA->GetKeySize()));
- shared_ptr <EncryptionMode> mode (new EncryptionModeXTS ());
- mode->SetKey (MasterKey.GetRange (options->EA->GetKeySize(), options->EA->GetKeySize()));
+ #ifdef WOLFCRYPT_BACKEND
+ shared_ptr <EncryptionMode> mode (new EncryptionModeWolfCryptXTS ());
+ options->EA->SetKeyXTS (MasterKey.GetRange (options->EA->GetKeySize(), options->EA->GetKeySize()));
+ #else
+ shared_ptr <EncryptionMode> mode (new EncryptionModeXTS ());
+ #endif
+ mode->SetKey (MasterKey.GetRange (options->EA->GetKeySize(), options->EA->GetKeySize()));
options->EA->SetMode (mode);
Options = options;
diff --git a/src/Core/VolumeCreator.h b/src/Core/VolumeCreator.h
index 3e051bc7..781354b9 100644
--- a/src/Core/VolumeCreator.h
+++ b/src/Core/VolumeCreator.h
@@ -38,6 +38,7 @@ namespace VeraCrypt
shared_ptr <Pkcs5Kdf> VolumeHeaderKdf;
shared_ptr <EncryptionAlgorithm> EA;
bool Quick;
+ bool EMVSupportEnabled;
struct FilesystemType
{
diff --git a/src/Crypto/Aes.h b/src/Crypto/Aes.h
index e12c6fc8..db1bed27 100644
--- a/src/Crypto/Aes.h
+++ b/src/Crypto/Aes.h
@@ -35,6 +35,11 @@
#include "Common/Tcdefs.h"
+#ifdef WOLFCRYPT_BACKEND
+ #include <wolfssl/options.h>
+ #include <wolfssl/wolfcrypt/aes.h>
+#endif
+
#ifndef EXIT_SUCCESS
#define EXIT_SUCCESS 0
#define EXIT_FAILURE 1
@@ -93,11 +98,19 @@ typedef union
typedef struct
{ uint_32t ks[KS_LENGTH];
aes_inf inf;
+#ifdef WOLFCRYPT_BACKEND
+ XtsAes wc_enc_xts;
+ Aes wc_enc_aes;
+#endif
} aes_encrypt_ctx;
typedef struct
{ uint_32t ks[KS_LENGTH];
aes_inf inf;
+#ifdef WOLFCRYPT_BACKEND
+ XtsAes wc_dec_xts;
+ Aes wc_dec_aes;
+#endif
} aes_decrypt_ctx;
/* This routine must be called before first use if non-static */
@@ -152,6 +165,13 @@ AES_RETURN aes_decrypt(const unsigned char *in, unsigned char *out, const aes_de
#endif
+#ifdef WOLFCRYPT_BACKEND
+AES_RETURN xts_encrypt_key256(const unsigned char *key, aes_encrypt_ctx cx[1]);
+AES_RETURN xts_decrypt_key256(const unsigned char *key, aes_decrypt_ctx cx[1]);
+AES_RETURN xts_encrypt(const unsigned char *in, unsigned char *out, word64 length, word64 sector, const aes_encrypt_ctx cx[1]);
+AES_RETURN xts_decrypt(const unsigned char *in, unsigned char *out, word64 length, word64 sector, const aes_decrypt_ctx cx[1]);
+#endif
+
#if defined(AES_MODES)
/* Multiple calls to the following subroutines for multiple block */
diff --git a/src/Crypto/Crypto_vs2019.vcxproj b/src/Crypto/Crypto_vs2019.vcxproj
index aa75b9b8..ccd512b9 100644
--- a/src/Crypto/Crypto_vs2019.vcxproj
+++ b/src/Crypto/Crypto_vs2019.vcxproj
@@ -308,6 +308,9 @@
<ClCompile Include="Aeskey.c" />
<ClCompile Include="Aestab.c" />
<ClCompile Include="blake2s.c" />
+ <ClCompile Include="blake2s_SSE2.c" />
+ <ClCompile Include="blake2s_SSE41.c" />
+ <ClCompile Include="blake2s_SSSE3.c" />
<ClCompile Include="Camellia.c" />
<ClCompile Include="chacha-xmm.c" />
<ClCompile Include="chacha256.c" />
diff --git a/src/Crypto/Sha2.h b/src/Crypto/Sha2.h
index 7e90abff..1fbcb8d1 100644
--- a/src/Crypto/Sha2.h
+++ b/src/Crypto/Sha2.h
@@ -12,6 +12,13 @@
#include "Common/Endian.h"
#include "Crypto/config.h"
+#ifdef WOLFCRYPT_BACKEND
+ #include <wolfssl/options.h>
+ #include <wolfssl/wolfcrypt/sha256.h>
+ #include <wolfssl/wolfcrypt/sha512.h>
+ #include <wolfssl/wolfcrypt/hash.h>
+#endif
+
#if defined(__cplusplus)
extern "C" {
#endif
@@ -28,6 +35,10 @@ extern "C" {
#define SHA2_ALIGN CRYPTOPP_ALIGN_DATA(16)
#endif
+#ifdef WOLFCRYPT_BACKEND
+typedef struct wc_Sha512 sha512_ctx;
+typedef struct wc_Sha256 sha256_ctx;
+#else
typedef struct
{ uint_64t count[2];
SHA2_ALIGN uint_64t hash[8];
@@ -39,6 +50,7 @@ typedef struct
SHA2_ALIGN uint_32t hash[8];
SHA2_ALIGN uint_32t wbuf[16];
} sha256_ctx;
+#endif
void sha512_begin(sha512_ctx* ctx);
diff --git a/src/Crypto/Twofish.c b/src/Crypto/Twofish.c
index f0906f15..ad93b66f 100644
--- a/src/Crypto/Twofish.c
+++ b/src/Crypto/Twofish.c
@@ -607,7 +607,7 @@ void twofish_set_key(TwofishInstance *instance, const u4byte in_key[])
byte S8[16];
uint32 S32[4];
} us;
- int i;
+ unsigned int i;
const byte* key = (const byte*) in_key;
us.S32[0] = RS[0][key[0]] ^ RS[1][key[1]] ^ RS[2][key[2]] ^ RS[3][key[3]] ^ RS[4][key[4]] ^ RS[5][key[5]] ^ RS[6][key[6]] ^ RS[7][key[7]];
diff --git a/src/Crypto/Whirlpool.c b/src/Crypto/Whirlpool.c
index 98ba318d..9af0cb32 100644
--- a/src/Crypto/Whirlpool.c
+++ b/src/Crypto/Whirlpool.c
@@ -894,7 +894,7 @@ static uint64 HashMultipleBlocks(WHIRLPOOL_CTX * const ctx, const uint64 *input,
#if BYTE_ORDER == BIG_ENDIAN
WhirlpoolTransform(ctx->state, input);
#else
- CorrectEndianess(dataBuf, input, 64);
+ CorrectEndianness(dataBuf, input, 64);
WhirlpoolTransform(ctx->state, dataBuf);
#endif
input += 8;
@@ -1008,7 +1008,7 @@ void WHIRLPOOL_finalize(WHIRLPOOL_CTX * const ctx,
memset(data, 0, 32);
}
#if BYTE_ORDER == LITTLE_ENDIAN
- CorrectEndianess(dataBuf, dataBuf, 32);
+ CorrectEndianness(dataBuf, dataBuf, 32);
#endif
dataBuf[4] = 0;
@@ -1018,7 +1018,7 @@ void WHIRLPOOL_finalize(WHIRLPOOL_CTX * const ctx,
WhirlpoolTransform(stateBuf, dataBuf);
#if BYTE_ORDER == LITTLE_ENDIAN
- CorrectEndianess(stateBuf, stateBuf, 64);
+ CorrectEndianness(stateBuf, stateBuf, 64);
#endif
memcpy(result, stateBuf, 64);
}
diff --git a/src/Crypto/config.h b/src/Crypto/config.h
index 7ed6aabf..867c13dd 100644
--- a/src/Crypto/config.h
+++ b/src/Crypto/config.h
@@ -113,13 +113,13 @@
#define CRYPTOPP_X64_ASM_AVAILABLE
#endif
-#if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(CRYPTOPP_MSVC6PP_OR_LATER) || defined(__SSE2__)) && !defined(_M_ARM) && !defined(_M_ARM64)
+#if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(CRYPTOPP_MSVC6PP_OR_LATER) || defined(__SSE2__)) && !defined(_M_ARM) && !defined(_M_ARM64) && !defined(__arm__) && !defined(__aarch64__) && !defined(__arm64__)
#define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 1
#else
#define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 0
#endif
-#if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_SSSE3) && !defined(_M_ARM) && !defined(_M_ARM64) && ( \
+#if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_SSSE3) && !defined(_M_ARM) && !defined(_M_ARM64) && !defined(__arm__) && !defined(__aarch64__) && !defined(__arm64__) && ( \
defined(__SSSE3__) || (_MSC_VER >= 1500) || \
(CRYPTOPP_GCC_VERSION >= 40300) || (__INTEL_COMPILER >= 1000) || (__SUNPRO_CC >= 0x5110) || \
(CRYPTOPP_LLVM_CLANG_VERSION >= 20300) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40000))
@@ -128,7 +128,7 @@
#define CRYPTOPP_SSSE3_AVAILABLE 0
# endif
-#if !defined(CRYPTOPP_DISABLE_SSSE3) && (defined(__SSSE3__) || (_MSC_VER >= 1500)) && !defined(_M_ARM) && !defined(_M_ARM64)
+#if !defined(CRYPTOPP_DISABLE_SSSE3) && (defined(__SSSE3__) || (_MSC_VER >= 1500)) && !defined(_M_ARM) && !defined(_M_ARM64) && !defined(__arm__) && !defined(__aarch64__) && !defined(__arm64__)
#define CRYPTOPP_BOOL_SSSE3_INTRINSICS_AVAILABLE 1
#else
#define CRYPTOPP_BOOL_SSSE3_INTRINSICS_AVAILABLE 0
@@ -146,7 +146,7 @@
#define CRYPTOPP_BOOL_ALIGN16 0
#endif
-#if CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE && (defined(__SSE4_1__) || defined(__INTEL_COMPILER) || defined(_MSC_VER))
+#if CRYPTOPP_BOOL_SSSE3_INTRINSICS_AVAILABLE && (defined(__SSE4_1__) || defined(__INTEL_COMPILER) || defined(_MSC_VER))
#define CRYPTOPP_BOOL_SSE41_INTRINSICS_AVAILABLE 1
#else
#define CRYPTOPP_BOOL_SSE41_INTRINSICS_AVAILABLE 0
diff --git a/src/Crypto/cpu.c b/src/Crypto/cpu.c
index c3a769c8..effde6ba 100644
--- a/src/Crypto/cpu.c
+++ b/src/Crypto/cpu.c
@@ -348,7 +348,6 @@ void DetectX86Features()
g_hasISSE = 1;
else
{
- uint32 cpuid2[4] = {0};
CpuId(0x080000000, cpuid2);
if (cpuid2[0] >= 0x080000001)
{
diff --git a/src/Crypto/cpu.h b/src/Crypto/cpu.h
index 157aeaef..2661bf1c 100644
--- a/src/Crypto/cpu.h
+++ b/src/Crypto/cpu.h
@@ -152,7 +152,7 @@ extern __m128i _mm_slli_si128(__m128i _A, int _Imm);
#endif
#endif
-#if CRYPTOPP_SSSE3_AVAILABLE || defined(__INTEL_COMPILER)
+#if CRYPTOPP_BOOL_SSSE3_INTRINSICS_AVAILABLE || defined(__INTEL_COMPILER)
#if defined(TC_WINDOWS_DRIVER) || defined (_UEFI)
#if defined(__cplusplus)
extern "C" {
@@ -214,7 +214,7 @@ extern "C" {
#endif
#define CRYPTOPP_CPUID_AVAILABLE
-#ifndef CRYPTOPP_DISABLE_AESNI
+#if !defined(CRYPTOPP_DISABLE_AESNI) && !defined(WOLFCRYPT_BACKEND)
#define TC_AES_HW_CPU
#endif
@@ -238,7 +238,7 @@ extern volatile int g_isIntel;
extern volatile int g_isAMD;
extern volatile uint32 g_cacheLineSize;
void DetectX86Features(); // must be called at the start of the program/driver
-int CpuId(uint32 input, uint32 *output);
+int CpuId(uint32 input, uint32 output[4]);
// disable all CPU extended features (e.g. SSE, AVX, AES) that may have
// been enabled by DetectX86Features.
void DisableCPUExtendedFeatures ();
diff --git a/src/Crypto/jitterentropy-base-user.h b/src/Crypto/jitterentropy-base-user.h
index b32d8ed3..aaefb41a 100644
--- a/src/Crypto/jitterentropy-base-user.h
+++ b/src/Crypto/jitterentropy-base-user.h
@@ -85,6 +85,8 @@ static VC_INLINE void jent_get_nstime(uint64 *out)
#else
+#include <sys/types.h>
+
#if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64
/* taken from Linux kernel */
diff --git a/src/Crypto/misc.h b/src/Crypto/misc.h
index 47d0288a..25313d1d 100644
--- a/src/Crypto/misc.h
+++ b/src/Crypto/misc.h
@@ -151,7 +151,7 @@ VC_INLINE uint64 ByteReverseWord64(uint64 value)
#endif
}
-VC_INLINE void CorrectEndianess(uint64 *out, const uint64 *in, size_t byteCount)
+VC_INLINE void CorrectEndianness(uint64 *out, const uint64 *in, size_t byteCount)
{
size_t i, count = byteCount/sizeof(uint64);
diff --git a/src/Crypto/wolfCrypt.c b/src/Crypto/wolfCrypt.c
new file mode 100644
index 00000000..39ab93a7
--- /dev/null
+++ b/src/Crypto/wolfCrypt.c
@@ -0,0 +1,243 @@
+/* See src/Crypto/wolfCrypt.md */
+
+#include "Aes.h"
+#include "Sha2.h"
+#include "../Common/Crypto.h"
+#include <wolfssl/wolfcrypt/hmac.h>
+
+
+AES_RETURN aes_init()
+{
+#if defined( AES_ERR_CHK )
+ return EXIT_SUCCESS;
+#else
+ return;
+#endif
+}
+
+AES_RETURN aes_encrypt_key(const unsigned char *key, int key_len, aes_encrypt_ctx cx[1])
+{
+ int ret = 0;
+
+ ret = wc_AesInit(&cx->wc_enc_aes, NULL, INVALID_DEVID);
+
+ if (key_len == 128 || key_len == 192 || key_len == 256)
+ key_len = key_len/8;
+
+ if (ret == 0) {
+ ret = wc_AesSetKey(&cx->wc_enc_aes, key, key_len, NULL, AES_ENCRYPTION);
+ }
+
+#if defined( AES_ERR_CHK )
+ return ret ? EXIT_FAILURE : EXIT_SUCCESS;
+#else
+ return;
+#endif
+}
+
+AES_RETURN aes_decrypt_key(const unsigned char *key, int key_len, aes_decrypt_ctx cx[1])
+{
+ int ret = 0;
+
+ ret = wc_AesInit(&cx->wc_dec_aes, NULL, INVALID_DEVID);
+
+ if (key_len == 128 || key_len == 192 || key_len == 256)
+ key_len = key_len/8;
+
+ if (ret == 0) {
+ ret = wc_AesSetKey(&cx->wc_dec_aes, key, key_len, NULL, AES_DECRYPTION);
+ }
+
+#if defined( AES_ERR_CHK )
+ return ret ? EXIT_FAILURE : EXIT_SUCCESS;
+#else
+ return;
+#endif
+}
+
+AES_RETURN aes_encrypt_key128(const unsigned char *key, aes_encrypt_ctx cx[1])
+{
+ return aes_encrypt_key(key, 128, cx);
+}
+
+AES_RETURN aes_encrypt_key192(const unsigned char *key, aes_encrypt_ctx cx[1])
+{
+ return aes_encrypt_key(key, 192, cx);
+}
+
+AES_RETURN aes_encrypt_key256(const unsigned char *key, aes_encrypt_ctx cx[1])
+{
+ return aes_encrypt_key(key, 256, cx);
+}
+
+AES_RETURN aes_decrypt_key128(const unsigned char *key, aes_decrypt_ctx cx[1])
+{
+ return aes_decrypt_key(key, 128, cx);
+}
+
+AES_RETURN aes_decrypt_key192(const unsigned char *key, aes_decrypt_ctx cx[1])
+{
+ return aes_decrypt_key(key, 192, cx);
+}
+
+AES_RETURN aes_decrypt_key256(const unsigned char *key, aes_decrypt_ctx cx[1])
+{
+ return aes_decrypt_key(key, 256, cx);
+}
+
+AES_RETURN aes_encrypt(const unsigned char *in, unsigned char *out, const aes_encrypt_ctx cx[1])
+{
+ int ret = wc_AesEncryptDirect(&cx->wc_enc_aes, out, in);
+#if defined( AES_ERR_CHK )
+ return ret ? EXIT_FAILURE : EXIT_SUCCESS;
+#else
+ return;
+#endif
+
+}
+
+AES_RETURN aes_decrypt(const unsigned char *in, unsigned char *out, const aes_decrypt_ctx cx[1])
+{
+ int ret = wc_AesDecryptDirect(&cx->wc_dec_aes, out, in);
+#if defined( AES_ERR_CHK )
+ return ret ? EXIT_FAILURE : EXIT_SUCCESS;
+#else
+ return;
+#endif
+
+}
+
+AES_RETURN xts_encrypt_key(const unsigned char *key, int key_len, aes_encrypt_ctx cx[1])
+{
+ int ret = 0;
+
+ cx->wc_enc_xts.aes = cx->wc_enc_aes;
+
+ ret = wc_AesInit(&cx->wc_enc_xts.tweak, NULL, INVALID_DEVID);
+
+ if (key_len == 128 || key_len == 192 || key_len == 256)
+ key_len = key_len/8;
+
+ if (ret == 0) {
+ ret = wc_AesSetKey(&cx->wc_enc_xts.tweak, key, key_len, NULL, AES_ENCRYPTION);
+ }
+#if defined( AES_ERR_CHK )
+ return ret ? EXIT_FAILURE : EXIT_SUCCESS;
+#else
+ return;
+#endif
+}
+
+AES_RETURN xts_decrypt_key(const unsigned char *key, int key_len, aes_decrypt_ctx cx[1])
+{
+ int ret = 0;
+
+ cx->wc_dec_xts.aes = cx->wc_dec_aes;
+
+ ret = wc_AesInit(&cx->wc_dec_xts.tweak, NULL, INVALID_DEVID);
+
+ if (key_len == 128 || key_len == 192 || key_len == 256)
+ key_len = key_len/8;
+
+ if (ret == 0) {
+ ret = wc_AesSetKey(&cx->wc_dec_xts.tweak, key, key_len, NULL, AES_ENCRYPTION);
+ }
+
+#if defined( AES_ERR_CHK )
+ return ret ? EXIT_FAILURE : EXIT_SUCCESS;
+#else
+ return;
+#endif
+}
+
+AES_RETURN xts_encrypt_key256(const unsigned char *key, aes_encrypt_ctx cx[1])
+{
+ return xts_encrypt_key(key, 256, cx);
+}
+
+AES_RETURN xts_decrypt_key256(const unsigned char *key, aes_decrypt_ctx cx[1])
+{
+ return xts_decrypt_key(key, 256, cx);
+}
+
+AES_RETURN xts_encrypt(const unsigned char *in, unsigned char *out, word64 length, word64 sector, const aes_encrypt_ctx cx[1])
+{
+ int ret = wc_AesXtsEncryptConsecutiveSectors(&cx->wc_enc_xts, out, in, length, sector, ENCRYPTION_DATA_UNIT_SIZE);
+
+#if defined( AES_ERR_CHK )
+ return ret ? EXIT_FAILURE : EXIT_SUCCESS;
+#else
+ return;
+#endif
+
+}
+
+AES_RETURN xts_decrypt(const unsigned char *in, unsigned char *out, word64 length, word64 sector, const aes_decrypt_ctx cx[1])
+{
+ int ret = wc_AesXtsDecryptConsecutiveSectors(&cx->wc_dec_xts, out, in, length, sector, ENCRYPTION_DATA_UNIT_SIZE);
+
+#if defined( AES_ERR_CHK )
+ return ret ? EXIT_FAILURE : EXIT_SUCCESS;
+#else
+ return;
+#endif
+}
+
+
+void sha256_begin(sha256_ctx* ctx)
+{
+ wc_InitSha256(ctx);
+}
+
+void sha256_hash(const unsigned char * source, uint_32t sourceLen, sha256_ctx *ctx)
+{
+ wc_Sha256Update(ctx, source, sourceLen);
+}
+
+void sha256_end(unsigned char * result, sha256_ctx* ctx)
+{
+ wc_Sha256Final(ctx, result);
+}
+
+void sha256(unsigned char * result, const unsigned char* source, uint_32t sourceLen)
+{
+ wc_Sha256 sha256;
+ wc_InitSha256(&sha256);
+ wc_Sha256Update(&sha256, source, sourceLen);
+ wc_Sha256Final(&sha256, result);
+ wc_Sha256Free(&sha256);
+}
+
+void sha512_begin(sha512_ctx* ctx)
+{
+ wc_InitSha512(ctx);
+}
+
+void sha512_hash(const unsigned char * source, uint_64t sourceLen, sha512_ctx *ctx)
+{
+ wc_Sha512Update(ctx, source, sourceLen);
+}
+
+void sha512_end(unsigned char * result, sha512_ctx* ctx)
+{
+ wc_Sha512Final(ctx, result);
+}
+
+void sha512(unsigned char * result, const unsigned char* source, uint_64t sourceLen)
+{
+ wc_Sha512 sha512;
+ wc_InitSha512(&sha512);
+ wc_Sha512Update(&sha512, source, sourceLen);
+ wc_Sha512Final(&sha512, result);
+ wc_Sha512Free(&sha512);
+}
+
+void derive_key_sha512 (char *pwd, int pwd_len, char *salt, int salt_len, uint32 iterations, char *dk, int dklen) {
+ (void) iterations;
+ wc_HKDF(WC_SHA512, (byte*)pwd, (word32)pwd_len, (byte*)salt, (word32)salt_len, NULL, 0, (byte*)dk, (word32)dklen);
+}
+
+void derive_key_sha256 (char *pwd, int pwd_len, char *salt, int salt_len, uint32 iterations, char *dk, int dklen) {
+ (void) iterations;
+ wc_HKDF(WC_SHA256, (byte*)pwd, (word32)pwd_len, (byte*)salt, (word32)salt_len, NULL, 0, (byte*)dk, (word32)dklen);
+}
diff --git a/src/Crypto/wolfCrypt.md b/src/Crypto/wolfCrypt.md
new file mode 100644
index 00000000..32ccf242
--- /dev/null
+++ b/src/Crypto/wolfCrypt.md
@@ -0,0 +1,25 @@
+# wolfSSL as crypto provider for VeraCrypt
+
+[wolfCrypt](https://www.wolfssl.com/products/wolfcrypt/) is wolfSSL's cutting edge crypto engine and a
+potential FIPS solution for users of VeraCrypt. Follow the steps below to setup VeraCrypt with wolfCrypt.
+
+## Building wolfSSL
+
+Clone wolfSSL and build it as shown below.
+
+```
+git clone https://github.com/wolfssl/wolfssl && cd wolfssl
+./autogen.sh
+./configure --enable-xts CFLAGS="-DNO_OLD_WC_NAMES"
+make
+sudo make install
+```
+
+## Building VeraCrypt with wolfSSL
+
+Build VeraCrypt with the `WOLFCRYPT` command line option.
+
+```
+make WXSTATIC=1 wxbuild && make WXSTATIC=1 clean && make WXSTATIC=1 WOLFCRYPT=1 && make WXSTATIC=1 WOLFCRYPT=1 package
+```
+
diff --git a/src/Driver/DriveFilter.c b/src/Driver/DriveFilter.c
index 0da212f6..49d62126 100644
--- a/src/Driver/DriveFilter.c
+++ b/src/Driver/DriveFilter.c
@@ -520,7 +520,7 @@ static NTSTATUS MountDrive (DriveFilterExtension *Extension, Password *password,
pim = (int) (BootArgs.Flags >> 16);
- if (ReadVolumeHeader (!hiddenVolume, header, password, pkcs5_prf, pim, FALSE, &Extension->Queue.CryptoInfo, Extension->HeaderCryptoInfo) == 0)
+ if (ReadVolumeHeader (!hiddenVolume, header, password, pkcs5_prf, pim, &Extension->Queue.CryptoInfo, Extension->HeaderCryptoInfo) == 0)
{
// Header decrypted
status = STATUS_SUCCESS;
@@ -1193,7 +1193,7 @@ void ReopenBootVolumeHeader (PIRP irp, PIO_STACK_LOCATION irpSp)
}
#endif
- if (ReadVolumeHeader (!BootDriveFilterExtension->HiddenSystem, header, &request->VolumePassword, request->pkcs5_prf, request->pim, FALSE, NULL, BootDriveFilterExtension->HeaderCryptoInfo) == 0)
+ if (ReadVolumeHeader (!BootDriveFilterExtension->HiddenSystem, header, &request->VolumePassword, request->pkcs5_prf, request->pim, NULL, BootDriveFilterExtension->HeaderCryptoInfo) == 0)
{
Dump ("Header reopened\n");
#ifdef _WIN64
diff --git a/src/Driver/Driver.rc b/src/Driver/Driver.rc
index b61ce330..ed2e4560 100644
--- a/src/Driver/Driver.rc
+++ b/src/Driver/Driver.rc
@@ -27,8 +27,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,26,0,0
- PRODUCTVERSION 1,26,0,0
+ FILEVERSION 1,26,10,0
+ PRODUCTVERSION 1,26,10,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -45,11 +45,11 @@ BEGIN
BEGIN
VALUE "CompanyName", "IDRIX"
VALUE "FileDescription", "VeraCrypt Driver"
- VALUE "FileVersion", "1.26"
+ VALUE "FileVersion", "1.26.10"
VALUE "LegalTrademarks", "VeraCrypt"
VALUE "OriginalFilename", "veracrypt.sys"
VALUE "ProductName", "VeraCrypt"
- VALUE "ProductVersion", "1.26"
+ VALUE "ProductVersion", "1.26.10"
END
END
BLOCK "VarFileInfo"
diff --git a/src/Driver/EncryptedIoQueue.c b/src/Driver/EncryptedIoQueue.c
index 6900fc0d..bdf139a1 100644
--- a/src/Driver/EncryptedIoQueue.c
+++ b/src/Driver/EncryptedIoQueue.c
@@ -797,7 +797,7 @@ static VOID MainThreadProc (PVOID threadArg)
request->OrigDataBufferFragment = dataBuffer;
request->Length = dataFragmentLength;
- if (queue->IsFilterDevice)
+ if (queue->IsFilterDevice || queue->bSupportPartialEncryption)
{
if (queue->EncryptedAreaStart == -1 || queue->EncryptedAreaEnd == -1)
{
diff --git a/src/Driver/EncryptedIoQueue.h b/src/Driver/EncryptedIoQueue.h
index c4b6f269..2ab9dc5b 100644
--- a/src/Driver/EncryptedIoQueue.h
+++ b/src/Driver/EncryptedIoQueue.h
@@ -49,6 +49,7 @@ typedef struct
// File-handle-based IO
HANDLE HostFileHandle;
+ BOOL bSupportPartialEncryption;
int64 VirtualDeviceLength;
SECURITY_CLIENT_CONTEXT *SecurityClientContext;
diff --git a/src/Driver/Fuse/Driver.make b/src/Driver/Fuse/Driver.make
index f58785b9..b3640115 100644
--- a/src/Driver/Fuse/Driver.make
+++ b/src/Driver/Fuse/Driver.make
@@ -15,6 +15,6 @@ NAME := Driver
OBJS :=
OBJS += FuseService.o
-CXXFLAGS += $(shell pkg-config fuse --cflags)
+CXXFLAGS += $(shell $(PKG_CONFIG) fuse --cflags)
include $(BUILD_INC)/Makefile.inc
diff --git a/src/Driver/Fuse/FuseService.cpp b/src/Driver/Fuse/FuseService.cpp
index eee0c433..bc3d1023 100644
--- a/src/Driver/Fuse/FuseService.cpp
+++ b/src/Driver/Fuse/FuseService.cpp
@@ -230,7 +230,7 @@ namespace VeraCrypt
FuseService::ReadVolumeSectors (BufferPtr ((byte *) buf, size), offset);
}
}
- catch (MissingVolumeData)
+ catch (MissingVolumeData&)
{
return 0;
}
@@ -359,7 +359,7 @@ namespace VeraCrypt
{
throw;
}
- catch (std::bad_alloc)
+ catch (std::bad_alloc&)
{
return -ENOMEM;
}
diff --git a/src/Driver/Ntdriver.c b/src/Driver/Ntdriver.c
index e70c0463..b337ad86 100644
--- a/src/Driver/Ntdriver.c
+++ b/src/Driver/Ntdriver.c
@@ -145,6 +145,7 @@ static BOOL RamEncryptionActivated = FALSE;
static KeSaveExtendedProcessorStateFn KeSaveExtendedProcessorStatePtr = NULL;
static KeRestoreExtendedProcessorStateFn KeRestoreExtendedProcessorStatePtr = NULL;
static ExGetFirmwareEnvironmentVariableFn ExGetFirmwareEnvironmentVariablePtr = NULL;
+static KeQueryInterruptTimePreciseFn KeQueryInterruptTimePrecisePtr = NULL;
static KeAreAllApcsDisabledFn KeAreAllApcsDisabledPtr = NULL;
static KeSetSystemGroupAffinityThreadFn KeSetSystemGroupAffinityThreadPtr = NULL;
static KeQueryActiveGroupCountFn KeQueryActiveGroupCountPtr = NULL;
@@ -238,8 +239,17 @@ void GetDriverRandomSeed (unsigned char* pbRandSeed, size_t cbRandSeed)
iSeed = KeQueryPerformanceCounter (&iSeed2);
WHIRLPOOL_add ((unsigned char *) &(iSeed.QuadPart), sizeof(iSeed.QuadPart), &tctx);
WHIRLPOOL_add ((unsigned char *) &(iSeed2.QuadPart), sizeof(iSeed2.QuadPart), &tctx);
- iSeed.QuadPart = KeQueryInterruptTime ();
- WHIRLPOOL_add ((unsigned char *) &(iSeed.QuadPart), sizeof(iSeed.QuadPart), &tctx);
+ if (KeQueryInterruptTimePrecisePtr)
+ {
+ iSeed.QuadPart = KeQueryInterruptTimePrecisePtr (&iSeed2.QuadPart);
+ WHIRLPOOL_add ((unsigned char *) &(iSeed.QuadPart), sizeof(iSeed.QuadPart), &tctx);
+ WHIRLPOOL_add ((unsigned char *) &(iSeed2.QuadPart), sizeof(iSeed2.QuadPart), &tctx);
+ }
+ else
+ {
+ iSeed.QuadPart = KeQueryInterruptTime ();
+ WHIRLPOOL_add ((unsigned char *) &(iSeed.QuadPart), sizeof(iSeed.QuadPart), &tctx);
+ }
/* use JitterEntropy library to get good quality random bytes based on CPU timing jitter */
if (0 == jent_entropy_init ())
@@ -339,6 +349,14 @@ NTSTATUS DriverEntry (PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
ExGetFirmwareEnvironmentVariablePtr = (ExGetFirmwareEnvironmentVariableFn) MmGetSystemRoutineAddress(&funcName);
}
+ // KeQueryInterruptTimePrecise is available starting from Windows 8.1
+ if ((OsMajorVersion > 6) || (OsMajorVersion == 6 && OsMinorVersion >= 3))
+ {
+ UNICODE_STRING funcName;
+ RtlInitUnicodeString(&funcName, L"KeQueryInterruptTimePrecise");
+ KeQueryInterruptTimePrecisePtr = (KeQueryInterruptTimePreciseFn) MmGetSystemRoutineAddress(&funcName);
+ }
+
// Load dump filter if the main driver is already loaded
if (NT_SUCCESS (TCDeviceIoControl (NT_ROOT_PREFIX, TC_IOCTL_GET_DRIVER_VERSION, NULL, 0, &version, sizeof (version))))
return DumpFilterEntry ((PFILTER_EXTENSION) DriverObject, (PFILTER_INITIALIZATION_DATA) RegistryPath);
@@ -1015,8 +1033,8 @@ NTSTATUS ProcessVolumeDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION
outputBuffer->Geometry.TracksPerCylinder = Extension->TracksPerCylinder;
outputBuffer->Geometry.SectorsPerTrack = Extension->SectorsPerTrack;
outputBuffer->Geometry.BytesPerSector = Extension->BytesPerSector;
- /* add one sector to DiskLength since our partition size is DiskLength and its offset if BytesPerSector */
- outputBuffer->DiskSize.QuadPart = Extension->DiskLength + Extension->BytesPerSector;
+ // Add 1MB to the disk size to emulate the geometry of a real MBR disk
+ outputBuffer->DiskSize.QuadPart = Extension->DiskLength + BYTES_PER_MB;
if (bFullBuffer)
{
@@ -1287,7 +1305,7 @@ NTSTATUS ProcessVolumeDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION
outputBuffer->BootIndicator = FALSE;
outputBuffer->RecognizedPartition = TRUE;
outputBuffer->RewritePartition = FALSE;
- outputBuffer->StartingOffset.QuadPart = Extension->BytesPerSector;
+ outputBuffer->StartingOffset.QuadPart = BYTES_PER_MB; // Set offset to 1MB to emulate the partition offset on a real MBR disk
outputBuffer->PartitionLength.QuadPart= Extension->DiskLength;
outputBuffer->PartitionNumber = 1;
outputBuffer->HiddenSectors = 0;
@@ -1304,7 +1322,7 @@ NTSTATUS ProcessVolumeDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION
outputBuffer->PartitionStyle = PARTITION_STYLE_MBR;
outputBuffer->RewritePartition = FALSE;
- outputBuffer->StartingOffset.QuadPart = Extension->BytesPerSector;
+ outputBuffer->StartingOffset.QuadPart = BYTES_PER_MB; // Set offset to 1MB to emulate the partition offset on a real MBR disk
outputBuffer->PartitionLength.QuadPart= Extension->DiskLength;
outputBuffer->PartitionNumber = 1;
outputBuffer->Mbr.PartitionType = Extension->PartitionType;
@@ -1332,7 +1350,7 @@ NTSTATUS ProcessVolumeDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION
outputBuffer->PartitionEntry->BootIndicator = FALSE;
outputBuffer->PartitionEntry->RecognizedPartition = TRUE;
outputBuffer->PartitionEntry->RewritePartition = FALSE;
- outputBuffer->PartitionEntry->StartingOffset.QuadPart = Extension->BytesPerSector;
+ outputBuffer->PartitionEntry->StartingOffset.QuadPart = BYTES_PER_MB; // Set offset to 1MB to emulate the partition offset on a real MBR disk
outputBuffer->PartitionEntry->PartitionLength.QuadPart = Extension->DiskLength;
outputBuffer->PartitionEntry->PartitionNumber = 1;
outputBuffer->PartitionEntry->HiddenSectors = 0;
@@ -1368,7 +1386,7 @@ NTSTATUS ProcessVolumeDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION
outputBuffer->PartitionEntry->Mbr.BootIndicator = FALSE;
outputBuffer->PartitionEntry->Mbr.RecognizedPartition = TRUE;
outputBuffer->PartitionEntry->RewritePartition = FALSE;
- outputBuffer->PartitionEntry->StartingOffset.QuadPart = Extension->BytesPerSector;
+ outputBuffer->PartitionEntry->StartingOffset.QuadPart = BYTES_PER_MB; // Set offset to 1MB to emulate the partition offset on a real MBR disk
outputBuffer->PartitionEntry->PartitionLength.QuadPart = Extension->DiskLength;
outputBuffer->PartitionEntry->PartitionNumber = 1;
outputBuffer->PartitionEntry->Mbr.HiddenSectors = 0;
@@ -1529,7 +1547,7 @@ NTSTATUS ProcessVolumeDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION
// of the underlaying physical disk and we report a single extent
extents->NumberOfDiskExtents = 1;
extents->Extents[0].DiskNumber = Extension->DeviceNumber;
- extents->Extents[0].StartingOffset.QuadPart = Extension->BytesPerSector;
+ extents->Extents[0].StartingOffset.QuadPart = BYTES_PER_MB; // Set offset to 1MB to emulate the partition offset on a real MBR disk
extents->Extents[0].ExtentLength.QuadPart = Extension->DiskLength;
}
else
@@ -1557,8 +1575,8 @@ NTSTATUS ProcessVolumeDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION
capacity->Version = sizeof (STORAGE_READ_CAPACITY);
capacity->Size = sizeof (STORAGE_READ_CAPACITY);
capacity->BlockLength = Extension->BytesPerSector;
- capacity->NumberOfBlocks.QuadPart = (Extension->DiskLength / Extension->BytesPerSector) + 1;
- capacity->DiskLength.QuadPart = Extension->DiskLength + Extension->BytesPerSector;
+ capacity->DiskLength.QuadPart = Extension->DiskLength + BYTES_PER_MB; // Add 1MB to the disk size to emulate the geometry of a real MBR disk
+ capacity->NumberOfBlocks.QuadPart = capacity->DiskLength.QuadPart / capacity->BlockLength;
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = sizeof (STORAGE_READ_CAPACITY);
@@ -1941,7 +1959,7 @@ NTSTATUS ProcessMainDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION Ex
switch (irpSp->Parameters.DeviceIoControl.IoControlCode)
{
case TC_IOCTL_GET_DRIVER_VERSION:
- case TC_IOCTL_LEGACY_GET_DRIVER_VERSION:
+
if (ValidateIOBufferSize (Irp, sizeof (LONG), ValidateOutput))
{
LONG tmp = VERSION_NUM;
@@ -2375,7 +2393,6 @@ NTSTATUS ProcessMainDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION Ex
list->volumeType[ListExtension->nDosDriveNo] = PROP_VOL_TYPE_OUTER; // Normal/outer volume (hidden volume protected)
else
list->volumeType[ListExtension->nDosDriveNo] = PROP_VOL_TYPE_NORMAL; // Normal volume
- list->truecryptMode[ListExtension->nDosDriveNo] = ListExtension->cryptoInfo->bTrueCryptMode;
}
}
@@ -2384,21 +2401,6 @@ NTSTATUS ProcessMainDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION Ex
}
break;
- case TC_IOCTL_LEGACY_GET_MOUNTED_VOLUMES:
- if (ValidateIOBufferSize (Irp, sizeof (uint32), ValidateOutput))
- {
- // Prevent the user from downgrading to versions lower than 5.0 by faking mounted volumes.
- // The user could render the system unbootable by downgrading when boot encryption
- // is active or being set up.
-
- memset (Irp->AssociatedIrp.SystemBuffer, 0, irpSp->Parameters.DeviceIoControl.OutputBufferLength);
- *(uint32 *) Irp->AssociatedIrp.SystemBuffer = 0xffffFFFF;
-
- Irp->IoStatus.Status = STATUS_SUCCESS;
- Irp->IoStatus.Information = irpSp->Parameters.DeviceIoControl.OutputBufferLength;
- }
- break;
-
case TC_IOCTL_GET_VOLUME_PROPERTIES:
if (ValidateIOBufferSize (Irp, sizeof (VOLUME_PROPERTIES_STRUCT), ValidateInputOutput))
{
@@ -2674,7 +2676,6 @@ NTSTATUS ProcessMainDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION Ex
|| mount->pkcs5_prf < 0 || mount->pkcs5_prf > LAST_PRF_ID
|| mount->VolumePim < -1 || mount->VolumePim == INT_MAX
|| mount->ProtectedHidVolPkcs5Prf < 0 || mount->ProtectedHidVolPkcs5Prf > LAST_PRF_ID
- || (mount->bTrueCryptMode != FALSE && mount->bTrueCryptMode != TRUE)
)
{
Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
@@ -2692,7 +2693,6 @@ NTSTATUS ProcessMainDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION Ex
burn (&mount->ProtectedHidVolPassword, sizeof (mount->ProtectedHidVolPassword));
burn (&mount->pkcs5_prf, sizeof (mount->pkcs5_prf));
burn (&mount->VolumePim, sizeof (mount->VolumePim));
- burn (&mount->bTrueCryptMode, sizeof (mount->bTrueCryptMode));
burn (&mount->ProtectedHidVolPkcs5Prf, sizeof (mount->ProtectedHidVolPkcs5Prf));
burn (&mount->ProtectedHidVolPim, sizeof (mount->ProtectedHidVolPim));
}
@@ -3174,6 +3174,21 @@ VOID VolumeThreadProc (PVOID Context)
Extension->Queue.HostFileHandle = Extension->hDeviceFile;
Extension->Queue.VirtualDeviceLength = Extension->DiskLength;
Extension->Queue.MaxReadAheadOffset.QuadPart = Extension->HostLength;
+ if (bDevice && pThreadBlock->mount->bPartitionInInactiveSysEncScope
+ && (!Extension->cryptoInfo->hiddenVolume)
+ && (Extension->cryptoInfo->EncryptedAreaLength.Value != Extension->cryptoInfo->VolumeSize.Value)
+ )
+ {
+ // Support partial encryption only in the case of system encryption
+ Extension->Queue.EncryptedAreaStart = 0;
+ Extension->Queue.EncryptedAreaEnd = Extension->cryptoInfo->EncryptedAreaLength.Value - 1;
+ if (Extension->Queue.CryptoInfo->EncryptedAreaLength.Value == 0)
+ {
+ Extension->Queue.EncryptedAreaStart = -1;
+ Extension->Queue.EncryptedAreaEnd = -1;
+ }
+ Extension->Queue.bSupportPartialEncryption = TRUE;
+ }
if (Extension->SecurityClientContextValid)
Extension->Queue.SecurityClientContext = &Extension->SecurityClientContext;
diff --git a/src/Driver/Ntvol.c b/src/Driver/Ntvol.c
index ebef6c37..444468c5 100644
--- a/src/Driver/Ntvol.c
+++ b/src/Driver/Ntvol.c
@@ -88,6 +88,7 @@ NTSTATUS TCOpenVolume (PDEVICE_OBJECT DeviceObject,
}
mount->VolumeMountedReadOnlyAfterDeviceWriteProtected = FALSE;
+ mount->VolumeMountedReadOnlyAfterPartialSysEnc = FALSE;
// If we are opening a device, query its size first
if (bRawDevice)
@@ -610,7 +611,6 @@ NTSTATUS TCOpenVolume (PDEVICE_OBJECT DeviceObject,
&mount->ProtectedHidVolPassword,
mount->ProtectedHidVolPkcs5Prf,
mount->ProtectedHidVolPim,
- mount->bTrueCryptMode,
&tmpCryptoInfo);
}
else
@@ -623,7 +623,6 @@ NTSTATUS TCOpenVolume (PDEVICE_OBJECT DeviceObject,
&mount->VolumePassword,
mount->pkcs5_prf,
mount->VolumePim,
- mount->bTrueCryptMode,
&Extension->cryptoInfo);
}
@@ -679,10 +678,9 @@ NTSTATUS TCOpenVolume (PDEVICE_OBJECT DeviceObject,
if (Extension->cryptoInfo->EncryptedAreaLength.Value != Extension->cryptoInfo->VolumeSize.Value)
{
- // Partial encryption is not supported for volumes mounted as regular
- mount->nReturnCode = ERR_ENCRYPTION_NOT_COMPLETED;
- ntStatus = STATUS_SUCCESS;
- goto error;
+ // mount as readonly in case of partial system encryption
+ Extension->bReadOnly = mount->bMountReadOnly = TRUE;
+ mount->VolumeMountedReadOnlyAfterPartialSysEnc = TRUE;
}
}
else if (Extension->cryptoInfo->HeaderFlags & TC_HEADER_FLAG_NONSYS_INPLACE_ENC)
@@ -800,8 +798,7 @@ NTSTATUS TCOpenVolume (PDEVICE_OBJECT DeviceObject,
Extension->TracksPerCylinder = 1;
Extension->SectorsPerTrack = 1;
Extension->BytesPerSector = Extension->cryptoInfo->SectorSize;
- // Add extra sector since our virtual partition starts at Extension->BytesPerSector and not 0
- Extension->NumberOfCylinders = (Extension->DiskLength / Extension->BytesPerSector) + 1;
+ Extension->NumberOfCylinders = Extension->DiskLength / Extension->BytesPerSector;
Extension->PartitionType = 0;
Extension->bRawDevice = bRawDevice;
diff --git a/src/Driver/veracrypt_vs2019.vcxproj b/src/Driver/veracrypt_vs2019.vcxproj
index f06f8974..e956bcb0 100644
--- a/src/Driver/veracrypt_vs2019.vcxproj
+++ b/src/Driver/veracrypt_vs2019.vcxproj
@@ -5,6 +5,10 @@
<Configuration>Debug</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
@@ -13,6 +17,10 @@
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
@@ -34,6 +42,9 @@
<ClCompile Include="..\Crypto\Aeskey.c" />
<ClCompile Include="..\Crypto\Aestab.c" />
<ClCompile Include="..\Crypto\blake2s.c" />
+ <ClCompile Include="..\Crypto\blake2s_SSE2.c" />
+ <ClCompile Include="..\Crypto\blake2s_SSE41.c" />
+ <ClCompile Include="..\Crypto\blake2s_SSSE3.c" />
<ClCompile Include="..\Crypto\Camellia.c" />
<ClCompile Include="..\Crypto\chacha-xmm.c" />
<ClCompile Include="..\Crypto\chacha256.c" />
@@ -44,21 +55,27 @@
<ClCompile Include="..\Crypto\kuznyechik_simd.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\Crypto\rdrand.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\Crypto\SerpentFast.c" />
<ClCompile Include="..\Crypto\SerpentFast_simd.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\Crypto\Sha2.c" />
<ClCompile Include="..\Crypto\Streebog.c" />
@@ -106,6 +123,16 @@
<_NT_TARGET_VERSION>0x0A00</_NT_TARGET_VERSION>
<SupportsPackaging>false</SupportsPackaging>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <TargetVersion>Windows10</TargetVersion>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
+ <ConfigurationType>Driver</ConfigurationType>
+ <DriverType>WDM</DriverType>
+ <DriverTargetPlatform>Universal</DriverTargetPlatform>
+ <_NT_TARGET_VERSION>0x0A00</_NT_TARGET_VERSION>
+ <SupportsPackaging>false</SupportsPackaging>
+ </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
<TargetVersion>Windows10</TargetVersion>
<UseDebugLibraries>false</UseDebugLibraries>
@@ -124,6 +151,15 @@
<_NT_TARGET_VERSION>0x0A00</_NT_TARGET_VERSION>
<SupportsPackaging>false</SupportsPackaging>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <TargetVersion>Windows10</TargetVersion>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
+ <ConfigurationType>Driver</ConfigurationType>
+ <DriverType>WDM</DriverType>
+ <_NT_TARGET_VERSION>0x0A00</_NT_TARGET_VERSION>
+ <SupportsPackaging>false</SupportsPackaging>
+ </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
@@ -141,6 +177,10 @@
<TargetName>veracrypt</TargetName>
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <TargetName>veracrypt</TargetName>
+ <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
+ </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
<OutDir>$(ProjectDir)$(Platform)\$(ConfigurationName)\</OutDir>
@@ -150,6 +190,10 @@
<TargetName>veracrypt</TargetName>
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <TargetName>veracrypt</TargetName>
+ <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
+ </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
<Link>
<AdditionalDependencies>fltmgr.lib;%(AdditionalDependencies)</AdditionalDependencies>
@@ -184,6 +228,23 @@
<SpecifyDriverVerDirectiveVersion>false</SpecifyDriverVerDirectiveVersion>
</Inf>
</ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Link>
+ <AdditionalDependencies>fltmgr.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
+ </Link>
+ <ClCompile>
+ <AdditionalIncludeDirectories>$(SolutionDir)Common;$(SolutionDir)Crypto;$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>TC_WINDOWS_DRIVER;_WIN32;_NO_CRT_STDIO_INLINE;DEBUG;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <DisableSpecificWarnings>4064;4627;4627;4366;4100;4057;4457;4456;4152;4213;4244;4127;4706;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <PostBuildEvent>
+ <Command>copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt-arm64.sys"</Command>
+ </PostBuildEvent>
+ <Inf>
+ <SpecifyDriverVerDirectiveVersion>false</SpecifyDriverVerDirectiveVersion>
+ </Inf>
+ </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<Link>
<AdditionalDependencies>fltmgr.lib;%(AdditionalDependencies)</AdditionalDependencies>
@@ -220,6 +281,24 @@
<SpecifyDriverVerDirectiveVersion>false</SpecifyDriverVerDirectiveVersion>
</Inf>
</ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Link>
+ <AdditionalDependencies>fltmgr.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
+ </Link>
+ <ClCompile>
+ <AdditionalIncludeDirectories>$(SolutionDir)Common;$(SolutionDir)Crypto;$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>TC_WINDOWS_DRIVER;_WIN32;_NO_CRT_STDIO_INLINE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <DisableSpecificWarnings>4064;4627;4627;4366;4100;4057;4457;4456;4152;4213;4244;4127;4706;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <PostBuildEvent>
+ <Command>copy $(TargetPath) "..\Release\Setup Files\VeraCrypt-arm64.sys"</Command>
+ </PostBuildEvent>
+ <Inf>
+ <SpecifyArchitecture>true</SpecifyArchitecture>
+ <SpecifyDriverVerDirectiveVersion>false</SpecifyDriverVerDirectiveVersion>
+ </Inf>
+ </ItemDefinitionGroup>
<ItemGroup>
<FilesToPackage Include="$(TargetPath)" />
</ItemGroup>
@@ -266,26 +345,36 @@
</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">echo %(Filename)%(Extension) &amp; nasm.exe -Xvc -f win64 -Ox -g -o "$(TargetDir)\%(Filename).obj" "%(FullPath)"
</Command>
+ <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">echo %(Filename)%(Extension) &amp; nasm.exe -Xvc -f win64 -Ox -g -o "$(TargetDir)\%(Filename).obj" "%(FullPath)"
+</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">echo %(Filename)%(Extension) &amp; nasm.exe -Xvc -f win64 -Ox -g -o "$(TargetDir)\%(Filename).obj" "%(FullPath)"
</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">echo %(Filename)%(Extension) &amp; nasm.exe -Xvc -f win64 -Ox -g -o "$(TargetDir)\%(Filename).obj" "%(FullPath)"
</Command>
+ <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">echo %(Filename)%(Extension) &amp; nasm.exe -Xvc -f win64 -Ox -g -o "$(TargetDir)\%(Filename).obj" "%(FullPath)"
+</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">$(TargetDir)\%(Filename).obj;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(TargetDir)\%(Filename).obj;%(Outputs)</Outputs>
+ <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(TargetDir)\%(Filename).obj;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">$(TargetDir)\%(Filename).obj;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(TargetDir)\%(Filename).obj;%(Outputs)</Outputs>
+ <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(TargetDir)\%(Filename).obj;%(Outputs)</Outputs>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="..\Crypto\Aes_x64.asm">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</CustomBuild>
</ItemGroup>
<ItemGroup>
@@ -294,18 +383,26 @@
</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">echo %(Filename)%(Extension) &amp; nasm.exe -Xvc -f win32 -Ox -g --prefix _ -o "$(TargetDir)\%(Filename).obj" "%(FullPath)"
</Command>
+ <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">echo %(Filename)%(Extension) &amp; nasm.exe -Xvc -f win32 -Ox -g --prefix _ -o "$(TargetDir)\%(Filename).obj" "%(FullPath)"
+</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">echo %(Filename)%(Extension) &amp; nasm.exe -Xvc -f win32 -Ox -g --prefix _ -o "$(TargetDir)\%(Filename).obj" "%(FullPath)"
</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">echo %(Filename)%(Extension) &amp; nasm.exe -Xvc -f win32 -Ox -g --prefix _ -o "$(TargetDir)\%(Filename).obj" "%(FullPath)"
</Command>
+ <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">echo %(Filename)%(Extension) &amp; nasm.exe -Xvc -f win32 -Ox -g --prefix _ -o "$(TargetDir)\%(Filename).obj" "%(FullPath)"
+</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">$(TargetDir)\%(Filename).obj;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(TargetDir)\%(Filename).obj;%(Outputs)</Outputs>
+ <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(TargetDir)\%(Filename).obj;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">$(TargetDir)\%(Filename).obj;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(TargetDir)\%(Filename).obj;%(Outputs)</Outputs>
+ <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(TargetDir)\%(Filename).obj;%(Outputs)</Outputs>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</CustomBuild>
</ItemGroup>
<ItemGroup>
@@ -313,8 +410,10 @@
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</CustomBuild>
</ItemGroup>
<ItemGroup>
@@ -322,8 +421,10 @@
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</CustomBuild>
</ItemGroup>
<ItemGroup>
@@ -331,8 +432,10 @@
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</CustomBuild>
</ItemGroup>
<ItemGroup>
@@ -345,8 +448,10 @@
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</CustomBuild>
</ItemGroup>
<ItemGroup>
@@ -354,8 +459,10 @@
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</CustomBuild>
</ItemGroup>
<ItemGroup>
@@ -363,8 +470,10 @@
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</CustomBuild>
</ItemGroup>
<ItemGroup>
@@ -372,8 +481,10 @@
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</ExcludedFromBuild>
</CustomBuild>
</ItemGroup>
<ItemGroup>
@@ -381,8 +492,10 @@
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</CustomBuild>
</ItemGroup>
<ItemGroup>
@@ -390,8 +503,10 @@
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</CustomBuild>
</ItemGroup>
<ItemGroup>
@@ -399,8 +514,10 @@
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</CustomBuild>
</ItemGroup>
<ItemGroup>
@@ -408,8 +525,10 @@
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</CustomBuild>
</ItemGroup>
<ItemGroup>
@@ -419,18 +538,26 @@
</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">echo %(Filename)%(Extension) &amp; ml64.exe /nologo /D_M_X64 /W3 /Cx /Zi /Fo "$(TargetDir)\%(Filename).obj" /c "%(FullPath)"
</Command>
+ <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">echo %(Filename)%(Extension) &amp; ml64.exe /nologo /D_M_X64 /W3 /Cx /Zi /Fo "$(TargetDir)\%(Filename).obj" /c "%(FullPath)"
+</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">echo %(Filename)%(Extension) &amp; ml64.exe /nologo /D_M_X64 /W3 /Cx /Zi /Fo "$(TargetDir)\%(Filename).obj" /c "%(FullPath)"
</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">echo %(Filename)%(Extension) &amp; ml64.exe /nologo /D_M_X64 /W3 /Cx /Zi /Fo "$(TargetDir)\%(Filename).obj" /c "%(FullPath)"
</Command>
+ <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">echo %(Filename)%(Extension) &amp; ml64.exe /nologo /D_M_X64 /W3 /Cx /Zi /Fo "$(TargetDir)\%(Filename).obj" /c "%(FullPath)"
+</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">$(TargetDir)\%(Filename).obj;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(TargetDir)\%(Filename).obj;%(Outputs)</Outputs>
+ <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(TargetDir)\%(Filename).obj;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">$(TargetDir)\%(Filename).obj;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(TargetDir)\%(Filename).obj;%(Outputs)</Outputs>
+ <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(TargetDir)\%(Filename).obj;%(Outputs)</Outputs>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</CustomBuild>
</ItemGroup>
<ItemGroup>
@@ -440,18 +567,26 @@
</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">echo %(Filename)%(Extension) &amp; ml64.exe /nologo /D_M_X64 /W3 /Cx /Zi /Fo "$(TargetDir)\%(Filename).obj" /c "%(FullPath)"
</Command>
+ <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">echo %(Filename)%(Extension) &amp; ml64.exe /nologo /D_M_X64 /W3 /Cx /Zi /Fo "$(TargetDir)\%(Filename).obj" /c "%(FullPath)"
+</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">echo %(Filename)%(Extension) &amp; ml64.exe /nologo /D_M_X64 /W3 /Cx /Zi /Fo "$(TargetDir)\%(Filename).obj" /c "%(FullPath)"
</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">echo %(Filename)%(Extension) &amp; ml64.exe /nologo /D_M_X64 /W3 /Cx /Zi /Fo "$(TargetDir)\%(Filename).obj" /c "%(FullPath)"
</Command>
+ <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">echo %(Filename)%(Extension) &amp; ml64.exe /nologo /D_M_X64 /W3 /Cx /Zi /Fo "$(TargetDir)\%(Filename).obj" /c "%(FullPath)"
+</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">$(TargetDir)\%(Filename).obj;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(TargetDir)\%(Filename).obj;%(Outputs)</Outputs>
+ <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(TargetDir)\%(Filename).obj;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">$(TargetDir)\%(Filename).obj;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(TargetDir)\%(Filename).obj;%(Outputs)</Outputs>
+ <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(TargetDir)\%(Filename).obj;%(Outputs)</Outputs>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</CustomBuild>
</ItemGroup>
<ItemGroup>
diff --git a/src/Driver/veracrypt_vs2019.vcxproj.filters b/src/Driver/veracrypt_vs2019.vcxproj.filters
index 2940815c..f0c7d0e3 100644
--- a/src/Driver/veracrypt_vs2019.vcxproj.filters
+++ b/src/Driver/veracrypt_vs2019.vcxproj.filters
@@ -148,6 +148,15 @@
<ClCompile Include="..\Crypto\blake2s.c">
<Filter>Crypto\Source Files</Filter>
</ClCompile>
+ <ClCompile Include="..\Crypto\blake2s_SSE2.c">
+ <Filter>Crypto\Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Crypto\blake2s_SSE41.c">
+ <Filter>Crypto\Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Crypto\blake2s_SSSE3.c">
+ <Filter>Crypto\Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="DriveFilter.h">
diff --git a/src/ExpandVolume/DlgExpandVolume.cpp b/src/ExpandVolume/DlgExpandVolume.cpp
index ab76d1ba..0d803511 100644
--- a/src/ExpandVolume/DlgExpandVolume.cpp
+++ b/src/ExpandVolume/DlgExpandVolume.cpp
@@ -61,7 +61,7 @@ BOOL CALLBACK ExpandVolProgressDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, L
namespace VeraCryptExpander
{
/* defined in WinMain.c, referenced by ExpandVolumeWizard() */
-int ExtcvAskVolumePassword (HWND hwndDlg, const wchar_t* fileName, Password *password, int *pkcs5, int *pim, BOOL* truecryptMode, char *titleStringId, BOOL enableMountOptions);
+int ExtcvAskVolumePassword (HWND hwndDlg, const wchar_t* fileName, Password *password, int *pkcs5, int *pim, char *titleStringId, BOOL enableMountOptions);
}
@@ -69,7 +69,7 @@ int GetSpaceString(wchar_t *dest, size_t cbDest, uint64 size, BOOL bDevice)
{
const wchar_t * szFmtBytes = L"%.0lf %s";
const wchar_t * szFmtOther = L"%.2lf %s";
- const wchar_t * SuffixStr[] = {L"Byte", L"KB", L"MB", L"GB", L"TB"};
+ const wchar_t * SuffixStr[] = {GetString("BYTE"), GetString("KB"), GetString("MB"), GetString("GB"), GetString("TB")};
const uint64 Muliplier[] = {1, BYTES_PER_KB, BYTES_PER_MB, BYTES_PER_GB, BYTES_PER_TB};
const int nMaxSuffix = sizeof(Muliplier)/sizeof(uint64) - 1;
int i;
@@ -147,6 +147,8 @@ BOOL CALLBACK ExpandVolSizeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
pVolExpandParam = (EXPAND_VOL_THREAD_PARAMS*)lParam;
+ LocalizeDialog (hwndDlg, NULL);
+
EnableWindow (GetDlgItem (hwndDlg, IDC_SIZEBOX), !pVolExpandParam->bIsDevice);
EnableWindow (GetDlgItem (hwndDlg, IDC_KB), !pVolExpandParam->bIsDevice);
EnableWindow (GetDlgItem (hwndDlg, IDC_MB), !pVolExpandParam->bIsDevice);
@@ -179,7 +181,7 @@ BOOL CALLBACK ExpandVolSizeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
SetWindowText (GetDlgItem (hwndDlg, IDT_NEW_SIZE), L"");
GetSpaceString(szHostFreeStr,sizeof(szHostFreeStr),pVolExpandParam->hostSizeFree,FALSE);
- StringCbPrintfW (szTemp,sizeof(szTemp),L"%s available on host drive", szHostFreeStr);
+ StringCbPrintfW (szTemp,sizeof(szTemp),GetString("EXPANDER_FREE_SPACE"), szHostFreeStr);
if (!pVolExpandParam->bDisableQuickExpand)
{
@@ -193,13 +195,13 @@ BOOL CALLBACK ExpandVolSizeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
// set help text
if (pVolExpandParam->bIsDevice)
{
- StringCbPrintfW (szTemp,sizeof(szTemp),L"This is a device-based VeraCrypt volume.\n\nThe new volume size will be choosen automatically as the size of the host device.");
+ StringCbPrintfW (szTemp,sizeof(szTemp),GetString("EXPANDER_HELP_DEVICE"));
if (pVolExpandParam->bIsLegacy)
StringCbCatW(szTemp,sizeof(szTemp),L" Note: filling the new space with random data is not supported for legacy volumes.");
}
else
{
- StringCbPrintfW (szTemp, sizeof(szTemp),L"Please specify the new size of the VeraCrypt volume (must be at least %I64u KB larger than the current size).",TC_MINVAL_FS_EXPAND/1024);
+ StringCbPrintfW (szTemp, sizeof(szTemp),GetString("EXPANDER_HELP_FILE"),TC_MINVAL_FS_EXPAND/1024);
}
SetWindowText (GetDlgItem (hwndDlg, IDC_BOX_HELP), szTemp);
@@ -214,7 +216,7 @@ BOOL CALLBACK ExpandVolSizeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
return 1;
}
- if (lw == IDOK)
+ if (lw == IDC_CONTINUE)
{
wchar_t szTemp[4096];
@@ -239,7 +241,7 @@ BOOL CALLBACK ExpandVolSizeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
if (lw == IDC_QUICKEXPAND && IsButtonChecked (GetDlgItem (hwndDlg, IDC_QUICKEXPAND)))
{
// If quick expand selected, then we warn about security issue
- if (MessageBoxW (hwndDlg, L"WARNING: You should use Quick Expand only in the following cases:\n\n1) The device where the file container is located contains no sensitive data and you do not need plausible deniability.\n2) The device where the file container is located has already been securely and fully encrypted.\n\nAre you sure you want to use Quick Expand?",
+ if (MessageBoxW (hwndDlg, GetString ("QUICK_EXPAND_WARNING"),
lpszTitle, YES_NO|MB_ICONWARNING|MB_DEFBUTTON2) == IDNO)
{
SendDlgItemMessage (hwndDlg, IDC_QUICKEXPAND, BM_SETCHECK, BST_UNCHECKED, 0);
@@ -309,6 +311,8 @@ BOOL CALLBACK ExpandVolProgressDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, L
VirtualLock (&mouseEntropyGathered, sizeof(mouseEntropyGathered));
VirtualLock (maskRandPool, sizeof(maskRandPool));
+ LocalizeDialog (hwndDlg, NULL);
+
mouseEntropyGathered = 0xFFFFFFFF;
mouseEventsInitialCount = 0;
bUseMask = FALSE;
@@ -326,7 +330,7 @@ BOOL CALLBACK ExpandVolProgressDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, L
SetWindowText (GetDlgItem (hwndDlg, IDC_EXPAND_VOLUME_NEWSIZE), szNewHostSize);
SetWindowText (GetDlgItem (hwndDlg, IDC_EXPAND_VOLUME_NAME), pProgressDlgParam->szVolumeName);
SetWindowText (GetDlgItem (hwndDlg, IDC_EXPAND_FILE_SYSTEM), szFileSystemStr[pProgressDlgParam->FileSystem]);
- SetWindowText (GetDlgItem (hwndDlg, IDC_EXPAND_VOLUME_INITSPACE), pProgressDlgParam->bInitFreeSpace?L"Yes":L"No");
+ SetWindowText (GetDlgItem (hwndDlg, IDC_EXPAND_VOLUME_INITSPACE), pProgressDlgParam->bInitFreeSpace?GetString("UISTR_YES"):GetString("UISTR_NO"));
SendMessage (GetDlgItem (hwndDlg, IDC_BOX_STATUS), WM_SETFONT, (WPARAM) hBoldFont, (LPARAM) TRUE);
@@ -338,11 +342,11 @@ BOOL CALLBACK ExpandVolProgressDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, L
showRandPool = FALSE;
EnableWindow (GetDlgItem (hwndDlg, IDC_DISPLAY_POOL_CONTENTS), FALSE);
EnableWindow (GetDlgItem (hwndDlg, IDC_RANDOM_BYTES), FALSE);
- SetDlgItemText(hwndDlg, IDC_BOX_STATUS, L"Click 'Continue' to expand the volume.");
+ SetDlgItemText(hwndDlg, IDC_BOX_STATUS, GetString("EXPANDER_STATUS_TEXT_LEGACY"));
}
else
{
- SetDlgItemText(hwndDlg, IDC_BOX_STATUS, L"IMPORTANT: Move your mouse as randomly as possible within this window. The longer you move it, the better. This significantly increases the cryptographic strength of the encryption keys. Then click 'Continue' to expand the volume.");
+ SetDlgItemText(hwndDlg, IDC_BOX_STATUS, GetString("EXPANDER_STATUS_TEXT"));
}
SendMessage (GetDlgItem (hwndDlg, IDC_DISPLAY_POOL_CONTENTS), BM_SETCHECK, BST_UNCHECKED, 0);
@@ -360,17 +364,17 @@ BOOL CALLBACK ExpandVolProgressDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, L
if (nStatus != 0)
{
if ( nStatus != ERR_USER_ABORT )
- AddProgressDlgStatus (hwndDlg, L"Error: volume expansion failed.");
+ AddProgressDlgStatus (hwndDlg, GetString("EXPANDER_FINISH_ERROR"));
else
- AddProgressDlgStatus (hwndDlg, L"Error: operation aborted by user.");
+ AddProgressDlgStatus (hwndDlg, GetString("EXPANDER_FINISH_ABORT"));
}
else
{
- AddProgressDlgStatus (hwndDlg, L"Finished. Volume successfully expanded.");
+ AddProgressDlgStatus (hwndDlg, GetString("EXPANDER_FINISH_OK"));
}
- SetWindowText (GetDlgItem (hwndDlg, IDOK), L"Exit");
- EnableWindow (GetDlgItem (hwndDlg, IDOK), TRUE);
+ SetWindowText (GetDlgItem (hwndDlg, IDC_CONTINUE), GetString("EXIT"));
+ EnableWindow (GetDlgItem (hwndDlg, IDC_CONTINUE), TRUE);
EnableWindow (GetDlgItem (hwndDlg, IDCANCEL), FALSE);
}
return 1;
@@ -427,7 +431,7 @@ BOOL CALLBACK ExpandVolProgressDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, L
{
if (bVolTransformStarted)
{
- if (MessageBoxW (hwndDlg, L"Warning: Volume expansion is in progress!\n\nStopping now may result in a damaged volume.\n\nDo you really want to cancel?", lpszTitle, YES_NO|MB_ICONQUESTION|MB_DEFBUTTON2) == IDNO)
+ if (MessageBoxW (hwndDlg, GetString("EXPANDER_CANCEL_WARNING"), lpszTitle, YES_NO|MB_ICONQUESTION|MB_DEFBUTTON2) == IDNO)
return 1;
// tell the volume transform thread to terminate
@@ -438,7 +442,7 @@ BOOL CALLBACK ExpandVolProgressDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, L
return 1;
}
- if (lw == IDOK)
+ if (lw == IDC_CONTINUE)
{
if (bVolTransformStarted)
{
@@ -451,8 +455,8 @@ BOOL CALLBACK ExpandVolProgressDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, L
showRandPool = FALSE;
KillTimer (hwndDlg, TIMER_ID_RANDVIEW);
EnableWindow (GetDlgItem (hwndDlg, IDC_DISPLAY_POOL_CONTENTS), FALSE);
- EnableWindow (GetDlgItem (hwndDlg, IDOK), FALSE);
- SetProgressDlgStatus (hwndDlg, L"Starting volume expansion ...\r\n");
+ EnableWindow (GetDlgItem (hwndDlg, IDC_CONTINUE), FALSE);
+ SetProgressDlgStatus (hwndDlg, GetString("EXPANDER_STARTING_STATUS"));
bVolTransformStarted = TRUE;
pProgressDlgParam->hwndDlg = hwndDlg;
if ( _beginthread (volTransformThreadFunction, 0, pProgressDlgParam) == -1L )
@@ -486,7 +490,6 @@ typedef struct
Password *password;
int pkcs5_prf;
int pim;
- BOOL truecryptMode;
BOOL write;
BOOL preserveTimestamps;
BOOL useBackupHeader;
@@ -498,7 +501,7 @@ void CALLBACK OpenVolumeWaitThreadProc(void* pArg, HWND hwndDlg)
OpenVolumeThreadParam* pThreadParam = (OpenVolumeThreadParam*) pArg;
*(pThreadParam)->nStatus = OpenVolume(pThreadParam->context, pThreadParam->volumePath, pThreadParam->password, pThreadParam->pkcs5_prf,
- pThreadParam->pim, pThreadParam->truecryptMode, pThreadParam->write, pThreadParam->preserveTimestamps, pThreadParam->useBackupHeader);
+ pThreadParam->pim, pThreadParam->write, pThreadParam->preserveTimestamps, pThreadParam->useBackupHeader);
}
/*
@@ -536,7 +539,7 @@ void ExpandVolumeWizard (HWND hwndDlg, wchar_t *lpszVolume)
{
case 1:
case 2:
- MessageBoxW (hwndDlg, L"A VeraCrypt system volume can't be expanded.", lpszTitle, MB_OK|MB_ICONEXCLAMATION);
+ MessageBoxW (hwndDlg, GetString("EXPANDER_SYSTEM_VOLUME_ERROR"), lpszTitle, MB_OK|MB_ICONEXCLAMATION);
goto ret;
}
@@ -564,7 +567,7 @@ void ExpandVolumeWizard (HWND hwndDlg, wchar_t *lpszVolume)
switch (AskMultiChoice ((void **) volTypeChoices, FALSE, hwndDlg))
{
case 1:
- MessageBoxW (hwndDlg, L"An outer volume containing a hidden volume can't be expanded, because this destroys the hidden volume.", lpszTitle, MB_OK|MB_ICONEXCLAMATION);
+ MessageBoxW (hwndDlg, GetString("EXPANDER_HIDDEN_VOLUME_ERROR"), lpszTitle, MB_OK|MB_ICONEXCLAMATION);
goto ret;
case 2:
@@ -590,9 +593,8 @@ void ExpandVolumeWizard (HWND hwndDlg, wchar_t *lpszVolume)
while (TRUE)
{
OpenVolumeContext expandVol;
- BOOL truecryptMode = FALSE;
- if (!VeraCryptExpander::ExtcvAskVolumePassword (hwndDlg, lpszVolume, &VolumePassword, &VolumePkcs5, &VolumePim, &truecryptMode, "ENTER_NORMAL_VOL_PASSWORD", FALSE))
+ if (!VeraCryptExpander::ExtcvAskVolumePassword (hwndDlg, lpszVolume, &VolumePassword, &VolumePkcs5, &VolumePim, "ENTER_NORMAL_VOL_PASSWORD", FALSE))
{
goto ret;
}
@@ -610,7 +612,6 @@ void ExpandVolumeWizard (HWND hwndDlg, wchar_t *lpszVolume)
threadParam.password = &VolumePassword;
threadParam.pkcs5_prf = VolumePkcs5;
threadParam.pim = VolumePim;
- threadParam.truecryptMode = FALSE;
threadParam.write = FALSE;
threadParam.preserveTimestamps = bPreserveTimestamp;
threadParam.useBackupHeader = FALSE;
@@ -699,13 +700,13 @@ void ExpandVolumeWizard (HWND hwndDlg, wchar_t *lpszVolume)
// check if there is enough free space on host device/drive to expand the volume
if ( (bIsDevice && hostSize < volSize + TC_MINVAL_FS_EXPAND) || (!bIsDevice && hostSizeFree < TC_MINVAL_FS_EXPAND) )
{
- MessageBoxW (hwndDlg, L"Not enough free space to expand the volume", lpszTitle, MB_OK|MB_ICONEXCLAMATION);
+ MessageBoxW (hwndDlg, GetString("EXPANDER_NO_FREE_SPACE"), lpszTitle, MB_OK|MB_ICONEXCLAMATION);
goto ret;
}
if (!bIsDevice && hostSize != volSize ) {
// there is some junk data at the end of the volume
- if (MessageBoxW (hwndDlg, L"Warning: The container file is larger than the VeraCrypt volume area. The data after the VeraCrypt volume area will be overwritten.\n\nDo you want to continue?", lpszTitle, YES_NO|MB_ICONQUESTION|MB_DEFBUTTON2) == IDNO)
+ if (MessageBoxW (hwndDlg, GetString("EXPANDER_WARNING_FILE_CONTAINER_JUNK"), lpszTitle, YES_NO|MB_ICONQUESTION|MB_DEFBUTTON2) == IDNO)
goto ret;
}
@@ -714,17 +715,17 @@ void ExpandVolumeWizard (HWND hwndDlg, wchar_t *lpszVolume)
case EV_FS_TYPE_NTFS:
break;
case EV_FS_TYPE_FAT:
- if (MessageBoxW (hwndDlg,L"Warning: The VeraCrypt volume contains a FAT file system!\n\nOnly the VeraCrypt volume itself will be expanded, but not the file system.\n\nDo you want to continue?",
+ if (MessageBoxW (hwndDlg, GetString("EXPANDER_WARNING_FAT"),
lpszTitle, YES_NO|MB_ICONQUESTION|MB_DEFBUTTON2) == IDNO)
goto ret;
break;
case EV_FS_TYPE_EXFAT:
- if (MessageBoxW (hwndDlg,L"Warning: The VeraCrypt volume contains an exFAT file system!\n\nOnly the VeraCrypt volume itself will be expanded, but not the file system.\n\nDo you want to continue?",
+ if (MessageBoxW (hwndDlg, GetString("EXPANDER_WARNING_EXFAT"),
lpszTitle, YES_NO|MB_ICONQUESTION|MB_DEFBUTTON2) == IDNO)
goto ret;
break;
default:
- if (MessageBoxW (hwndDlg,L"Warning: The VeraCrypt volume contains an unknown or no file system!\n\nOnly the VeraCrypt volume itself will be expanded, the file system remains unchanged.\n\nDo you want to continue?",
+ if (MessageBoxW (hwndDlg, GetString("EXPANDER_WARNING_UNKNOWN_FS"),
lpszTitle, YES_NO|MB_ICONQUESTION|MB_DEFBUTTON2) == IDNO)
goto ret;
}
@@ -773,21 +774,21 @@ void ExpandVolumeWizard (HWND hwndDlg, wchar_t *lpszVolume)
{
if ( (newVolumeSize < hostSize + TC_MINVAL_FS_EXPAND) && ((hostSize == volSize) || (newVolumeSize != hostSize) || ((hostSize - volSize) < TC_MINVAL_FS_EXPAND)))
{
- StringCbPrintfW(szTmp,sizeof(szTmp),L"New volume size too small, must be at least %I64u kB larger than the current size.",TC_MINVAL_FS_EXPAND/BYTES_PER_KB);
+ StringCbPrintfW(szTmp,sizeof(szTmp),GetString("EXPANDER_ERROR_VOLUME_SIZE_TOO_SMALL"),TC_MINVAL_FS_EXPAND/BYTES_PER_KB);
MessageBoxW (hwndDlg, szTmp, lpszTitle, MB_OK | MB_ICONEXCLAMATION );
continue;
}
if ( newVolumeSize - hostSize > hostSizeFree )
{
- StringCbPrintfW(szTmp,sizeof(szTmp),L"New volume size too large, not enough space on host drive.");
+ StringCbPrintfW(szTmp,sizeof(szTmp), GetString("EXPANDER_ERROR_VOLUME_SIZE_TOO_LARGE"));
MessageBoxW (hwndDlg, szTmp, lpszTitle, MB_OK | MB_ICONEXCLAMATION );
continue;
}
if ( newVolumeSize>maxSizeFS )
{
- StringCbPrintfW(szTmp,sizeof(szTmp),L"Maximum file size of %I64u MB on host drive exceeded.",maxSizeFS/BYTES_PER_MB);
+ StringCbPrintfW(szTmp,sizeof(szTmp), GetString("EXPANDER_ERROR_MAX_FILE_SIZE_EXCEEDED"),maxSizeFS/BYTES_PER_MB);
MessageBoxW (hwndDlg, L"!\n",lpszTitle, MB_OK | MB_ICONEXCLAMATION );
continue;
}
@@ -796,7 +797,7 @@ void ExpandVolumeWizard (HWND hwndDlg, wchar_t *lpszVolume)
{
if (!SetPrivilege (SE_MANAGE_VOLUME_NAME, TRUE))
{
- MessageBoxW (hwndDlg, L"Error: Failed to get necessary privileges to enable Quick Expand!\nPlease uncheck Quick Expand option and try again.",lpszTitle, MB_OK | MB_ICONEXCLAMATION );
+ MessageBoxW (hwndDlg, GetString("EXPANDER_ERROR_QUICKEXPAND_PRIVILEGES"),lpszTitle, MB_OK | MB_ICONEXCLAMATION );
VolExpandParam.bQuickExpand = FALSE;
continue;
}
@@ -808,7 +809,7 @@ void ExpandVolumeWizard (HWND hwndDlg, wchar_t *lpszVolume)
if ( newVolumeSize > TC_MAX_VOLUME_SIZE )
{
// note: current limit TC_MAX_VOLUME_SIZE is 1 PetaByte
- StringCbPrintfW(szTmp,sizeof(szTmp),L"Maximum VeraCrypt volume size of %I64u TB exceeded!\n",TC_MAX_VOLUME_SIZE/BYTES_PER_TB);
+ StringCbPrintfW(szTmp,sizeof(szTmp), GetString("EXPANDER_ERROR_MAX_VC_VOLUME_SIZE_EXCEEDED"),TC_MAX_VOLUME_SIZE/BYTES_PER_TB);
MessageBoxW (hwndDlg, szTmp,lpszTitle, MB_OK | MB_ICONEXCLAMATION );
if (bIsDevice)
break; // TODO: ask to limit volume size to TC_MAX_VOLUME_SIZE
diff --git a/src/ExpandVolume/ExpandVolume.c b/src/ExpandVolume/ExpandVolume.c
index f62d93ae..712d23a3 100644
--- a/src/ExpandVolume/ExpandVolume.c
+++ b/src/ExpandVolume/ExpandVolume.c
@@ -105,7 +105,7 @@ int MountVolTemp (HWND hwndDlg, wchar_t *volumePath, int *driveNo, Password *pas
mountOptions.PartitionInInactiveSysEncScope = FALSE;
mountOptions.UseBackupHeader = FALSE;
- if (MountVolume (hwndDlg, *driveNo, volumePath, password, pkcs5, pim, FALSE, FALSE, FALSE, TRUE, &mountOptions, FALSE, FALSE) < 1)
+ if (MountVolume (hwndDlg, *driveNo, volumePath, password, pkcs5, pim, FALSE, FALSE, TRUE, &mountOptions, FALSE, FALSE) < 1)
{
*driveNo = -3;
return ERR_VOL_MOUNT_FAILED;
@@ -390,7 +390,7 @@ int ExtendFileSystem (HWND hwndDlg , wchar_t *lpszVolume, Password *pVolumePassw
// mount and resize file system
- DebugAddProgressDlgStatus (hwndDlg, L"Mounting volume ...\r\n");
+ DebugAddProgressDlgStatus (hwndDlg, GetString("EXPANDER_MOUNTING_VOLUME"));
nStatus=MountVolTemp(hwndDlg, lpszVolume, &driveNo, pVolumePassword, VolumePkcs5, VolumePim);
if (nStatus!=ERR_SUCCESS)
@@ -448,7 +448,7 @@ int ExtendFileSystem (HWND hwndDlg , wchar_t *lpszVolume, Password *pVolumePassw
goto error;
}
- DebugAddProgressDlgStatus (hwndDlg, L"Extending file system ...\r\n");
+ DebugAddProgressDlgStatus (hwndDlg, GetString("EXPANDER_EXTENDING_FILESYSTEM"));
// extend volume
nStatus = FsctlExtendVolume(szVolumeGUID, newDataAreaSize/BytesPerSector );
@@ -459,7 +459,7 @@ error:
if (driveNo>=0)
{
- DebugAddProgressDlgStatus (hwndDlg, L"Unmounting volume ...\r\n");
+ DebugAddProgressDlgStatus (hwndDlg, GetString("EXPANDER_UNMOUNTING_VOLUME"));
UnmountVolume (hwndDlg, driveNo, TRUE);
}
@@ -508,6 +508,7 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas
PCRYPTO_INFO cryptoInfo = NULL, ci = NULL;
void *dev = INVALID_HANDLE_VALUE;
DWORD dwError;
+ DWORD bytesRead;
BOOL bDevice;
uint64 hostSize=0, newDataAreaSize, currentVolSize;
DWORD HostSectorSize;
@@ -672,8 +673,13 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas
}
/* Read in volume header */
- nStatus = _lread ((HFILE) dev, buffer, sizeof (buffer));
- if (nStatus != sizeof (buffer))
+ if (!ReadEffectiveVolumeHeader (bDevice, dev, buffer, &bytesRead))
+ {
+ nStatus = ERR_OS_ERROR;
+ goto error;
+ }
+
+ if (bytesRead != sizeof (buffer))
{
// Windows may report EOF when reading sectors from the last cluster of a device formatted as NTFS
memset (buffer, 0, sizeof (buffer));
@@ -681,7 +687,7 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas
/* Try to decrypt the header */
- nStatus = ReadVolumeHeader (FALSE, buffer, pVolumePassword, VolumePkcs5, VolumePim, FALSE, &cryptoInfo, NULL);
+ nStatus = ReadVolumeHeader (FALSE, buffer, pVolumePassword, VolumePkcs5, VolumePim, &cryptoInfo, NULL);
if (nStatus == ERR_CIPHER_INIT_WEAK_KEY)
nStatus = 0; // We can ignore this error here
@@ -818,7 +824,7 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas
goto error;
}
- DebugAddProgressDlgStatus(hwndDlg, L"Writing random data to new space ...\r\n");
+ DebugAddProgressDlgStatus(hwndDlg, GetString ("EXPANDER_WRITING_RANDOM_DATA"));
SetFormatSectorSize(HostSectorSize);
nStatus = FormatNoFs (hwndDlg, startSector, num_sectors, dev, cryptoInfo, FALSE);
@@ -859,9 +865,9 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas
while ( !cryptoInfo->LegacyVolume )
{
if (backupHeader)
- DebugAddProgressDlgStatus(hwndDlg, L"Writing re-encrypted backup header ...\r\n");
+ DebugAddProgressDlgStatus(hwndDlg, GetString("EXPANDER_WRITING_ENCRYPTED_BACKUP"));
else
- DebugAddProgressDlgStatus(hwndDlg, L"Writing re-encrypted primary header ...\r\n");
+ DebugAddProgressDlgStatus(hwndDlg, GetString("EXPANDER_WRITING_ENCRYPTED_PRIMARY"));
#ifdef _WIN64
if (bIsRamEncryptionEnabled)
@@ -1032,7 +1038,7 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas
goto error;
}
- DebugAddProgressDlgStatus(hwndDlg, L"Wiping old backup header ...\r\n");
+ DebugAddProgressDlgStatus(hwndDlg, GetString("EXPANDER_WIPING_OLD_HEADER"));
wipeBuffer = (byte *) TCalloc (workChunkSize);
if (!wipeBuffer)
diff --git a/src/ExpandVolume/ExpandVolume.rc b/src/ExpandVolume/ExpandVolume.rc
index 38373b01..a65d738f 100644
--- a/src/ExpandVolume/ExpandVolume.rc
+++ b/src/ExpandVolume/ExpandVolume.rc
@@ -40,10 +40,10 @@ BEGIN
CONTROL "Fill new space with random data",IDC_INIT_NEWSPACE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,30,120,276,10
CONTROL "Quick Expand",IDC_QUICKEXPAND,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,30,132,276,10
- DEFPUSHBUTTON "Continue",IDOK,15,238,84,18
+ DEFPUSHBUTTON "Continue",IDC_CONTINUE,15,238,84,18
PUSHBUTTON "Cancel",IDCANCEL,277,238,84,18
LTEXT "Help Text",IDC_BOX_HELP,15,165,346,58,0,WS_EX_CLIENTEDGE
- GROUPBOX "Enter new volume size",IDC_STATIC,15,83,346,63
+ GROUPBOX "Enter new volume size",IDT_NEW_SIZE_BOX_TITLE,15,83,346,63
RTEXT "Current size: ",IDT_CURRENT_SIZE,27,42,46,8
CONTROL "",IDC_EXPAND_VOLUME_OLDSIZE,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,80,42,275,8,WS_EX_TRANSPARENT
RTEXT "New size: ",IDT_NEW_SIZE,28,54,45,8
@@ -73,7 +73,7 @@ BEGIN
GROUPBOX "",IDC_STATIC,282,238,88,24
GROUPBOX "",IDC_STATIC,6,238,88,24
GROUPBOX "",IDC_STATIC,1,147,373,123,BS_CENTER
- LTEXT "1. Select the VeraCrypt volume to be expanded\n2. Click the 'Mount' button",IDC_STATIC,15,156,293,21
+ LTEXT "1. Select the VeraCrypt volume to be expanded\n2. Click the 'Mount' button",IDC_STEPSEXPAND,15,156,293,21
LTEXT "Static",IDC_INFOEXPAND,8,6,361,134,SS_NOPREFIX | SS_SUNKEN,WS_EX_STATICEDGE
END
@@ -84,7 +84,6 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
EDITTEXT IDC_PASSWORD,69,8,166,14,ES_PASSWORD | ES_AUTOHSCROLL
COMBOBOX IDC_PKCS5_PRF_ID,69,26,86,90,CBS_DROPDOWNLIST | WS_TABSTOP
- CONTROL "&TrueCrypt Mode",IDC_TRUECRYPT_MODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,28,76,10
EDITTEXT IDC_PIM,69,43,42,14,ES_RIGHT | ES_PASSWORD | ES_AUTOHSCROLL | ES_NUMBER | NOT WS_VISIBLE
CONTROL "Use P&IM",IDC_PIM_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,49,97,10
CONTROL "Cache passwords and keyfil&es in memory",IDC_CACHE,
@@ -121,14 +120,14 @@ BEGIN
RTEXT "Volume: ",IDT_VOL_NAME,31,16,42,8
GROUPBOX "",IDC_STATIC,15,7,346,72
CONTROL "",IDC_EXPAND_VOLUME_NAME,"Static",SS_SIMPLE | WS_GROUP,80,16,275,8,WS_EX_TRANSPARENT
- DEFPUSHBUTTON "Continue",IDOK,15,247,84,18
+ DEFPUSHBUTTON "Continue",IDC_CONTINUE,15,247,84,18
PUSHBUTTON "Cancel",IDCANCEL,277,247,84,18
EDITTEXT IDC_BOX_STATUS,15,176,346,66,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | ES_WANTRETURN | WS_VSCROLL
CONTROL "",IDC_EXPAND_VOLUME_INITSPACE,"Static",SS_SIMPLE | WS_GROUP,80,64,275,8,WS_EX_TRANSPARENT
RTEXT "Fill new space: ",IDT_INIT_SPACE,20,64,53,8
RTEXT "File system: ",IDT_FILE_SYS,31,28,42,8
CONTROL "",IDC_EXPAND_FILE_SYSTEM,"Static",SS_SIMPLE | WS_GROUP,80,28,275,8,WS_EX_TRANSPARENT
- RTEXT "Random Pool: ",IDT_RANDOM_POOL2,20,144,53,8
+ RTEXT "Random Pool: ",IDT_RANDOM_POOL,20,144,53,8
CONTROL "",IDC_RANDOM_BYTES,"Static",SS_SIMPLE | WS_GROUP,80,144,149,8,WS_EX_TRANSPARENT
CONTROL "Display pool content",IDC_DISPLAY_POOL_CONTENTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,236,142,125,12
GROUPBOX "Randomness Collected From Mouse Movements",IDT_ENTROPY_BAR,20,156,214,18
@@ -193,8 +192,8 @@ IDR_MOUNT_RSRC_HEADER HEADER "resource.h"
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,26,0,0
- PRODUCTVERSION 1,26,0,0
+ FILEVERSION 1,26,10,0
+ PRODUCTVERSION 1,26,10,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -211,11 +210,11 @@ BEGIN
BEGIN
VALUE "CompanyName", "IDRIX"
VALUE "FileDescription", "VeraCrypt Expander"
- VALUE "FileVersion", "1.26"
+ VALUE "FileVersion", "1.26.10"
VALUE "LegalTrademarks", "VeraCrypt"
VALUE "OriginalFilename", "VeraCryptExpander.exe"
VALUE "ProductName", "VeraCrypt"
- VALUE "ProductVersion", "1.26"
+ VALUE "ProductVersion", "1.26.10"
END
END
BLOCK "VarFileInfo"
diff --git a/src/ExpandVolume/ExpandVolume.vcxproj b/src/ExpandVolume/ExpandVolume.vcxproj
index c4f8ce09..62ff1a09 100644
--- a/src/ExpandVolume/ExpandVolume.vcxproj
+++ b/src/ExpandVolume/ExpandVolume.vcxproj
@@ -194,7 +194,7 @@
<AdditionalDependencies>..\Crypto\Debug\crypto.lib;..\Common\Debug\Zip.lib;..\Common\Debug\lzma.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptExpander.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)ExpandVolume.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
@@ -248,7 +248,7 @@ copy Debug\VeraCryptExpander.exe "..\Debug\Setup Files" &gt;NUL:
<AdditionalDependencies>..\Crypto\x64\Debug\crypto.lib;..\Common\x64\Debug\Zip.lib;..\Common\x64\Debug\lzma.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptExpander.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)ExpandVolume.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
@@ -295,7 +295,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCryptExpander-x64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\Release\crypto.lib;..\Common\Release\Zip.lib;..\Common\Release\lzma.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptExpander.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -339,7 +339,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCryptExpander-x64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\Release\crypto.lib;..\Common\Release\Zip.lib;..\Common\Release\lzma.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptExpander.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -383,7 +383,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCryptExpander-x64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\Release\crypto.lib;..\Common\Release\Zip.lib;..\Common\Release\lzma.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptExpander.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -431,7 +431,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCryptExpander-x64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;..\Common\x64\Release\lzma.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptExpander.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -479,7 +479,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCryptExpander-x64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;..\Common\x64\Release\lzma.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptExpander.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -527,7 +527,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCryptExpander-x64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;..\Common\x64\Release\lzma.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptExpander.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -575,6 +575,17 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCryptExpander-x64.exe" &gt;NUL:
</ProjectReference>
</ItemGroup>
<ItemGroup>
+ <ClCompile Include="..\Common\CommandAPDU.cpp" />
+ <ClCompile Include="..\Common\EMVCard.cpp" />
+ <ClCompile Include="..\Common\EMVToken.cpp" />
+ <ClCompile Include="..\Common\PCSCException.cpp" />
+ <ClCompile Include="..\Common\ResponseAPDU.cpp" />
+ <ClCompile Include="..\Common\SCard.cpp" />
+ <ClCompile Include="..\Common\SCardLoader.cpp" />
+ <ClCompile Include="..\Common\SCardManager.cpp" />
+ <ClCompile Include="..\Common\SCardReader.cpp" />
+ <ClCompile Include="..\Common\TLVParser.cpp" />
+ <ClCompile Include="..\Common\Token.cpp" />
<ClCompile Include="..\Setup\SelfExtract.c" />
<ClCompile Include="DlgExpandVolume.cpp" />
<ClCompile Include="ExpandVolume.c" />
@@ -655,6 +666,17 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCryptExpander-x64.exe" &gt;NUL:
</ClCompile>
</ItemGroup>
<ItemGroup>
+ <ClInclude Include="..\Common\CommandAPDU.h" />
+ <ClInclude Include="..\Common\EMVCard.h" />
+ <ClInclude Include="..\Common\EMVToken.h" />
+ <ClInclude Include="..\Common\PCSCException.h" />
+ <ClInclude Include="..\Common\ResponseAPDU.h" />
+ <ClInclude Include="..\Common\SCard.h" />
+ <ClInclude Include="..\Common\SCardLoader.h" />
+ <ClInclude Include="..\Common\SCardManager.h" />
+ <ClInclude Include="..\Common\SCardReader.h" />
+ <ClInclude Include="..\Common\TLVParser.h" />
+ <ClInclude Include="..\Common\Token.h" />
<ClInclude Include="..\Common\Wipe.h" />
<ClInclude Include="..\Common\Apidrvr.h" />
<ClInclude Include="..\Common\BaseCom.h" />
diff --git a/src/ExpandVolume/ExpandVolume.vcxproj.filters b/src/ExpandVolume/ExpandVolume.vcxproj.filters
index 007757ff..c168cfc2 100644
--- a/src/ExpandVolume/ExpandVolume.vcxproj.filters
+++ b/src/ExpandVolume/ExpandVolume.vcxproj.filters
@@ -126,6 +126,39 @@
<ClCompile Include="..\Setup\SelfExtract.c">
<Filter>Source Files\Setup</Filter>
</ClCompile>
+ <ClCompile Include="..\Common\EMVToken.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\Token.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\TLVParser.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\CommandAPDU.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\SCardReader.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\SCardLoader.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\SCardManager.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\ResponseAPDU.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\PCSCException.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\EMVCard.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\SCard.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\Common\Wipe.h">
@@ -230,6 +263,39 @@
<ClInclude Include="..\Common\Xts.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="..\Common\EMVToken.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\Token.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\TLVParser.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\CommandAPDU.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\SCardLoader.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\PCSCException.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\SCardManager.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\SCardReader.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\ResponseAPDU.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\EMVCard.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\SCard.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<Midl Include="..\Mount\MainCom.idl">
diff --git a/src/ExpandVolume/ExpandVolume_vs2019.vcxproj b/src/ExpandVolume/ExpandVolume_vs2019.vcxproj
index c2db2f65..32937616 100644
--- a/src/ExpandVolume/ExpandVolume_vs2019.vcxproj
+++ b/src/ExpandVolume/ExpandVolume_vs2019.vcxproj
@@ -49,22 +49,22 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ <PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ <PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ <PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ <PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
@@ -74,7 +74,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ <PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|ARM64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
@@ -84,7 +84,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ <PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
@@ -214,7 +214,7 @@
<AdditionalDependencies>..\Crypto\Debug\crypto.lib;..\Common\Debug\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptExpander.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)ExpandVolume.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
@@ -268,7 +268,7 @@ copy Debug\VeraCryptExpander.exe "..\Debug\Setup Files" &gt;NUL:
<AdditionalDependencies>..\Crypto\x64\Debug\crypto.lib;..\Common\x64\Debug\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptExpander.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)ExpandVolume.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
@@ -324,7 +324,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCryptExpander-x64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\ARM64\Debug\crypto.lib;..\Common\ARM64\Debug\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptExpander.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)ExpandVolume.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
@@ -369,7 +369,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCryptExpander-arm64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\Release\crypto.lib;..\Common\Release\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptExpander.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -413,7 +413,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCryptExpander-arm64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\Release\crypto.lib;..\Common\Release\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptExpander.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -461,7 +461,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCryptExpander-arm64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptExpander.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -508,7 +508,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCryptExpander-arm64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\ARM64\Release\crypto.lib;..\Common\ARM64\Release\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptExpander.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -555,7 +555,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCryptExpander-arm64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptExpander.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -602,7 +602,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCryptExpander-arm64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\AMD64\Release\crypto.lib;..\Common\AMD64\Release\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptExpander.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -641,6 +641,17 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCryptExpander-arm64.exe" &gt;NUL:
</ProjectReference>
</ItemGroup>
<ItemGroup>
+ <ClCompile Include="..\Common\CommandAPDU.cpp" />
+ <ClCompile Include="..\Common\EMVCard.cpp" />
+ <ClCompile Include="..\Common\EMVToken.cpp" />
+ <ClCompile Include="..\Common\PCSCException.cpp" />
+ <ClCompile Include="..\Common\ResponseAPDU.cpp" />
+ <ClCompile Include="..\Common\SCard.cpp" />
+ <ClCompile Include="..\Common\SCardLoader.cpp" />
+ <ClCompile Include="..\Common\SCardManager.cpp" />
+ <ClCompile Include="..\Common\SCardReader.cpp" />
+ <ClCompile Include="..\Common\TLVParser.cpp" />
+ <ClCompile Include="..\Common\Token.cpp" />
<ClCompile Include="..\Setup\SelfExtract.c" />
<ClCompile Include="DlgExpandVolume.cpp" />
<ClCompile Include="ExpandVolume.c" />
@@ -726,6 +737,17 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCryptExpander-arm64.exe" &gt;NUL:
</ClCompile>
</ItemGroup>
<ItemGroup>
+ <ClInclude Include="..\Common\CommandAPDU.h" />
+ <ClInclude Include="..\Common\EMVCard.h" />
+ <ClInclude Include="..\Common\EMVToken.h" />
+ <ClInclude Include="..\Common\PCSCException.h" />
+ <ClInclude Include="..\Common\ResponseAPDU.h" />
+ <ClInclude Include="..\Common\SCard.h" />
+ <ClInclude Include="..\Common\SCardLoader.h" />
+ <ClInclude Include="..\Common\SCardManager.h" />
+ <ClInclude Include="..\Common\SCardReader.h" />
+ <ClInclude Include="..\Common\TLVParser.h" />
+ <ClInclude Include="..\Common\Token.h" />
<ClInclude Include="..\Common\Wipe.h" />
<ClInclude Include="..\Common\Apidrvr.h" />
<ClInclude Include="..\Common\BaseCom.h" />
diff --git a/src/ExpandVolume/ExpandVolume_vs2019.vcxproj.filters b/src/ExpandVolume/ExpandVolume_vs2019.vcxproj.filters
index 007757ff..17ed8515 100644
--- a/src/ExpandVolume/ExpandVolume_vs2019.vcxproj.filters
+++ b/src/ExpandVolume/ExpandVolume_vs2019.vcxproj.filters
@@ -126,6 +126,39 @@
<ClCompile Include="..\Setup\SelfExtract.c">
<Filter>Source Files\Setup</Filter>
</ClCompile>
+ <ClCompile Include="..\Common\EMVToken.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\TLVParser.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\Token.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\CommandAPDU.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\PCSCException.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\ResponseAPDU.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\SCardLoader.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\SCardManager.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\SCardReader.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\EMVCard.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\SCard.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\Common\Wipe.h">
@@ -230,6 +263,39 @@
<ClInclude Include="..\Common\Xts.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="..\Common\EMVToken.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\TLVParser.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\Token.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\CommandAPDU.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\PCSCException.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\ResponseAPDU.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\SCardLoader.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\SCardManager.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\SCardReader.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\EMVCard.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\SCard.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<Midl Include="..\Mount\MainCom.idl">
diff --git a/src/ExpandVolume/VeraCryptExpander.manifest b/src/ExpandVolume/VeraCryptExpander.manifest
index 36c64bca..4905cac0 100644
--- a/src/ExpandVolume/VeraCryptExpander.manifest
+++ b/src/ExpandVolume/VeraCryptExpander.manifest
@@ -1,12 +1,29 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
- <v3:trustInfo xmlns:v3="urn:schemas-microsoft-com:asm.v3">
- <v3:security>
- <v3:requestedPrivileges>
- <v3:requestedExecutionLevel level="requireAdministrator" />
- </v3:requestedPrivileges>
- </v3:security>
- </v3:trustInfo>
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
+ <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
+ <security>
+ <requestedPrivileges>
+ <requestedExecutionLevel level="requireAdministrator" />
+ </requestedPrivileges>
+ </security>
+ </trustInfo>
+ <asmv3:application>
+ <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
+ <dpiAware>true</dpiAware>
+ </asmv3:windowsSettings>
+ </asmv3:application>
+ <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+ <application>
+ <!-- Windows 10 and Windows 11 -->
+ <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
+ <!-- Windows 8.1 -->
+ <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
+ <!-- Windows 8 -->
+ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
+ <!-- Windows 7 -->
+ <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
+ </application>
+ </compatibility>
<dependency>
<dependentAssembly>
<assemblyIdentity
diff --git a/src/ExpandVolume/WinMain.cpp b/src/ExpandVolume/WinMain.cpp
index 49422319..9a822153 100644
--- a/src/ExpandVolume/WinMain.cpp
+++ b/src/ExpandVolume/WinMain.cpp
@@ -199,15 +199,40 @@ BOOL CheckSysEncMountWithoutPBA (const char *devicePath, BOOL quiet)
static void InitMainDialog (HWND hwndDlg)
{
+ MENUITEMINFOW info;
+ int i;
+ wchar_t *str;
+ int menuEntries[] = {IDM_ABOUT, IDM_HOMEPAGE};
/* Call the common dialog init code */
InitDialog (hwndDlg);
LocalizeDialog (hwndDlg, NULL);
+ DragAcceptFiles (hwndDlg, TRUE);
SendMessage (GetDlgItem (hwndDlg, IDC_VOLUME), CB_LIMITTEXT, TC_MAX_PATH, 0);
SetWindowTextW (hwndDlg, lpszTitle);
SendMessage (GetDlgItem (hwndDlg, IDC_INFOEXPAND), WM_SETFONT, (WPARAM) hBoldFont, (LPARAM) TRUE);
- SetWindowText (GetDlgItem (hwndDlg, IDC_INFOEXPAND), szExpandVolumeInfo);
+ SetWindowText (GetDlgItem (hwndDlg, IDC_INFOEXPAND), GetString("EXPANDER_INFO"));
+
+ // Localize menu strings
+ for (i = 0; i < array_capacity (menuEntries); i++)
+ {
+ str = (wchar_t *)GetDictionaryValueByInt (menuEntries[i]);
+ if (str)
+ {
+ ZeroMemory (&info, sizeof(info));
+ info.cbSize = sizeof (info);
+ info.fMask = MIIM_TYPE;
+ info.fType = MFT_STRING;
+ if (GetMenuItemInfoW (GetMenu (hwndDlg), menuEntries[i], FALSE, &info))
+ {
+ info.dwTypeData = str;
+ info.cch = (UINT) wcslen (str);
+
+ SetMenuItemInfoW (GetMenu (hwndDlg), menuEntries[i], FALSE, &info);
+ }
+ }
+ }
// Resize the logo bitmap if the user has a non-default DPI
if (ScreenDPI != USER_DEFAULT_SCREEN_DPI
@@ -292,10 +317,12 @@ void LoadSettings (HWND hwndDlg)
defaultMountOptions.PartitionInInactiveSysEncScope = FALSE;
defaultMountOptions.RecoveryMode = FALSE;
defaultMountOptions.UseBackupHeader = FALSE;
+ defaultMountOptions.SkipCachedPasswords = FALSE;
mountOptions = defaultMountOptions;
CloseSecurityTokenSessionsAfterMount = ConfigReadInt ("CloseSecurityTokenSessionsAfterMount", 0);
+ EMVSupportEnabled = ConfigReadInt ("EMVSupportEnabled", 0);
{
char szTmp[TC_MAX_PATH] = {0};
@@ -391,7 +418,6 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
static Password *szXPwd;
static int *pkcs5;
static int *pim;
- static BOOL* truecryptMode;
switch (msg)
{
@@ -401,7 +427,6 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
szXPwd = ((PasswordDlgParam *) lParam) -> password;
pkcs5 = ((PasswordDlgParam *) lParam) -> pkcs5;
pim = ((PasswordDlgParam *) lParam) -> pim;
- truecryptMode = ((PasswordDlgParam *) lParam) -> truecryptMode;
LocalizeDialog (hwndDlg, "IDD_PASSWORD_DLG");
DragAcceptFiles (hwndDlg, TRUE);
@@ -471,10 +496,6 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
EnableWindow (GetDlgItem (hwndDlg, IDC_MOUNT_OPTIONS), FALSE);
}
- /* No support for mounting TrueCrypt volumes */
- SetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE, FALSE);
- EnableWindow (GetDlgItem (hwndDlg, IDC_TRUECRYPT_MODE), FALSE);
-
if (!SetForegroundWindow (hwndDlg) && (FavoriteMountOnArrivalInProgress))
{
SetWindowPos (hwndDlg, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
@@ -490,26 +511,11 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
SetWindowPos (hwndDlg, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}
-
- if (!bSecureDesktopOngoing)
- {
- PasswordEditDropTarget* pTarget = new PasswordEditDropTarget ();
- if (pTarget->Register (hwndDlg))
- {
- SetWindowLongPtr (hwndDlg, DWLP_USER, (LONG_PTR) pTarget);
- }
- else
- delete pTarget;
- }
}
return 0;
case TC_APPMSG_PREBOOT_PASSWORD_MODE:
{
- /* No support for mounting TrueCrypt system partition */
- SetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE, FALSE);
- EnableWindow (GetDlgItem (hwndDlg, IDC_TRUECRYPT_MODE), FALSE);
-
/* Repopulate the PRF algorithms list with algorithms that support system encryption */
HWND hComboBox = GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID);
SendMessage (hComboBox, CB_RESETCONTENT, 0, 0);
@@ -685,38 +691,19 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
if (lw == IDOK)
{
- BOOL bTrueCryptMode = GetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE);
- int iMaxPasswordLength = (bUseLegacyMaxPasswordLength || bTrueCryptMode)? MAX_LEGACY_PASSWORD : MAX_PASSWORD;
+ int iMaxPasswordLength = (bUseLegacyMaxPasswordLength)? MAX_LEGACY_PASSWORD : MAX_PASSWORD;
if (mountOptions.ProtectHiddenVolume && hidVolProtKeyFilesParam.EnableKeyFiles)
KeyFilesApply (hwndDlg, &mountOptions.ProtectedHidVolPassword, hidVolProtKeyFilesParam.FirstKeyFile, PasswordDlgVolume);
- if (GetPassword (hwndDlg, IDC_PASSWORD, (LPSTR) szXPwd->Text, iMaxPasswordLength + 1, bTrueCryptMode, TRUE))
+ if (GetPassword (hwndDlg, IDC_PASSWORD, (LPSTR) szXPwd->Text, iMaxPasswordLength + 1, FALSE, TRUE))
szXPwd->Length = (unsigned __int32) (strlen ((char *) szXPwd->Text));
else
return 1;
bCacheInDriver = IsButtonChecked (GetDlgItem (hwndDlg, IDC_CACHE));
*pkcs5 = (int) SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETITEMDATA, SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETCURSEL, 0, 0), 0);
- *truecryptMode = bTrueCryptMode;
*pim = GetPim (hwndDlg, IDC_PIM, 0);
-
- /* check that PRF is supported in TrueCrypt Mode */
- if ( (*truecryptMode)
- && ((!is_pkcs5_prf_supported(*pkcs5, TRUE, PRF_BOOT_NO)) || (mountOptions.ProtectHiddenVolume && !is_pkcs5_prf_supported(mountOptions.ProtectedHidVolPkcs5Prf, TRUE, PRF_BOOT_NO)))
- )
- {
- Error ("ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE", hwndDlg);
- return 1;
- }
-
- if ( (*truecryptMode)
- && (*pim != 0)
- )
- {
- Error ("PIM_NOT_SUPPORTED_FOR_TRUECRYPT_MODE", hwndDlg);
- return 1;
- }
}
// Attempt to wipe password stored in the input field buffer
@@ -793,19 +780,6 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
DragFinish (hdrop);
}
return 1;
-
- case WM_NCDESTROY:
- {
- /* unregister drap-n-drop support */
- PasswordEditDropTarget* pTarget = (PasswordEditDropTarget*) GetWindowLongPtr (hwndDlg, DWLP_USER);
- if (pTarget)
- {
- SetWindowLongPtr (hwndDlg, DWLP_USER, (LONG_PTR) 0);
- pTarget->Revoke ();
- pTarget->Release();
- }
- }
- return 0;
}
return 0;
@@ -828,7 +802,7 @@ int RestoreVolumeHeader (HWND hwndDlg, char *lpszVolume)
return 0;
}
-int ExtcvAskVolumePassword (HWND hwndDlg, const wchar_t* fileName, Password *password, int *pkcs5, int *pim, BOOL* truecryptMode, char *titleStringId, BOOL enableMountOptions)
+int ExtcvAskVolumePassword (HWND hwndDlg, const wchar_t* fileName, Password *password, int *pkcs5, int *pim, char *titleStringId, BOOL enableMountOptions)
{
INT_PTR result;
PasswordDlgParam dlgParam;
@@ -839,7 +813,6 @@ int ExtcvAskVolumePassword (HWND hwndDlg, const wchar_t* fileName, Password *pas
dlgParam.password = password;
dlgParam.pkcs5 = pkcs5;
dlgParam.pim = pim;
- dlgParam.truecryptMode = truecryptMode;
StringCbCopyW (PasswordDlgVolume, sizeof(PasswordDlgVolume), fileName);
@@ -852,7 +825,6 @@ int ExtcvAskVolumePassword (HWND hwndDlg, const wchar_t* fileName, Password *pas
password->Length = 0;
*pkcs5 = 0;
*pim = 0;
- *truecryptMode = FALSE;
burn (&mountOptions.ProtectedHidVolPassword, sizeof (mountOptions.ProtectedHidVolPassword));
burn (&mountOptions.ProtectedHidVolPkcs5Prf, sizeof (mountOptions.ProtectedHidVolPkcs5Prf));
}
@@ -864,7 +836,7 @@ int ExtcvAskVolumePassword (HWND hwndDlg, const wchar_t* fileName, Password *pas
static BOOL SelectContainer (HWND hwndDlg)
{
- if (BrowseFiles (hwndDlg, "OPEN_VOL_TITLE", szFileName, bHistory, FALSE, NULL) == FALSE)
+ if (BrowseFiles (hwndDlg, "OPEN_VOL_TITLE", szFileName, bHistory, FALSE) == FALSE)
return FALSE;
AddComboItem (GetDlgItem (hwndDlg, IDC_VOLUME), szFileName, bHistory);
@@ -990,7 +962,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (EnableMemoryProtection)
{
/* Protect this process memory from being accessed by non-admin users */
- EnableProcessProtection ();
+ ActivateMemoryProtection ();
}
InitMainDialog (hwndDlg);
@@ -1018,6 +990,17 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
localcleanup ();
return 0;
+ case WM_DROPFILES:
+ {
+ HDROP hdrop = (HDROP) wParam;
+ DragQueryFile (hdrop, 0, szFileName, ARRAYSIZE (szFileName));
+ DragFinish (hdrop);
+
+ AddComboItem (GetDlgItem (hwndDlg, IDC_VOLUME), szFileName, bHistory);
+ SetFocus (GetDlgItem (hwndDlg, IDOK));
+ }
+ return 1;
+
case WM_COMMAND:
if (lw == IDCANCEL || lw == IDC_EXIT)
@@ -1036,7 +1019,12 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
wchar_t fileName[MAX_PATH];
GetWindowText (GetDlgItem (hwndDlg, IDC_VOLUME), fileName, ARRAYSIZE (fileName));
- ExpandVolumeWizard(hwndDlg, fileName);
+ if (!VolumePathExists (fileName))
+ {
+ handleWin32Error (hwndDlg, SRC_POS);
+ }
+ else
+ ExpandVolumeWizard(hwndDlg, fileName);
}
return 1;
}
diff --git a/src/ExpandVolume/resource.h b/src/ExpandVolume/resource.h
index 99d89dda..d4e1c1dd 100644
--- a/src/ExpandVolume/resource.h
+++ b/src/ExpandVolume/resource.h
@@ -43,24 +43,22 @@
#define IDC_SELECT_FILE 1042
#define IDC_VOLUME_PROPERTIES 1044
#define IDT_RANDOM_POOL 1047
-#define IDT_VOL_NAME 1047
#define IDT_HEADER_KEY 1048
-#define IDT_CURRENT_SIZE 1048
-#define IDT_VOLUME 1049
#define IDT_MASTER_KEY 1049
-#define IDT_NEW_SIZE 1049
-#define IDT_PASSWORD 1050
#define IDT_DONE 1050
#define IDT_SPEED 1051
#define IDT_LEFT 1052
#define IDT_INIT_SPACE 1053
#define IDT_FILE_SYS 1054
-#define IDT_INIT_SPACE2 1055
-#define IDT_RANDOM_POOL2 1055
#define IDC_EXIT 1060
#define IDC_UNMOUNTALL 1063
#define IDC_SHOW_PASSWORD 1094
#define IDC_LOGO 1095
+#define IDT_VOL_NAME 1096
+#define IDT_CURRENT_SIZE 1097
+#define IDT_NEW_SIZE 1098
+#define IDT_VOLUME 1099
+#define IDT_PASSWORD 1100
#define IDC_SIZEDLG_TITLE 1111
#define IDC_INIT_NEWSPACE 1112
#define IDC_INFOEXPAND 1113
@@ -72,6 +70,8 @@
#define IDC_OLD_PIM_HELP 1144
#define ID_HOMEPAGE 1145
#define IDC_QUICKEXPAND 1146
+#define IDC_STEPSEXPAND 1147
+#define IDT_NEW_SIZE_BOX_TITLE 1148
#define IDM_HELP 40001
#define IDM_ABOUT 40002
#define IDM_UNMOUNT_VOLUME 40003
@@ -142,7 +142,7 @@
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 120
#define _APS_NEXT_COMMAND_VALUE 40064
-#define _APS_NEXT_CONTROL_VALUE 1147
+#define _APS_NEXT_CONTROL_VALUE 1149
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/src/Format/Format.manifest b/src/Format/Format.manifest
index 5d4cb896..79d86799 100644
--- a/src/Format/Format.manifest
+++ b/src/Format/Format.manifest
@@ -14,7 +14,13 @@
</asmv3:application>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
- <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
+ <!-- Windows 10 and Windows 11 -->
+ <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
+ <!-- Windows 8.1 -->
+ <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
+ <!-- Windows 8 -->
+ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
+ <!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
</application>
</compatibility>
diff --git a/src/Format/Format.rc b/src/Format/Format.rc
index d4a9a5f5..46e811b7 100644
--- a/src/Format/Format.rc
+++ b/src/Format/Format.rc
@@ -28,8 +28,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,26,0,0
- PRODUCTVERSION 1,26,0,0
+ FILEVERSION 1,26,10,0
+ PRODUCTVERSION 1,26,10,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -46,11 +46,11 @@ BEGIN
BEGIN
VALUE "CompanyName", "IDRIX"
VALUE "FileDescription", "VeraCrypt Format"
- VALUE "FileVersion", "1.26"
+ VALUE "FileVersion", "1.26.10"
VALUE "LegalTrademarks", "VeraCrypt"
VALUE "OriginalFilename", "VeraCrypt Format.exe"
VALUE "ProductName", "VeraCrypt"
- VALUE "ProductVersion", "1.26"
+ VALUE "ProductVersion", "1.26.10"
END
END
BLOCK "VarFileInfo"
@@ -154,7 +154,8 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
COMBOBOX IDC_FILESYS,50,13,36,90,CBS_DROPDOWNLIST | WS_TABSTOP
COMBOBOX IDC_CLUSTERSIZE,135,13,42,90,CBS_DROPDOWNLIST | WS_TABSTOP
- CONTROL "Quick Format",IDC_QUICKFORMAT,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,181,9,92,8
+ COMBOBOX IDC_FORMAT_TYPE,181,8,93,131,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ CONTROL "Dynamic",SPARSE_FILE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,181,22,92,8
CONTROL "",IDC_SHOW_KEYS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,265,38,9,8
PUSHBUTTON "Abort",IDC_ABORT_BUTTON,200,75,64,14
RTEXT "Header Key: ",IDT_HEADER_KEY,2,47,76,8
@@ -178,7 +179,6 @@ BEGIN
CONTROL "",IDC_RANDOM_BYTES,"Static",SS_SIMPLE | WS_GROUP,83,38,177,8,WS_EX_TRANSPARENT
GROUPBOX "Randomness Collected From Mouse Movements",IDT_ENTROPY_BAR,0,175,276,18
CONTROL "",IDC_ENTROPY_BAR,"msctls_progress32",WS_BORDER,20,184,235,6
- CONTROL "Dynamic",SPARSE_FILE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,181,21,92,8
END
IDD_INTRO_PAGE_DLG DIALOGEX 0, 0, 276, 193
diff --git a/src/Format/Format.vcxproj b/src/Format/Format.vcxproj
index e377c1e0..1ae26d43 100644
--- a/src/Format/Format.vcxproj
+++ b/src/Format/Format.vcxproj
@@ -181,7 +181,7 @@
<AdditionalDependencies>..\Crypto\Debug\crypto.lib;..\Common\Debug\Zip.lib;..\Common\Debug\lzma.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)Format.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
@@ -221,7 +221,7 @@ copy Debug\VeraCryptFormat.exe "..\Debug\Setup Files\VeraCrypt Format.exe" &gt;N
<AdditionalDependencies>..\Crypto\x64\Debug\crypto.lib;..\Common\x64\Debug\Zip.lib;..\Common\x64\Debug\lzma.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)Format.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
@@ -264,7 +264,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-x64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\Release\crypto.lib;..\Common\Release\Zip.lib;..\Common\Release\lzma.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -304,7 +304,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-x64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\Release\crypto.lib;..\Common\Release\Zip.lib;..\Common\Release\lzma.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -344,7 +344,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-x64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\Release\crypto.lib;..\Common\Release\Zip.lib;..\Common\Release\lzma.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -388,7 +388,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-x64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;..\Common\x64\Release\lzma.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -432,7 +432,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-x64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;..\Common\x64\Release\lzma.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -476,7 +476,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-x64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;..\Common\x64\Release\lzma.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -497,6 +497,17 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-x64.exe" &gt;NUL:
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
+ <ClCompile Include="..\Common\CommandAPDU.cpp" />
+ <ClCompile Include="..\Common\EMVCard.cpp" />
+ <ClCompile Include="..\Common\EMVToken.cpp" />
+ <ClCompile Include="..\Common\PCSCException.cpp" />
+ <ClCompile Include="..\Common\ResponseAPDU.cpp" />
+ <ClCompile Include="..\Common\SCard.cpp" />
+ <ClCompile Include="..\Common\SCardLoader.cpp" />
+ <ClCompile Include="..\Common\SCardManager.cpp" />
+ <ClCompile Include="..\Common\SCardReader.cpp" />
+ <ClCompile Include="..\Common\TLVParser.cpp" />
+ <ClCompile Include="..\Common\Token.cpp" />
<ClCompile Include="FormatCom.cpp" />
<ClCompile Include="InPlace.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
@@ -577,16 +588,27 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-x64.exe" &gt;NUL:
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\Common\BaseCom.h" />
+ <ClInclude Include="..\Common\CommandAPDU.h" />
<ClInclude Include="..\Common\Common.h" />
<ClInclude Include="..\Common\Crc.h" />
<ClInclude Include="..\Common\Crypto.h" />
<ClInclude Include="..\Common\Dictionary.h" />
<ClInclude Include="..\Common\Dlgcode.h" />
+ <ClInclude Include="..\Common\EMVCard.h" />
+ <ClInclude Include="..\Common\EMVToken.h" />
<ClInclude Include="..\Common\EncryptionThreadPool.h" />
<ClInclude Include="..\Common\Endian.h" />
<ClInclude Include="..\Common\Exception.h" />
<ClInclude Include="..\Common\Fat.h" />
<ClInclude Include="..\Common\Format.h" />
+ <ClInclude Include="..\Common\PCSCException.h" />
+ <ClInclude Include="..\Common\ResponseAPDU.h" />
+ <ClInclude Include="..\Common\SCard.h" />
+ <ClInclude Include="..\Common\SCardLoader.h" />
+ <ClInclude Include="..\Common\SCardManager.h" />
+ <ClInclude Include="..\Common\SCardReader.h" />
+ <ClInclude Include="..\Common\TLVParser.h" />
+ <ClInclude Include="..\Common\Token.h" />
<ClInclude Include="FormatCom.h" />
<ClInclude Include="..\Common\GfMul.h" />
<ClInclude Include="InPlace.h" />
@@ -644,7 +666,9 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-x64.exe" &gt;NUL:
<None Include="..\Boot\Windows\Release_Twofish\BootSector.bin" />
<None Include="..\Boot\Windows\Release_AES\BootSector.bin" />
<None Include="..\Boot\Windows\Release\Decompressor.com" />
- <None Include="..\Common\Language.xml" />
+ <None Include="..\Common\Language.xml">
+ <SubType>Designer</SubType>
+ </None>
<None Include="..\Resources\Texts\License.rtf" />
<None Include="..\Common\Textual_logo_288dpi.bmp" />
<None Include="..\Common\Textual_logo_96dpi.bmp" />
diff --git a/src/Format/Format.vcxproj.filters b/src/Format/Format.vcxproj.filters
index 4f0e81eb..dbba0b57 100644
--- a/src/Format/Format.vcxproj.filters
+++ b/src/Format/Format.vcxproj.filters
@@ -108,6 +108,39 @@
<ClCompile Include="..\Common\Xts.c">
<Filter>Source Files\Common</Filter>
</ClCompile>
+ <ClCompile Include="..\Common\EMVToken.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\Token.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\TLVParser.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\CommandAPDU.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\PCSCException.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\ResponseAPDU.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\SCardLoader.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\SCardManager.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\SCardReader.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\EMVCard.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\SCard.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<Midl Include="FormatCom.idl">
@@ -208,6 +241,39 @@
<ClInclude Include="..\Common\Xts.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="..\Common\EMVToken.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\Token.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\TLVParser.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\CommandAPDU.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\PCSCException.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\ResponseAPDU.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\SCardLoader.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\SCardManager.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\SCardReader.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\EMVCard.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\SCard.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\Boot\Windows\Release_Serpent_SHA2\BootSector.bin">
diff --git a/src/Format/FormatCom.cpp b/src/Format/FormatCom.cpp
index 7c155600..90333f23 100644
--- a/src/Format/FormatCom.cpp
+++ b/src/Format/FormatCom.cpp
@@ -92,7 +92,7 @@ public:
virtual BOOL STDMETHODCALLTYPE FormatNtfs (int driveNo, int clusterSize)
{
- return ::FormatNtfs (driveNo, clusterSize);
+ return ::FormatNtfs (driveNo, clusterSize, TRUE);
}
virtual int STDMETHODCALLTYPE AnalyzeHiddenVolumeHost (
@@ -134,7 +134,7 @@ public:
virtual BOOL STDMETHODCALLTYPE FormatFs (int driveNo, int clusterSize, int fsType)
{
- return ::FormatFs (driveNo, clusterSize, fsType);
+ return ::FormatFs (driveNo, clusterSize, fsType, TRUE);
}
virtual DWORD STDMETHODCALLTYPE GetFileSize (BSTR filePath, unsigned __int64 *pSize)
@@ -182,6 +182,16 @@ public:
return BaseCom::UpdateSetupConfigFile (bForInstall);
}
+ virtual DWORD STDMETHODCALLTYPE NotifyService (DWORD dwNotifyCode)
+ {
+ return BaseCom::NotifyService (dwNotifyCode);
+ }
+
+ virtual DWORD STDMETHODCALLTYPE FastFileResize (BSTR filePath, __int64 fileSize)
+ {
+ return BaseCom::FastFileResize (filePath, fileSize);
+ }
+
protected:
DWORD MessageThreadId;
LONG RefCount;
@@ -245,12 +255,12 @@ extern "C" int UacFormatNtfs (HWND hWnd, int driveNo, int clusterSize)
CComPtr<ITrueCryptFormatCom> tc;
int r;
- CoInitialize (NULL);
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
if (ComGetInstance (hWnd, &tc))
r = tc->FormatNtfs (driveNo, clusterSize);
else
- r = 0;
+ r = (int) GetLastError();
CoUninitialize ();
@@ -262,12 +272,12 @@ extern "C" int UacFormatFs (HWND hWnd, int driveNo, int clusterSize, int fsType)
CComPtr<ITrueCryptFormatCom> tc;
int r;
- CoInitialize (NULL);
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
if (ComGetInstance (hWnd, &tc))
r = tc->FormatFs (driveNo, clusterSize, fsType);
else
- r = 0;
+ r = (int) GetLastError();
CoUninitialize ();
@@ -280,7 +290,7 @@ extern "C" int UacAnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 h
CComPtr<ITrueCryptFormatCom> tc;
int r;
- CoInitialize (NULL);
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
if (ComGetInstance (hwndDlg, &tc))
r = tc->AnalyzeHiddenVolumeHost ((__int64) hwndDlg, driveNo, hiddenVolHostSize, realClusterSize, nbrFreeClusters);
@@ -297,7 +307,7 @@ extern "C" BOOL UacWriteLocalMachineRegistryDword (HWND hwndDlg, wchar_t *keyPat
CComPtr<ITrueCryptFormatCom> tc;
int r = 0;
- CoInitialize (NULL);
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
if (ComGetInstance (hwndDlg, &tc))
{
@@ -330,3 +340,29 @@ extern "C" BOOL UacWriteLocalMachineRegistryDword (HWND hwndDlg, wchar_t *keyPat
}
}
+extern "C" DWORD UacFastFileCreation (HWND hWnd, wchar_t* filePath, __int64 fileSize)
+{
+ CComPtr<ITrueCryptFormatCom> tc;
+ DWORD r;
+
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
+
+ if (ComGetInstance (hWnd, &tc))
+ {
+ CComBSTR filePathBstr;
+ BSTR bstr = W2BSTR(filePath);
+ if (bstr)
+ {
+ filePathBstr.Attach (bstr);
+ r = tc->FastFileResize (filePathBstr, fileSize);
+ }
+ else
+ r = ERROR_OUTOFMEMORY;
+ }
+ else
+ r = GetLastError();
+
+ CoUninitialize ();
+
+ return r;
+}
diff --git a/src/Format/FormatCom.h b/src/Format/FormatCom.h
index 5ab6bd52..e474608d 100644
--- a/src/Format/FormatCom.h
+++ b/src/Format/FormatCom.h
@@ -30,6 +30,7 @@ int UacAnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 hiddenVolHos
int UacFormatVolume (char *cvolumePath , BOOL bDevice , unsigned __int64 size , unsigned __int64 hiddenVolHostSize , Password *password , int cipher , int pkcs5 , BOOL quickFormat, BOOL sparseFileSwitch, int fileSystem , int clusterSize, HWND hwndDlg , BOOL hiddenVol , int *realClusterSize);
BOOL UacUpdateProgressBar (__int64 nSecNo, BOOL *bVolTransformThreadCancel);
BOOL UacWriteLocalMachineRegistryDword (HWND hwndDlg, wchar_t *keyPath, wchar_t *valueName, DWORD value);
+DWORD UacFastFileCreation (HWND hWnd, wchar_t* filePath, __int64 fileSize);
#ifdef __cplusplus
}
diff --git a/src/Format/FormatCom.idl b/src/Format/FormatCom.idl
index 9df43f6e..7276de81 100644
--- a/src/Format/FormatCom.idl
+++ b/src/Format/FormatCom.idl
@@ -16,7 +16,7 @@ import "..\Common\Password.h";
[
uuid(56327DDA-F1A7-4e13-B128-520D129BDEF6),
helpstring("VeraCrypt Format UAC Support Library"),
- version(2.9) // Update ComSetup.cpp when changing version number
+ version(2.10) // Update ComSetup.cpp when changing version number
]
library TrueCryptFormatCom
{
@@ -49,6 +49,8 @@ library TrueCryptFormatCom
DWORD WriteEfiBootSectorUserConfig (DWORD userConfig, BSTR customUserMessage, int pim, int hashAlg);
DWORD UpdateSetupConfigFile (BOOL bForInstall);
DWORD GetSecureBootConfig (BOOL* pSecureBootEnabled, BOOL *pVeraCryptKeysLoaded);
+ DWORD NotifyService (DWORD dwNotifyCode);
+ DWORD FastFileResize (BSTR filePath, __int64 fileSize);
};
[
diff --git a/src/Format/Format_vs2019.vcxproj b/src/Format/Format_vs2019.vcxproj
index e6fe017f..95f61615 100644
--- a/src/Format/Format_vs2019.vcxproj
+++ b/src/Format/Format_vs2019.vcxproj
@@ -201,7 +201,7 @@
<AdditionalDependencies>..\Crypto\Debug\crypto.lib;..\Common\Debug\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)Format.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
@@ -241,7 +241,7 @@ copy Debug\VeraCryptFormat.exe "..\Debug\Setup Files\VeraCrypt Format.exe" &gt;N
<AdditionalDependencies>..\Crypto\ARM64\Debug\crypto.lib;..\Common\ARM64\Debug\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)Format.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
@@ -283,7 +283,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-x64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\ARM64\Debug\crypto.lib;..\Common\ARM64\Debug\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)Format.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
@@ -324,7 +324,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-arm64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\Release\crypto.lib;..\Common\Release\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -364,7 +364,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-arm64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\Release\crypto.lib;..\Common\Release\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -408,7 +408,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-arm64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -451,7 +451,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-arm64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\ARM64\Release\crypto.lib;..\Common\ARM64\Release\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -494,7 +494,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-arm64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -537,7 +537,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-arm64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -557,6 +557,17 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-arm64.exe" &gt;NUL:
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
+ <ClCompile Include="..\Common\CommandAPDU.cpp" />
+ <ClCompile Include="..\Common\EMVCard.cpp" />
+ <ClCompile Include="..\Common\EMVToken.cpp" />
+ <ClCompile Include="..\Common\PCSCException.cpp" />
+ <ClCompile Include="..\Common\ResponseAPDU.cpp" />
+ <ClCompile Include="..\Common\SCard.cpp" />
+ <ClCompile Include="..\Common\SCardLoader.cpp" />
+ <ClCompile Include="..\Common\SCardManager.cpp" />
+ <ClCompile Include="..\Common\SCardReader.cpp" />
+ <ClCompile Include="..\Common\TLVParser.cpp" />
+ <ClCompile Include="..\Common\Token.cpp" />
<ClCompile Include="FormatCom.cpp" />
<ClCompile Include="InPlace.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
@@ -642,16 +653,27 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-arm64.exe" &gt;NUL:
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\Common\BaseCom.h" />
+ <ClInclude Include="..\Common\CommandAPDU.h" />
<ClInclude Include="..\Common\Common.h" />
<ClInclude Include="..\Common\Crc.h" />
<ClInclude Include="..\Common\Crypto.h" />
<ClInclude Include="..\Common\Dictionary.h" />
<ClInclude Include="..\Common\Dlgcode.h" />
+ <ClInclude Include="..\Common\EMVCard.h" />
+ <ClInclude Include="..\Common\EMVToken.h" />
<ClInclude Include="..\Common\EncryptionThreadPool.h" />
<ClInclude Include="..\Common\Endian.h" />
<ClInclude Include="..\Common\Exception.h" />
<ClInclude Include="..\Common\Fat.h" />
<ClInclude Include="..\Common\Format.h" />
+ <ClInclude Include="..\Common\PCSCException.h" />
+ <ClInclude Include="..\Common\ResponseAPDU.h" />
+ <ClInclude Include="..\Common\SCard.h" />
+ <ClInclude Include="..\Common\SCardLoader.h" />
+ <ClInclude Include="..\Common\SCardManager.h" />
+ <ClInclude Include="..\Common\SCardReader.h" />
+ <ClInclude Include="..\Common\TLVParser.h" />
+ <ClInclude Include="..\Common\Token.h" />
<ClInclude Include="FormatCom.h" />
<ClInclude Include="..\Common\GfMul.h" />
<ClInclude Include="InPlace.h" />
diff --git a/src/Format/InPlace.c b/src/Format/InPlace.c
index f6166dab..b1483631 100644
--- a/src/Format/InPlace.c
+++ b/src/Format/InPlace.c
@@ -593,7 +593,7 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol
offset.QuadPart = TC_VOLUME_DATA_OFFSET + dataAreaSize;
- if (!SetFilePointerEx (dev, offset, NULL, FILE_BEGIN))
+ if (!MoveFilePointer (dev, offset))
{
nStatus = ERR_OS_ERROR;
goto closing_seq;
@@ -639,7 +639,7 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol
offset.QuadPart += TC_HIDDEN_VOLUME_HEADER_OFFSET;
- if (!SetFilePointerEx (dev, offset, NULL, FILE_BEGIN))
+ if (!MoveFilePointer (dev, offset))
{
nStatus = ERR_OS_ERROR;
goto closing_seq;
@@ -916,7 +916,7 @@ inplace_enc_read:
offset.QuadPart = masterCryptoInfo->EncryptedAreaStart.Value - workChunkSize - TC_VOLUME_DATA_OFFSET;
- if (SetFilePointerEx (dev, offset, NULL, FILE_BEGIN) == 0)
+ if (MoveFilePointer (dev, offset) == 0)
{
nStatus = ERR_OS_ERROR;
goto closing_seq;
@@ -1007,14 +1007,14 @@ inplace_enc_read:
memcpy (wipeRandCharsUpdate, wipeBuffer, sizeof (wipeRandCharsUpdate));
}
- if (SetFilePointerEx (dev, offset, NULL, FILE_BEGIN) == 0
+ if (MoveFilePointer (dev, offset) == 0
|| WriteFile (dev, wipeBuffer, workChunkSize, &n, NULL) == 0)
{
// Write error
dwError = GetLastError();
// Undo failed write operation
- if (workChunkSize > TC_VOLUME_DATA_OFFSET && SetFilePointerEx (dev, offset, NULL, FILE_BEGIN))
+ if (workChunkSize > TC_VOLUME_DATA_OFFSET && MoveFilePointer (dev, offset))
{
DecryptDataUnits ((byte *) buf, &unitNo, workChunkSize / ENCRYPTION_DATA_UNIT_SIZE, masterCryptoInfo);
WriteFile (dev, buf + TC_VOLUME_DATA_OFFSET, workChunkSize - TC_VOLUME_DATA_OFFSET, &n, NULL);
@@ -1034,7 +1034,7 @@ inplace_enc_read:
offset.QuadPart = masterCryptoInfo->EncryptedAreaStart.Value - workChunkSize;
- if (SetFilePointerEx (dev, offset, NULL, FILE_BEGIN) == 0)
+ if (MoveFilePointer (dev, offset) == 0)
{
nStatus = ERR_OS_ERROR;
goto closing_seq;
@@ -1046,7 +1046,7 @@ inplace_enc_read:
dwError = GetLastError();
// Undo failed write operation
- if (workChunkSize > TC_VOLUME_DATA_OFFSET && SetFilePointerEx (dev, offset, NULL, FILE_BEGIN))
+ if (workChunkSize > TC_VOLUME_DATA_OFFSET && MoveFilePointer (dev, offset))
{
DecryptDataUnits ((byte *) buf, &unitNo, workChunkSize / ENCRYPTION_DATA_UNIT_SIZE, masterCryptoInfo);
WriteFile (dev, buf + TC_VOLUME_DATA_OFFSET, workChunkSize - TC_VOLUME_DATA_OFFSET, &n, NULL);
@@ -1148,7 +1148,7 @@ inplace_enc_read:
offset.QuadPart = TC_VOLUME_HEADER_OFFSET;
- if (SetFilePointerEx (dev, offset, NULL, FILE_BEGIN) == 0
+ if (MoveFilePointer (dev, offset) == 0
|| !WriteEffectiveVolumeHeader (TRUE, dev, (byte *) header))
{
nStatus = ERR_OS_ERROR;
@@ -1207,7 +1207,7 @@ inplace_enc_read:
offset.QuadPart += TC_HIDDEN_VOLUME_HEADER_OFFSET;
- if (SetFilePointerEx (dev, offset, NULL, FILE_BEGIN) == 0
+ if (MoveFilePointer (dev, offset) == 0
|| !WriteEffectiveVolumeHeader (TRUE, dev, (byte *) header))
{
nStatus = ERR_OS_ERROR;
@@ -1544,7 +1544,7 @@ int DecryptPartitionInPlace (volatile FORMAT_VOL_PARAMETERS *volParams, volatile
offset.QuadPart = workChunkStartByteOffset;
- if (SetFilePointerEx (dev, offset, NULL, FILE_BEGIN) == 0)
+ if (MoveFilePointer (dev, offset) == 0)
{
nStatus = ERR_OS_ERROR;
goto closing_seq;
@@ -1578,7 +1578,7 @@ int DecryptPartitionInPlace (volatile FORMAT_VOL_PARAMETERS *volParams, volatile
for (tmpSectorCount = workChunkSize / sectorSize; tmpSectorCount > 0; --tmpSectorCount)
{
- if (SetFilePointerEx (dev, tmpSectorOffset, NULL, FILE_BEGIN) == 0)
+ if (MoveFilePointer (dev, tmpSectorOffset) == 0)
{
nStatus = ERR_OS_ERROR;
goto closing_seq;
@@ -1640,7 +1640,7 @@ int DecryptPartitionInPlace (volatile FORMAT_VOL_PARAMETERS *volParams, volatile
offset.QuadPart = workChunkStartByteOffset - TC_VOLUME_DATA_OFFSET;
- if (SetFilePointerEx (dev, offset, NULL, FILE_BEGIN) == 0)
+ if (MoveFilePointer (dev, offset) == 0)
{
nStatus = ERR_OS_ERROR;
goto closing_seq;
@@ -1724,7 +1724,7 @@ int DecryptPartitionInPlace (volatile FORMAT_VOL_PARAMETERS *volParams, volatile
offset.QuadPart <= deviceSize - sectorSize;
offset.QuadPart += sectorSize)
{
- if (SetFilePointerEx (dev, offset, NULL, FILE_BEGIN) == 0)
+ if (MoveFilePointer (dev, offset) == 0)
{
nStatus = ERR_OS_ERROR;
goto closing_seq;
@@ -1864,7 +1864,7 @@ int FastVolumeHeaderUpdate (HANDLE dev, CRYPTO_INFO *headerCryptoInfo, CRYPTO_IN
offset.QuadPart = deviceSize - TC_VOLUME_HEADER_GROUP_SIZE;
- if (SetFilePointerEx (dev, offset, NULL, FILE_BEGIN) == 0
+ if (MoveFilePointer (dev, offset) == 0
|| !ReadEffectiveVolumeHeader (TRUE, dev, header, &n) || n < TC_VOLUME_HEADER_EFFECTIVE_SIZE)
{
nStatus = ERR_OS_ERROR;
@@ -1913,7 +1913,7 @@ int FastVolumeHeaderUpdate (HANDLE dev, CRYPTO_INFO *headerCryptoInfo, CRYPTO_IN
EncryptBuffer (header + HEADER_ENCRYPTED_DATA_OFFSET, HEADER_ENCRYPTED_DATA_SIZE, pCryptoInfo);
- if (SetFilePointerEx (dev, offset, NULL, FILE_BEGIN) == 0
+ if (MoveFilePointer (dev, offset) == 0
|| !WriteEffectiveVolumeHeader (TRUE, dev, header))
{
nStatus = ERR_OS_ERROR;
@@ -2092,7 +2092,7 @@ static int ConcealNTFS (HANDLE dev)
offset.QuadPart = 0;
- if (SetFilePointerEx (dev, offset, NULL, FILE_BEGIN) == 0)
+ if (MoveFilePointer (dev, offset) == 0)
return ERR_OS_ERROR;
if (ReadFile (dev, buf, TC_INITIAL_NTFS_CONCEAL_PORTION_SIZE, &nbrBytesProcessed, NULL) == 0)
@@ -2103,7 +2103,7 @@ static int ConcealNTFS (HANDLE dev)
offset.QuadPart = 0;
- if (SetFilePointerEx (dev, offset, NULL, FILE_BEGIN) == 0)
+ if (MoveFilePointer (dev, offset) == 0)
return ERR_OS_ERROR;
if (WriteFile (dev, buf, TC_INITIAL_NTFS_CONCEAL_PORTION_SIZE, &nbrBytesProcessed, NULL) == 0)
@@ -2122,7 +2122,7 @@ static int ConcealNTFS (HANDLE dev)
{
Sleep (1);
}
- while (SetFilePointerEx (dev, offset, NULL, FILE_BEGIN) == 0
+ while (MoveFilePointer (dev, offset) == 0
|| WriteFile (dev, buf, TC_INITIAL_NTFS_CONCEAL_PORTION_SIZE, &nbrBytesProcessed2, NULL) == 0);
SetLastError (dwError);
@@ -2198,6 +2198,38 @@ BOOL SaveNonSysInPlaceEncSettings (int delta, WipeAlgorithmId newWipeAlgorithm,
return SaveBufferToFile (str, GetConfigPath (TC_APPD_FILENAME_NONSYS_INPLACE_ENC), (DWORD) strlen(str), FALSE, FALSE);
}
+// This function moves the file pointer to the given offset. It first retrieves the current
+// file position using SetFilePointerEx() with FILE_CURRENT as the reference point, and then
+// calculates the difference between the current position and the desired position. Subsequently,
+// it moves the file pointer by the difference calculated using SetFilePointerEx() again.
+//
+// This approach of moving the file pointer relatively (instead of absolutely) was implemented
+// as a workaround to address the performance issues related to in-place encryption. When using
+// SetFilePointerEx() with FILE_BEGIN as the reference point, reaching the end of large drives
+// during in-place encryption can cause significant slowdowns. By moving the file pointer
+// relatively, these performance issues are mitigated.
+//
+// We fall back to absolute positioning if the relative positioning fails.
+BOOL MoveFilePointer (HANDLE dev, LARGE_INTEGER offset)
+{
+ LARGE_INTEGER currOffset;
+ LARGE_INTEGER diffOffset;
+
+ currOffset.QuadPart = 0;
+ if (SetFilePointerEx (dev, currOffset, &currOffset, FILE_CURRENT))
+ {
+ diffOffset.QuadPart = offset.QuadPart - currOffset.QuadPart;
+ if (diffOffset.QuadPart == 0)
+ return TRUE;
+
+ // Moves the file pointer by the difference between current and desired positions
+ if (SetFilePointerEx (dev, diffOffset, NULL, FILE_CURRENT))
+ return TRUE;
+ }
+
+ // An error occurred, fallback to absolute positioning
+ return SetFilePointerEx (dev, offset, NULL, FILE_BEGIN);
+}
// Repairs damaged sectors (i.e. those with read errors) by zeroing them.
// Note that this operating fails if there are any write errors.
@@ -2217,7 +2249,7 @@ int ZeroUnreadableSectors (HANDLE dev, LARGE_INTEGER startOffset, int64 size, in
if (!sectorBuffer)
return ERR_OUTOFMEMORY;
- if (SetFilePointerEx (dev, startOffset, NULL, FILE_BEGIN) == 0)
+ if (!MoveFilePointer(dev, workOffset))
{
nStatus = ERR_OS_ERROR;
goto closing_seq;
@@ -2230,7 +2262,8 @@ int ZeroUnreadableSectors (HANDLE dev, LARGE_INTEGER startOffset, int64 size, in
{
memset (sectorBuffer, 0, sectorSize);
- if (SetFilePointerEx (dev, workOffset, NULL, FILE_BEGIN) == 0)
+ // If ReadFile failed, move back to start of the unreadable sector
+ if (MoveFilePointer (dev, workOffset) == 0)
{
nStatus = ERR_OS_ERROR;
goto closing_seq;
@@ -2281,7 +2314,7 @@ static int OpenBackupHeader (HANDLE dev, const wchar_t *devicePath, Password *pa
offset.QuadPart = deviceSize - TC_VOLUME_HEADER_GROUP_SIZE;
- if (SetFilePointerEx (dev, offset, NULL, FILE_BEGIN) == 0
+ if (MoveFilePointer (dev, offset) == 0
|| !ReadEffectiveVolumeHeader (TRUE, dev, (byte *) header, &n) || n < TC_VOLUME_HEADER_EFFECTIVE_SIZE)
{
nStatus = ERR_OS_ERROR;
@@ -2289,7 +2322,7 @@ static int OpenBackupHeader (HANDLE dev, const wchar_t *devicePath, Password *pa
}
- nStatus = ReadVolumeHeader (FALSE, header, password, pkcs5, pim, FALSE, retMasterCryptoInfo, headerCryptoInfo);
+ nStatus = ReadVolumeHeader (FALSE, header, password, pkcs5, pim, retMasterCryptoInfo, headerCryptoInfo);
if (nStatus != ERR_SUCCESS)
goto closing_seq;
diff --git a/src/Format/Resource.h b/src/Format/Resource.h
index c37a6f4a..d8fb8dc4 100644
--- a/src/Format/Resource.h
+++ b/src/Format/Resource.h
@@ -146,6 +146,7 @@
#define IDC_TB 1107
#define IDC_SKIP_RESCUE_VERIFICATION 1108
#define SPARSE_FILE 1109
+#define IDC_FORMAT_TYPE 1110
// Next default values for new objects
//
@@ -154,7 +155,7 @@
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 134
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1110
+#define _APS_NEXT_CONTROL_VALUE 1111
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c
index efd95caf..658d3797 100644
--- a/src/Format/Tcformat.c
+++ b/src/Format/Tcformat.c
@@ -290,6 +290,7 @@ volatile BOOL quickFormat = FALSE;
volatile BOOL fastCreateFile = FALSE;
volatile BOOL dynamicFormat = FALSE; /* this variable represents the sparse file flag. */
volatile int fileSystem = FILESYS_NONE;
+volatile int formatType = FORMAT_TYPE_FULL;
volatile int clusterSize = 0;
SYSENC_MULTIBOOT_CFG SysEncMultiBootCfg;
@@ -324,7 +325,7 @@ void CALLBACK ResumeInPlaceEncWaitThreadProc(void* pArg, HWND hwndDlg)
if (device.Path == szDevicePath)
{
OpenVolumeContext volume;
- int status = OpenVolume (&volume, device.Path.c_str(), &volumePassword, hash_algo, volumePim, FALSE, FALSE, FALSE, TRUE);
+ int status = OpenVolume (&volume, device.Path.c_str(), &volumePassword, hash_algo, volumePim, FALSE, FALSE, TRUE);
if ( status == ERR_SUCCESS)
{
@@ -370,7 +371,7 @@ void CALLBACK ResumeInPlaceEncWaitThreadProc(void* pArg, HWND hwndDlg)
OpenVolumeContext volume;
- if (OpenVolume (&volume, device.Path.c_str(), &volumePassword, hash_algo, volumePim, FALSE, FALSE, FALSE, TRUE) == ERR_SUCCESS)
+ if (OpenVolume (&volume, device.Path.c_str(), &volumePassword, hash_algo, volumePim, FALSE, FALSE, TRUE) == ERR_SUCCESS)
{
if ((volume.CryptoInfo->HeaderFlags & TC_HEADER_FLAG_NONSYS_INPLACE_ENC) != 0
&& volume.CryptoInfo->EncryptedAreaLength.Value != volume.CryptoInfo->VolumeSize.Value)
@@ -801,6 +802,8 @@ static void LoadSettingsAndCheckModified (HWND hwndDlg, BOOL bOnlyCheckModified,
ConfigReadCompareInt ("UseLegacyMaxPasswordLength", FALSE, &bUseLegacyMaxPasswordLength, bOnlyCheckModified, pbSettingsModified);
+ ConfigReadCompareInt ("EMVSupportEnabled", 0, &EMVSupportEnabled, bOnlyCheckModified, pbSettingsModified);
+
{
char szTmp[MAX_PATH] = {0};
WideCharToMultiByte (CP_UTF8, 0, SecurityTokenLibraryPath, -1, szTmp, MAX_PATH, NULL, NULL);
@@ -1103,24 +1106,6 @@ BOOL SwitchWizardToSysEncMode (void)
if (AskWarnYesNoString ((wstring (GetString ("SYSDRIVE_NON_STANDARD_PARTITIONS")) + L"\n\n" + GetString ("ASK_ENCRYPT_PARTITION_INSTEAD_OF_DRIVE")).c_str(), MainDlg) == IDYES)
bWholeSysDrive = FALSE;
}
-
- if (!IsOSAtLeast (WIN_VISTA) && bWholeSysDrive)
- {
- if (BootEncObj->SystemDriveContainsExtendedPartition())
- {
- bWholeSysDrive = FALSE;
-
- Error ("WDE_UNSUPPORTED_FOR_EXTENDED_PARTITIONS", MainDlg);
-
- if (AskYesNo ("ASK_ENCRYPT_PARTITION_INSTEAD_OF_DRIVE", MainDlg) == IDNO)
- {
- ChangeWizardMode (WIZARD_MODE_NONSYS_DEVICE);
- return FALSE;
- }
- }
- else
- Warning ("WDE_EXTENDED_PARTITIONS_WARNING", MainDlg);
- }
}
else if (BootEncObj->SystemPartitionCoversWholeDrive()
&& !bWholeSysDrive)
@@ -3459,6 +3444,13 @@ BOOL QueryFreeSpace (HWND hwndDlg, HWND hwndTextBox, BOOL display, LONGLONG *pFr
else
{
LARGE_INTEGER lDiskFree;
+ // if the file pointed by szFileName already exists, we must add its size to the free space since it will be overwritten durig the volume creation
+ __int64 lFileSize = GetFileSize64(szFileName);
+ if (lFileSize != -1)
+ {
+ free.QuadPart += lFileSize;
+ }
+
lDiskFree.QuadPart = free.QuadPart;
if (pFreeSpaceValue)
@@ -3702,24 +3694,44 @@ static void UpdateClusterSizeList (HWND hwndDlg, int fsType)
SendMessage (GetDlgItem (hwndDlg, IDC_CLUSTERSIZE), CB_RESETCONTENT, 0, 0);
AddComboPair (GetDlgItem (hwndDlg, IDC_CLUSTERSIZE), GetString ("DEFAULT"), 0);
- for (int i = 1; i <= 128; i *= 2)
+ for (int i = 1; i <= 65536; i *= 2)
{
wstringstream s;
DWORD size = GetFormatSectorSize() * i;
- if (size > TC_MAX_FAT_CLUSTER_SIZE)
+ /* cluster size makes sense only when there is a filesystem */
+ if (fsType == FILESYS_NONE)
+ break;
+
+ /* FAT supports at maximum 64K when sector size is 512, and at maximum 256K when sector size is larger than 512 */
+ /* For now we set maximum cluster size to 64K in all cases for compatibility with exiting FAT code in VeraCrypt */
+ if ((fsType == FILESYS_FAT) && (size > 64*BYTES_PER_KB))
break;
/* ReFS supports only 4KiB and 64KiB clusters */
if ((fsType == FILESYS_REFS) && (size != 4*BYTES_PER_KB) && (size != 64*BYTES_PER_KB))
continue;
+ /* NTFS supports at maximum 2M cluster */
+ if ((fsType == FILESYS_NTFS) && (size > 2*BYTES_PER_MB))
+ break;
+
+ /* exFAT supports at maximum 32M cluster */
+ if ((fsType == FILESYS_EXFAT) && (size > 32*BYTES_PER_MB))
+ break;
+
if (size == 512)
- s << L"0.5";
- else
+ s << L"0.5 " << GetString ("KB");
+ else if (size < BYTES_PER_MB)
+ {
s << size / BYTES_PER_KB;
-
- s << L" " << GetString ("KB");
+ s << L" " << GetString ("KB");
+ }
+ else
+ {
+ s << size / BYTES_PER_MB;
+ s << L" " << GetString ("MB");
+ }
AddComboPair (GetDlgItem (hwndDlg, IDC_CLUSTERSIZE), s.str().c_str(), i);
}
@@ -4463,9 +4475,11 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
}
SetFocus (GetDlgItem (hwndDlg, IDC_PIM));
-
+ #ifndef WOLFCRYPT_BACKEND
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString (SysEncInEffect () && hash_algo != SHA512 && hash_algo != WHIRLPOOL? "PIM_SYSENC_HELP" : "PIM_HELP"));
-
+ #else
+ SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString (SysEncInEffect () && hash_algo != SHA512? "PIM_SYSENC_HELP" : "PIM_HELP"));
+ #endif
ToHyperlink (hwndDlg, IDC_LINK_PIM_INFO);
if (CreatingHiddenSysVol())
@@ -4961,6 +4975,18 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
else
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("FORMAT_TITLE"));
+ /* Fill the format type combobox */
+ SendMessage (GetDlgItem (hwndDlg, IDC_FORMAT_TYPE), CB_RESETCONTENT, 0, 0);
+ EnableWindow (GetDlgItem (hwndDlg, IDC_FORMAT_TYPE), TRUE);
+
+ AddComboPair (GetDlgItem (hwndDlg, IDC_FORMAT_TYPE), GetString("FULL_FORMAT"), FORMAT_TYPE_FULL);
+ AddComboPair (GetDlgItem (hwndDlg, IDC_FORMAT_TYPE), GetString("IDC_QUICKFORMAT"), FORMAT_TYPE_QUICK);
+ if (!bDevice) // Fast Create only makes sens for file containers
+ AddComboPair (GetDlgItem (hwndDlg, IDC_FORMAT_TYPE), GetString("FAST_CREATE"), FORMAT_TYPE_FAST);
+ SendMessage (GetDlgItem (hwndDlg, IDC_FORMAT_TYPE), CB_SETCURSEL, 0, 0);
+
+ formatType = FORMAT_TYPE_FULL;
+
/* Quick/Dynamic */
if (bHiddenVol)
@@ -4972,8 +4998,18 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
SetCheckBox (hwndDlg, SPARSE_FILE, FALSE);
EnableWindow (GetDlgItem (hwndDlg, SPARSE_FILE), FALSE);
- SetCheckBox (hwndDlg, IDC_QUICKFORMAT, quickFormat);
- EnableWindow (GetDlgItem (hwndDlg, IDC_QUICKFORMAT), bHiddenVolHost);
+ if (quickFormat)
+ {
+ formatType = FORMAT_TYPE_QUICK;
+ SelectAlgo (GetDlgItem (hwndDlg, IDC_FORMAT_TYPE), (int *) &formatType);
+ }
+ else if (!bDevice && fastCreateFile)
+ {
+ formatType = FORMAT_TYPE_FAST;
+ quickFormat = TRUE;
+ SelectAlgo (GetDlgItem (hwndDlg, IDC_FORMAT_TYPE), (int *) &formatType);
+ }
+ EnableWindow (GetDlgItem (hwndDlg, IDC_FORMAT_TYPE), bHiddenVolHost);
}
else
{
@@ -4983,7 +5019,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
bSparseFileSwitch = FALSE;
SetCheckBox (hwndDlg, SPARSE_FILE, FALSE);
EnableWindow (GetDlgItem (hwndDlg, SPARSE_FILE), FALSE);
- EnableWindow (GetDlgItem (hwndDlg, IDC_QUICKFORMAT), TRUE);
+ EnableWindow (GetDlgItem (hwndDlg, IDC_FORMAT_TYPE), TRUE);
}
else
{
@@ -5004,8 +5040,15 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
dynamicFormat = FALSE;
SetCheckBox (hwndDlg, SPARSE_FILE, FALSE);
}
+
+ if (fastCreateFile)
+ {
+ formatType = FORMAT_TYPE_FAST;
+ quickFormat = TRUE;
+ SelectAlgo (GetDlgItem (hwndDlg, IDC_FORMAT_TYPE), (int *) &formatType);
+ }
EnableWindow (GetDlgItem (hwndDlg, SPARSE_FILE), bSparseFileSwitch);
- EnableWindow (GetDlgItem (hwndDlg, IDC_QUICKFORMAT), TRUE);
+ EnableWindow (GetDlgItem (hwndDlg, IDC_FORMAT_TYPE), TRUE);
}
}
@@ -5043,7 +5086,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
}
//exFAT support added starting from Vista SP1
- if (IsOSVersionAtLeast (WIN_VISTA, 1) && dataAreaSize >= TC_MIN_EXFAT_FS_SIZE && dataAreaSize <= TC_MAX_EXFAT_FS_SIZE)
+ if (dataAreaSize >= TC_MIN_EXFAT_FS_SIZE && dataAreaSize <= TC_MAX_EXFAT_FS_SIZE)
{
AddComboPair (GetDlgItem (hwndDlg, IDC_FILESYS), L"exFAT", FILESYS_EXFAT);
bEXFATallowed = TRUE;
@@ -5862,7 +5905,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
// Select file
- if (BrowseFiles (hwndDlg, "OPEN_TITLE", szFileName, bHistory, !bHiddenVolDirect, NULL) == FALSE)
+ if (BrowseFiles (hwndDlg, "OPEN_TITLE", szFileName, bHistory, !bHiddenVolDirect) == FALSE)
return 1;
AddComboItem (GetDlgItem (hwndDlg, IDC_COMBO_BOX), szFileName, bHistory);
@@ -5959,29 +6002,50 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
}
- if (lw == IDC_QUICKFORMAT)
+ if (lw == IDC_FORMAT_TYPE && hw == CBN_SELCHANGE)
{
- if (IsButtonChecked (GetDlgItem (hCurPage, IDC_QUICKFORMAT)))
+ formatType = (int) SendMessage (GetDlgItem (hCurPage, IDC_FORMAT_TYPE), CB_GETITEMDATA,
+ SendMessage (GetDlgItem (hCurPage, IDC_FORMAT_TYPE), CB_GETCURSEL, 0, 0) , 0);
+
+ if (formatType == FORMAT_TYPE_QUICK)
{
if (AskWarnYesNo("WARN_QUICK_FORMAT", MainDlg) == IDNO)
- SetCheckBox (hwndDlg, IDC_QUICKFORMAT, FALSE);
+ {
+ formatType = FORMAT_TYPE_FULL;
+ SelectAlgo(GetDlgItem (hCurPage, IDC_FORMAT_TYPE), (int *) &formatType);
+ }
}
- else if (IsButtonChecked (GetDlgItem (hCurPage, SPARSE_FILE)))
+ else if (formatType == FORMAT_TYPE_FAST)
{
- /* sparse file require quick format */
- SetCheckBox (hwndDlg, SPARSE_FILE, FALSE);
+ if (AskWarnYesNo("WARN_FAST_CREATE", MainDlg) == IDNO)
+ {
+ formatType = FORMAT_TYPE_FULL;
+ SelectAlgo(GetDlgItem (hCurPage, IDC_FORMAT_TYPE), (int *) &formatType);
+ }
}
+
return 1;
}
- if (lw == SPARSE_FILE && IsButtonChecked (GetDlgItem (hCurPage, SPARSE_FILE)))
+ if (lw == SPARSE_FILE)
{
- if (AskWarnYesNo("CONFIRM_SPARSE_FILE", MainDlg) == IDNO)
- SetCheckBox (hwndDlg, SPARSE_FILE, FALSE);
- else if (!IsButtonChecked (GetDlgItem (hCurPage, IDC_QUICKFORMAT)) && IsWindowEnabled (GetDlgItem (hCurPage, IDC_QUICKFORMAT)))
+ if (IsButtonChecked (GetDlgItem (hCurPage, SPARSE_FILE)))
{
- /* sparse file require quick format */
- SetCheckBox (hwndDlg, IDC_QUICKFORMAT, TRUE);
+ if (AskWarnYesNo("CONFIRM_SPARSE_FILE", MainDlg) == IDNO)
+ SetCheckBox (hwndDlg, SPARSE_FILE, FALSE);
+ else
+ {
+ /* sparse file require quick format */
+ formatType = FORMAT_TYPE_QUICK;
+ SelectAlgo(GetDlgItem (hCurPage, IDC_FORMAT_TYPE), (int *) &formatType);
+ EnableWindow(GetDlgItem (hCurPage, IDC_FORMAT_TYPE), FALSE);
+ }
+ }
+ else
+ {
+ EnableWindow(GetDlgItem (hCurPage, IDC_FORMAT_TYPE), TRUE);
+ formatType = FORMAT_TYPE_FULL;
+ SelectAlgo(GetDlgItem (hCurPage, IDC_FORMAT_TYPE), (int *) &formatType);
}
return 1;
}
@@ -6032,7 +6096,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
wchar_t tmpszRescueDiskISO [TC_MAX_PATH+1];
- if (!BrowseFiles (hwndDlg, "OPEN_TITLE", tmpszRescueDiskISO, FALSE, TRUE, NULL))
+ if (!BrowseFiles (hwndDlg, "OPEN_TITLE", tmpszRescueDiskISO, FALSE, TRUE))
return 1;
StringCbCopyW (szRescueDiskISO, sizeof(szRescueDiskISO), tmpszRescueDiskISO);
@@ -6177,7 +6241,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (EnableMemoryProtection)
{
/* Protect this process memory from being accessed by non-admin users */
- EnableProcessProtection ();
+ ActivateMemoryProtection ();
}
if (ComServerMode)
@@ -6344,13 +6408,6 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
}
}
- /* Verify that the volume would not be too large for the operating system */
- if (!IsOSAtLeast (WIN_VISTA)
- && nVolumeSize > 2 * BYTES_PER_TB)
- {
- AbortProcess ("VOLUME_TOO_LARGE_FOR_WINXP");
- }
-
if (volumePassword.Length > 0)
{
// Check password length (check also done for outer volume which is not the case in TrueCrypt).
@@ -6376,12 +6433,9 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
else
StringCbCatW (szRescueDiskISO, sizeof(szRescueDiskISO), L"\\VeraCrypt Rescue Disk.iso");
- if (IsOSAtLeast (WIN_VISTA))
- {
- // Availability of in-place encryption (which is pre-selected by default whenever
- // possible) makes partition-hosted volume creation safer.
- bWarnDeviceFormatAdvanced = FALSE;
- }
+ // Availability of in-place encryption (which is pre-selected by default whenever
+ // possible) makes partition-hosted volume creation safer.
+ bWarnDeviceFormatAdvanced = FALSE;
#ifdef _DEBUG
// For faster testing
@@ -6896,7 +6950,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
// Format has been aborted (did not finish)
- EnableWindow (GetDlgItem (hCurPage, IDC_QUICKFORMAT), !(bHiddenVol && !bHiddenVolHost));
+ EnableWindow (GetDlgItem (hCurPage, IDC_FORMAT_TYPE), !(bHiddenVol && !bHiddenVolHost));
EnableWindow (GetDlgItem (hCurPage, SPARSE_FILE), (bSparseFileSwitch) && !(bHiddenVol && !bHiddenVolHost));
EnableWindow (GetDlgItem (hCurPage, IDC_FILESYS), TRUE);
EnableWindow (GetDlgItem (hCurPage, IDC_CLUSTERSIZE), TRUE);
@@ -7158,21 +7212,6 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (AskWarnYesNoString ((wstring (GetString ("SYSDRIVE_NON_STANDARD_PARTITIONS")) + L"\n\n" + GetString ("ASK_ENCRYPT_PARTITION_INSTEAD_OF_DRIVE")).c_str(), MainDlg) == IDYES)
bWholeSysDrive = FALSE;
}
-
- if (!IsOSAtLeast (WIN_VISTA) && bWholeSysDrive)
- {
- if (BootEncObj->SystemDriveContainsExtendedPartition())
- {
- Error ("WDE_UNSUPPORTED_FOR_EXTENDED_PARTITIONS", MainDlg);
-
- if (AskYesNo ("ASK_ENCRYPT_PARTITION_INSTEAD_OF_DRIVE", MainDlg) == IDNO)
- return 1;
-
- bWholeSysDrive = FALSE;
- }
- else
- Warning ("WDE_EXTENDED_PARTITIONS_WARNING", hwndDlg);
- }
}
if (!bWholeSysDrive && BootEncObj->SystemPartitionCoversWholeDrive())
@@ -7230,8 +7269,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (bHiddenOS)
{
- if (IsOSAtLeast (WIN_7)
- && BootEncObj->GetSystemDriveConfiguration().ExtraBootPartitionPresent
+ if (BootEncObj->GetSystemDriveConfiguration().ExtraBootPartitionPresent
&& AskWarnYesNo ("CONFIRM_HIDDEN_OS_EXTRA_BOOT_PARTITION", hwndDlg) == IDNO)
{
TextInfoDialogBox (TC_TBXID_EXTRA_BOOT_PARTITION_REMOVAL_INSTRUCTIONS);
@@ -7600,13 +7638,6 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
}
}
- /* Verify that the volume would not be too large for the operating system */
-
- if (!IsOSAtLeast (WIN_VISTA)
- && nUIVolumeSize * nMultiplier > 2 * BYTES_PER_TB)
- {
- Warning ("VOLUME_TOO_LARGE_FOR_WINXP", hwndDlg);
- }
}
if (bHiddenVol && !bHiddenVolHost) // If it's a hidden volume
@@ -8007,7 +8038,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
// Check that it is not a hidden or legacy volume
- if (MountVolume (hwndDlg, driveNo, szFileName, &volumePassword, hash_algo, volumePim, FALSE, FALSE, FALSE, TRUE, &mountOptions, FALSE, TRUE) < 1)
+ if (MountVolume (hwndDlg, driveNo, szFileName, &volumePassword, hash_algo, volumePim, FALSE, FALSE, TRUE, &mountOptions, FALSE, TRUE) < 1)
{
NormalCursor();
return 1;
@@ -8049,7 +8080,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
mountOptions.UseBackupHeader = TRUE; // This must be TRUE at this point (we won't be using the regular header, which will be lost soon after the decryption process starts)
- if (MountVolume (hwndDlg, driveNo, szFileName, &volumePassword, hash_algo, volumePim, FALSE, FALSE, FALSE, TRUE, &mountOptions, FALSE, TRUE) < 1)
+ if (MountVolume (hwndDlg, driveNo, szFileName, &volumePassword, hash_algo, volumePim, FALSE, FALSE, TRUE, &mountOptions, FALSE, TRUE) < 1)
{
NormalCursor();
return 1;
@@ -8496,7 +8527,10 @@ retryCDDriveCheck:
clusterSize = (int) SendMessage (GetDlgItem (hCurPage, IDC_CLUSTERSIZE), CB_GETITEMDATA,
SendMessage (GetDlgItem (hCurPage, IDC_CLUSTERSIZE), CB_GETCURSEL, 0, 0) , 0);
- quickFormat = IsButtonChecked (GetDlgItem (hCurPage, IDC_QUICKFORMAT));
+ formatType = (int) SendMessage (GetDlgItem (hCurPage, IDC_FORMAT_TYPE), CB_GETITEMDATA,
+ SendMessage (GetDlgItem (hCurPage, IDC_FORMAT_TYPE), CB_GETCURSEL, 0, 0) , 0);
+ quickFormat = (formatType == FORMAT_TYPE_QUICK) || (formatType == FORMAT_TYPE_FAST);
+ fastCreateFile = (formatType == FORMAT_TYPE_FAST);
dynamicFormat = IsButtonChecked (GetDlgItem (hCurPage, SPARSE_FILE));
if (!dynamicFormat && !bDevice && !(bHiddenVol && !bHiddenVolHost) && (nVolumeSize > (ULONGLONG) nAvailableFreeSpace))
@@ -8595,7 +8629,7 @@ retryCDDriveCheck:
EnableWindow (GetDlgItem (hwndDlg, IDC_NEXT), FALSE);
EnableWindow (GetDlgItem (hwndDlg, IDHELP), FALSE);
EnableWindow (GetDlgItem (hwndDlg, IDCANCEL), FALSE);
- EnableWindow (GetDlgItem (hCurPage, IDC_QUICKFORMAT), FALSE);
+ EnableWindow (GetDlgItem (hCurPage, IDC_FORMAT_TYPE), FALSE);
EnableWindow (GetDlgItem (hCurPage, SPARSE_FILE), FALSE);
EnableWindow (GetDlgItem (hCurPage, IDC_CLUSTERSIZE), FALSE);
EnableWindow (GetDlgItem (hCurPage, IDC_FILESYS), FALSE);
@@ -9206,7 +9240,7 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine)
CmdVolumeFilesystem = FILESYS_FAT;
else if (_wcsicmp(szTmp, L"NTFS") == 0)
CmdVolumeFilesystem = FILESYS_NTFS;
- else if (IsOSVersionAtLeast (WIN_VISTA, 1) && _wcsicmp(szTmp, L"EXFAT") == 0)
+ else if (_wcsicmp(szTmp, L"EXFAT") == 0)
CmdVolumeFilesystem = FILESYS_EXFAT;
else if (IsOSVersionAtLeast (WIN_10, 0) && _wcsicmp(szTmp, L"ReFS") == 0)
CmdVolumeFilesystem = FILESYS_REFS;
@@ -9535,7 +9569,7 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine)
case OptionTokenPin:
{
- wchar_t szTmp[SecurityToken::MaxPasswordLength + 1] = {0};
+ wchar_t szTmp[SecurityToken::MaxPasswordLength + 1] = {0}; // TODO Use Token
if (GetArgumentValue (lpszCommandLineArgs, &i, nNoCommandLineArgs, szTmp, ARRAYSIZE (szTmp)) == HAS_ARGUMENT)
{
if (0 == WideCharToMultiByte (CP_UTF8, 0, szTmp, -1, CmdTokenPin, TC_MAX_PATH, nullptr, nullptr))
@@ -9839,7 +9873,7 @@ int MountHiddenVolHost (HWND hwndDlg, wchar_t *volumePath, int *driveNo, Passwor
mountOptions.PartitionInInactiveSysEncScope = FALSE;
mountOptions.UseBackupHeader = FALSE;
- if (MountVolume (hwndDlg, *driveNo, volumePath, password, pkcs5_prf, pim, FALSE, FALSE, FALSE, TRUE, &mountOptions, FALSE, TRUE) < 1)
+ if (MountVolume (hwndDlg, *driveNo, volumePath, password, pkcs5_prf, pim, FALSE, FALSE, TRUE, &mountOptions, FALSE, TRUE) < 1)
{
*driveNo = -3;
return ERR_VOL_MOUNT_FAILED;
@@ -10567,10 +10601,6 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpsz
InitApp (hInstance, lpszCommandLine);
- // Write block size greater than 64 KB causes a performance drop when writing to files on XP/Vista
- if (!IsOSAtLeast (WIN_7))
- FormatWriteBufferSize = 64 * 1024;
-
#if TC_MAX_VOLUME_SECTOR_SIZE > 64 * 1024
#error TC_MAX_VOLUME_SECTOR_SIZE > 64 * 1024
#endif
@@ -10611,7 +10641,6 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpsz
DialogBoxParamW (hInstance, MAKEINTRESOURCEW (IDD_VOL_CREATION_WIZARD_DLG), NULL, (DLGPROC) MainDialogProc,
(LPARAM)lpszCommandLine);
- FinalizeApp ();
return 0;
}
diff --git a/src/LICENSE b/src/LICENSE
index 5fb86039..19d47e25 100644
--- a/src/LICENSE
+++ b/src/LICENSE
@@ -175,7 +175,7 @@ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
END OF TERMS AND CONDITIONS
-Copyright 2013-2022 IDRIX
+Copyright 2013-2023 IDRIX
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/src/License.html b/src/License.html
index ce476eeb..08a4aeae 100644
--- a/src/License.html
+++ b/src/License.html
@@ -163,7 +163,7 @@ The free distribution and use of this software is allowed (with or without chang
This software is provided 'as is' with no explicit or implied warranties in respect of its properties, including, but not limited to, correctness and/or fitness for purpose.<br>
____________________________________________________________<br>
<br>
- Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler.<br>
+ Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler.<br>
<br>
This software is provided 'as-is', without any express or implied warranty. In no event will the author be held liable for any damages arising from the use of this software.<br>
<br>
@@ -177,7 +177,7 @@ Permission is granted to anyone to use this software for any purpose, including
jloup@gzip.org madler@alumni.caltech.edu<br>
____________________________________________________________<br>
<br>
- Copyright (C) 1999-2017 Dieter Baron and Thomas Klausner<br>
+ Copyright (C) 1999-2023 Dieter Baron and Thomas Klausner<br>
<br>
The authors can be contacted at <libzip@nih.at><br>
<br>
@@ -216,5 +216,37 @@ Redistribution and use in source and binary forms, with or without modification,
<br>
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.<br>
____________________________________________________________<br>
+<br>
+Copyright (c) 2013-2019 Stephan Mueller &lt;smueller@chronox.de&gt;<br>
+<br>
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:<br>
+<ol>
+<li>Redistributions of source code must retain the above copyright notice, and the entire permission notice in its entirety, including the disclaimer of warranties.</li>
+<li>Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.</li>
+<li>The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.</li>
+</ol>
+<p>
+ALTERNATIVELY, this product may be distributed under the terms of the GNU General Public License, in which case the provisions of the GPL2 are required INSTEAD OF the above restrictions. (This clause is necessary due to a potential bad interaction between the GPL and the restrictions contained in a BSD-style copyright.)
+</p>
+<p>
+THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+</p>
+____________________________________________________________<br>
+<br>
+Copyright (c) 1999-2023 Igor Pavlov<br>
+<br>
+LZMA SDK is written and placed in the public domain by Igor Pavlov.<br>
+<br>
+Some code in LZMA SDK is based on public domain code from another developers:<br>
+<ol>
+ <li> PPMd var.H (2001): Dmitry Shkarin</li>
+ <li> SHA-256: Wei Dai (Crypto++ library)</li>
+</ol>
+<p>
+ Anyone is free to copy, modify, publish, use, compile, sell, or distribute the <br>
+ original LZMA SDK code, either in source code form or as a compiled binary, for <br>
+ any purpose, commercial or non-commercial, and by any means.
+</p>
+____________________________________________________________<br>
</body>
</html>
diff --git a/src/License.txt b/src/License.txt
index cbdf8128..28b9b94f 100644
--- a/src/License.txt
+++ b/src/License.txt
@@ -679,7 +679,7 @@ warranties in respect of its properties, including, but not
limited to, correctness and/or fitness for purpose.
____________________________________________________________
-Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
+Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -700,7 +700,7 @@ Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
Jean-loup Gailly Mark Adler
jloup@gzip.org madler@alumni.caltech.edu
____________________________________________________________
-Copyright (C) 1999-2017 Dieter Baron and Thomas Klausner
+Copyright (C) 1999-2023 Dieter Baron and Thomas Klausner
The authors can be contacted at <libzip@nih.at>
@@ -770,7 +770,52 @@ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
____________________________________________________________
-LZMA SDK Copyright (C) 1999-2021 Igor Pavlov
+Copyright (c) 2013-2019 Stephan Mueller <smueller@chronox.de>
-Public domain
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, and the entire permission notice in its entirety,
+ including the disclaimer of warranties.
+
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+3. The name of the author may not be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ALTERNATIVELY, this product may be distributed under the terms of
+the GNU General Public License, in which case the provisions of the
+GPL2 are required INSTEAD OF the above restrictions. (This clause is
+necessary due to a potential bad interaction between the GPL and the
+restrictions contained in a BSD-style copyright.)
+
+THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF WHICH
+ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+____________________________________________________________
+Copyright (c) 1999-2023 Igor Pavlov
+
+LZMA SDK is written and placed in the public domain by Igor Pavlov.
+
+Some code in LZMA SDK is based on public domain code from another developers:
+ 1) PPMd var.H (2001): Dmitry Shkarin
+ 2) SHA-256: Wei Dai (Crypto++ library)
+
+Anyone is free to copy, modify, publish, use, compile, sell, or distribute the
+original LZMA SDK code, either in source code form or as a compiled binary, for
+any purpose, commercial or non-commercial, and by any means.
____________________________________________________________
diff --git a/src/Main/Application.cpp b/src/Main/Application.cpp
index cb118bab..c72e2cc6 100644
--- a/src/Main/Application.cpp
+++ b/src/Main/Application.cpp
@@ -82,6 +82,7 @@ namespace VeraCrypt
{
mUserInterface = new GraphicUserInterface;
mUserInterfaceType = UserInterfaceType::Graphic;
+ wxSetEnv("WXSUPPRESS_SIZER_FLAGS_CHECK", "1");
return mUserInterface;
}
#endif
diff --git a/src/Main/CommandLineInterface.cpp b/src/Main/CommandLineInterface.cpp
index 865f69dd..2bbc73ea 100644
--- a/src/Main/CommandLineInterface.cpp
+++ b/src/Main/CommandLineInterface.cpp
@@ -29,7 +29,6 @@ namespace VeraCrypt
ArgPim (-1),
ArgSize (0),
ArgVolumeType (VolumeType::Unknown),
- ArgTrueCryptMode (false),
ArgDisableFileSizeCheck (false),
ArgUseLegacyPassword (false),
#if defined(TC_LINUX ) || defined (TC_FREEBSD)
@@ -56,7 +55,7 @@ namespace VeraCrypt
parser.AddSwitch (L"", L"display-password", _("Display password while typing"));
parser.AddOption (L"", L"encryption", _("Encryption algorithm"));
parser.AddSwitch (L"", L"explore", _("Open explorer window for mounted volume"));
- parser.AddSwitch (L"", L"export-token-keyfile",_("Export keyfile from security token"));
+ parser.AddSwitch (L"", L"export-token-keyfile",_("Export keyfile from token"));
parser.AddOption (L"", L"filesystem", _("Filesystem type"));
parser.AddSwitch (L"f", L"force", _("Force mount/dismount/overwrite"));
#if !defined(TC_WINDOWS) && !defined(TC_MACOSX)
@@ -67,7 +66,9 @@ namespace VeraCrypt
parser.AddSwitch (L"", L"import-token-keyfiles", _("Import keyfiles to security token"));
parser.AddOption (L"k", L"keyfiles", _("Keyfiles"));
parser.AddSwitch (L"l", L"list", _("List mounted volumes"));
- parser.AddSwitch (L"", L"list-token-keyfiles", _("List security token keyfiles"));
+ parser.AddSwitch (L"", L"list-token-keyfiles", _("List token keyfiles"));
+ parser.AddSwitch (L"", L"list-securitytoken-keyfiles", _("List security token keyfiles"));
+ parser.AddSwitch (L"", L"list-emvtoken-keyfiles", _("List EMV token keyfiles"));
parser.AddSwitch (L"", L"load-preferences", _("Load user preferences"));
parser.AddSwitch (L"", L"mount", _("Mount volume interactively"));
parser.AddOption (L"m", L"mount-options", _("VeraCrypt volume mount options"));
@@ -90,7 +91,6 @@ namespace VeraCrypt
parser.AddSwitch (L"", L"quick", _("Enable quick format"));
parser.AddOption (L"", L"size", _("Size in bytes"));
parser.AddOption (L"", L"slot", _("Volume slot number"));
- parser.AddSwitch (L"tc",L"truecrypt", _("Enable TrueCrypt mode. Should be put first to avoid issues."));
parser.AddSwitch (L"", L"test", _("Test internal algorithms"));
parser.AddSwitch (L"t", L"text", _("Use text user interface"));
parser.AddOption (L"", L"token-lib", _("Security token library"));
@@ -219,13 +219,13 @@ namespace VeraCrypt
if (parser.Found (L"export-token-keyfile"))
{
CheckCommandSingle();
- ArgCommand = CommandId::ExportSecurityTokenKeyfile;
+ ArgCommand = CommandId::ExportTokenKeyfile;
}
if (parser.Found (L"import-token-keyfiles"))
{
CheckCommandSingle();
- ArgCommand = CommandId::ImportSecurityTokenKeyfiles;
+ ArgCommand = CommandId::ImportTokenKeyfiles;
}
if (parser.Found (L"list"))
@@ -238,8 +238,18 @@ namespace VeraCrypt
if (parser.Found (L"list-token-keyfiles"))
{
CheckCommandSingle();
- ArgCommand = CommandId::ListSecurityTokenKeyfiles;
+ ArgCommand = CommandId::ListTokenKeyfiles;
}
+ if (parser.Found (L"list-securitytoken-keyfiles"))
+ {
+ CheckCommandSingle();
+ ArgCommand = CommandId::ListSecurityTokenKeyfiles;
+ }
+ if (parser.Found (L"list-emvtoken-keyfiles"))
+ {
+ CheckCommandSingle();
+ ArgCommand = CommandId::ListEMVTokenKeyfiles;
+ }
if (parser.Found (L"mount"))
{
@@ -345,9 +355,8 @@ namespace VeraCrypt
ArgForce = parser.Found (L"force");
- ArgTrueCryptMode = parser.Found (L"truecrypt");
ArgDisableFileSizeCheck = parser.Found (L"no-size-check");
- ArgUseLegacyPassword = parser.Found (L"legacy-password-maxlength") || ArgTrueCryptMode;
+ ArgUseLegacyPassword = parser.Found (L"legacy-password-maxlength");
#if defined(TC_LINUX ) || defined (TC_FREEBSD)
ArgUseDummySudoPassword = parser.Found (L"use-dummy-sudo-password");
#endif
@@ -437,8 +446,6 @@ namespace VeraCrypt
if (ArgNewPim < 0 || ArgNewPim > (ArgMountOptions.PartitionInSystemEncryptionScope? MAX_BOOT_PIM_VALUE: MAX_PIM_VALUE))
throw_err (LangString["PARAMETER_INCORRECT"] + L": " + str);
- else if (ArgNewPim > 0 && ArgTrueCryptMode)
- throw_err (LangString["PIM_NOT_SUPPORTED_FOR_TRUECRYPT_MODE"]);
}
if (parser.Found (L"non-interactive"))
@@ -477,8 +484,6 @@ namespace VeraCrypt
if (ArgPim < 0 || ArgPim > (ArgMountOptions.PartitionInSystemEncryptionScope? MAX_BOOT_PIM_VALUE: MAX_PIM_VALUE))
throw_err (LangString["PARAMETER_INCORRECT"] + L": " + str);
- else if (ArgPim > 0 && ArgTrueCryptMode)
- throw_err (LangString["PIM_NOT_SUPPORTED_FOR_TRUECRYPT_MODE"]);
}
if (parser.Found (L"protect-hidden", &str))
@@ -533,7 +538,7 @@ namespace VeraCrypt
if (hashName.IsSameAs (str, false) || hashAltName.IsSameAs (str, false))
{
bHashFound = true;
- ArgMountOptions.ProtectionKdf = Pkcs5Kdf::GetAlgorithm (*hash, ArgTrueCryptMode);
+ ArgMountOptions.ProtectionKdf = Pkcs5Kdf::GetAlgorithm (*hash);
}
}
diff --git a/src/Main/CommandLineInterface.h b/src/Main/CommandLineInterface.h
index 23693330..4003dc05 100644
--- a/src/Main/CommandLineInterface.h
+++ b/src/Main/CommandLineInterface.h
@@ -39,10 +39,12 @@ namespace VeraCrypt
DismountVolumes,
DisplayVersion,
DisplayVolumeProperties,
- ExportSecurityTokenKeyfile,
+ ExportTokenKeyfile,
Help,
- ImportSecurityTokenKeyfiles,
- ListSecurityTokenKeyfiles,
+ ImportTokenKeyfiles,
+ ListTokenKeyfiles,
+ ListSecurityTokenKeyfiles,
+ ListEMVTokenKeyfiles,
ListVolumes,
MountVolume,
RestoreHeaders,
@@ -81,7 +83,6 @@ namespace VeraCrypt
shared_ptr <VolumePath> ArgVolumePath;
VolumeInfoList ArgVolumes;
VolumeType::Enum ArgVolumeType;
- bool ArgTrueCryptMode;
shared_ptr<SecureBuffer> ArgTokenPin;
bool ArgDisableFileSizeCheck;
bool ArgUseLegacyPassword;
diff --git a/src/Main/Forms/AboutDialog.cpp b/src/Main/Forms/AboutDialog.cpp
index ba341dd2..e3768361 100644
--- a/src/Main/Forms/AboutDialog.cpp
+++ b/src/Main/Forms/AboutDialog.cpp
@@ -57,20 +57,20 @@ namespace VeraCrypt
L"Paulo Barreto, Brian Gladman, Wei Dai, Peter Gutmann, and many others.\n\n"
L"Portions of this software:\n"
- L"Copyright \xA9 2013-2022 IDRIX. All rights reserved.\n"
+ L"Copyright \xA9 2013-2023 IDRIX. All rights reserved.\n"
L"Copyright \xA9 2003-2012 TrueCrypt Developers Association. All Rights Reserved.\n"
L"Copyright \xA9 1998-2000 Paul Le Roux. All Rights Reserved.\n"
L"Copyright \xA9 1998-2008 Brian Gladman. All Rights Reserved.\n"
- L"Copyright \xA9 1995-2017 Jean-loup Gailly and Mark Adler.\n"
+ L"Copyright \xA9 1995-2023 Jean-loup Gailly and Mark Adler.\n"
L"Copyright \xA9 2016 Disk Cryptography Services for EFI (DCS), Alex Kolotnikov.\n"
- L"Copyright \xA9 1999-2017 Dieter Baron and Thomas Klausner.\n"
+ L"Copyright \xA9 1999-2023 Dieter Baron and Thomas Klausner.\n"
L"Copyright \xA9 2013, Alexey Degtyarev. All rights reserved.\n"
L"Copyright \xA9 1999-2016 Jack Lloyd. All rights reserved.\n"
L"Copyright \xA9 2013-2019 Stephan Mueller <smueller@chronox.de>\n"
- L"Copyright \xA9 1999-2021 Igor Pavlov\n\n"
+ L"Copyright \xA9 1999-2023 Igor Pavlov\n\n"
L"\nThis software as a whole:\n"
- L"Copyright \xA9 2013-2022 IDRIX. All rights reserved.\n\n"
+ L"Copyright \xA9 2013-2023 IDRIX. All rights reserved.\n\n"
L"This software uses wxWidgets library, which is copyright \xA9 1998-2011 Julian Smart, Robert Roebling et al.\n\n"
diff --git a/src/Main/Forms/BenchmarkDialog.cpp b/src/Main/Forms/BenchmarkDialog.cpp
index 18712274..47f00610 100644
--- a/src/Main/Forms/BenchmarkDialog.cpp
+++ b/src/Main/Forms/BenchmarkDialog.cpp
@@ -12,6 +12,9 @@
#include "System.h"
#include "Volume/EncryptionModeXTS.h"
+#ifdef WOLFCRYPT_BACKEND
+#include "Volume/EncryptionModeWolfCryptXTS.h"
+#endif
#include "Main/GraphicUserInterface.h"
#include "BenchmarkDialog.h"
@@ -42,10 +45,10 @@ namespace VeraCrypt
BufferSizeChoice->Select (1);
UpdateBenchmarkList ();
-
- wxTextValidator validator (wxFILTER_INCLUDE_CHAR_LIST); // wxFILTER_NUMERIC does not exclude - . , etc.
- const wxChar *valArr[] = { L"0", L"1", L"2", L"3", L"4", L"5", L"6", L"7", L"8", L"9" };
- validator.SetIncludes (wxArrayString (array_capacity (valArr), (const wxChar **) &valArr));
+
+ VolumePimText->SetMinSize (wxSize (Gui->GetCharWidth (VolumePimText) * 15, -1));
+
+ wxTextValidator validator (wxFILTER_DIGITS);
VolumePimText->SetValidator (validator);
Layout();
@@ -209,9 +212,13 @@ namespace VeraCrypt
Buffer key (ea->GetKeySize());
ea->SetKey (key);
-
+ #ifdef WOLFCRYPT_BACKEND
+ shared_ptr <EncryptionMode> xts (new EncryptionModeWolfCryptXTS);
+ ea->SetKeyXTS (key);
+ #else
shared_ptr <EncryptionMode> xts (new EncryptionModeXTS);
- xts->SetKey (key);
+ #endif
+ xts->SetKey (key);
ea->SetMode (xts);
wxLongLong startTime = wxGetLocalTimeMillis();
@@ -273,7 +280,7 @@ namespace VeraCrypt
Buffer salt(64);
const char *tmp_salt = {"\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xAA\xBB\xCC\xDD\xEE\xFF\x01\x23\x45\x67\x89\xAB\xCD\xEF\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xAA\xBB\xCC\xDD\xEE\xFF\x01\x23\x45\x67\x89\xAB\xCD\xEF\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xAA\xBB\xCC\xDD\xEE\xFF"};
unsigned long pim;
- Pkcs5KdfList prfList = Pkcs5Kdf::GetAvailableAlgorithms (false);
+ Pkcs5KdfList prfList = Pkcs5Kdf::GetAvailableAlgorithms ();
VolumePassword password ((const byte*) "passphrase-1234567890", 21);
memcpy (&pim, buffer.Ptr (), sizeof (unsigned long));
diff --git a/src/Main/Forms/ChangePasswordDialog.cpp b/src/Main/Forms/ChangePasswordDialog.cpp
index 585d14a5..397ee693 100644
--- a/src/Main/Forms/ChangePasswordDialog.cpp
+++ b/src/Main/Forms/ChangePasswordDialog.cpp
@@ -35,12 +35,6 @@ namespace VeraCrypt
bool enableNewPassword = false;
bool enableNewKeyfiles = false;
bool enablePkcs5Prf = false;
- bool isTrueCryptFile = false;
-
- if (volumePath && volumePath->HasTrueCryptExtension ())
- {
- isTrueCryptFile = true;
- }
switch (mode)
{
@@ -73,12 +67,11 @@ namespace VeraCrypt
GraphicUserInterface::InstallPasswordEntryCustomKeyboardShortcuts (this);
#endif
- CurrentPasswordPanel = new VolumePasswordPanel (this, NULL, password, false, keyfiles, false, true, true, false, true, true);
+ CurrentPasswordPanel = new VolumePasswordPanel (this, NULL, password, keyfiles, false, true, true, false, true, true);
CurrentPasswordPanel->UpdateEvent.Connect (EventConnector <ChangePasswordDialog> (this, &ChangePasswordDialog::OnPasswordPanelUpdate));
- CurrentPasswordPanel->SetTrueCryptMode (isTrueCryptFile);
CurrentPasswordPanelSizer->Add (CurrentPasswordPanel, 1, wxALL | wxEXPAND);
- NewPasswordPanel = new VolumePasswordPanel (this, NULL, newPassword, true, newKeyfiles, false, enableNewPassword, enableNewKeyfiles, enableNewPassword, enablePkcs5Prf);
+ NewPasswordPanel = new VolumePasswordPanel (this, NULL, newPassword, newKeyfiles, false, enableNewPassword, enableNewKeyfiles, enableNewPassword, enablePkcs5Prf);
NewPasswordPanel->UpdateEvent.Connect (EventConnector <ChangePasswordDialog> (this, &ChangePasswordDialog::OnPasswordPanelUpdate));
NewPasswordPanelSizer->Add (NewPasswordPanel, 1, wxALL | wxEXPAND);
@@ -107,13 +100,7 @@ namespace VeraCrypt
try
{
- bool bUnsupportedKdf = false;
- shared_ptr <Pkcs5Kdf> currentKdf = CurrentPasswordPanel->GetPkcs5Kdf(bUnsupportedKdf);
- if (bUnsupportedKdf)
- {
- Gui->ShowWarning (LangString ["ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE"]);
- return;
- }
+ shared_ptr <Pkcs5Kdf> currentKdf = CurrentPasswordPanel->GetPkcs5Kdf();
int currentPim = CurrentPasswordPanel->GetVolumePim();
if (-1 == currentPim)
{
@@ -182,7 +169,7 @@ namespace VeraCrypt
/* force the display of the random enriching interface */
RandomNumberGenerator::SetEnrichedByUserStatus (false);
- Gui->UserEnrichRandomPool (this, NewPasswordPanel->GetPkcs5Kdf(bUnsupportedKdf) ? NewPasswordPanel->GetPkcs5Kdf(bUnsupportedKdf)->GetHash() : shared_ptr <Hash>());
+ Gui->UserEnrichRandomPool (this, NewPasswordPanel->GetPkcs5Kdf() ? NewPasswordPanel->GetPkcs5Kdf()->GetHash() : shared_ptr <Hash>());
{
#ifdef TC_UNIX
@@ -203,8 +190,8 @@ namespace VeraCrypt
#endif
wxBusyCursor busy;
ChangePasswordThreadRoutine routine(Path, Gui->GetPreferences().DefaultMountOptions.PreserveTimestamps,
- CurrentPasswordPanel->GetPassword(), CurrentPasswordPanel->GetVolumePim(), CurrentPasswordPanel->GetPkcs5Kdf(bUnsupportedKdf), CurrentPasswordPanel->GetTrueCryptMode(),CurrentPasswordPanel->GetKeyfiles(),
- newPassword, newPim, newKeyfiles, NewPasswordPanel->GetPkcs5Kdf(bUnsupportedKdf), NewPasswordPanel->GetHeaderWipeCount());
+ CurrentPasswordPanel->GetPassword(), CurrentPasswordPanel->GetVolumePim(), CurrentPasswordPanel->GetPkcs5Kdf(), CurrentPasswordPanel->GetKeyfiles(),
+ newPassword, newPim, newKeyfiles, NewPasswordPanel->GetPkcs5Kdf(), NewPasswordPanel->GetHeaderWipeCount(), Gui->GetPreferences().EMVSupportEnabled);
Gui->ExecuteWaitThreadRoutine (this, &routine);
}
diff --git a/src/Main/Forms/EncryptionTestDialog.cpp b/src/Main/Forms/EncryptionTestDialog.cpp
index 17184a0e..a85bbc94 100644
--- a/src/Main/Forms/EncryptionTestDialog.cpp
+++ b/src/Main/Forms/EncryptionTestDialog.cpp
@@ -12,6 +12,9 @@
#include "System.h"
#include "Volume/EncryptionModeXTS.h"
+#ifdef WOLFCRYPT_BACKEND
+#include "Volume/EncryptionModeWolfCryptXTS.h"
+#endif
#include "Volume/EncryptionTest.h"
#include "Main/GraphicUserInterface.h"
#include "EncryptionTestDialog.h"
@@ -94,8 +97,13 @@ namespace VeraCrypt
throw StringConversionFailed (SRC_POS);
}
+ #ifdef WOLFCRYPT_BACKEND
+ shared_ptr <EncryptionMode> xts (new EncryptionModeWolfCryptXTS);
+ ea->SetKeyXTS (secondaryKey);
+ #else
shared_ptr <EncryptionMode> xts (new EncryptionModeXTS);
- xts->SetKey (secondaryKey);
+ #endif
+ xts->SetKey (secondaryKey);
ea->SetMode (xts);
Buffer sector (ENCRYPTION_DATA_UNIT_SIZE);
diff --git a/src/Main/Forms/Forms.cpp b/src/Main/Forms/Forms.cpp
index d281febc..9ffad555 100644
--- a/src/Main/Forms/Forms.cpp
+++ b/src/Main/Forms/Forms.cpp
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version Jun 20 2018)
+// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -15,442 +15,456 @@ using namespace VeraCrypt;
MainFrameBase::MainFrameBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( -1,496 ), wxDefaultSize );
-
+
MainMenuBar = new wxMenuBar( 0 );
VolumesMenu = new wxMenu();
wxMenuItem* CreateNewVolumeMenuItem;
CreateNewVolumeMenuItem = new wxMenuItem( VolumesMenu, wxID_ANY, wxString( _("IDM_CREATE_VOLUME") ) , wxEmptyString, wxITEM_NORMAL );
VolumesMenu->Append( CreateNewVolumeMenuItem );
-
+
VolumesMenu->AppendSeparator();
-
+
MountVolumeMenuItem = new wxMenuItem( VolumesMenu, wxID_ANY, wxString( _("IDM_MOUNT_VOLUME") ) , wxEmptyString, wxITEM_NORMAL );
VolumesMenu->Append( MountVolumeMenuItem );
-
+
wxMenuItem* AutoMountDevicesMenuItem;
AutoMountDevicesMenuItem = new wxMenuItem( VolumesMenu, wxID_ANY, wxString( _("IDM_MOUNTALL") ) , wxEmptyString, wxITEM_NORMAL );
VolumesMenu->Append( AutoMountDevicesMenuItem );
-
+
VolumesMenu->AppendSeparator();
-
+
DismountVolumeMenuItem = new wxMenuItem( VolumesMenu, wxID_ANY, wxString( _("IDM_UNMOUNT_VOLUME") ) , wxEmptyString, wxITEM_NORMAL );
VolumesMenu->Append( DismountVolumeMenuItem );
-
+
DismountAllMenuItem = new wxMenuItem( VolumesMenu, wxID_ANY, wxString( _("IDM_UNMOUNTALL") ) , wxEmptyString, wxITEM_NORMAL );
VolumesMenu->Append( DismountAllMenuItem );
-
+
VolumesMenu->AppendSeparator();
-
+
wxMenuItem* ChangePasswordMenuItem;
ChangePasswordMenuItem = new wxMenuItem( VolumesMenu, wxID_ANY, wxString( _("IDM_CHANGE_PASSWORD") ) , wxEmptyString, wxITEM_NORMAL );
VolumesMenu->Append( ChangePasswordMenuItem );
-
+
wxMenuItem* ChangePkcs5PrfMenuItem;
ChangePkcs5PrfMenuItem = new wxMenuItem( VolumesMenu, wxID_ANY, wxString( _("IDM_CHANGE_HEADER_KEY_DERIV_ALGO") ) , wxEmptyString, wxITEM_NORMAL );
VolumesMenu->Append( ChangePkcs5PrfMenuItem );
-
+
wxMenuItem* ChangeKeyfilesMenuItem;
ChangeKeyfilesMenuItem = new wxMenuItem( VolumesMenu, wxID_ANY, wxString( _("IDD_PCDM_ADD_REMOVE_VOL_KEYFILES") ) , wxEmptyString, wxITEM_NORMAL );
VolumesMenu->Append( ChangeKeyfilesMenuItem );
-
+
wxMenuItem* RemoveKeyfilesMenuItem;
RemoveKeyfilesMenuItem = new wxMenuItem( VolumesMenu, wxID_ANY, wxString( _("IDM_REMOVE_ALL_KEYFILES_FROM_VOL") ) , wxEmptyString, wxITEM_NORMAL );
VolumesMenu->Append( RemoveKeyfilesMenuItem );
-
+
VolumesMenu->AppendSeparator();
-
+
VolumePropertiesMenuItem = new wxMenuItem( VolumesMenu, wxID_ANY, wxString( _("IDC_VOLUME_PROPERTIES") ) , wxEmptyString, wxITEM_NORMAL );
VolumesMenu->Append( VolumePropertiesMenuItem );
-
- MainMenuBar->Append( VolumesMenu, _("MENU_VOLUMES") );
-
+
+ MainMenuBar->Append( VolumesMenu, _("MENU_VOLUMES") );
+
FavoritesMenu = new wxMenu();
AddToFavoritesMenuItem = new wxMenuItem( FavoritesMenu, wxID_ANY, wxString( _("IDM_ADD_VOLUME_TO_FAVORITES") ) , wxEmptyString, wxITEM_NORMAL );
FavoritesMenu->Append( AddToFavoritesMenuItem );
-
+
AddAllMountedToFavoritesMenuItem = new wxMenuItem( FavoritesMenu, wxID_ANY, wxString( _("IDM_ADD_ALL_VOLUME_TO_FAVORITES") ) , wxEmptyString, wxITEM_NORMAL );
FavoritesMenu->Append( AddAllMountedToFavoritesMenuItem );
-
+
wxMenuItem* OrganizeFavoritesMenuItem;
OrganizeFavoritesMenuItem = new wxMenuItem( FavoritesMenu, wxID_ANY, wxString( _("IDM_ORGANIZE_FAVORITES") ) , wxEmptyString, wxITEM_NORMAL );
FavoritesMenu->Append( OrganizeFavoritesMenuItem );
-
+
FavoritesMenu->AppendSeparator();
-
+
wxMenuItem* MountAllFavoritesMenuItem;
MountAllFavoritesMenuItem = new wxMenuItem( FavoritesMenu, wxID_ANY, wxString( _("IDM_MOUNT_FAVORITE_VOLUMES") ) , wxEmptyString, wxITEM_NORMAL );
FavoritesMenu->Append( MountAllFavoritesMenuItem );
-
+
FavoritesMenu->AppendSeparator();
-
- MainMenuBar->Append( FavoritesMenu, _("MENU_FAVORITES") );
-
+
+ MainMenuBar->Append( FavoritesMenu, _("MENU_FAVORITES") );
+
ToolsMenu = new wxMenu();
wxMenuItem* BenchmarkMenuItem;
BenchmarkMenuItem = new wxMenuItem( ToolsMenu, wxID_ANY, wxString( _("IDM_BENCHMARK") ) , wxEmptyString, wxITEM_NORMAL );
ToolsMenu->Append( BenchmarkMenuItem );
-
+
wxMenuItem* EncryptionTestMenuItem;
EncryptionTestMenuItem = new wxMenuItem( ToolsMenu, wxID_ANY, wxString( _("IDM_TEST_VECTORS") ) , wxEmptyString, wxITEM_NORMAL );
ToolsMenu->Append( EncryptionTestMenuItem );
-
+
ToolsMenu->AppendSeparator();
-
+
wxMenuItem* VolumeCreationWizardMenuItem;
VolumeCreationWizardMenuItem = new wxMenuItem( ToolsMenu, wxID_ANY, wxString( _("IDM_VOLUME_WIZARD") ) , wxEmptyString, wxITEM_NORMAL );
ToolsMenu->Append( VolumeCreationWizardMenuItem );
-
+
ToolsMenu->AppendSeparator();
-
+
BackupVolumeHeadersMenuItem = new wxMenuItem( ToolsMenu, wxID_ANY, wxString( _("IDM_BACKUP_VOL_HEADER") ) , wxEmptyString, wxITEM_NORMAL );
ToolsMenu->Append( BackupVolumeHeadersMenuItem );
-
+
RestoreVolumeHeaderMenuItem = new wxMenuItem( ToolsMenu, wxID_ANY, wxString( _("IDM_RESTORE_VOL_HEADER") ) , wxEmptyString, wxITEM_NORMAL );
ToolsMenu->Append( RestoreVolumeHeaderMenuItem );
-
+
ToolsMenu->AppendSeparator();
-
+
wxMenuItem* CreateKeyfileMenuItem;
CreateKeyfileMenuItem = new wxMenuItem( ToolsMenu, wxID_ANY, wxString( _("IDM_KEYFILE_GENERATOR") ) , wxEmptyString, wxITEM_NORMAL );
ToolsMenu->Append( CreateKeyfileMenuItem );
-
+
wxMenuItem* ManageSecurityTokenKeyfilesMenuItem;
ManageSecurityTokenKeyfilesMenuItem = new wxMenuItem( ToolsMenu, wxID_ANY, wxString( _("IDM_MANAGE_TOKEN_KEYFILES") ) , wxEmptyString, wxITEM_NORMAL );
ToolsMenu->Append( ManageSecurityTokenKeyfilesMenuItem );
-
+
wxMenuItem* CloseAllSecurityTokenSessionsMenuItem;
CloseAllSecurityTokenSessionsMenuItem = new wxMenuItem( ToolsMenu, wxID_ANY, wxString( _("IDM_CLOSE_ALL_TOKEN_SESSIONS") ) , wxEmptyString, wxITEM_NORMAL );
ToolsMenu->Append( CloseAllSecurityTokenSessionsMenuItem );
-
+
ToolsMenu->AppendSeparator();
-
+
WipeCachedPasswordsMenuItem = new wxMenuItem( ToolsMenu, wxID_ANY, wxString( _("IDM_WIPE_CACHE") ) , wxEmptyString, wxITEM_NORMAL );
ToolsMenu->Append( WipeCachedPasswordsMenuItem );
-
- MainMenuBar->Append( ToolsMenu, _("MENU_TOOLS") );
-
+
+ MainMenuBar->Append( ToolsMenu, _("MENU_TOOLS") );
+
SettingsMenu = new wxMenu();
+ wxMenuItem* LanguageMenuItem;
+ LanguageMenuItem = new wxMenuItem( SettingsMenu, wxID_ANY, wxString( _("IDM_LANGUAGE") ) , wxEmptyString, wxITEM_NORMAL );
+ SettingsMenu->Append( LanguageMenuItem );
+
HotkeysMenuItem = new wxMenuItem( SettingsMenu, wxID_ANY, wxString( _("IDM_HOTKEY_SETTINGS") ) , wxEmptyString, wxITEM_NORMAL );
SettingsMenu->Append( HotkeysMenuItem );
-
+
wxMenuItem* DefaultKeyfilesMenuItem;
DefaultKeyfilesMenuItem = new wxMenuItem( SettingsMenu, wxID_ANY, wxString( _("IDM_DEFAULT_KEYFILES") ) , wxEmptyString, wxITEM_NORMAL );
SettingsMenu->Append( DefaultKeyfilesMenuItem );
-
+
wxMenuItem* DefaultMountParametersMenuItem;
DefaultMountParametersMenuItem = new wxMenuItem( SettingsMenu, wxID_ANY, wxString( _("IDM_DEFAULT_MOUNT_PARAMETERS") ) , wxEmptyString, wxITEM_NORMAL );
SettingsMenu->Append( DefaultMountParametersMenuItem );
-
+
wxMenuItem* SecurityTokenPreferencesMenuItem;
SecurityTokenPreferencesMenuItem = new wxMenuItem( SettingsMenu, wxID_ANY, wxString( _("IDM_TOKEN_PREFERENCES") ) , wxEmptyString, wxITEM_NORMAL );
SettingsMenu->Append( SecurityTokenPreferencesMenuItem );
-
+
SettingsMenu->AppendSeparator();
-
+
PreferencesMenuItem = new wxMenuItem( SettingsMenu, wxID_PREFERENCES, wxString( _("IDM_PREFERENCES") ) , wxEmptyString, wxITEM_NORMAL );
SettingsMenu->Append( PreferencesMenuItem );
-
- MainMenuBar->Append( SettingsMenu, _("MENU_SETTINGS") );
-
+
+ MainMenuBar->Append( SettingsMenu, _("MENU_SETTINGS") );
+
HelpMenu = new wxMenu();
wxMenuItem* UserGuideMenuItem;
UserGuideMenuItem = new wxMenuItem( HelpMenu, wxID_HELP, wxString( _("IDM_HELP") ) , wxEmptyString, wxITEM_NORMAL );
HelpMenu->Append( UserGuideMenuItem );
-
+
wxMenuItem* OnlineHelpMenuItem;
OnlineHelpMenuItem = new wxMenuItem( HelpMenu, wxID_ANY, wxString( _("IDM_ONLINE_HELP") ) , wxEmptyString, wxITEM_NORMAL );
HelpMenu->Append( OnlineHelpMenuItem );
-
+
wxMenuItem* BeginnersTutorialMenuItem;
BeginnersTutorialMenuItem = new wxMenuItem( HelpMenu, wxID_ANY, wxString( _("IDM_ONLINE_TUTORIAL") ) , wxEmptyString, wxITEM_NORMAL );
HelpMenu->Append( BeginnersTutorialMenuItem );
-
+
wxMenuItem* FaqMenuItem;
FaqMenuItem = new wxMenuItem( HelpMenu, wxID_ANY, wxString( _("IDM_FAQ") ) , wxEmptyString, wxITEM_NORMAL );
HelpMenu->Append( FaqMenuItem );
-
+
HelpMenu->AppendSeparator();
-
+
wxMenuItem* WebsiteMenuItem;
WebsiteMenuItem = new wxMenuItem( HelpMenu, wxID_ANY, wxString( _("IDM_WEBSITE") ) , wxEmptyString, wxITEM_NORMAL );
HelpMenu->Append( WebsiteMenuItem );
-
+
wxMenuItem* DownloadsMenuItem;
DownloadsMenuItem = new wxMenuItem( HelpMenu, wxID_ANY, wxString( _("IDM_TC_DOWNLOADS") ) , wxEmptyString, wxITEM_NORMAL );
HelpMenu->Append( DownloadsMenuItem );
-
+
wxMenuItem* NewsMenuItem;
NewsMenuItem = new wxMenuItem( HelpMenu, wxID_ANY, wxString( _("IDM_NEWS") ) , wxEmptyString, wxITEM_NORMAL );
HelpMenu->Append( NewsMenuItem );
-
+
wxMenuItem* VersionHistoryMenuItem;
VersionHistoryMenuItem = new wxMenuItem( HelpMenu, wxID_ANY, wxString( _("IDM_VERSION_HISTORY") ) , wxEmptyString, wxITEM_NORMAL );
HelpMenu->Append( VersionHistoryMenuItem );
-
+
HelpMenu->AppendSeparator();
-
+
wxMenuItem* DonateMenuItem;
DonateMenuItem = new wxMenuItem( HelpMenu, wxID_ANY, wxString( _("IDM_DONATE") ) , wxEmptyString, wxITEM_NORMAL );
HelpMenu->Append( DonateMenuItem );
-
+
wxMenuItem* ContactMenuItem;
ContactMenuItem = new wxMenuItem( HelpMenu, wxID_ANY, wxString( _("IDM_CONTACT") ) , wxEmptyString, wxITEM_NORMAL );
HelpMenu->Append( ContactMenuItem );
-
+
wxMenuItem* LegalNoticesMenuItem;
LegalNoticesMenuItem = new wxMenuItem( HelpMenu, wxID_ANY, wxString( _("IDM_LICENSE") ) , wxEmptyString, wxITEM_NORMAL );
HelpMenu->Append( LegalNoticesMenuItem );
-
+
wxMenuItem* AboutMenuItem;
AboutMenuItem = new wxMenuItem( HelpMenu, wxID_ABOUT, wxString( _("ABOUTBOX") ) , wxEmptyString, wxITEM_NORMAL );
HelpMenu->Append( AboutMenuItem );
-
- MainMenuBar->Append( HelpMenu, _("MENU_HELP") );
-
+
+ MainMenuBar->Append( HelpMenu, _("MENU_HELP") );
+
this->SetMenuBar( MainMenuBar );
-
+
wxBoxSizer* bSizer1;
bSizer1 = new wxBoxSizer( wxVERTICAL );
-
+
MainPanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer2;
bSizer2 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer48;
bSizer48 = new wxBoxSizer( wxVERTICAL );
-
+
wxStaticBoxSizer* sbSizer1;
sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( MainPanel, wxID_ANY, wxEmptyString ), wxVERTICAL );
-
- SlotListCtrl = new wxListCtrl( sbSizer1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES|wxSUNKEN_BORDER );
+
+ SlotListCtrl = new wxListCtrl( sbSizer1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES|wxBORDER_SUNKEN );
sbSizer1->Add( SlotListCtrl, 1, wxALL|wxEXPAND, 5 );
-
-
+
+
bSizer48->Add( sbSizer1, 1, wxEXPAND, 5 );
-
+
LowStaticBoxSizer = new wxStaticBoxSizer( new wxStaticBox( MainPanel, wxID_ANY, wxEmptyString ), wxVERTICAL );
-
+
HigherButtonSizer = new wxBoxSizer( wxVERTICAL );
-
-
+
+
LowStaticBoxSizer->Add( HigherButtonSizer, 0, wxEXPAND|wxTOP, 2 );
-
+
wxGridSizer* gSizer1;
gSizer1 = new wxGridSizer( 1, 3, 0, 0 );
-
+
wxBoxSizer* bSizer17;
bSizer17 = new wxBoxSizer( wxVERTICAL );
-
- bSizer17->SetMinSize( wxSize( 138,34 ) );
+
+ bSizer17->SetMinSize( wxSize( 138,34 ) );
CreateVolumeButton = new wxButton( LowStaticBoxSizer->GetStaticBox(), wxID_ANY, _("IDC_CREATE_VOLUME"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer17->Add( CreateVolumeButton, 1, wxALL|wxEXPAND, 5 );
-
-
+
+
gSizer1->Add( bSizer17, 0, 0, 5 );
-
+
wxBoxSizer* bSizer18;
bSizer18 = new wxBoxSizer( wxVERTICAL );
-
- bSizer18->SetMinSize( wxSize( 138,34 ) );
+
+ bSizer18->SetMinSize( wxSize( 138,34 ) );
VolumePropertiesButton = new wxButton( LowStaticBoxSizer->GetStaticBox(), wxID_ANY, _("IDC_VOLUME_PROPERTIES"), wxDefaultPosition, wxDefaultSize, 0 );
- bSizer18->Add( VolumePropertiesButton, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
-
-
+ bSizer18->Add( VolumePropertiesButton, 1, wxALL|wxEXPAND, 5 );
+
+
gSizer1->Add( bSizer18, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
-
+
wxBoxSizer* bSizer19;
bSizer19 = new wxBoxSizer( wxVERTICAL );
-
- bSizer19->SetMinSize( wxSize( 138,34 ) );
+
+ bSizer19->SetMinSize( wxSize( 138,34 ) );
WipeCacheButton = new wxButton( LowStaticBoxSizer->GetStaticBox(), wxID_ANY, _("HK_WIPE_CACHE"), wxDefaultPosition, wxDefaultSize, 0 );
- bSizer19->Add( WipeCacheButton, 1, wxALL|wxALIGN_RIGHT|wxEXPAND, 5 );
-
-
+ bSizer19->Add( WipeCacheButton, 1, wxALL|wxEXPAND, 5 );
+
+
gSizer1->Add( bSizer19, 0, wxALIGN_RIGHT, 5 );
-
-
+
+
LowStaticBoxSizer->Add( gSizer1, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
-
-
+
+
LowStaticBoxSizer->Add( 0, 0, 0, 0, 5 );
-
+
VolumeStaticBoxSizer = new wxStaticBoxSizer( new wxStaticBox( LowStaticBoxSizer->GetStaticBox(), wxID_ANY, _("IDT_VOLUME") ), wxVERTICAL );
-
+
VolumeGridBagSizer = new wxGridBagSizer( 0, 0 );
VolumeGridBagSizer->SetFlexibleDirection( wxBOTH );
VolumeGridBagSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
-
- LogoBitmap = new wxStaticBitmap( VolumeStaticBoxSizer->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER );
+
+ LogoBitmap = new wxStaticBitmap( VolumeStaticBoxSizer->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN );
LogoBitmap->SetMinSize( wxSize( 42,52 ) );
-
+
VolumeGridBagSizer->Add( LogoBitmap, wxGBPosition( 0, 0 ), wxGBSpan( 2, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
-
- VolumePathComboBox = new wxComboBox( VolumeStaticBoxSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN );
+
+ VolumePathComboBox = new wxComboBox( VolumeStaticBoxSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN );
VolumeGridBagSizer->Add( VolumePathComboBox, wxGBPosition( 0, 1 ), wxGBSpan( 1, 2 ), wxEXPAND|wxALL, 5 );
-
+
wxBoxSizer* bSizer191;
bSizer191 = new wxBoxSizer( wxVERTICAL );
-
- bSizer191->SetMinSize( wxSize( 138,34 ) );
+
+ bSizer191->SetMinSize( wxSize( 138,34 ) );
SelectFileButton = new wxButton( VolumeStaticBoxSizer->GetStaticBox(), wxID_ANY, _("IDC_SELECT_FILE"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer191->Add( SelectFileButton, 1, wxALL|wxEXPAND, 5 );
-
-
+
+
VolumeGridBagSizer->Add( bSizer191, wxGBPosition( 0, 3 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
-
+
NoHistoryCheckBox = new wxCheckBox( VolumeStaticBoxSizer->GetStaticBox(), wxID_ANY, _("IDC_NO_HISTORY"), wxDefaultPosition, wxDefaultSize, 0 );
VolumeGridBagSizer->Add( NoHistoryCheckBox, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxRIGHT|wxLEFT, 5 );
-
+
wxBoxSizer* bSizer20;
bSizer20 = new wxBoxSizer( wxVERTICAL );
-
- bSizer20->SetMinSize( wxSize( 138,34 ) );
+
+ bSizer20->SetMinSize( wxSize( 138,34 ) );
VolumeToolsButton = new wxButton( VolumeStaticBoxSizer->GetStaticBox(), wxID_ANY, _("IDC_VOLUME_TOOLS"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer20->Add( VolumeToolsButton, 1, wxALL|wxEXPAND, 5 );
-
-
+
+
VolumeGridBagSizer->Add( bSizer20, wxGBPosition( 1, 2 ), wxGBSpan( 1, 1 ), wxALIGN_RIGHT, 5 );
-
+
wxBoxSizer* bSizer21;
bSizer21 = new wxBoxSizer( wxVERTICAL );
-
- bSizer21->SetMinSize( wxSize( 138,34 ) );
+
+ bSizer21->SetMinSize( wxSize( 138,34 ) );
SelectDeviceButton = new wxButton( VolumeStaticBoxSizer->GetStaticBox(), wxID_ANY, _("IDC_SELECT_DEVICE"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer21->Add( SelectDeviceButton, 1, wxEXPAND|wxALL, 5 );
-
-
+
+
VolumeGridBagSizer->Add( bSizer21, wxGBPosition( 1, 3 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
-
-
+
+
VolumeGridBagSizer->AddGrowableCol( 1 );
VolumeGridBagSizer->AddGrowableRow( 0 );
-
+
VolumeStaticBoxSizer->Add( VolumeGridBagSizer, 1, wxEXPAND|wxALL, 4 );
-
-
+
+
LowStaticBoxSizer->Add( VolumeStaticBoxSizer, 1, wxEXPAND|wxALL, 5 );
-
-
+
+
LowStaticBoxSizer->Add( 0, 0, 0, 0, 5 );
-
+
wxGridSizer* gSizer2;
gSizer2 = new wxGridSizer( 1, 4, 0, 0 );
-
+
wxStaticBoxSizer* sbSizer4;
sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( LowStaticBoxSizer->GetStaticBox(), wxID_ANY, wxEmptyString ), wxVERTICAL );
-
- sbSizer4->SetMinSize( wxSize( 139,-1 ) );
+
+ sbSizer4->SetMinSize( wxSize( 139,-1 ) );
VolumeButton = new wxButton( sbSizer4->GetStaticBox(), wxID_ANY, _("MOUNT_BUTTON"), wxDefaultPosition, wxDefaultSize, 0 );
+
VolumeButton->SetDefault();
-
VolumeButton->SetMinSize( wxSize( -1,32 ) );
-
- sbSizer4->Add( VolumeButton, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxALL, 2 );
-
-
+
+ sbSizer4->Add( VolumeButton, 1, wxEXPAND|wxALL, 2 );
+
+
gSizer2->Add( sbSizer4, 1, wxEXPAND, 0 );
-
+
wxStaticBoxSizer* sbSizer41;
sbSizer41 = new wxStaticBoxSizer( new wxStaticBox( LowStaticBoxSizer->GetStaticBox(), wxID_ANY, wxEmptyString ), wxVERTICAL );
-
- sbSizer41->SetMinSize( wxSize( 139,-1 ) );
+
+ sbSizer41->SetMinSize( wxSize( 139,-1 ) );
MountAllDevicesButton = new wxButton( sbSizer41->GetStaticBox(), wxID_ANY, _("IDC_MOUNTALL"), wxDefaultPosition, wxDefaultSize, 0 );
MountAllDevicesButton->SetMinSize( wxSize( -1,32 ) );
-
- sbSizer41->Add( MountAllDevicesButton, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxALL, 2 );
-
-
+
+ sbSizer41->Add( MountAllDevicesButton, 1, wxEXPAND|wxALL, 2 );
+
+
gSizer2->Add( sbSizer41, 1, wxEXPAND, 5 );
-
+
wxStaticBoxSizer* sbSizer42;
sbSizer42 = new wxStaticBoxSizer( new wxStaticBox( LowStaticBoxSizer->GetStaticBox(), wxID_ANY, wxEmptyString ), wxVERTICAL );
-
- sbSizer42->SetMinSize( wxSize( 139,-1 ) );
+
+ sbSizer42->SetMinSize( wxSize( 139,-1 ) );
DismountAllButton = new wxButton( sbSizer42->GetStaticBox(), wxID_ANY, _("IDC_UNMOUNTALL"), wxDefaultPosition, wxDefaultSize, 0 );
DismountAllButton->SetMinSize( wxSize( -1,32 ) );
-
- sbSizer42->Add( DismountAllButton, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxALL, 2 );
-
-
+
+ sbSizer42->Add( DismountAllButton, 1, wxEXPAND|wxALL, 2 );
+
+
gSizer2->Add( sbSizer42, 1, wxEXPAND, 5 );
-
+
wxStaticBoxSizer* sbSizer43;
sbSizer43 = new wxStaticBoxSizer( new wxStaticBox( LowStaticBoxSizer->GetStaticBox(), wxID_ANY, wxEmptyString ), wxVERTICAL );
-
- sbSizer43->SetMinSize( wxSize( 139,-1 ) );
+
+ sbSizer43->SetMinSize( wxSize( 139,-1 ) );
ExitButton = new wxButton( sbSizer43->GetStaticBox(), wxID_ANY, _("IDC_EXIT"), wxDefaultPosition, wxDefaultSize, 0 );
ExitButton->SetMinSize( wxSize( -1,32 ) );
-
- sbSizer43->Add( ExitButton, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxALL, 2 );
-
-
+
+ sbSizer43->Add( ExitButton, 1, wxEXPAND|wxALL, 2 );
+
+
gSizer2->Add( sbSizer43, 1, wxEXPAND, 5 );
-
-
+
+
LowStaticBoxSizer->Add( gSizer2, 0, wxEXPAND|wxALL, 5 );
-
-
+
+
bSizer48->Add( LowStaticBoxSizer, 0, wxEXPAND, 5 );
-
-
+
+
bSizer2->Add( bSizer48, 1, wxEXPAND, 5 );
-
-
+
+
MainPanel->SetSizer( bSizer2 );
MainPanel->Layout();
bSizer2->Fit( MainPanel );
bSizer1->Add( MainPanel, 1, wxEXPAND, 0 );
-
-
+
+
this->SetSizer( bSizer1 );
this->Layout();
bSizer1->Fit( this );
-
+
this->Centre( wxBOTH );
-
+
// Connect Events
this->Connect( wxEVT_ACTIVATE, wxActivateEventHandler( MainFrameBase::OnActivate ) );
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainFrameBase::OnClose ) );
- this->Connect( CreateNewVolumeMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnCreateVolumeButtonClick ) );
- this->Connect( MountVolumeMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnMountVolumeMenuItemSelected ) );
- this->Connect( AutoMountDevicesMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnMountAllDevicesButtonClick ) );
- this->Connect( DismountVolumeMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnDismountVolumeMenuItemSelected ) );
- this->Connect( DismountAllMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnDismountAllButtonClick ) );
- this->Connect( ChangePasswordMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnChangePasswordMenuItemSelected ) );
- this->Connect( ChangePkcs5PrfMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnChangePkcs5PrfMenuItemSelected ) );
- this->Connect( ChangeKeyfilesMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnChangeKeyfilesMenuItemSelected ) );
- this->Connect( RemoveKeyfilesMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnRemoveKeyfilesMenuItemSelected ) );
- this->Connect( VolumePropertiesMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnVolumePropertiesButtonClick ) );
- this->Connect( AddToFavoritesMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnAddToFavoritesMenuItemSelected ) );
- this->Connect( AddAllMountedToFavoritesMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnAddAllMountedToFavoritesMenuItemSelected ) );
- this->Connect( OrganizeFavoritesMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnOrganizeFavoritesMenuItemSelected ) );
- this->Connect( MountAllFavoritesMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnMountAllFavoritesMenuItemSelected ) );
- this->Connect( BenchmarkMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnBenchmarkMenuItemSelected ) );
- this->Connect( EncryptionTestMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnEncryptionTestMenuItemSelected ) );
- this->Connect( VolumeCreationWizardMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnCreateVolumeButtonClick ) );
- this->Connect( BackupVolumeHeadersMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnBackupVolumeHeadersMenuItemSelected ) );
- this->Connect( RestoreVolumeHeaderMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnRestoreVolumeHeaderMenuItemSelected ) );
- this->Connect( CreateKeyfileMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnCreateKeyfileMenuItemSelected ) );
- this->Connect( ManageSecurityTokenKeyfilesMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnManageSecurityTokenKeyfilesMenuItemSelected ) );
- this->Connect( CloseAllSecurityTokenSessionsMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnCloseAllSecurityTokenSessionsMenuItemSelected ) );
- this->Connect( WipeCachedPasswordsMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnWipeCacheButtonClick ) );
- this->Connect( HotkeysMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnHotkeysMenuItemSelected ) );
- this->Connect( DefaultKeyfilesMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnDefaultKeyfilesMenuItemSelected ) );
- this->Connect( DefaultMountParametersMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnDefaultMountParametersMenuItemSelected ) );
- this->Connect( SecurityTokenPreferencesMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnSecurityTokenPreferencesMenuItemSelected ) );
+ VolumesMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnCreateVolumeButtonClick ), this, CreateNewVolumeMenuItem->GetId());
+ VolumesMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnMountVolumeMenuItemSelected ), this, MountVolumeMenuItem->GetId());
+ VolumesMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnMountAllDevicesButtonClick ), this, AutoMountDevicesMenuItem->GetId());
+ VolumesMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnDismountVolumeMenuItemSelected ), this, DismountVolumeMenuItem->GetId());
+ VolumesMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnDismountAllButtonClick ), this, DismountAllMenuItem->GetId());
+ VolumesMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnChangePasswordMenuItemSelected ), this, ChangePasswordMenuItem->GetId());
+ VolumesMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnChangePkcs5PrfMenuItemSelected ), this, ChangePkcs5PrfMenuItem->GetId());
+ VolumesMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnChangeKeyfilesMenuItemSelected ), this, ChangeKeyfilesMenuItem->GetId());
+ VolumesMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnRemoveKeyfilesMenuItemSelected ), this, RemoveKeyfilesMenuItem->GetId());
+ VolumesMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnVolumePropertiesButtonClick ), this, VolumePropertiesMenuItem->GetId());
+ FavoritesMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnAddToFavoritesMenuItemSelected ), this, AddToFavoritesMenuItem->GetId());
+ FavoritesMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnAddAllMountedToFavoritesMenuItemSelected ), this, AddAllMountedToFavoritesMenuItem->GetId());
+ FavoritesMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnOrganizeFavoritesMenuItemSelected ), this, OrganizeFavoritesMenuItem->GetId());
+ FavoritesMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnMountAllFavoritesMenuItemSelected ), this, MountAllFavoritesMenuItem->GetId());
+ ToolsMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnBenchmarkMenuItemSelected ), this, BenchmarkMenuItem->GetId());
+ ToolsMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnEncryptionTestMenuItemSelected ), this, EncryptionTestMenuItem->GetId());
+ ToolsMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnCreateVolumeButtonClick ), this, VolumeCreationWizardMenuItem->GetId());
+ ToolsMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnBackupVolumeHeadersMenuItemSelected ), this, BackupVolumeHeadersMenuItem->GetId());
+ ToolsMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnRestoreVolumeHeaderMenuItemSelected ), this, RestoreVolumeHeaderMenuItem->GetId());
+ ToolsMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnCreateKeyfileMenuItemSelected ), this, CreateKeyfileMenuItem->GetId());
+ ToolsMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnManageSecurityTokenKeyfilesMenuItemSelected ), this, ManageSecurityTokenKeyfilesMenuItem->GetId());
+ ToolsMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnCloseAllSecurityTokenSessionsMenuItemSelected ), this, CloseAllSecurityTokenSessionsMenuItem->GetId());
+ ToolsMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnWipeCacheButtonClick ), this, WipeCachedPasswordsMenuItem->GetId());
+ SettingsMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnLanguageMenuItemSelected ), this, LanguageMenuItem->GetId());
+ SettingsMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnHotkeysMenuItemSelected ), this, HotkeysMenuItem->GetId());
+ SettingsMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnDefaultKeyfilesMenuItemSelected ), this, DefaultKeyfilesMenuItem->GetId());
+ SettingsMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnDefaultMountParametersMenuItemSelected ), this, DefaultMountParametersMenuItem->GetId());
+ SettingsMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnSecurityTokenPreferencesMenuItemSelected ), this, SecurityTokenPreferencesMenuItem->GetId());
+#ifdef TC_MACOSX
this->Connect( PreferencesMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnPreferencesMenuItemSelected ) );
this->Connect( UserGuideMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnUserGuideMenuItemSelected ) );
- this->Connect( OnlineHelpMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnOnlineHelpMenuItemSelected ) );
- this->Connect( BeginnersTutorialMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnBeginnersTutorialMenuItemSelected ) );
- this->Connect( FaqMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnFaqMenuItemSelected ) );
- this->Connect( WebsiteMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnWebsiteMenuItemSelected ) );
- this->Connect( DownloadsMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnDownloadsMenuItemSelected ) );
- this->Connect( NewsMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnNewsMenuItemSelected ) );
- this->Connect( VersionHistoryMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnVersionHistoryMenuItemSelected ) );
- this->Connect( DonateMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnDonateMenuItemSelected ) );
- this->Connect( ContactMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnContactMenuItemSelected ) );
- this->Connect( LegalNoticesMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnLegalNoticesMenuItemSelected ) );
+#else
+ SettingsMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnPreferencesMenuItemSelected ), this, PreferencesMenuItem->GetId());
+ HelpMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnUserGuideMenuItemSelected ), this, UserGuideMenuItem->GetId());
+#endif
+ HelpMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnOnlineHelpMenuItemSelected ), this, OnlineHelpMenuItem->GetId());
+ HelpMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnBeginnersTutorialMenuItemSelected ), this, BeginnersTutorialMenuItem->GetId());
+ HelpMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnFaqMenuItemSelected ), this, FaqMenuItem->GetId());
+ HelpMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnWebsiteMenuItemSelected ), this, WebsiteMenuItem->GetId());
+ HelpMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnDownloadsMenuItemSelected ), this, DownloadsMenuItem->GetId());
+ HelpMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnNewsMenuItemSelected ), this, NewsMenuItem->GetId());
+ HelpMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnVersionHistoryMenuItemSelected ), this, VersionHistoryMenuItem->GetId());
+ HelpMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnDonateMenuItemSelected ), this, DonateMenuItem->GetId());
+ HelpMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnContactMenuItemSelected ), this, ContactMenuItem->GetId());
+ HelpMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnLegalNoticesMenuItemSelected ), this, LegalNoticesMenuItem->GetId());
+#ifdef TC_MACOSX
this->Connect( AboutMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnAboutMenuItemSelected ) );
+#else
+ HelpMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnAboutMenuItemSelected ), this, AboutMenuItem->GetId());
+#endif
SlotListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( MainFrameBase::OnListItemActivated ), NULL, this );
SlotListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( MainFrameBase::OnListItemDeselected ), NULL, this );
SlotListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, wxListEventHandler( MainFrameBase::OnListItemRightClick ), NULL, this );
@@ -472,48 +486,13 @@ MainFrameBase::MainFrameBase( wxWindow* parent, wxWindowID id, const wxString& t
MainFrameBase::~MainFrameBase()
{
// Disconnect Events
- this->Disconnect( wxEVT_ACTIVATE, wxActivateEventHandler( MainFrameBase::OnActivate ) );
- this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainFrameBase::OnClose ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnCreateVolumeButtonClick ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnMountVolumeMenuItemSelected ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnMountAllDevicesButtonClick ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnDismountVolumeMenuItemSelected ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnDismountAllButtonClick ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnChangePasswordMenuItemSelected ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnChangePkcs5PrfMenuItemSelected ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnChangeKeyfilesMenuItemSelected ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnRemoveKeyfilesMenuItemSelected ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnVolumePropertiesButtonClick ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnAddToFavoritesMenuItemSelected ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnAddAllMountedToFavoritesMenuItemSelected ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnOrganizeFavoritesMenuItemSelected ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnMountAllFavoritesMenuItemSelected ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnBenchmarkMenuItemSelected ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnEncryptionTestMenuItemSelected ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnCreateVolumeButtonClick ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnBackupVolumeHeadersMenuItemSelected ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnRestoreVolumeHeaderMenuItemSelected ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnCreateKeyfileMenuItemSelected ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnManageSecurityTokenKeyfilesMenuItemSelected ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnCloseAllSecurityTokenSessionsMenuItemSelected ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnWipeCacheButtonClick ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnHotkeysMenuItemSelected ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnDefaultKeyfilesMenuItemSelected ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnDefaultMountParametersMenuItemSelected ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnSecurityTokenPreferencesMenuItemSelected ) );
+#ifdef TC_MACOSX
this->Disconnect( wxID_PREFERENCES, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnPreferencesMenuItemSelected ) );
this->Disconnect( wxID_HELP, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnUserGuideMenuItemSelected ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnOnlineHelpMenuItemSelected ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnBeginnersTutorialMenuItemSelected ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnFaqMenuItemSelected ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnWebsiteMenuItemSelected ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnDownloadsMenuItemSelected ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnNewsMenuItemSelected ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnVersionHistoryMenuItemSelected ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnDonateMenuItemSelected ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnContactMenuItemSelected ) );
- this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnLegalNoticesMenuItemSelected ) );
this->Disconnect( wxID_ABOUT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnAboutMenuItemSelected ) );
+#endif
+ this->Disconnect( wxEVT_ACTIVATE, wxActivateEventHandler( MainFrameBase::OnActivate ) );
+ this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainFrameBase::OnClose ) );
SlotListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( MainFrameBase::OnListItemActivated ), NULL, this );
SlotListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( MainFrameBase::OnListItemDeselected ), NULL, this );
SlotListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, wxListEventHandler( MainFrameBase::OnListItemRightClick ), NULL, this );
@@ -530,98 +509,97 @@ MainFrameBase::~MainFrameBase()
MountAllDevicesButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnMountAllDevicesButtonClick ), NULL, this );
DismountAllButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnDismountAllButtonClick ), NULL, this );
ExitButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnExitButtonClick ), NULL, this );
-
+
}
WizardFrameBase::WizardFrameBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( 800,500 ), wxDefaultSize );
-
+
MainSizer = new wxBoxSizer( wxVERTICAL );
-
+
MainPanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer63;
bSizer63 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer64;
bSizer64 = new wxBoxSizer( wxVERTICAL );
-
+
wxStaticBoxSizer* sbSizer27;
sbSizer27 = new wxStaticBoxSizer( new wxStaticBox( MainPanel, wxID_ANY, wxEmptyString ), wxHORIZONTAL );
-
+
WizardBitmap = new wxStaticBitmap( sbSizer27->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
sbSizer27->Add( WizardBitmap, 0, wxALL|wxEXPAND, 5 );
-
+
wxBoxSizer* bSizer66;
bSizer66 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer126;
bSizer126 = new wxBoxSizer( wxHORIZONTAL );
-
+
PageTitleStaticText = new wxStaticText( sbSizer27->GetStaticBox(), wxID_ANY, _("Page Title"), wxDefaultPosition, wxDefaultSize, 0 );
PageTitleStaticText->Wrap( -1 );
-
PageTitleStaticText->SetFont( wxFont( 16, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("Times New Roman") ) );
-
+
bSizer126->Add( PageTitleStaticText, 0, wxALL, 5 );
-
-
+
+
bSizer66->Add( bSizer126, 0, wxLEFT, 5 );
-
+
PageSizer = new wxBoxSizer( wxVERTICAL );
-
-
+
+
bSizer66->Add( PageSizer, 1, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
-
-
+
+
sbSizer27->Add( bSizer66, 1, wxEXPAND|wxLEFT, 5 );
-
-
+
+
bSizer64->Add( sbSizer27, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
-
+
wxBoxSizer* bSizer70;
bSizer70 = new wxBoxSizer( wxHORIZONTAL );
-
-
+
+
bSizer70->Add( 0, 0, 1, wxEXPAND, 5 );
-
+
HelpButton = new wxButton( MainPanel, wxID_HELP, _("IDHELP"), wxDefaultPosition, wxDefaultSize, 0 );
- bSizer70->Add( HelpButton, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 );
-
-
- bSizer70->Add( 0, 0, 0, wxLEFT|wxALIGN_RIGHT, 5 );
-
+ bSizer70->Add( HelpButton, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
+
+
+ bSizer70->Add( 2, 0, 0, wxLEFT, 5 );
+
PreviousButton = new wxButton( MainPanel, wxID_ANY, _("PREV"), wxDefaultPosition, wxDefaultSize, 0 );
- bSizer70->Add( PreviousButton, 0, wxTOP|wxBOTTOM|wxLEFT|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 );
-
+ bSizer70->Add( PreviousButton, 0, wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
+
NextButton = new wxButton( MainPanel, wxID_ANY, _("NEXT"), wxDefaultPosition, wxDefaultSize, 0|wxWANTS_CHARS );
+
NextButton->SetDefault();
-
- bSizer70->Add( NextButton, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 );
-
-
- bSizer70->Add( 0, 0, 0, wxLEFT|wxALIGN_RIGHT, 5 );
-
+ bSizer70->Add( NextButton, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
+
+
+ bSizer70->Add( 2, 0, 0, wxLEFT, 5 );
+
CancelButton = new wxButton( MainPanel, wxID_CANCEL, _("IDCANCEL"), wxDefaultPosition, wxDefaultSize, 0 );
- bSizer70->Add( CancelButton, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 );
-
-
- bSizer64->Add( bSizer70, 0, wxEXPAND|wxALIGN_RIGHT|wxALL, 5 );
-
-
+ bSizer70->Add( CancelButton, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
+
+
+ bSizer64->Add( bSizer70, 0, wxEXPAND|wxALL, 5 );
+
+
bSizer63->Add( bSizer64, 1, wxEXPAND, 5 );
-
-
+
+
MainPanel->SetSizer( bSizer63 );
MainPanel->Layout();
bSizer63->Fit( MainPanel );
MainSizer->Add( MainPanel, 1, wxEXPAND, 5 );
-
-
+
+
this->SetSizer( MainSizer );
this->Layout();
MainSizer->Fit( this );
-
+
// Connect Events
this->Connect( wxEVT_ACTIVATE, wxActivateEventHandler( WizardFrameBase::OnActivate ) );
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( WizardFrameBase::OnClose ) );
@@ -642,126 +620,124 @@ WizardFrameBase::~WizardFrameBase()
PreviousButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WizardFrameBase::OnPreviousButtonClick ), NULL, this );
NextButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WizardFrameBase::OnNextButtonClick ), NULL, this );
CancelButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WizardFrameBase::OnCancelButtonClick ), NULL, this );
-
+
}
AboutDialogBase::AboutDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
-
+
wxBoxSizer* bSizer116;
bSizer116 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer117;
bSizer117 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer120;
bSizer120 = new wxBoxSizer( wxVERTICAL );
-
- bSizer120->SetMinSize( wxSize( -1,78 ) );
+
+ bSizer120->SetMinSize( wxSize( -1,78 ) );
m_panel14 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_panel14->SetBackgroundColour( wxColour( 10, 108, 206 ) );
-
+
wxBoxSizer* bSizer121;
bSizer121 = new wxBoxSizer( wxVERTICAL );
-
-
+
+
bSizer121->Add( 0, 0, 1, wxEXPAND|wxALL, 5 );
-
+
wxBoxSizer* bSizer122;
bSizer122 = new wxBoxSizer( wxVERTICAL );
-
+
LogoBitmap = new wxStaticBitmap( m_panel14, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
bSizer122->Add( LogoBitmap, 0, wxALL, 10 );
-
-
+
+
bSizer121->Add( bSizer122, 0, wxEXPAND|wxLEFT, 8 );
-
-
+
+
m_panel14->SetSizer( bSizer121 );
m_panel14->Layout();
bSizer121->Fit( m_panel14 );
bSizer120->Add( m_panel14, 1, wxEXPAND, 5 );
-
-
+
+
bSizer117->Add( bSizer120, 0, wxEXPAND, 5 );
-
+
wxBoxSizer* bSizer118;
bSizer118 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer123;
bSizer123 = new wxBoxSizer( wxVERTICAL );
-
+
VersionStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
VersionStaticText->Wrap( -1 );
-
bSizer123->Add( VersionStaticText, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
-
-
+
+
bSizer123->Add( 0, 0, 0, wxTOP, 3 );
-
+
CopyrightStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
CopyrightStaticText->Wrap( -1 );
-
bSizer123->Add( CopyrightStaticText, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
-
-
+
+
bSizer123->Add( 0, 0, 0, wxTOP, 3 );
-
+
WebsiteHyperlink = new wxHyperlinkCtrl( this, wxID_ANY, wxEmptyString, wxT("."), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
-
+
WebsiteHyperlink->SetHoverColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) );
WebsiteHyperlink->SetNormalColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) );
WebsiteHyperlink->SetVisitedColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) );
bSizer123->Add( WebsiteHyperlink, 0, wxALL, 5 );
-
-
+
+
bSizer118->Add( bSizer123, 1, wxEXPAND|wxLEFT, 5 );
-
-
+
+
bSizer117->Add( bSizer118, 1, wxALL|wxEXPAND, 15 );
-
+
m_staticline3 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizer117->Add( m_staticline3, 0, wxEXPAND|wxBOTTOM, 5 );
-
- CreditsTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxSUNKEN_BORDER );
+
+ CreditsTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxBORDER_SUNKEN );
bSizer117->Add( CreditsTextCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 10 );
-
-
+
+
bSizer117->Add( 0, 0, 0, wxTOP, 5 );
-
+
m_staticline4 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizer117->Add( m_staticline4, 0, wxEXPAND|wxTOP|wxBOTTOM, 3 );
-
+
m_staticline5 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizer117->Add( m_staticline5, 0, wxEXPAND|wxBOTTOM, 5 );
-
+
wxBoxSizer* bSizer119;
bSizer119 = new wxBoxSizer( wxHORIZONTAL );
-
-
+
+
bSizer119->Add( 0, 0, 1, wxEXPAND|wxALL, 5 );
-
+
wxButton* OKButton;
OKButton = new wxButton( this, wxID_OK, _("IDOK"), wxDefaultPosition, wxDefaultSize, 0 );
+
OKButton->SetDefault();
-
bSizer119->Add( OKButton, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
-
-
+
+
bSizer119->Add( 0, 0, 0, wxLEFT, 5 );
-
-
+
+
bSizer117->Add( bSizer119, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 6 );
-
-
+
+
bSizer116->Add( bSizer117, 1, wxEXPAND, 5 );
-
-
+
+
this->SetSizer( bSizer116 );
this->Layout();
bSizer116->Fit( this );
-
+
// Connect Events
WebsiteHyperlink->Connect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( AboutDialogBase::OnWebsiteHyperlinkClick ), NULL, this );
}
@@ -770,51 +746,48 @@ AboutDialogBase::~AboutDialogBase()
{
// Disconnect Events
WebsiteHyperlink->Disconnect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( AboutDialogBase::OnWebsiteHyperlinkClick ), NULL, this );
-
+
}
BenchmarkDialogBase::BenchmarkDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
-
+
wxBoxSizer* bSizer153;
bSizer153 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer154;
bSizer154 = new wxBoxSizer( wxVERTICAL );
-
+
wxFlexGridSizer* fgSizer9;
fgSizer9 = new wxFlexGridSizer( 3, 2, 0, 0 );
fgSizer9->AddGrowableCol( 1 );
fgSizer9->SetFlexibleDirection( wxHORIZONTAL );
fgSizer9->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
-
+
m_staticText70 = new wxStaticText( this, wxID_ANY, _("IDT_BENCHMARK"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText70->Wrap( -1 );
-
fgSizer9->Add( m_staticText70, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
-
+
wxString BenchmarkChoiceChoices[] = { _("ENCRYPTION_ALGORITHM"), _("PKCS5_PRF"), _("IDT_HASH_ALGO") };
int BenchmarkChoiceNChoices = sizeof( BenchmarkChoiceChoices ) / sizeof( wxString );
BenchmarkChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, BenchmarkChoiceNChoices, BenchmarkChoiceChoices, 0 );
BenchmarkChoice->SetSelection( 0 );
fgSizer9->Add( BenchmarkChoice, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
-
+
m_bufferSizeLabel = new wxStaticText( this, wxID_ANY, _("IDT_BUFFER_SIZE"), wxDefaultPosition, wxDefaultSize, 0 );
m_bufferSizeLabel->Wrap( -1 );
-
fgSizer9->Add( m_bufferSizeLabel, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
-
+
wxArrayString BufferSizeChoiceChoices;
BufferSizeChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, BufferSizeChoiceChoices, 0 );
BufferSizeChoice->SetSelection( 0 );
fgSizer9->Add( BufferSizeChoice, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
-
+
m_volumePimLabel = new wxStaticText( this, wxID_ANY, _("IDT_PIM"), wxDefaultPosition, wxDefaultSize, 0 );
m_volumePimLabel->Wrap( -1 );
-
fgSizer9->Add( m_volumePimLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
-
+
VolumePimText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
#ifdef __WXGTK__
if ( !VolumePimText->HasFlag( wxTE_MULTILINE ) )
@@ -825,53 +798,52 @@ BenchmarkDialogBase::BenchmarkDialogBase( wxWindow* parent, wxWindowID id, const
VolumePimText->SetMaxLength( 7 );
#endif
fgSizer9->Add( VolumePimText, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
-
-
+
+
bSizer154->Add( fgSizer9, 0, wxEXPAND, 5 );
-
+
wxStaticLine* m_staticline6;
m_staticline6 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizer154->Add( m_staticline6, 0, wxEXPAND | wxALL, 5 );
-
+
wxBoxSizer* bSizer156;
bSizer156 = new wxBoxSizer( wxHORIZONTAL );
-
- BenchmarkListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxSUNKEN_BORDER );
+
+ BenchmarkListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxBORDER_SUNKEN );
bSizer156->Add( BenchmarkListCtrl, 1, wxALL|wxEXPAND, 5 );
-
+
RightSizer = new wxBoxSizer( wxVERTICAL );
-
+
BenchmarkButton = new wxButton( this, wxID_OK, _("IDC_PERFORM_BENCHMARK"), wxDefaultPosition, wxDefaultSize, 0 );
+
BenchmarkButton->SetDefault();
-
RightSizer->Add( BenchmarkButton, 0, wxALL|wxEXPAND, 5 );
-
+
wxButton* CancelButton;
CancelButton = new wxButton( this, wxID_CANCEL, _("IDCLOSE"), wxDefaultPosition, wxDefaultSize, 0 );
RightSizer->Add( CancelButton, 0, wxALL|wxEXPAND, 5 );
-
-
+
+
RightSizer->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
-
+
BenchmarkNoteStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
BenchmarkNoteStaticText->Wrap( -1 );
-
RightSizer->Add( BenchmarkNoteStaticText, 1, wxALL|wxEXPAND, 5 );
-
-
+
+
bSizer156->Add( RightSizer, 0, wxEXPAND, 5 );
-
-
+
+
bSizer154->Add( bSizer156, 1, wxEXPAND, 5 );
-
-
+
+
bSizer153->Add( bSizer154, 1, wxEXPAND|wxALL, 5 );
-
-
+
+
this->SetSizer( bSizer153 );
this->Layout();
bSizer153->Fit( this );
-
+
// Connect Events
BenchmarkChoice->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( BenchmarkDialogBase::OnBenchmarkChoiceSelected ), NULL, this );
BenchmarkButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BenchmarkDialogBase::OnBenchmarkButtonClick ), NULL, this );
@@ -882,68 +854,68 @@ BenchmarkDialogBase::~BenchmarkDialogBase()
// Disconnect Events
BenchmarkChoice->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( BenchmarkDialogBase::OnBenchmarkChoiceSelected ), NULL, this );
BenchmarkButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BenchmarkDialogBase::OnBenchmarkButtonClick ), NULL, this );
-
+
}
ChangePasswordDialogBase::ChangePasswordDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
this->SetExtraStyle( this->GetExtraStyle() | wxWS_EX_VALIDATE_RECURSIVELY );
-
+
wxBoxSizer* bSizer30;
bSizer30 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer31;
bSizer31 = new wxBoxSizer( wxHORIZONTAL );
-
+
wxBoxSizer* bSizer32;
bSizer32 = new wxBoxSizer( wxVERTICAL );
-
+
CurrentSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("IDT_CURRENT") ), wxVERTICAL );
-
+
CurrentPasswordPanelSizer = new wxBoxSizer( wxVERTICAL );
-
-
+
+
CurrentSizer->Add( CurrentPasswordPanelSizer, 0, wxALIGN_LEFT, 5 );
-
-
+
+
bSizer32->Add( CurrentSizer, 0, wxEXPAND, 5 );
-
+
NewSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("IDT_NEW") ), wxVERTICAL );
-
+
NewPasswordPanelSizer = new wxBoxSizer( wxVERTICAL );
-
-
+
+
NewSizer->Add( NewPasswordPanelSizer, 0, wxALIGN_LEFT, 5 );
-
-
+
+
bSizer32->Add( NewSizer, 0, wxTOP|wxEXPAND, 5 );
-
-
+
+
bSizer31->Add( bSizer32, 1, wxEXPAND|wxALL, 5 );
-
+
wxBoxSizer* bSizer33;
bSizer33 = new wxBoxSizer( wxVERTICAL );
-
+
OKButton = new wxButton( this, wxID_OK, _("IDOK"), wxDefaultPosition, wxDefaultSize, 0 );
+
OKButton->SetDefault();
-
bSizer33->Add( OKButton, 0, wxALL|wxEXPAND, 5 );
-
+
CancelButton = new wxButton( this, wxID_CANCEL, _("IDCANCEL"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer33->Add( CancelButton, 0, wxALL|wxEXPAND, 5 );
-
-
+
+
bSizer31->Add( bSizer33, 0, 0, 5 );
-
-
+
+
bSizer30->Add( bSizer31, 1, wxEXPAND|wxALL, 5 );
-
-
+
+
this->SetSizer( bSizer30 );
this->Layout();
bSizer30->Fit( this );
-
+
// Connect Events
OKButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ChangePasswordDialogBase::OnOKButtonClick ), NULL, this );
}
@@ -952,50 +924,50 @@ ChangePasswordDialogBase::~ChangePasswordDialogBase()
{
// Disconnect Events
OKButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ChangePasswordDialogBase::OnOKButtonClick ), NULL, this );
-
+
}
DeviceSelectionDialogBase::DeviceSelectionDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
this->SetExtraStyle( this->GetExtraStyle() | wxWS_EX_VALIDATE_RECURSIVELY );
-
+
wxBoxSizer* bSizer3;
bSizer3 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer4;
bSizer4 = new wxBoxSizer( wxVERTICAL );
-
- DeviceListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES|wxSUNKEN_BORDER );
+
+ DeviceListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES|wxBORDER_SUNKEN );
bSizer4->Add( DeviceListCtrl, 1, wxALL|wxEXPAND, 5 );
-
-
+
+
bSizer3->Add( bSizer4, 1, wxEXPAND|wxALL, 5 );
-
+
wxBoxSizer* bSizer166;
bSizer166 = new wxBoxSizer( wxHORIZONTAL );
-
-
+
+
bSizer166->Add( 0, 0, 1, wxEXPAND, 5 );
-
+
CancelButton = new wxButton( this, wxID_CANCEL, _("IDCANCEL"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer166->Add( CancelButton, 0, wxALL, 5 );
-
+
OKButton = new wxButton( this, wxID_OK, _("IDOK"), wxDefaultPosition, wxDefaultSize, 0 );
+
OKButton->SetDefault();
-
bSizer166->Add( OKButton, 0, wxALL, 5 );
-
-
- bSizer3->Add( bSizer166, 0, wxALIGN_RIGHT|wxALL|wxEXPAND, 5 );
-
-
+
+
+ bSizer3->Add( bSizer166, 0, wxALL|wxEXPAND, 5 );
+
+
this->SetSizer( bSizer3 );
this->Layout();
bSizer3->Fit( this );
-
+
this->Centre( wxBOTH );
-
+
// Connect Events
DeviceListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( DeviceSelectionDialogBase::OnListItemActivated ), NULL, this );
DeviceListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DeviceSelectionDialogBase::OnListItemDeselected ), NULL, this );
@@ -1010,154 +982,148 @@ DeviceSelectionDialogBase::~DeviceSelectionDialogBase()
DeviceListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DeviceSelectionDialogBase::OnListItemDeselected ), NULL, this );
DeviceListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DeviceSelectionDialogBase::OnListItemSelected ), NULL, this );
OKButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DeviceSelectionDialogBase::OnOKButtonClick ), NULL, this );
-
+
}
EncryptionTestDialogBase::EncryptionTestDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
-
+
wxBoxSizer* bSizer132;
bSizer132 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer133;
bSizer133 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer134;
bSizer134 = new wxBoxSizer( wxHORIZONTAL );
-
+
wxStaticText* m_staticText41;
m_staticText41 = new wxStaticText( this, wxID_ANY, _("IDT_CIPHER"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText41->Wrap( -1 );
-
bSizer134->Add( m_staticText41, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
-
+
wxArrayString EncryptionAlgorithmChoiceChoices;
EncryptionAlgorithmChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, EncryptionAlgorithmChoiceChoices, 0 );
EncryptionAlgorithmChoice->SetSelection( 0 );
bSizer134->Add( EncryptionAlgorithmChoice, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
-
+
XtsModeCheckBox = new wxCheckBox( this, wxID_ANY, _("IDT_XTS_MODE"), wxDefaultPosition, wxDefaultSize, 0 );
- XtsModeCheckBox->SetValue(true);
+ XtsModeCheckBox->SetValue(true);
bSizer134->Add( XtsModeCheckBox, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
-
-
+
+
bSizer133->Add( bSizer134, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
-
+
wxStaticBoxSizer* sbSizer38;
sbSizer38 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("IDT_TEST_KEY") ), wxVERTICAL );
-
+
KeyTextCtrl = new wxTextCtrl( sbSizer38->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
KeyTextCtrl->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("Courier") ) );
-
+
sbSizer38->Add( KeyTextCtrl, 1, wxALL|wxEXPAND, 5 );
-
+
wxBoxSizer* bSizer135;
bSizer135 = new wxBoxSizer( wxHORIZONTAL );
-
+
wxStaticText* m_staticText43;
m_staticText43 = new wxStaticText( sbSizer38->GetStaticBox(), wxID_ANY, _("IDT_KEY"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText43->Wrap( -1 );
-
bSizer135->Add( m_staticText43, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
-
+
KeySizeStaticText = new wxStaticText( sbSizer38->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
KeySizeStaticText->Wrap( -1 );
-
bSizer135->Add( KeySizeStaticText, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
-
-
+
+
sbSizer38->Add( bSizer135, 0, wxEXPAND, 5 );
-
-
+
+
bSizer133->Add( sbSizer38, 0, wxEXPAND|wxALL, 5 );
-
+
wxStaticBoxSizer* sbSizer39;
sbSizer39 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("IDT_XTS_MODE") ), wxVERTICAL );
-
+
wxStaticText* m_staticText45;
m_staticText45 = new wxStaticText( sbSizer39->GetStaticBox(), wxID_ANY, _("IDT_SECONDARY_KEY"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText45->Wrap( -1 );
-
sbSizer39->Add( m_staticText45, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
-
+
SecondaryKeyTextCtrl = new wxTextCtrl( sbSizer39->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
SecondaryKeyTextCtrl->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("Courier") ) );
-
+
sbSizer39->Add( SecondaryKeyTextCtrl, 0, wxEXPAND|wxALL, 5 );
-
+
wxStaticText* m_staticText46;
m_staticText46 = new wxStaticText( sbSizer39->GetStaticBox(), wxID_ANY, _("IDT_TEST_DATA_UNIT_NUMBER"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText46->Wrap( -1 );
-
sbSizer39->Add( m_staticText46, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
-
+
DataUnitNumberTextCtrl = new wxTextCtrl( sbSizer39->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
sbSizer39->Add( DataUnitNumberTextCtrl, 0, wxALL, 5 );
-
+
wxStaticText* m_staticText47;
m_staticText47 = new wxStaticText( sbSizer39->GetStaticBox(), wxID_ANY, _("IDT_TEST_BLOCK_NUMBER"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText47->Wrap( -1 );
-
sbSizer39->Add( m_staticText47, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
-
+
BlockNumberTextCtrl = new wxTextCtrl( sbSizer39->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
sbSizer39->Add( BlockNumberTextCtrl, 0, wxALL, 5 );
-
-
+
+
bSizer133->Add( sbSizer39, 1, wxEXPAND|wxALL, 5 );
-
+
wxStaticBoxSizer* sbSizer40;
sbSizer40 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("IDT_TEST_PLAINTEXT") ), wxVERTICAL );
-
+
PlainTextTextCtrl = new wxTextCtrl( sbSizer40->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
PlainTextTextCtrl->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("Courier") ) );
-
+
sbSizer40->Add( PlainTextTextCtrl, 0, wxALL|wxEXPAND, 5 );
-
-
+
+
bSizer133->Add( sbSizer40, 0, wxEXPAND|wxALL, 5 );
-
+
wxStaticBoxSizer* sbSizer41;
sbSizer41 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("IDT_TEST_CIPHERTEXT") ), wxVERTICAL );
-
+
CipherTextTextCtrl = new wxTextCtrl( sbSizer41->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
CipherTextTextCtrl->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("Courier") ) );
-
+
sbSizer41->Add( CipherTextTextCtrl, 0, wxALL|wxEXPAND, 5 );
-
-
+
+
bSizer133->Add( sbSizer41, 0, wxEXPAND|wxALL, 5 );
-
+
wxBoxSizer* bSizer136;
bSizer136 = new wxBoxSizer( wxHORIZONTAL );
-
+
EncryptButton = new wxButton( this, wxID_ANY, _("ENCRYPT"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer136->Add( EncryptButton, 0, wxALL, 5 );
-
+
DecryptButton = new wxButton( this, wxID_ANY, _("DECRYPT"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer136->Add( DecryptButton, 0, wxALL, 5 );
-
+
AutoTestAllButton = new wxButton( this, wxID_ANY, _("IDC_AUTO"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer136->Add( AutoTestAllButton, 0, wxALL, 5 );
-
+
ResetButton = new wxButton( this, wxID_ANY, _("IDC_RESET"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer136->Add( ResetButton, 0, wxALL, 5 );
-
+
CloseButton = new wxButton( this, wxID_CANCEL, _("IDCLOSE"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer136->Add( CloseButton, 0, wxALL, 5 );
-
-
+
+
bSizer133->Add( bSizer136, 0, wxEXPAND, 5 );
-
-
+
+
bSizer132->Add( bSizer133, 1, wxEXPAND|wxALL, 5 );
-
-
+
+
this->SetSizer( bSizer132 );
this->Layout();
bSizer132->Fit( this );
-
+
// Connect Events
EncryptionAlgorithmChoice->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( EncryptionTestDialogBase::OnEncryptionAlgorithmSelected ), NULL, this );
XtsModeCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( EncryptionTestDialogBase::OnXtsModeCheckBoxClick ), NULL, this );
@@ -1176,80 +1142,80 @@ EncryptionTestDialogBase::~EncryptionTestDialogBase()
DecryptButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( EncryptionTestDialogBase::OnDecryptButtonClick ), NULL, this );
AutoTestAllButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( EncryptionTestDialogBase::OnAutoTestAllButtonClick ), NULL, this );
ResetButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( EncryptionTestDialogBase::OnResetButtonClick ), NULL, this );
-
+
}
FavoriteVolumesDialogBase::FavoriteVolumesDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
-
+
wxBoxSizer* bSizer57;
bSizer57 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer60;
bSizer60 = new wxBoxSizer( wxHORIZONTAL );
-
+
wxBoxSizer* bSizer58;
bSizer58 = new wxBoxSizer( wxVERTICAL );
-
- FavoritesListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_VRULES|wxSUNKEN_BORDER );
+
+ FavoritesListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_VRULES|wxBORDER_SUNKEN );
bSizer58->Add( FavoritesListCtrl, 1, wxALL|wxEXPAND, 5 );
-
+
wxGridSizer* gSizer5;
gSizer5 = new wxGridSizer( 1, 4, 0, 0 );
-
+
MoveUpButton = new wxButton( this, wxID_ANY, _("IDC_FAVORITE_MOVE_UP"), wxDefaultPosition, wxDefaultSize, 0 );
gSizer5->Add( MoveUpButton, 0, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 5 );
-
+
MoveDownButton = new wxButton( this, wxID_ANY, _("IDC_FAVORITE_MOVE_DOWN"), wxDefaultPosition, wxDefaultSize, 0 );
gSizer5->Add( MoveDownButton, 0, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 5 );
-
+
RemoveButton = new wxButton( this, wxID_ANY, _("IDC_KEYREMOVE"), wxDefaultPosition, wxDefaultSize, 0 );
- gSizer5->Add( RemoveButton, 0, wxALIGN_RIGHT|wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
-
+ gSizer5->Add( RemoveButton, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
+
RemoveAllButton = new wxButton( this, wxID_ANY, _("IDC_KEYREMOVEALL"), wxDefaultPosition, wxDefaultSize, 0 );
gSizer5->Add( RemoveAllButton, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
-
-
+
+
bSizer58->Add( gSizer5, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
-
+
wxFlexGridSizer* fgSizer4;
fgSizer4 = new wxFlexGridSizer( 1, 5, 0, 0 );
fgSizer4->AddGrowableCol( 2 );
fgSizer4->SetFlexibleDirection( wxBOTH );
fgSizer4->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
-
-
+
+
fgSizer4->Add( 0, 0, 1, wxEXPAND, 5 );
-
-
+
+
bSizer58->Add( fgSizer4, 0, wxEXPAND, 5 );
-
-
+
+
bSizer60->Add( bSizer58, 1, wxEXPAND, 5 );
-
+
wxBoxSizer* bSizer59;
bSizer59 = new wxBoxSizer( wxVERTICAL );
-
+
OKButton = new wxButton( this, wxID_OK, _("IDOK"), wxDefaultPosition, wxDefaultSize, 0 );
+
OKButton->SetDefault();
-
bSizer59->Add( OKButton, 0, wxALL, 5 );
-
+
CancelButton = new wxButton( this, wxID_CANCEL, _("IDCANCEL"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer59->Add( CancelButton, 0, wxALL, 5 );
-
-
+
+
bSizer60->Add( bSizer59, 0, wxEXPAND, 5 );
-
-
+
+
bSizer57->Add( bSizer60, 1, wxEXPAND|wxALL, 5 );
-
-
+
+
this->SetSizer( bSizer57 );
this->Layout();
bSizer57->Fit( this );
-
+
// Connect Events
FavoritesListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( FavoriteVolumesDialogBase::OnListItemDeselected ), NULL, this );
FavoritesListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( FavoriteVolumesDialogBase::OnListItemSelected ), NULL, this );
@@ -1270,94 +1236,92 @@ FavoriteVolumesDialogBase::~FavoriteVolumesDialogBase()
RemoveButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FavoriteVolumesDialogBase::OnRemoveButtonClick ), NULL, this );
RemoveAllButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FavoriteVolumesDialogBase::OnRemoveAllButtonClick ), NULL, this );
OKButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FavoriteVolumesDialogBase::OnOKButtonClick ), NULL, this );
-
+
}
KeyfilesDialogBase::KeyfilesDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
this->SetExtraStyle( this->GetExtraStyle() | wxWS_EX_VALIDATE_RECURSIVELY );
-
+
wxBoxSizer* bSizer26;
bSizer26 = new wxBoxSizer( wxVERTICAL );
-
+
UpperSizer = new wxBoxSizer( wxHORIZONTAL );
-
+
PanelSizer = new wxBoxSizer( wxVERTICAL );
-
-
+
+
UpperSizer->Add( PanelSizer, 1, wxEXPAND, 5 );
-
+
wxBoxSizer* bSizer22;
bSizer22 = new wxBoxSizer( wxVERTICAL );
-
+
OKButton = new wxButton( this, wxID_OK, _("IDOK"), wxDefaultPosition, wxDefaultSize, 0 );
+
OKButton->SetDefault();
-
bSizer22->Add( OKButton, 0, wxALL|wxEXPAND, 5 );
-
+
CancelButton = new wxButton( this, wxID_CANCEL, _("IDCANCEL"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer22->Add( CancelButton, 0, wxALL|wxEXPAND, 5 );
-
+
WarningStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
WarningStaticText->Wrap( -1 );
-
bSizer22->Add( WarningStaticText, 1, wxALL|wxEXPAND, 5 );
-
-
+
+
UpperSizer->Add( bSizer22, 0, wxEXPAND, 5 );
-
-
+
+
bSizer26->Add( UpperSizer, 1, wxTOP|wxRIGHT|wxLEFT, 5 );
-
+
wxBoxSizer* bSizer23;
bSizer23 = new wxBoxSizer( wxVERTICAL );
-
+
KeyfilesNoteSizer = new wxBoxSizer( wxVERTICAL );
-
+
wxStaticLine* m_staticline1;
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
KeyfilesNoteSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
-
+
KeyfilesNoteStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
KeyfilesNoteStaticText->Wrap( -1 );
-
KeyfilesNoteSizer->Add( KeyfilesNoteStaticText, 0, wxALL|wxEXPAND, 5 );
-
+
wxStaticLine* m_staticline2;
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
KeyfilesNoteSizer->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 );
-
-
+
+
bSizer23->Add( KeyfilesNoteSizer, 1, wxEXPAND, 5 );
-
+
wxFlexGridSizer* fgSizer2;
fgSizer2 = new wxFlexGridSizer( 1, 2, 0, 0 );
fgSizer2->AddGrowableCol( 0 );
fgSizer2->SetFlexibleDirection( wxBOTH );
fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
-
+
KeyfilesHyperlink = new wxHyperlinkCtrl( this, wxID_ANY, _("IDC_LINK_KEYFILES_INFO"), wxEmptyString, wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
-
+
KeyfilesHyperlink->SetHoverColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) );
KeyfilesHyperlink->SetNormalColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) );
KeyfilesHyperlink->SetVisitedColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) );
fgSizer2->Add( KeyfilesHyperlink, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
-
+
CreateKeyfileButtton = new wxButton( this, wxID_ANY, _("IDC_GENERATE_KEYFILE"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer2->Add( CreateKeyfileButtton, 0, wxALL, 5 );
-
-
+
+
bSizer23->Add( fgSizer2, 0, wxEXPAND, 5 );
-
-
+
+
bSizer26->Add( bSizer23, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
-
-
+
+
this->SetSizer( bSizer26 );
this->Layout();
bSizer26->Fit( this );
-
+
// Connect Events
KeyfilesHyperlink->Connect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( KeyfilesDialogBase::OnKeyfilesHyperlinkClick ), NULL, this );
CreateKeyfileButtton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( KeyfilesDialogBase::OnCreateKeyfileButttonClick ), NULL, this );
@@ -1368,165 +1332,158 @@ KeyfilesDialogBase::~KeyfilesDialogBase()
// Disconnect Events
KeyfilesHyperlink->Disconnect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( KeyfilesDialogBase::OnKeyfilesHyperlinkClick ), NULL, this );
CreateKeyfileButtton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( KeyfilesDialogBase::OnCreateKeyfileButttonClick ), NULL, this );
-
+
}
KeyfileGeneratorDialogBase::KeyfileGeneratorDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
-
+
MainSizer = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer144;
bSizer144 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer145;
bSizer145 = new wxBoxSizer( wxHORIZONTAL );
-
-
+
+
bSizer145->Add( 0, 0, 1, wxEXPAND, 5 );
-
+
wxStaticText* m_staticText49;
m_staticText49 = new wxStaticText( this, wxID_ANY, _("IDT_PRF"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText49->Wrap( -1 );
-
bSizer145->Add( m_staticText49, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
-
+
wxArrayString HashChoiceChoices;
HashChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, HashChoiceChoices, 0 );
HashChoice->SetSelection( 0 );
bSizer145->Add( HashChoice, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
-
-
+
+
bSizer145->Add( 0, 0, 1, wxEXPAND, 5 );
-
-
+
+
bSizer144->Add( bSizer145, 0, wxEXPAND, 5 );
-
+
wxStaticBoxSizer* sbSizer43;
sbSizer43 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL );
-
+
wxBoxSizer* bSizer147;
bSizer147 = new wxBoxSizer( wxHORIZONTAL );
-
+
wxStaticText* m_staticText52;
m_staticText52 = new wxStaticText( sbSizer43->GetStaticBox(), wxID_ANY, _("IDT_RANDOM_POOL"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText52->Wrap( -1 );
-
bSizer147->Add( m_staticText52, 0, wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
-
+
RandomPoolStaticText = new wxStaticText( sbSizer43->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
RandomPoolStaticText->Wrap( -1 );
-
RandomPoolStaticText->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("Courier New") ) );
-
+
bSizer147->Add( RandomPoolStaticText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
-
+
ShowRandomPoolCheckBox = new wxCheckBox( sbSizer43->GetStaticBox(), wxID_ANY, _("IDC_DISPLAY_POOL_CONTENTS"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer147->Add( ShowRandomPoolCheckBox, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
-
-
+
+
sbSizer43->Add( bSizer147, 0, wxEXPAND|wxTOP, 5 );
-
-
+
+
sbSizer43->Add( 0, 0, 1, wxEXPAND, 5 );
-
+
wxStaticBoxSizer* sbSizer45;
sbSizer45 = new wxStaticBoxSizer( new wxStaticBox( sbSizer43->GetStaticBox(), wxID_ANY, _("IDT_ENTROPY_BAR") ), wxVERTICAL );
-
+
CollectedEntropy = new wxGauge( sbSizer45->GetStaticBox(), wxID_ANY, 2560, wxDefaultPosition, wxDefaultSize, wxGA_HORIZONTAL|wxGA_SMOOTH );
- CollectedEntropy->SetValue( 0 );
+ CollectedEntropy->SetValue( 0 );
sbSizer45->Add( CollectedEntropy, 1, wxALL|wxEXPAND, 5 );
-
-
+
+
sbSizer43->Add( sbSizer45, 0, wxBOTTOM|wxEXPAND|wxTOP, 5 );
-
-
+
+
sbSizer43->Add( 0, 0, 1, wxEXPAND, 5 );
-
+
MouseStaticText = new wxStaticText( sbSizer43->GetStaticBox(), wxID_ANY, _("IDT_KEYFILE_GENERATOR_NOTE"), wxDefaultPosition, wxDefaultSize, 0 );
MouseStaticText->Wrap( -1 );
-
sbSizer43->Add( MouseStaticText, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
-
-
+
+
sbSizer43->Add( 0, 0, 1, wxEXPAND, 5 );
-
-
+
+
bSizer144->Add( sbSizer43, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
-
+
wxBoxSizer* bSizer162;
bSizer162 = new wxBoxSizer( wxVERTICAL );
-
+
wxFlexGridSizer* fgSizer8;
fgSizer8 = new wxFlexGridSizer( 3, 3, 0, 0 );
fgSizer8->AddGrowableCol( 2 );
fgSizer8->SetFlexibleDirection( wxBOTH );
fgSizer8->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
-
+
m_staticText60 = new wxStaticText( this, wxID_ANY, _("IDT_NUMBER_KEYFILES"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText60->Wrap( -1 );
-
fgSizer8->Add( m_staticText60, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
-
+
NumberOfKeyfiles = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 9999999, 1 );
fgSizer8->Add( NumberOfKeyfiles, 0, wxALL, 5 );
-
+
m_panel18 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
fgSizer8->Add( m_panel18, 1, wxEXPAND | wxALL, 5 );
-
+
m_staticText63 = new wxStaticText( this, wxID_ANY, _("IDT_KEYFILES_SIZE"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText63->Wrap( -1 );
-
fgSizer8->Add( m_staticText63, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
-
+
KeyfilesSize = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 64, 1048576, 64 );
fgSizer8->Add( KeyfilesSize, 0, wxALL, 5 );
-
+
RandomSizeCheckBox = new wxCheckBox( this, wxID_ANY, _("IDC_KEYFILES_RANDOM_SIZE"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer8->Add( RandomSizeCheckBox, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
-
+
m_staticText65 = new wxStaticText( this, wxID_ANY, _("IDT_KEYFILES_BASE_NAME"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText65->Wrap( -1 );
-
fgSizer8->Add( m_staticText65, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
-
+
KeyfilesBaseName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer8->Add( KeyfilesBaseName, 0, wxALL, 5 );
-
+
m_panel19 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
fgSizer8->Add( m_panel19, 1, wxEXPAND | wxALL, 5 );
-
-
+
+
bSizer162->Add( fgSizer8, 1, wxEXPAND, 5 );
-
-
+
+
bSizer144->Add( bSizer162, 1, wxALL|wxEXPAND, 5 );
-
+
wxBoxSizer* bSizer146;
bSizer146 = new wxBoxSizer( wxHORIZONTAL );
-
+
GenerateButton = new wxButton( this, wxID_ANY, _("IDC_GENERATE_AND_SAVE_KEYFILE"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer146->Add( GenerateButton, 0, wxALL, 5 );
-
-
+
+
bSizer146->Add( 0, 0, 1, wxEXPAND, 5 );
-
+
wxButton* m_button61;
m_button61 = new wxButton( this, wxID_CANCEL, _("IDCLOSE"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer146->Add( m_button61, 0, wxALL, 5 );
-
-
+
+
bSizer144->Add( bSizer146, 0, wxEXPAND, 5 );
-
-
+
+
MainSizer->Add( bSizer144, 1, wxEXPAND|wxALL, 5 );
-
-
+
+
this->SetSizer( MainSizer );
this->Layout();
MainSizer->Fit( this );
-
+
// Connect Events
this->Connect( wxEVT_MOTION, wxMouseEventHandler( KeyfileGeneratorDialogBase::OnMouseMotion ) );
HashChoice->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( KeyfileGeneratorDialogBase::OnHashSelected ), NULL, this );
@@ -1543,32 +1500,32 @@ KeyfileGeneratorDialogBase::~KeyfileGeneratorDialogBase()
ShowRandomPoolCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( KeyfileGeneratorDialogBase::OnShowRandomPoolCheckBoxClicked ), NULL, this );
RandomSizeCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( KeyfileGeneratorDialogBase::OnRandomSizeCheckBoxClicked ), NULL, this );
GenerateButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( KeyfileGeneratorDialogBase::OnGenerateButtonClick ), NULL, this );
-
+
}
LegalNoticesDialogBase::LegalNoticesDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
-
+
wxBoxSizer* bSizer114;
bSizer114 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer115;
bSizer115 = new wxBoxSizer( wxVERTICAL );
-
+
LegalNoticesTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY );
bSizer115->Add( LegalNoticesTextCtrl, 1, wxALL|wxEXPAND, 5 );
-
+
wxButton* OKButton;
OKButton = new wxButton( this, wxID_OK, _("IDOK"), wxDefaultPosition, wxDefaultSize, 0 );
+
OKButton->SetDefault();
-
bSizer115->Add( OKButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
-
-
+
+
bSizer114->Add( bSizer115, 1, wxEXPAND|wxALL, 5 );
-
-
+
+
this->SetSizer( bSizer114 );
this->Layout();
bSizer114->Fit( this );
@@ -1582,167 +1539,165 @@ MountOptionsDialogBase::MountOptionsDialogBase( wxWindow* parent, wxWindowID id,
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
this->SetExtraStyle( this->GetExtraStyle() | wxWS_EX_VALIDATE_RECURSIVELY );
-
+
MainSizer = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer19;
bSizer19 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer14;
bSizer14 = new wxBoxSizer( wxHORIZONTAL );
-
+
PasswordSizer = new wxBoxSizer( wxVERTICAL );
-
-
+
+
bSizer14->Add( PasswordSizer, 1, wxEXPAND, 5 );
-
+
wxBoxSizer* bSizer9;
bSizer9 = new wxBoxSizer( wxVERTICAL );
-
+
OKButton = new wxButton( this, wxID_OK, _("IDOK"), wxDefaultPosition, wxDefaultSize, 0 );
+
OKButton->SetDefault();
-
bSizer9->Add( OKButton, 0, wxALL|wxEXPAND, 5 );
-
+
CancelButton = new wxButton( this, wxID_CANCEL, _("IDCANCEL"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer9->Add( CancelButton, 0, wxALL|wxEXPAND, 5 );
-
-
+
+
bSizer9->Add( 0, 0, 1, wxTOP|wxEXPAND, 5 );
-
+
OptionsButton = new wxButton( this, wxID_ANY, _("IDT_FORMAT_OPTIONS"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer9->Add( OptionsButton, 0, wxALL|wxEXPAND, 5 );
-
-
+
+
bSizer14->Add( bSizer9, 0, wxEXPAND, 5 );
-
-
+
+
bSizer19->Add( bSizer14, 0, wxEXPAND|wxALL, 5 );
-
+
wxBoxSizer* bSizer6;
bSizer6 = new wxBoxSizer( wxVERTICAL );
-
+
OptionsPanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
OptionsSizer = new wxStaticBoxSizer( new wxStaticBox( OptionsPanel, wxID_ANY, wxEmptyString ), wxVERTICAL );
-
-
+
+
OptionsSizer->Add( 0, 0, 0, wxTOP, 5 );
-
+
ReadOnlyCheckBox = new wxCheckBox( OptionsSizer->GetStaticBox(), wxID_ANY, _("IDC_MOUNT_READONLY"), wxDefaultPosition, wxDefaultSize, 0 );
OptionsSizer->Add( ReadOnlyCheckBox, 0, wxALL, 5 );
-
+
RemovableCheckBox = new wxCheckBox( OptionsSizer->GetStaticBox(), wxID_ANY, _("IDC_MOUNT_REMOVABLE"), wxDefaultPosition, wxDefaultSize, 0 );
OptionsSizer->Add( RemovableCheckBox, 0, wxALL, 5 );
-
+
BackupHeaderCheckBox = new wxCheckBox( OptionsSizer->GetStaticBox(), wxID_ANY, _("IDC_USE_EMBEDDED_HEADER_BAK"), wxDefaultPosition, wxDefaultSize, 0 );
OptionsSizer->Add( BackupHeaderCheckBox, 0, wxALL, 5 );
-
+
PartitionInSystemEncryptionScopeCheckBox = new wxCheckBox( OptionsSizer->GetStaticBox(), wxID_ANY, _("LINUX_MOUNT_SYSTEM_ENC_PREBOOT"), wxDefaultPosition, wxDefaultSize, 0 );
OptionsSizer->Add( PartitionInSystemEncryptionScopeCheckBox, 0, wxALL, 5 );
-
+
ProtectionSizer = new wxStaticBoxSizer( new wxStaticBox( OptionsSizer->GetStaticBox(), wxID_ANY, _("IDT_HIDDEN_VOL_PROTECTION") ), wxVERTICAL );
-
+
ProtectionCheckBox = new wxCheckBox( ProtectionSizer->GetStaticBox(), wxID_ANY, _("IDC_PROTECT_HIDDEN_VOL"), wxDefaultPosition, wxDefaultSize, 0 );
ProtectionSizer->Add( ProtectionCheckBox, 0, wxALL, 5 );
-
+
ProtectionPasswordSizer = new wxBoxSizer( wxVERTICAL );
-
-
+
+
ProtectionSizer->Add( ProtectionPasswordSizer, 1, wxEXPAND|wxLEFT, 5 );
-
+
ProtectionHyperlinkCtrl = new wxHyperlinkCtrl( ProtectionSizer->GetStaticBox(), wxID_ANY, _("IDC_LINK_HIDVOL_PROTECTION_INFO"), wxEmptyString, wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
-
+
ProtectionHyperlinkCtrl->SetHoverColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) );
ProtectionHyperlinkCtrl->SetNormalColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) );
ProtectionHyperlinkCtrl->SetVisitedColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) );
ProtectionSizer->Add( ProtectionHyperlinkCtrl, 0, wxALL, 5 );
-
-
+
+
OptionsSizer->Add( ProtectionSizer, 1, wxEXPAND|wxALL, 5 );
-
+
FilesystemSizer = new wxBoxSizer( wxVERTICAL );
-
+
m_panel8 = new wxPanel( OptionsSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxStaticBoxSizer* sbSizer28;
sbSizer28 = new wxStaticBoxSizer( new wxStaticBox( m_panel8, wxID_ANY, _("IDT_FILESYSTEM") ), wxVERTICAL );
-
+
wxBoxSizer* bSizer54;
bSizer54 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer55;
bSizer55 = new wxBoxSizer( wxVERTICAL );
-
+
NoFilesystemCheckBox = new wxCheckBox( sbSizer28->GetStaticBox(), wxID_ANY, _("LINUX_DO_NOT_MOUNT"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer55->Add( NoFilesystemCheckBox, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
-
-
+
+
bSizer54->Add( bSizer55, 1, wxEXPAND, 5 );
-
+
FilesystemOptionsSizer = new wxGridBagSizer( 0, 0 );
FilesystemOptionsSizer->SetFlexibleDirection( wxBOTH );
FilesystemOptionsSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
FilesystemOptionsSizer->SetEmptyCellSize( wxSize( 0,0 ) );
-
+
FilesystemSpacer = new wxBoxSizer( wxVERTICAL );
-
-
+
+
FilesystemOptionsSizer->Add( FilesystemSpacer, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxEXPAND|wxTOP, 5 );
-
+
MountPointTextCtrlStaticText = new wxStaticText( sbSizer28->GetStaticBox(), wxID_ANY, _("LINUX_MOUNT_AT_DIR"), wxDefaultPosition, wxDefaultSize, 0 );
MountPointTextCtrlStaticText->Wrap( -1 );
-
FilesystemOptionsSizer->Add( MountPointTextCtrlStaticText, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT, 5 );
-
+
MountPointTextCtrl = new wxTextCtrl( sbSizer28->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
- FilesystemOptionsSizer->Add( MountPointTextCtrl, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
-
+ FilesystemOptionsSizer->Add( MountPointTextCtrl, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
+
MountPointButton = new wxButton( sbSizer28->GetStaticBox(), wxID_ANY, _("LINUX_SELECT"), wxDefaultPosition, wxDefaultSize, 0 );
FilesystemOptionsSizer->Add( MountPointButton, wxGBPosition( 1, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
-
+
FilesystemOptionsStaticText = new wxStaticText( sbSizer28->GetStaticBox(), wxID_ANY, _("IDT_LINUX_PREF_TAB_MOUNT_OPTIONS"), wxDefaultPosition, wxDefaultSize, 0 );
FilesystemOptionsStaticText->Wrap( -1 );
-
FilesystemOptionsSizer->Add( FilesystemOptionsStaticText, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxLEFT, 5 );
-
+
FilesystemOptionsTextCtrl = new wxTextCtrl( sbSizer28->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
- FilesystemOptionsSizer->Add( FilesystemOptionsTextCtrl, wxGBPosition( 2, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
-
-
+ FilesystemOptionsSizer->Add( FilesystemOptionsTextCtrl, wxGBPosition( 2, 1 ), wxGBSpan( 1, 2 ), wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
+
+
FilesystemOptionsSizer->AddGrowableCol( 1 );
-
+
bSizer54->Add( FilesystemOptionsSizer, 0, wxEXPAND, 5 );
-
-
+
+
sbSizer28->Add( bSizer54, 0, wxEXPAND|wxBOTTOM, 5 );
-
-
+
+
m_panel8->SetSizer( sbSizer28 );
m_panel8->Layout();
sbSizer28->Fit( m_panel8 );
FilesystemSizer->Add( m_panel8, 0, wxEXPAND | wxALL, 5 );
-
-
+
+
OptionsSizer->Add( FilesystemSizer, 0, wxEXPAND, 5 );
-
-
+
+
OptionsPanel->SetSizer( OptionsSizer );
OptionsPanel->Layout();
OptionsSizer->Fit( OptionsPanel );
bSizer6->Add( OptionsPanel, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
-
-
+
+
bSizer19->Add( bSizer6, 0, wxEXPAND, 5 );
-
-
+
+
MainSizer->Add( bSizer19, 1, wxEXPAND, 5 );
-
-
+
+
this->SetSizer( MainSizer );
this->Layout();
MainSizer->Fit( this );
-
+
this->Centre( wxBOTH );
-
+
// Connect Events
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( MountOptionsDialogBase::OnInitDialog ) );
OKButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MountOptionsDialogBase::OnOKButtonClick ), NULL, this );
@@ -1765,78 +1720,76 @@ MountOptionsDialogBase::~MountOptionsDialogBase()
ProtectionHyperlinkCtrl->Disconnect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( MountOptionsDialogBase::OnProtectionHyperlinkClick ), NULL, this );
NoFilesystemCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( MountOptionsDialogBase::OnNoFilesystemCheckBoxClick ), NULL, this );
MountPointButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MountOptionsDialogBase::OnMountPointButtonClick ), NULL, this );
-
+
}
NewSecurityTokenKeyfileDialogBase::NewSecurityTokenKeyfileDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
-
+
wxBoxSizer* bSizer143;
bSizer143 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer144;
bSizer144 = new wxBoxSizer( wxVERTICAL );
-
+
wxStaticBoxSizer* sbSizer42;
sbSizer42 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL );
-
+
wxFlexGridSizer* fgSizer7;
fgSizer7 = new wxFlexGridSizer( 2, 2, 0, 0 );
fgSizer7->SetFlexibleDirection( wxBOTH );
fgSizer7->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
-
+
wxStaticText* m_staticText47;
m_staticText47 = new wxStaticText( sbSizer42->GetStaticBox(), wxID_ANY, _("IDT_SECURITY_TOKEN"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT );
m_staticText47->Wrap( -1 );
-
fgSizer7->Add( m_staticText47, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT, 5 );
-
+
wxArrayString SecurityTokenChoiceChoices;
SecurityTokenChoice = new wxChoice( sbSizer42->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, SecurityTokenChoiceChoices, 0 );
SecurityTokenChoice->SetSelection( 0 );
- fgSizer7->Add( SecurityTokenChoice, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
-
+ fgSizer7->Add( SecurityTokenChoice, 0, wxALL|wxEXPAND, 5 );
+
wxStaticText* m_staticText48;
m_staticText48 = new wxStaticText( sbSizer42->GetStaticBox(), wxID_ANY, _("IDT_TOKEN_KEYFILE_NAME"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT );
m_staticText48->Wrap( -1 );
-
fgSizer7->Add( m_staticText48, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT, 5 );
-
+
KeyfileNameTextCtrl = new wxTextCtrl( sbSizer42->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
- fgSizer7->Add( KeyfileNameTextCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, 5 );
-
-
+ fgSizer7->Add( KeyfileNameTextCtrl, 0, wxEXPAND|wxALL, 5 );
+
+
sbSizer42->Add( fgSizer7, 1, wxEXPAND|wxTOP, 5 );
-
-
+
+
bSizer144->Add( sbSizer42, 1, wxEXPAND|wxALL, 5 );
-
+
wxBoxSizer* bSizer167;
bSizer167 = new wxBoxSizer( wxHORIZONTAL );
-
-
+
+
bSizer167->Add( 0, 0, 1, wxEXPAND, 5 );
-
+
CancelButton = new wxButton( this, wxID_CANCEL, _("IDCANCEL"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer167->Add( CancelButton, 0, wxALL, 5 );
-
+
OKButton = new wxButton( this, wxID_OK, _("IDOK"), wxDefaultPosition, wxDefaultSize, 0 );
+
OKButton->SetDefault();
-
bSizer167->Add( OKButton, 0, wxALL, 5 );
-
-
+
+
bSizer144->Add( bSizer167, 0, wxEXPAND, 5 );
-
-
+
+
bSizer143->Add( bSizer144, 1, wxEXPAND|wxALL, 5 );
-
-
+
+
this->SetSizer( bSizer143 );
this->Layout();
bSizer143->Fit( this );
-
+
// Connect Events
KeyfileNameTextCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( NewSecurityTokenKeyfileDialogBase::OnKeyfileNameChanged ), NULL, this );
OKButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( NewSecurityTokenKeyfileDialogBase::OnOKButtonClick ), NULL, this );
@@ -1847,94 +1800,93 @@ NewSecurityTokenKeyfileDialogBase::~NewSecurityTokenKeyfileDialogBase()
// Disconnect Events
KeyfileNameTextCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( NewSecurityTokenKeyfileDialogBase::OnKeyfileNameChanged ), NULL, this );
OKButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( NewSecurityTokenKeyfileDialogBase::OnOKButtonClick ), NULL, this );
-
+
}
PreferencesDialogBase::PreferencesDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
this->SetExtraStyle( this->GetExtraStyle() | wxWS_EX_VALIDATE_RECURSIVELY );
-
+
bSizer32 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer178;
bSizer178 = new wxBoxSizer( wxVERTICAL );
-
+
PreferencesNotebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
SecurityPage = new wxPanel( PreferencesNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer44;
bSizer44 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer33;
bSizer33 = new wxBoxSizer( wxVERTICAL );
-
+
AutoDismountSizer = new wxStaticBoxSizer( new wxStaticBox( SecurityPage, wxID_ANY, _("IDT_AUTO_DISMOUNT") ), wxVERTICAL );
-
+
wxStaticBoxSizer* sbSizer13;
sbSizer13 = new wxStaticBoxSizer( new wxStaticBox( AutoDismountSizer->GetStaticBox(), wxID_ANY, _("LINUX_DISMOUNT_ALL_WHEN") ), wxVERTICAL );
-
+
DismountOnLogOffCheckBox = new wxCheckBox( sbSizer13->GetStaticBox(), wxID_ANY, _("IDC_PREF_DISMOUNT_LOGOFF"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer13->Add( DismountOnLogOffCheckBox, 0, wxALL, 5 );
-
+
DismountOnScreenSaverCheckBox = new wxCheckBox( sbSizer13->GetStaticBox(), wxID_ANY, _("IDC_PREF_DISMOUNT_SCREENSAVER"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer13->Add( DismountOnScreenSaverCheckBox, 0, wxALL, 5 );
-
+
DismountOnPowerSavingCheckBox = new wxCheckBox( sbSizer13->GetStaticBox(), wxID_ANY, _("LINUX_ENTERING_POVERSAWING"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer13->Add( DismountOnPowerSavingCheckBox, 0, wxALL, 5 );
-
-
+
+
AutoDismountSizer->Add( sbSizer13, 0, wxEXPAND|wxALL, 5 );
-
+
wxBoxSizer* bSizer34;
bSizer34 = new wxBoxSizer( wxHORIZONTAL );
-
+
DismountOnInactivityCheckBox = new wxCheckBox( AutoDismountSizer->GetStaticBox(), wxID_ANY, _("IDC_PREF_DISMOUNT_INACTIVE"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer34->Add( DismountOnInactivityCheckBox, 0, wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
-
+
DismountOnInactivitySpinCtrl = new wxSpinCtrl( AutoDismountSizer->GetStaticBox(), wxID_ANY, wxT("1"), wxDefaultPosition, wxSize( -1,-1 ), wxSP_ARROW_KEYS, 1, 9999, 1 );
DismountOnInactivitySpinCtrl->SetMinSize( wxSize( 60,-1 ) );
-
+
bSizer34->Add( DismountOnInactivitySpinCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
-
+
wxStaticText* m_staticText5;
m_staticText5 = new wxStaticText( AutoDismountSizer->GetStaticBox(), wxID_ANY, _("MINUTES"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText5->Wrap( -1 );
-
bSizer34->Add( m_staticText5, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
-
-
+
+
AutoDismountSizer->Add( bSizer34, 0, wxEXPAND, 5 );
-
+
ForceAutoDismountCheckBox = new wxCheckBox( AutoDismountSizer->GetStaticBox(), wxID_ANY, _("IDC_PREF_FORCE_AUTO_DISMOUNT"), wxDefaultPosition, wxDefaultSize, 0 );
AutoDismountSizer->Add( ForceAutoDismountCheckBox, 0, wxALL, 5 );
-
-
+
+
bSizer33->Add( AutoDismountSizer, 0, wxEXPAND|wxALL, 5 );
-
+
FilesystemSecuritySizer = new wxStaticBoxSizer( new wxStaticBox( SecurityPage, wxID_ANY, _("LINUX_PREF_TAB_MOUNT_OPTIONS_FS") ), wxVERTICAL );
-
+
PreserveTimestampsCheckBox = new wxCheckBox( FilesystemSecuritySizer->GetStaticBox(), wxID_ANY, _("IDC_PRESERVE_TIMESTAMPS"), wxDefaultPosition, wxDefaultSize, 0 );
FilesystemSecuritySizer->Add( PreserveTimestampsCheckBox, 0, wxALL, 5 );
-
-
+
+
bSizer33->Add( FilesystemSecuritySizer, 0, wxEXPAND|wxALL, 5 );
-
+
wxStaticBoxSizer* sbSizer14;
sbSizer14 = new wxStaticBoxSizer( new wxStaticBox( SecurityPage, wxID_ANY, _("IDT_PW_CACHE_OPTIONS") ), wxVERTICAL );
-
+
WipeCacheOnCloseCheckBox = new wxCheckBox( sbSizer14->GetStaticBox(), wxID_ANY, _("IDC_PREF_WIPE_CACHE_ON_EXIT"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer14->Add( WipeCacheOnCloseCheckBox, 0, wxALL, 5 );
-
+
WipeCacheOnAutoDismountCheckBox = new wxCheckBox( sbSizer14->GetStaticBox(), wxID_ANY, _("IDC_PREF_WIPE_CACHE_ON_AUTODISMOUNT"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer14->Add( WipeCacheOnAutoDismountCheckBox, 0, wxALL, 5 );
-
-
+
+
bSizer33->Add( sbSizer14, 0, wxEXPAND|wxALL, 5 );
-
-
+
+
bSizer44->Add( bSizer33, 1, wxEXPAND|wxALL, 5 );
-
-
+
+
SecurityPage->SetSizer( bSizer44 );
SecurityPage->Layout();
bSizer44->Fit( SecurityPage );
@@ -1942,71 +1894,66 @@ PreferencesDialogBase::PreferencesDialogBase( wxWindow* parent, wxWindowID id, c
DefaultMountOptionsPage = new wxPanel( PreferencesNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer46;
bSizer46 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer35;
bSizer35 = new wxBoxSizer( wxVERTICAL );
-
+
wxStaticBoxSizer* sbSizer15;
sbSizer15 = new wxStaticBoxSizer( new wxStaticBox( DefaultMountOptionsPage, wxID_ANY, _("IDT_DEFAULT_MOUNT_OPTIONS") ), wxVERTICAL );
-
+
MountReadOnlyCheckBox = new wxCheckBox( sbSizer15->GetStaticBox(), wxID_ANY, _("IDC_PREF_MOUNT_READONLY"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer15->Add( MountReadOnlyCheckBox, 0, wxALL, 5 );
-
+
MountRemovableCheckBox = new wxCheckBox( sbSizer15->GetStaticBox(), wxID_ANY, _("IDC_PREF_MOUNT_REMOVABLE"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer15->Add( MountRemovableCheckBox, 0, wxALL, 5 );
-
+
CachePasswordsCheckBox = new wxCheckBox( sbSizer15->GetStaticBox(), wxID_ANY, _("IDC_TRAV_CACHE_PASSWORDS"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer15->Add( CachePasswordsCheckBox, 0, wxALL, 5 );
-
- TrueCryptModeCheckBox = new wxCheckBox( sbSizer15->GetStaticBox(), wxID_ANY, _("IDC_TRUECRYPT_MODE"), wxDefaultPosition, wxDefaultSize, 0 );
- sbSizer15->Add( TrueCryptModeCheckBox, 0, wxALL, 5 );
-
+
wxBoxSizer* bSizer163;
bSizer163 = new wxBoxSizer( wxHORIZONTAL );
-
+
Pkcs5PrfStaticText = new wxStaticText( sbSizer15->GetStaticBox(), wxID_ANY, _("PKCS5_PRF"), wxDefaultPosition, wxDefaultSize, 0 );
Pkcs5PrfStaticText->Wrap( -1 );
-
bSizer163->Add( Pkcs5PrfStaticText, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
-
+
wxArrayString Pkcs5PrfChoiceChoices;
Pkcs5PrfChoice = new wxChoice( sbSizer15->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, Pkcs5PrfChoiceChoices, 0 );
Pkcs5PrfChoice->SetSelection( 0 );
bSizer163->Add( Pkcs5PrfChoice, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
-
-
+
+
sbSizer15->Add( bSizer163, 0, wxEXPAND, 5 );
-
-
+
+
bSizer35->Add( sbSizer15, 0, wxEXPAND|wxALL, 5 );
-
+
FilesystemSizer = new wxStaticBoxSizer( new wxStaticBox( DefaultMountOptionsPage, wxID_ANY, _("LINUX_PREF_TAB_MOUNT_OPTIONS_FS") ), wxVERTICAL );
-
+
wxFlexGridSizer* fgSizer3;
fgSizer3 = new wxFlexGridSizer( 1, 2, 0, 0 );
fgSizer3->AddGrowableCol( 1 );
fgSizer3->SetFlexibleDirection( wxBOTH );
fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
-
+
wxStaticText* m_staticText6;
m_staticText6 = new wxStaticText( FilesystemSizer->GetStaticBox(), wxID_ANY, _("IDT_LINUX_PREF_TAB_MOUNT_OPTIONS"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText6->Wrap( -1 );
-
fgSizer3->Add( m_staticText6, 0, wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
-
+
FilesystemOptionsTextCtrl = new wxTextCtrl( FilesystemSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
- fgSizer3->Add( FilesystemOptionsTextCtrl, 0, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
-
-
+ fgSizer3->Add( FilesystemOptionsTextCtrl, 0, wxALL|wxEXPAND, 5 );
+
+
FilesystemSizer->Add( fgSizer3, 1, wxEXPAND, 5 );
-
-
+
+
bSizer35->Add( FilesystemSizer, 0, wxEXPAND|wxALL, 5 );
-
-
+
+
bSizer46->Add( bSizer35, 1, wxEXPAND|wxALL, 5 );
-
-
+
+
DefaultMountOptionsPage->SetSizer( bSizer46 );
DefaultMountOptionsPage->Layout();
bSizer46->Fit( DefaultMountOptionsPage );
@@ -2014,41 +1961,41 @@ PreferencesDialogBase::PreferencesDialogBase( wxWindow* parent, wxWindowID id, c
BackgroundTaskPanel = new wxPanel( PreferencesNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer61;
bSizer61 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer62;
bSizer62 = new wxBoxSizer( wxVERTICAL );
-
+
wxStaticBoxSizer* sbSizer18;
sbSizer18 = new wxStaticBoxSizer( new wxStaticBox( BackgroundTaskPanel, wxID_ANY, _("IDT_TASKBAR_ICON") ), wxVERTICAL );
-
+
BackgroundTaskEnabledCheckBox = new wxCheckBox( sbSizer18->GetStaticBox(), wxID_ANY, _("IDC_PREF_BKG_TASK_ENABLE"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer18->Add( BackgroundTaskEnabledCheckBox, 0, wxALL, 5 );
-
+
CloseBackgroundTaskOnNoVolumesCheckBox = new wxCheckBox( sbSizer18->GetStaticBox(), wxID_ANY, _("IDC_CLOSE_BKG_TASK_WHEN_NOVOL"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer18->Add( CloseBackgroundTaskOnNoVolumesCheckBox, 0, wxALL, 5 );
-
+
wxStaticBoxSizer* sbSizer26;
sbSizer26 = new wxStaticBoxSizer( new wxStaticBox( sbSizer18->GetStaticBox(), wxID_ANY, _("TASKICON_PREF_MENU_ITEMS") ), wxVERTICAL );
-
+
BackgroundTaskMenuMountItemsEnabledCheckBox = new wxCheckBox( sbSizer26->GetStaticBox(), wxID_ANY, _("HK_MOUNT_FAVORITE_VOLUMES"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer26->Add( BackgroundTaskMenuMountItemsEnabledCheckBox, 0, wxALL, 5 );
-
+
BackgroundTaskMenuOpenItemsEnabledCheckBox = new wxCheckBox( sbSizer26->GetStaticBox(), wxID_ANY, _("TASKICON_PREF_OPEN_VOL"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer26->Add( BackgroundTaskMenuOpenItemsEnabledCheckBox, 0, wxALL, 5 );
-
+
BackgroundTaskMenuDismountItemsEnabledCheckBox = new wxCheckBox( sbSizer26->GetStaticBox(), wxID_ANY, _("TASKICON_PREF_DISMOUNT_VOL"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer26->Add( BackgroundTaskMenuDismountItemsEnabledCheckBox, 0, wxALL, 5 );
-
-
+
+
sbSizer18->Add( sbSizer26, 1, wxEXPAND|wxALL, 5 );
-
-
+
+
bSizer62->Add( sbSizer18, 0, wxEXPAND|wxALL, 5 );
-
-
+
+
bSizer61->Add( bSizer62, 1, wxEXPAND|wxALL, 5 );
-
-
+
+
BackgroundTaskPanel->SetSizer( bSizer61 );
BackgroundTaskPanel->Layout();
bSizer61->Fit( BackgroundTaskPanel );
@@ -2056,47 +2003,47 @@ PreferencesDialogBase::PreferencesDialogBase( wxWindow* parent, wxWindowID id, c
SystemIntegrationPage = new wxPanel( PreferencesNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer49;
bSizer49 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer37;
bSizer37 = new wxBoxSizer( wxVERTICAL );
-
+
LogOnSizer = new wxStaticBoxSizer( new wxStaticBox( SystemIntegrationPage, wxID_ANY, _("LINUX_LOGIN_ACTION") ), wxVERTICAL );
-
+
StartOnLogonCheckBox = new wxCheckBox( LogOnSizer->GetStaticBox(), wxID_ANY, _("IDC_PREF_LOGON_START"), wxDefaultPosition, wxDefaultSize, 0 );
LogOnSizer->Add( StartOnLogonCheckBox, 0, wxALL, 5 );
-
+
MountFavoritesOnLogonCheckBox = new wxCheckBox( LogOnSizer->GetStaticBox(), wxID_ANY, _("HK_MOUNT_FAVORITE_VOLUMES"), wxDefaultPosition, wxDefaultSize, 0 );
LogOnSizer->Add( MountFavoritesOnLogonCheckBox, 0, wxALL, 5 );
-
+
MountDevicesOnLogonCheckBox = new wxCheckBox( LogOnSizer->GetStaticBox(), wxID_ANY, _("IDC_PREF_LOGON_MOUNT_DEVICES"), wxDefaultPosition, wxDefaultSize, 0 );
LogOnSizer->Add( MountDevicesOnLogonCheckBox, 0, wxALL, 5 );
-
-
+
+
bSizer37->Add( LogOnSizer, 0, wxALL|wxEXPAND, 5 );
-
+
ExplorerSizer = new wxStaticBoxSizer( new wxStaticBox( SystemIntegrationPage, wxID_ANY, _("LINUX_PREF_TAB_SYSTEM_INTEGRATION_EXPLORER") ), wxVERTICAL );
-
+
OpenExplorerWindowAfterMountCheckBox = new wxCheckBox( ExplorerSizer->GetStaticBox(), wxID_ANY, _("IDC_PREF_OPEN_EXPLORER"), wxDefaultPosition, wxDefaultSize, 0 );
ExplorerSizer->Add( OpenExplorerWindowAfterMountCheckBox, 0, wxALL, 5 );
-
+
CloseExplorerWindowsOnDismountCheckBox = new wxCheckBox( ExplorerSizer->GetStaticBox(), wxID_ANY, _("LINUX_CLOSE_EXPL_ON_DISMOUNT"), wxDefaultPosition, wxDefaultSize, 0 );
ExplorerSizer->Add( CloseExplorerWindowsOnDismountCheckBox, 0, wxALL, 5 );
-
-
+
+
bSizer37->Add( ExplorerSizer, 0, wxEXPAND|wxALL, 5 );
-
+
KernelServicesSizer = new wxStaticBoxSizer( new wxStaticBox( SystemIntegrationPage, wxID_ANY, _("LINUX_PREF_KERNEL_SERVICES") ), wxVERTICAL );
-
+
NoKernelCryptoCheckBox = new wxCheckBox( KernelServicesSizer->GetStaticBox(), wxID_ANY, _("LINUX_PREF_KERNEL_CRYPT"), wxDefaultPosition, wxDefaultSize, 0 );
KernelServicesSizer->Add( NoKernelCryptoCheckBox, 0, wxALL, 5 );
-
-
+
+
bSizer37->Add( KernelServicesSizer, 0, wxEXPAND|wxALL, 5 );
-
-
+
+
bSizer49->Add( bSizer37, 1, wxEXPAND|wxALL, 5 );
-
-
+
+
SystemIntegrationPage->SetSizer( bSizer49 );
SystemIntegrationPage->Layout();
bSizer49->Fit( SystemIntegrationPage );
@@ -2104,43 +2051,41 @@ PreferencesDialogBase::PreferencesDialogBase( wxWindow* parent, wxWindowID id, c
PerformanceOptionsPage = new wxPanel( PreferencesNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer151;
bSizer151 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer152;
bSizer152 = new wxBoxSizer( wxVERTICAL );
-
+
wxStaticBoxSizer* sbSizer44;
sbSizer44 = new wxStaticBoxSizer( new wxStaticBox( PerformanceOptionsPage, wxID_ANY, _("IDT_ACCELERATION_OPTIONS") ), wxVERTICAL );
-
+
wxBoxSizer* bSizer158;
bSizer158 = new wxBoxSizer( wxHORIZONTAL );
-
+
wxStaticText* m_staticText57;
m_staticText57 = new wxStaticText( sbSizer44->GetStaticBox(), wxID_ANY, _("IDT_HW_AES_SUPPORTED_BY_CPU"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText57->Wrap( -1 );
-
bSizer158->Add( m_staticText57, 0, wxALL, 5 );
-
- AesHwCpuSupportedStaticText = new wxStaticText( sbSizer44->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0|wxSUNKEN_BORDER );
+
+ AesHwCpuSupportedStaticText = new wxStaticText( sbSizer44->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0|wxBORDER_SUNKEN );
AesHwCpuSupportedStaticText->Wrap( -1 );
-
bSizer158->Add( AesHwCpuSupportedStaticText, 0, wxALL, 5 );
-
-
+
+
sbSizer44->Add( bSizer158, 1, wxEXPAND, 5 );
-
-
+
+
sbSizer44->Add( 0, 0, 0, wxBOTTOM, 5 );
-
+
NoHardwareCryptoCheckBox = new wxCheckBox( sbSizer44->GetStaticBox(), wxID_ANY, _("IDC_ENABLE_HARDWARE_ENCRYPTION_NEG"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer44->Add( NoHardwareCryptoCheckBox, 0, wxALL, 5 );
-
-
+
+
bSizer152->Add( sbSizer44, 0, wxEXPAND|wxALL, 5 );
-
-
+
+
bSizer151->Add( bSizer152, 1, wxALL|wxEXPAND, 5 );
-
-
+
+
PerformanceOptionsPage->SetSizer( bSizer151 );
PerformanceOptionsPage->Layout();
bSizer151->Fit( PerformanceOptionsPage );
@@ -2148,28 +2093,28 @@ PreferencesDialogBase::PreferencesDialogBase( wxWindow* parent, wxWindowID id, c
DefaultKeyfilesPage = new wxPanel( PreferencesNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer40;
bSizer40 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer43;
bSizer43 = new wxBoxSizer( wxVERTICAL );
-
+
wxStaticBoxSizer* bSizer42;
bSizer42 = new wxStaticBoxSizer( new wxStaticBox( DefaultKeyfilesPage, wxID_ANY, _("IDD_KEYFILES") ), wxVERTICAL );
-
+
DefaultKeyfilesSizer = new wxBoxSizer( wxVERTICAL );
-
-
+
+
bSizer42->Add( DefaultKeyfilesSizer, 1, wxEXPAND, 5 );
-
-
+
+
bSizer43->Add( bSizer42, 1, wxEXPAND|wxALL, 5 );
-
+
UseKeyfilesCheckBox = new wxCheckBox( DefaultKeyfilesPage, wxID_ANY, _("IDC_KEYFILES_ENABLE"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer43->Add( UseKeyfilesCheckBox, 0, wxALL, 5 );
-
-
+
+
bSizer40->Add( bSizer43, 1, wxEXPAND|wxALL, 5 );
-
-
+
+
DefaultKeyfilesPage->SetSizer( bSizer40 );
DefaultKeyfilesPage->Layout();
bSizer40->Fit( DefaultKeyfilesPage );
@@ -2177,41 +2122,50 @@ PreferencesDialogBase::PreferencesDialogBase( wxWindow* parent, wxWindowID id, c
SecurityTokensPage = new wxPanel( PreferencesNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer127;
bSizer127 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer128;
bSizer128 = new wxBoxSizer( wxVERTICAL );
-
+
wxStaticBoxSizer* sbSizer36;
sbSizer36 = new wxStaticBoxSizer( new wxStaticBox( SecurityTokensPage, wxID_ANY, _("IDT_PKCS11_LIB_PATH") ), wxVERTICAL );
-
+
wxBoxSizer* bSizer129;
bSizer129 = new wxBoxSizer( wxHORIZONTAL );
-
+
Pkcs11ModulePathTextCtrl = new wxTextCtrl( sbSizer36->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizer129->Add( Pkcs11ModulePathTextCtrl, 1, wxALL, 5 );
-
+
SelectPkcs11ModuleButton = new wxButton( sbSizer36->GetStaticBox(), wxID_ANY, _("IDC_SELECT_PKCS11_MODULE"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer129->Add( SelectPkcs11ModuleButton, 0, wxALL, 5 );
-
-
+
+
sbSizer36->Add( bSizer129, 1, wxEXPAND, 5 );
-
-
+
+
bSizer128->Add( sbSizer36, 0, wxEXPAND|wxALL, 5 );
-
+
wxStaticBoxSizer* sbSizer37;
sbSizer37 = new wxStaticBoxSizer( new wxStaticBox( SecurityTokensPage, wxID_ANY, _("IDT_SECURITY_OPTIONS") ), wxVERTICAL );
-
+
CloseSecurityTokenSessionsAfterMountCheckBox = new wxCheckBox( sbSizer37->GetStaticBox(), wxID_ANY, _("IDC_CLOSE_TOKEN_SESSION_AFTER_MOUNT"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer37->Add( CloseSecurityTokenSessionsAfterMountCheckBox, 0, wxALL, 5 );
-
-
+
+
bSizer128->Add( sbSizer37, 0, wxEXPAND|wxALL, 5 );
-
-
+
+ wxStaticBoxSizer* sbSizer38;
+ sbSizer38 = new wxStaticBoxSizer( new wxStaticBox( SecurityTokensPage, wxID_ANY, _("IDT_EMV_OPTIONS") ), wxVERTICAL );
+
+ EMVSupportEnabledCheckBox = new wxCheckBox( sbSizer38->GetStaticBox(), wxID_ANY, _("IDC_ENABLE_EMV_SUPPORT"), wxDefaultPosition, wxDefaultSize, 0 );
+ sbSizer38->Add( EMVSupportEnabledCheckBox, 0, wxALL, 5 );
+
+
+ bSizer128->Add( sbSizer38, 0, wxALL|wxEXPAND, 5 );
+
+
bSizer127->Add( bSizer128, 1, wxEXPAND|wxALL, 5 );
-
-
+
+
SecurityTokensPage->SetSizer( bSizer127 );
SecurityTokensPage->Layout();
bSizer127->Fit( SecurityTokensPage );
@@ -2219,119 +2173,180 @@ PreferencesDialogBase::PreferencesDialogBase( wxWindow* parent, wxWindowID id, c
HotkeysPage = new wxPanel( PreferencesNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer51;
bSizer51 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer38;
bSizer38 = new wxBoxSizer( wxVERTICAL );
-
+
wxStaticBoxSizer* sbSizer21;
sbSizer21 = new wxStaticBoxSizer( new wxStaticBox( HotkeysPage, wxID_ANY, _("LINUX_SYSTEM_HOTKEYS") ), wxVERTICAL );
-
- HotkeyListCtrl = new wxListCtrl( sbSizer21->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES|wxSUNKEN_BORDER );
+
+ HotkeyListCtrl = new wxListCtrl( sbSizer21->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES|wxBORDER_SUNKEN );
sbSizer21->Add( HotkeyListCtrl, 1, wxALL|wxEXPAND, 5 );
-
+
wxStaticBoxSizer* sbSizer23;
sbSizer23 = new wxStaticBoxSizer( new wxStaticBox( sbSizer21->GetStaticBox(), wxID_ANY, _("SHORTCUT") ), wxVERTICAL );
-
+
wxFlexGridSizer* fgSizer4;
fgSizer4 = new wxFlexGridSizer( 2, 3, 0, 0 );
fgSizer4->SetFlexibleDirection( wxBOTH );
fgSizer4->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
-
+
wxStaticText* m_staticText10;
m_staticText10 = new wxStaticText( sbSizer23->GetStaticBox(), wxID_ANY, _("IDT_HOTKEY_KEY"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText10->Wrap( -1 );
-
fgSizer4->Add( m_staticText10, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT, 5 );
-
+
HotkeyTextCtrl = new wxTextCtrl( sbSizer23->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
- fgSizer4->Add( HotkeyTextCtrl, 0, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
-
+ fgSizer4->Add( HotkeyTextCtrl, 0, wxALL|wxEXPAND, 5 );
+
AssignHotkeyButton = new wxButton( sbSizer23->GetStaticBox(), wxID_ANY, _("IDC_HOTKEY_ASSIGN"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer4->Add( AssignHotkeyButton, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
-
-
+
+
fgSizer4->Add( 0, 0, 1, wxEXPAND, 5 );
-
+
wxGridSizer* gSizer4;
gSizer4 = new wxGridSizer( 1, 4, 0, 0 );
-
+
HotkeyControlCheckBox = new wxCheckBox( sbSizer23->GetStaticBox(), wxID_ANY, _("VK_CONTROL"), wxDefaultPosition, wxDefaultSize, 0 );
gSizer4->Add( HotkeyControlCheckBox, 0, wxALL, 5 );
-
+
HotkeyShiftCheckBox = new wxCheckBox( sbSizer23->GetStaticBox(), wxID_ANY, _("VK_SHIFT"), wxDefaultPosition, wxDefaultSize, 0 );
gSizer4->Add( HotkeyShiftCheckBox, 0, wxALL, 5 );
-
+
HotkeyAltCheckBox = new wxCheckBox( sbSizer23->GetStaticBox(), wxID_ANY, _("VK_ALT"), wxDefaultPosition, wxDefaultSize, 0 );
gSizer4->Add( HotkeyAltCheckBox, 0, wxALL, 5 );
-
+
HotkeyWinCheckBox = new wxCheckBox( sbSizer23->GetStaticBox(), wxID_ANY, _("VK_WIN"), wxDefaultPosition, wxDefaultSize, 0 );
gSizer4->Add( HotkeyWinCheckBox, 0, wxALL, 5 );
-
-
+
+
fgSizer4->Add( gSizer4, 1, wxEXPAND, 5 );
-
+
RemoveHotkeyButton = new wxButton( sbSizer23->GetStaticBox(), wxID_ANY, _("IDC_KEYREMOVE"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer4->Add( RemoveHotkeyButton, 1, wxALL, 5 );
-
-
+
+
sbSizer23->Add( fgSizer4, 1, wxALIGN_RIGHT, 5 );
-
-
+
+
sbSizer21->Add( sbSizer23, 0, wxEXPAND|wxALL, 5 );
-
+
wxStaticBoxSizer* sbSizer24;
sbSizer24 = new wxStaticBoxSizer( new wxStaticBox( sbSizer21->GetStaticBox(), wxID_ANY, _("IDT_FORMAT_OPTIONS") ), wxVERTICAL );
-
+
BeepAfterHotkeyMountDismountCheckBox = new wxCheckBox( sbSizer24->GetStaticBox(), wxID_ANY, _("LINUX_SOUND_NOTIFICATION"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer24->Add( BeepAfterHotkeyMountDismountCheckBox, 0, wxALL, 5 );
-
+
DisplayMessageAfterHotkeyDismountCheckBox = new wxCheckBox( sbSizer24->GetStaticBox(), wxID_ANY, _("LINUX_CONFIRM_AFTER_DISMOUNT"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer24->Add( DisplayMessageAfterHotkeyDismountCheckBox, 0, wxALL, 5 );
-
-
+
+
sbSizer21->Add( sbSizer24, 0, wxEXPAND|wxALL, 5 );
-
-
+
+
bSizer38->Add( sbSizer21, 1, wxEXPAND|wxALL, 5 );
-
-
+
+
bSizer51->Add( bSizer38, 1, wxEXPAND|wxALL, 5 );
-
-
+
+
HotkeysPage->SetSizer( bSizer51 );
HotkeysPage->Layout();
bSizer51->Fit( HotkeysPage );
PreferencesNotebook->AddPage( HotkeysPage, _("LINUX_HOTKEYS"), false );
-
+ LanguagesPage = new wxPanel( PreferencesNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
+ wxBoxSizer* bSizer170;
+ bSizer170 = new wxBoxSizer( wxVERTICAL );
+
+ wxBoxSizer* bSizer171;
+ bSizer171 = new wxBoxSizer( wxVERTICAL );
+
+ wxBoxSizer* bSizer173;
+ bSizer173 = new wxBoxSizer( wxVERTICAL );
+
+ wxStaticBoxSizer* sbSizer49;
+ sbSizer49 = new wxStaticBoxSizer( new wxStaticBox( LanguagesPage, wxID_ANY, _("LINUX_LANGUAGE") ), wxVERTICAL );
+
+ wxBoxSizer* bSizer174;
+ bSizer174 = new wxBoxSizer( wxHORIZONTAL );
+
+ m_staticText73 = new wxStaticText( sbSizer49->GetStaticBox(), wxID_ANY, _("IDT_ACTIVE_LANG_PACK"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_staticText73->Wrap( -1 );
+ bSizer174->Add( m_staticText73, 0, wxLEFT|wxTOP, 5 );
+
+ m_staticText74 = new wxStaticText( sbSizer49->GetStaticBox(), wxID_ANY, _("CURRENT_LANGUAGE_PACK"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_staticText74->Wrap( -1 );
+ bSizer174->Add( m_staticText74, 0, wxLEFT|wxRIGHT|wxTOP, 5 );
+
+
+ sbSizer49->Add( bSizer174, 0, wxBOTTOM, 5 );
+
+ wxWrapSizer* wSizer1;
+ wSizer1 = new wxWrapSizer( wxHORIZONTAL, wxWRAPSIZER_DEFAULT_FLAGS );
+
+ m_staticText72 = new wxStaticText( sbSizer49->GetStaticBox(), wxID_ANY, _("IDT_LANGPACK_AUTHORS"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_staticText72->Wrap( -1 );
+ wSizer1->Add( m_staticText72, 0, wxBOTTOM|wxLEFT, 5 );
+
+ m_staticText71 = new wxStaticText( sbSizer49->GetStaticBox(), wxID_ANY, _("LANGUAGE_TRANSLATORS"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_staticText71->Wrap( -1 );
+ wSizer1->Add( m_staticText71, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 );
+
+
+ sbSizer49->Add( wSizer1, 0, 0, 5 );
+
+ LanguageListBox = new wxListBox( sbSizer49->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE|wxLB_SORT );
+ sbSizer49->Add( LanguageListBox, 1, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
+
+ SysDefaultLangButton = new wxButton( sbSizer49->GetStaticBox(), wxID_ANY, _("LINUX_SELECT_SYS_DEFAULT_LANG"), wxDefaultPosition, wxDefaultSize, 0 );
+ sbSizer49->Add( SysDefaultLangButton, 0, wxALIGN_BOTTOM|wxALL|wxEXPAND, 5 );
+
+
+ bSizer173->Add( sbSizer49, 1, wxALL|wxEXPAND, 5 );
+
+
+ bSizer171->Add( bSizer173, 1, wxEXPAND, 5 );
+
+
+ bSizer170->Add( bSizer171, 1, wxALL|wxEXPAND, 5 );
+
+
+ LanguagesPage->SetSizer( bSizer170 );
+ LanguagesPage->Layout();
+ bSizer170->Fit( LanguagesPage );
+ PreferencesNotebook->AddPage( LanguagesPage, _("LINUX_LANGUAGE"), false );
+
bSizer178->Add( PreferencesNotebook, 1, wxEXPAND | wxALL, 5 );
-
+
wxBoxSizer* bSizer182;
bSizer182 = new wxBoxSizer( wxHORIZONTAL );
-
-
+
+
bSizer182->Add( 0, 0, 1, wxEXPAND, 5 );
-
+
OKButton = new wxButton( this, wxID_OK, _("IDOK"), wxDefaultPosition, wxDefaultSize, 0 );
+
OKButton->SetDefault();
-
- bSizer182->Add( OKButton, 0, wxALIGN_RIGHT|wxALL, 5 );
-
+ bSizer182->Add( OKButton, 0, wxALL, 5 );
+
CancelButton = new wxButton( this, wxID_CANCEL, _("IDCANCEL"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer182->Add( CancelButton, 0, wxALL, 5 );
-
-
+
+
bSizer178->Add( bSizer182, 0, wxALL|wxEXPAND, 5 );
-
-
+
+
bSizer32->Add( bSizer178, 1, wxEXPAND, 5 );
-
-
+
+
this->SetSizer( bSizer32 );
this->Layout();
bSizer32->Fit( this );
-
+
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( PreferencesDialogBase::OnClose ) );
+ PreferencesNotebook->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( PreferencesDialogBase::OnPageChanged ), NULL, this );
DismountOnScreenSaverCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnDismountOnScreenSaverCheckBoxClick ), NULL, this );
DismountOnPowerSavingCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnDismountOnPowerSavingCheckBoxClick ), NULL, this );
ForceAutoDismountCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnForceAutoDismountCheckBoxClick ), NULL, this );
@@ -2344,6 +2359,7 @@ PreferencesDialogBase::PreferencesDialogBase( wxWindow* parent, wxWindowID id, c
HotkeyListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( PreferencesDialogBase::OnHotkeyListItemSelected ), NULL, this );
AssignHotkeyButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnAssignHotkeyButtonClick ), NULL, this );
RemoveHotkeyButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnRemoveHotkeyButtonClick ), NULL, this );
+ SysDefaultLangButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnSysDefaultLangButtonClick ), NULL, this );
OKButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnOKButtonClick ), NULL, this );
}
@@ -2351,6 +2367,7 @@ PreferencesDialogBase::~PreferencesDialogBase()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( PreferencesDialogBase::OnClose ) );
+ PreferencesNotebook->Disconnect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( PreferencesDialogBase::OnPageChanged ), NULL, this );
DismountOnScreenSaverCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnDismountOnScreenSaverCheckBoxClick ), NULL, this );
DismountOnPowerSavingCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnDismountOnPowerSavingCheckBoxClick ), NULL, this );
ForceAutoDismountCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnForceAutoDismountCheckBoxClick ), NULL, this );
@@ -2363,121 +2380,118 @@ PreferencesDialogBase::~PreferencesDialogBase()
HotkeyListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( PreferencesDialogBase::OnHotkeyListItemSelected ), NULL, this );
AssignHotkeyButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnAssignHotkeyButtonClick ), NULL, this );
RemoveHotkeyButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnRemoveHotkeyButtonClick ), NULL, this );
+ SysDefaultLangButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnSysDefaultLangButtonClick ), NULL, this );
OKButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnOKButtonClick ), NULL, this );
-
+
}
RandomPoolEnrichmentDialogBase::RandomPoolEnrichmentDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
-
+
MainSizer = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer144;
bSizer144 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer145;
bSizer145 = new wxBoxSizer( wxHORIZONTAL );
-
-
+
+
bSizer145->Add( 0, 0, 1, wxEXPAND, 5 );
-
+
wxStaticText* m_staticText49;
m_staticText49 = new wxStaticText( this, wxID_ANY, _("IDT_PRF"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText49->Wrap( -1 );
-
bSizer145->Add( m_staticText49, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
-
+
wxArrayString HashChoiceChoices;
HashChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, HashChoiceChoices, 0 );
HashChoice->SetSelection( 0 );
bSizer145->Add( HashChoice, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
-
-
+
+
bSizer145->Add( 0, 0, 1, wxEXPAND, 5 );
-
-
+
+
bSizer144->Add( bSizer145, 0, wxEXPAND, 5 );
-
+
wxStaticBoxSizer* sbSizer43;
sbSizer43 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL );
-
+
wxBoxSizer* bSizer147;
bSizer147 = new wxBoxSizer( wxHORIZONTAL );
-
+
wxStaticText* m_staticText52;
m_staticText52 = new wxStaticText( sbSizer43->GetStaticBox(), wxID_ANY, _("IDT_RANDOM_POOL"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText52->Wrap( -1 );
-
bSizer147->Add( m_staticText52, 0, wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
-
+
RandomPoolStaticText = new wxStaticText( sbSizer43->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
RandomPoolStaticText->Wrap( -1 );
-
RandomPoolStaticText->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("Courier New") ) );
-
+
bSizer147->Add( RandomPoolStaticText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
-
+
ShowRandomPoolCheckBox = new wxCheckBox( sbSizer43->GetStaticBox(), wxID_ANY, _("IDC_DISPLAY_POOL_CONTENTS"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer147->Add( ShowRandomPoolCheckBox, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
-
-
+
+
sbSizer43->Add( bSizer147, 0, wxEXPAND|wxTOP, 5 );
-
-
+
+
sbSizer43->Add( 0, 0, 1, wxEXPAND, 5 );
-
+
wxStaticBoxSizer* sbSizer45;
sbSizer45 = new wxStaticBoxSizer( new wxStaticBox( sbSizer43->GetStaticBox(), wxID_ANY, _("IDT_ENTROPY_BAR") ), wxVERTICAL );
-
+
CollectedEntropy = new wxGauge( sbSizer45->GetStaticBox(), wxID_ANY, 2560, wxDefaultPosition, wxDefaultSize, wxGA_HORIZONTAL|wxGA_SMOOTH );
- CollectedEntropy->SetValue( 0 );
+ CollectedEntropy->SetValue( 0 );
sbSizer45->Add( CollectedEntropy, 0, wxALL|wxEXPAND, 5 );
-
-
+
+
sbSizer43->Add( sbSizer45, 0, wxBOTTOM|wxEXPAND|wxTOP, 5 );
-
-
+
+
sbSizer43->Add( 0, 0, 1, wxEXPAND, 5 );
-
+
MouseStaticText = new wxStaticText( sbSizer43->GetStaticBox(), wxID_ANY, _("IDT_RANDOM_POOL_ENRICHMENT_NOTE"), wxDefaultPosition, wxDefaultSize, 0 );
MouseStaticText->Wrap( -1 );
-
sbSizer43->Add( MouseStaticText, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
-
-
+
+
sbSizer43->Add( 0, 0, 1, wxEXPAND, 5 );
-
-
+
+
bSizer144->Add( sbSizer43, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
-
+
wxBoxSizer* bSizer146;
bSizer146 = new wxBoxSizer( wxHORIZONTAL );
-
-
+
+
bSizer146->Add( 0, 0, 1, wxEXPAND, 5 );
-
+
ContinueButton = new wxButton( this, wxID_OK, _("CONTINUE"), wxDefaultPosition, wxDefaultSize, 0 );
+
ContinueButton->SetDefault();
-
bSizer146->Add( ContinueButton, 0, wxALL, 5 );
-
-
+
+
bSizer146->Add( 0, 0, 1, wxEXPAND, 5 );
-
-
+
+
bSizer144->Add( bSizer146, 0, wxEXPAND, 5 );
-
-
+
+
MainSizer->Add( bSizer144, 1, wxEXPAND|wxALL, 5 );
-
-
+
+
this->SetSizer( MainSizer );
this->Layout();
MainSizer->Fit( this );
-
+
this->Centre( wxBOTH );
-
+
// Connect Events
this->Connect( wxEVT_MOTION, wxMouseEventHandler( RandomPoolEnrichmentDialogBase::OnMouseMotion ) );
HashChoice->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( RandomPoolEnrichmentDialogBase::OnHashSelected ), NULL, this );
@@ -2490,69 +2504,69 @@ RandomPoolEnrichmentDialogBase::~RandomPoolEnrichmentDialogBase()
this->Disconnect( wxEVT_MOTION, wxMouseEventHandler( RandomPoolEnrichmentDialogBase::OnMouseMotion ) );
HashChoice->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( RandomPoolEnrichmentDialogBase::OnHashSelected ), NULL, this );
ShowRandomPoolCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( RandomPoolEnrichmentDialogBase::OnShowRandomPoolCheckBoxClicked ), NULL, this );
-
+
}
SecurityTokenKeyfilesDialogBase::SecurityTokenKeyfilesDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
this->SetExtraStyle( this->GetExtraStyle() | wxWS_EX_VALIDATE_RECURSIVELY );
-
+
wxBoxSizer* bSizer3;
bSizer3 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer138;
bSizer138 = new wxBoxSizer( wxHORIZONTAL );
-
+
wxBoxSizer* bSizer142;
bSizer142 = new wxBoxSizer( wxVERTICAL );
-
- SecurityTokenKeyfileListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_VRULES|wxSUNKEN_BORDER );
+
+ SecurityTokenKeyfileListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_VRULES|wxBORDER_SUNKEN );
bSizer142->Add( SecurityTokenKeyfileListCtrl, 1, wxALL|wxEXPAND, 5 );
-
+
wxBoxSizer* bSizer141;
bSizer141 = new wxBoxSizer( wxHORIZONTAL );
-
+
ExportButton = new wxButton( this, wxID_ANY, _("IDC_EXPORT"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer141->Add( ExportButton, 0, wxALL, 5 );
-
+
DeleteButton = new wxButton( this, wxID_ANY, _("VKEY_2E"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer141->Add( DeleteButton, 0, wxALL, 5 );
-
-
+
+
bSizer141->Add( 0, 0, 1, wxEXPAND|wxLEFT, 5 );
-
+
ImportButton = new wxButton( this, wxID_ANY, _("IDC_IMPORT_KEYFILE"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer141->Add( ImportButton, 0, wxALL, 5 );
-
-
+
+
bSizer142->Add( bSizer141, 0, wxEXPAND, 5 );
-
-
+
+
bSizer138->Add( bSizer142, 1, wxEXPAND, 5 );
-
+
wxBoxSizer* bSizer139;
bSizer139 = new wxBoxSizer( wxVERTICAL );
-
+
OKButton = new wxButton( this, wxID_OK, _("IDOK"), wxDefaultPosition, wxDefaultSize, 0 );
+
OKButton->SetDefault();
-
bSizer139->Add( OKButton, 0, wxALL, 5 );
-
+
CancelButton = new wxButton( this, wxID_CANCEL, _("IDCANCEL"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer139->Add( CancelButton, 0, wxALL, 5 );
-
-
+
+
bSizer138->Add( bSizer139, 0, wxEXPAND, 5 );
-
-
+
+
bSizer3->Add( bSizer138, 1, wxEXPAND|wxALL, 5 );
-
-
+
+
this->SetSizer( bSizer3 );
this->Layout();
bSizer3->Fit( this );
-
+
// Connect Events
SecurityTokenKeyfileListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( SecurityTokenKeyfilesDialogBase::OnListItemActivated ), NULL, this );
SecurityTokenKeyfileListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( SecurityTokenKeyfilesDialogBase::OnListItemDeselected ), NULL, this );
@@ -2573,47 +2587,47 @@ SecurityTokenKeyfilesDialogBase::~SecurityTokenKeyfilesDialogBase()
DeleteButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SecurityTokenKeyfilesDialogBase::OnDeleteButtonClick ), NULL, this );
ImportButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SecurityTokenKeyfilesDialogBase::OnImportButtonClick ), NULL, this );
OKButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SecurityTokenKeyfilesDialogBase::OnOKButtonClick ), NULL, this );
-
+
}
VolumePropertiesDialogBase::VolumePropertiesDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
-
+
wxBoxSizer* bSizer49;
bSizer49 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer50;
bSizer50 = new wxBoxSizer( wxVERTICAL );
-
- PropertiesListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_VRULES|wxSUNKEN_BORDER );
+
+ PropertiesListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_VRULES|wxBORDER_SUNKEN );
bSizer50->Add( PropertiesListCtrl, 1, wxALL|wxEXPAND, 5 );
-
+
wxBoxSizer* bSizer169;
bSizer169 = new wxBoxSizer( wxHORIZONTAL );
-
-
+
+
bSizer169->Add( 0, 0, 1, wxEXPAND, 5 );
-
+
OKButton = new wxButton( this, wxID_OK, _("IDOK"), wxDefaultPosition, wxDefaultSize, 0 );
+
OKButton->SetDefault();
-
bSizer169->Add( OKButton, 0, wxALL, 5 );
-
-
+
+
bSizer169->Add( 0, 0, 1, wxEXPAND, 5 );
-
-
+
+
bSizer50->Add( bSizer169, 0, wxALL|wxEXPAND, 5 );
-
-
+
+
bSizer49->Add( bSizer50, 1, wxEXPAND|wxALL, 5 );
-
-
+
+
this->SetSizer( bSizer49 );
this->Layout();
bSizer49->Fit( this );
-
+
// Connect Events
OKButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( VolumePropertiesDialogBase::OnOKButtonClick ), NULL, this );
}
@@ -2622,93 +2636,92 @@ VolumePropertiesDialogBase::~VolumePropertiesDialogBase()
{
// Disconnect Events
OKButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( VolumePropertiesDialogBase::OnOKButtonClick ), NULL, this );
-
+
}
-EncryptionOptionsWizardPageBase::EncryptionOptionsWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : WizardPage( parent, id, pos, size, style )
+EncryptionOptionsWizardPageBase::EncryptionOptionsWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : WizardPage( parent, id, pos, size, style, name )
{
wxBoxSizer* bSizer93;
bSizer93 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer94;
bSizer94 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer95;
bSizer95 = new wxBoxSizer( wxVERTICAL );
-
+
wxStaticBoxSizer* sbSizer29;
sbSizer29 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("ENCRYPTION_ALGORITHM_LV") ), wxVERTICAL );
-
+
wxBoxSizer* bSizer96;
bSizer96 = new wxBoxSizer( wxHORIZONTAL );
-
+
wxArrayString EncryptionAlgorithmChoiceChoices;
EncryptionAlgorithmChoice = new wxChoice( sbSizer29->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, EncryptionAlgorithmChoiceChoices, 0 );
EncryptionAlgorithmChoice->SetSelection( 0 );
bSizer96->Add( EncryptionAlgorithmChoice, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
-
+
TestButton = new wxButton( sbSizer29->GetStaticBox(), wxID_ANY, _("TEST"), wxDefaultPosition, wxDefaultSize, 0 );
- bSizer96->Add( TestButton, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
-
-
+ bSizer96->Add( TestButton, 0, wxALL|wxEXPAND, 5 );
+
+
sbSizer29->Add( bSizer96, 0, wxEXPAND, 5 );
-
+
EncryptionAlgorithmStaticText = new wxStaticText( sbSizer29->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
EncryptionAlgorithmStaticText->Wrap( -1 );
-
sbSizer29->Add( EncryptionAlgorithmStaticText, 1, wxALL|wxEXPAND, 5 );
-
+
wxBoxSizer* bSizer97;
bSizer97 = new wxBoxSizer( wxHORIZONTAL );
-
+
EncryptionAlgorithmHyperlink = new wxHyperlinkCtrl( sbSizer29->GetStaticBox(), wxID_ANY, _("IDC_LINK_MORE_INFO_ABOUT_CIPHER"), wxEmptyString, wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
-
+
EncryptionAlgorithmHyperlink->SetHoverColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) );
EncryptionAlgorithmHyperlink->SetNormalColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) );
EncryptionAlgorithmHyperlink->SetVisitedColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) );
bSizer97->Add( EncryptionAlgorithmHyperlink, 0, wxALL, 5 );
-
-
+
+
bSizer97->Add( 0, 0, 1, wxEXPAND, 5 );
-
+
BenchmarkButton = new wxButton( sbSizer29->GetStaticBox(), wxID_ANY, _("IDC_BENCHMARK"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer97->Add( BenchmarkButton, 0, wxALL, 5 );
-
-
+
+
sbSizer29->Add( bSizer97, 0, wxEXPAND, 5 );
-
-
+
+
bSizer95->Add( sbSizer29, 1, wxEXPAND|wxALL, 5 );
-
+
wxStaticBoxSizer* sbSizer30;
sbSizer30 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("IDT_HASH_ALGO") ), wxHORIZONTAL );
-
+
wxArrayString HashChoiceChoices;
HashChoice = new wxChoice( sbSizer30->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, HashChoiceChoices, 0 );
HashChoice->SetSelection( 0 );
sbSizer30->Add( HashChoice, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
-
+
HashHyperlink = new wxHyperlinkCtrl( sbSizer30->GetStaticBox(), wxID_ANY, _("IDC_LINK_HASH_INFO"), wxEmptyString, wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
-
+
HashHyperlink->SetHoverColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) );
HashHyperlink->SetNormalColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) );
HashHyperlink->SetVisitedColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) );
sbSizer30->Add( HashHyperlink, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
-
-
+
+
bSizer95->Add( sbSizer30, 0, wxEXPAND|wxALL, 5 );
-
-
+
+
bSizer94->Add( bSizer95, 1, wxEXPAND, 5 );
-
-
+
+
bSizer93->Add( bSizer94, 1, wxEXPAND, 5 );
-
-
+
+
this->SetSizer( bSizer93 );
this->Layout();
bSizer93->Fit( this );
-
+
// Connect Events
EncryptionAlgorithmChoice->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( EncryptionOptionsWizardPageBase::OnEncryptionAlgorithmSelected ), NULL, this );
TestButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( EncryptionOptionsWizardPageBase::OnTestButtonClick ), NULL, this );
@@ -2725,25 +2738,24 @@ EncryptionOptionsWizardPageBase::~EncryptionOptionsWizardPageBase()
EncryptionAlgorithmHyperlink->Disconnect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( EncryptionOptionsWizardPageBase::OnEncryptionAlgorithmHyperlinkClick ), NULL, this );
BenchmarkButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( EncryptionOptionsWizardPageBase::OnBenchmarkButtonClick ), NULL, this );
HashHyperlink->Disconnect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( EncryptionOptionsWizardPageBase::OnHashHyperlinkClick ), NULL, this );
-
+
}
-InfoWizardPageBase::InfoWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : WizardPage( parent, id, pos, size, style )
+InfoWizardPageBase::InfoWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : WizardPage( parent, id, pos, size, style, name )
{
wxBoxSizer* bSizer71;
bSizer71 = new wxBoxSizer( wxVERTICAL );
-
+
InfoPageSizer = new wxBoxSizer( wxVERTICAL );
-
+
InfoStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
InfoStaticText->Wrap( -1 );
-
InfoPageSizer->Add( InfoStaticText, 1, wxALL|wxEXPAND, 5 );
-
-
+
+
bSizer71->Add( InfoPageSizer, 1, wxEXPAND, 5 );
-
-
+
+
this->SetSizer( bSizer71 );
this->Layout();
bSizer71->Fit( this );
@@ -2753,54 +2765,54 @@ InfoWizardPageBase::~InfoWizardPageBase()
{
}
-KeyfilesPanelBase::KeyfilesPanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
+KeyfilesPanelBase::KeyfilesPanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
{
this->SetMinSize( wxSize( 500,300 ) );
-
+
wxBoxSizer* bSizer19;
bSizer19 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer20;
bSizer20 = new wxBoxSizer( wxHORIZONTAL );
-
+
wxBoxSizer* bSizer21;
bSizer21 = new wxBoxSizer( wxVERTICAL );
-
- KeyfilesListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxSUNKEN_BORDER );
+
+ KeyfilesListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxBORDER_SUNKEN );
bSizer21->Add( KeyfilesListCtrl, 1, wxEXPAND|wxALL, 5 );
-
+
wxBoxSizer* bSizer137;
bSizer137 = new wxBoxSizer( wxHORIZONTAL );
-
+
AddFilesButton = new wxButton( this, wxID_ANY, _("IDC_KEYADD"), wxDefaultPosition, wxDefaultSize, 0 );
- bSizer137->Add( AddFilesButton, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
-
+ bSizer137->Add( AddFilesButton, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 5 );
+
AddDirectoryButton = new wxButton( this, wxID_ANY, _("IDC_ADD_KEYFILE_PATH"), wxDefaultPosition, wxDefaultSize, 0 );
- bSizer137->Add( AddDirectoryButton, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
-
+ bSizer137->Add( AddDirectoryButton, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 5 );
+
AddSecurityTokenSignatureButton = new wxButton( this, wxID_ANY, _("IDC_TOKEN_FILES_ADD"), wxDefaultPosition, wxDefaultSize, 0 );
- bSizer137->Add( AddSecurityTokenSignatureButton, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
-
+ bSizer137->Add( AddSecurityTokenSignatureButton, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 5 );
+
RemoveButton = new wxButton( this, wxID_ANY, _("IDC_KEYREMOVE"), wxDefaultPosition, wxDefaultSize, 0 );
- bSizer137->Add( RemoveButton, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
-
+ bSizer137->Add( RemoveButton, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 5 );
+
RemoveAllButton = new wxButton( this, wxID_ANY, _("IDC_KEYREMOVEALL"), wxDefaultPosition, wxDefaultSize, 0 );
- bSizer137->Add( RemoveAllButton, 0, wxEXPAND|wxALL, 5 );
-
-
+ bSizer137->Add( RemoveAllButton, 0, wxALL|wxEXPAND, 5 );
+
+
bSizer21->Add( bSizer137, 0, wxEXPAND, 5 );
-
-
+
+
bSizer20->Add( bSizer21, 1, wxEXPAND, 5 );
-
-
+
+
bSizer19->Add( bSizer20, 1, wxEXPAND, 5 );
-
-
+
+
this->SetSizer( bSizer19 );
this->Layout();
bSizer19->Fit( this );
-
+
// Connect Events
KeyfilesListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( KeyfilesPanelBase::OnListItemDeselected ), NULL, this );
KeyfilesListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( KeyfilesPanelBase::OnListItemSelected ), NULL, this );
@@ -2823,44 +2835,43 @@ KeyfilesPanelBase::~KeyfilesPanelBase()
AddSecurityTokenSignatureButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( KeyfilesPanelBase::OnAddSecurityTokenSignatureButtonClick ), NULL, this );
RemoveButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( KeyfilesPanelBase::OnRemoveButtonClick ), NULL, this );
RemoveAllButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( KeyfilesPanelBase::OnRemoveAllButtonClick ), NULL, this );
-
+
}
-ProgressWizardPageBase::ProgressWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : WizardPage( parent, id, pos, size, style )
+ProgressWizardPageBase::ProgressWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : WizardPage( parent, id, pos, size, style, name )
{
wxBoxSizer* bSizer81;
bSizer81 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer82;
bSizer82 = new wxBoxSizer( wxVERTICAL );
-
+
ProgressSizer = new wxBoxSizer( wxHORIZONTAL );
-
+
ProgressGauge = new wxGauge( this, wxID_ANY, 100, wxDefaultPosition, wxSize( -1,-1 ), wxGA_HORIZONTAL|wxGA_SMOOTH );
- ProgressGauge->SetValue( 0 );
+ ProgressGauge->SetValue( 0 );
ProgressSizer->Add( ProgressGauge, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
-
+
AbortButton = new wxButton( this, wxID_ANY, _("IDC_ABORT_BUTTON"), wxDefaultPosition, wxDefaultSize, 0 );
AbortButton->Enable( false );
-
+
ProgressSizer->Add( AbortButton, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
-
-
+
+
bSizer82->Add( ProgressSizer, 0, wxEXPAND, 5 );
-
+
InfoStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
InfoStaticText->Wrap( -1 );
-
bSizer82->Add( InfoStaticText, 0, wxALL|wxEXPAND, 5 );
-
-
+
+
bSizer81->Add( bSizer82, 0, wxEXPAND, 5 );
-
-
+
+
this->SetSizer( bSizer81 );
this->Layout();
bSizer81->Fit( this );
-
+
// Connect Events
AbortButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ProgressWizardPageBase::OnAbortButtonClick ), NULL, this );
}
@@ -2869,44 +2880,43 @@ ProgressWizardPageBase::~ProgressWizardPageBase()
{
// Disconnect Events
AbortButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ProgressWizardPageBase::OnAbortButtonClick ), NULL, this );
-
+
}
-SelectDirectoryWizardPageBase::SelectDirectoryWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : WizardPage( parent, id, pos, size, style )
+SelectDirectoryWizardPageBase::SelectDirectoryWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : WizardPage( parent, id, pos, size, style, name )
{
this->SetMinSize( wxSize( 200,65 ) );
-
+
wxBoxSizer* bSizer68;
bSizer68 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer69;
bSizer69 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer70;
bSizer70 = new wxBoxSizer( wxHORIZONTAL );
-
+
DirectoryTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizer70->Add( DirectoryTextCtrl, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
-
+
BrowseButton = new wxButton( this, wxID_ANY, _("IDC_BROWSE_FILES"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer70->Add( BrowseButton, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
-
-
+
+
bSizer69->Add( bSizer70, 0, wxEXPAND, 5 );
-
+
InfoStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
InfoStaticText->Wrap( 300 );
-
bSizer69->Add( InfoStaticText, 1, wxALL|wxEXPAND, 5 );
-
-
+
+
bSizer68->Add( bSizer69, 1, wxEXPAND, 5 );
-
-
+
+
this->SetSizer( bSizer68 );
this->Layout();
bSizer68->Fit( this );
-
+
// Connect Events
DirectoryTextCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( SelectDirectoryWizardPageBase::OnDirectoryTextChanged ), NULL, this );
BrowseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SelectDirectoryWizardPageBase::OnBrowseButtonClick ), NULL, this );
@@ -2917,39 +2927,38 @@ SelectDirectoryWizardPageBase::~SelectDirectoryWizardPageBase()
// Disconnect Events
DirectoryTextCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( SelectDirectoryWizardPageBase::OnDirectoryTextChanged ), NULL, this );
BrowseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SelectDirectoryWizardPageBase::OnBrowseButtonClick ), NULL, this );
-
+
}
-SingleChoiceWizardPageBase::SingleChoiceWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : WizardPage( parent, id, pos, size, style )
+SingleChoiceWizardPageBase::SingleChoiceWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : WizardPage( parent, id, pos, size, style, name )
{
wxBoxSizer* bSizer71;
bSizer71 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer77;
bSizer77 = new wxBoxSizer( wxVERTICAL );
-
-
+
+
bSizer77->Add( 0, 0, 0, wxEXPAND|wxTOP, 5 );
-
+
OuterChoicesSizer = new wxBoxSizer( wxVERTICAL );
-
+
ChoicesSizer = new wxBoxSizer( wxVERTICAL );
-
-
+
+
OuterChoicesSizer->Add( ChoicesSizer, 0, wxEXPAND, 5 );
-
-
+
+
bSizer77->Add( OuterChoicesSizer, 0, wxEXPAND, 5 );
-
+
InfoStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
InfoStaticText->Wrap( -1 );
-
bSizer77->Add( InfoStaticText, 1, wxALL|wxEXPAND, 5 );
-
-
+
+
bSizer71->Add( bSizer77, 1, wxEXPAND, 5 );
-
-
+
+
this->SetSizer( bSizer71 );
this->Layout();
bSizer71->Fit( this );
@@ -2959,211 +2968,198 @@ SingleChoiceWizardPageBase::~SingleChoiceWizardPageBase()
{
}
-VolumeCreationProgressWizardPageBase::VolumeCreationProgressWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : WizardPage( parent, id, pos, size, style )
+VolumeCreationProgressWizardPageBase::VolumeCreationProgressWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : WizardPage( parent, id, pos, size, style, name )
{
wxBoxSizer* bSizer104;
bSizer104 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer105;
bSizer105 = new wxBoxSizer( wxVERTICAL );
-
+
wxStaticBoxSizer* sbSizer31;
sbSizer31 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL );
-
+
KeySamplesUpperSizer = new wxBoxSizer( wxVERTICAL );
-
+
KeySamplesUpperInnerSizer = new wxBoxSizer( wxVERTICAL );
-
-
+
+
KeySamplesUpperSizer->Add( KeySamplesUpperInnerSizer, 1, wxEXPAND|wxTOP, 3 );
-
-
+
+
sbSizer31->Add( KeySamplesUpperSizer, 1, wxEXPAND, 30 );
-
+
wxFlexGridSizer* fgSizer5;
fgSizer5 = new wxFlexGridSizer( 3, 2, 0, 0 );
fgSizer5->SetFlexibleDirection( wxBOTH );
fgSizer5->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
-
+
wxStaticText* m_staticText25;
m_staticText25 = new wxStaticText( sbSizer31->GetStaticBox(), wxID_ANY, _("IDT_RANDOM_POOL"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText25->Wrap( -1 );
-
fgSizer5->Add( m_staticText25, 0, wxALL|wxALIGN_RIGHT|wxALIGN_BOTTOM, 5 );
-
+
wxBoxSizer* bSizer126;
bSizer126 = new wxBoxSizer( wxHORIZONTAL );
-
+
RandomPoolSampleStaticText = new wxStaticText( sbSizer31->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
RandomPoolSampleStaticText->Wrap( -1 );
-
RandomPoolSampleStaticText->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("Courier New") ) );
-
- bSizer126->Add( RandomPoolSampleStaticText, 0, wxEXPAND|wxTOP|wxRIGHT|wxALIGN_BOTTOM, 7 );
-
+
+ bSizer126->Add( RandomPoolSampleStaticText, 0, wxEXPAND|wxTOP|wxRIGHT, 7 );
+
DisplayKeysCheckBox = new wxCheckBox( sbSizer31->GetStaticBox(), wxID_ANY, _("IDC_DISPLAY_POOL_CONTENTS"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer126->Add( DisplayKeysCheckBox, 0, wxEXPAND|wxRIGHT, 5 );
-
-
- fgSizer5->Add( bSizer126, 1, wxEXPAND|wxALIGN_BOTTOM, 5 );
-
+
+
+ fgSizer5->Add( bSizer126, 1, wxEXPAND, 5 );
+
wxStaticText* m_staticText28;
m_staticText28 = new wxStaticText( sbSizer31->GetStaticBox(), wxID_ANY, _("IDT_HEADER_KEY"), wxDefaultPosition, wxSize( -1,-1 ), 0 );
m_staticText28->Wrap( -1 );
-
fgSizer5->Add( m_staticText28, 0, wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_BOTTOM, 5 );
-
+
HeaderKeySampleStaticText = new wxStaticText( sbSizer31->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
HeaderKeySampleStaticText->Wrap( -1 );
-
HeaderKeySampleStaticText->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("Courier New") ) );
-
- fgSizer5->Add( HeaderKeySampleStaticText, 0, wxALIGN_BOTTOM|wxEXPAND|wxTOP|wxRIGHT, 2 );
-
+
+ fgSizer5->Add( HeaderKeySampleStaticText, 0, wxEXPAND|wxTOP|wxRIGHT, 2 );
+
wxStaticText* m_staticText29;
m_staticText29 = new wxStaticText( sbSizer31->GetStaticBox(), wxID_ANY, _("IDT_MASTER_KEY"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText29->Wrap( -1 );
-
fgSizer5->Add( m_staticText29, 0, wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_BOTTOM, 5 );
-
+
MasterKeySampleStaticText = new wxStaticText( sbSizer31->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
MasterKeySampleStaticText->Wrap( -1 );
-
MasterKeySampleStaticText->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("Courier New") ) );
-
- fgSizer5->Add( MasterKeySampleStaticText, 0, wxEXPAND|wxALIGN_BOTTOM|wxTOP|wxRIGHT, 2 );
-
-
+
+ fgSizer5->Add( MasterKeySampleStaticText, 0, wxEXPAND|wxTOP|wxRIGHT, 2 );
+
+
sbSizer31->Add( fgSizer5, 0, wxEXPAND, 5 );
-
-
+
+
bSizer105->Add( sbSizer31, 0, wxALL|wxEXPAND, 5 );
-
+
wxStaticBoxSizer* sbSizer45;
sbSizer45 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("IDT_ENTROPY_BAR") ), wxVERTICAL );
-
+
CollectedEntropy = new wxGauge( sbSizer45->GetStaticBox(), wxID_ANY, 2560, wxDefaultPosition, wxDefaultSize, wxGA_HORIZONTAL|wxGA_SMOOTH );
- CollectedEntropy->SetValue( 0 );
+ CollectedEntropy->SetValue( 0 );
sbSizer45->Add( CollectedEntropy, 0, wxALL|wxEXPAND, 5 );
-
-
+
+
bSizer105->Add( sbSizer45, 0, wxEXPAND|wxLEFT|wxRIGHT, 5 );
-
+
wxStaticBoxSizer* sbSizer32;
sbSizer32 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL );
-
+
wxBoxSizer* bSizer106;
bSizer106 = new wxBoxSizer( wxHORIZONTAL );
-
+
ProgressGauge = new wxGauge( sbSizer32->GetStaticBox(), wxID_ANY, 100, wxDefaultPosition, wxDefaultSize, wxGA_HORIZONTAL|wxGA_SMOOTH );
bSizer106->Add( ProgressGauge, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
-
+
AbortButton = new wxButton( sbSizer32->GetStaticBox(), wxID_ANY, _("IDC_ABORT_BUTTON"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer106->Add( AbortButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
-
-
+
+
sbSizer32->Add( bSizer106, 0, wxEXPAND, 5 );
-
+
wxGridSizer* gSizer6;
gSizer6 = new wxGridSizer( 1, 3, 0, 0 );
-
+
wxBoxSizer* bSizer108;
bSizer108 = new wxBoxSizer( wxHORIZONTAL );
-
+
m_staticText31 = new wxStaticText( sbSizer32->GetStaticBox(), wxID_ANY, _("IDT_DONE"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText31->Wrap( -1 );
-
bSizer108->Add( m_staticText31, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
-
- m_panel12 = new wxPanel( sbSizer32->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxSUNKEN_BORDER );
+
+ m_panel12 = new wxPanel( sbSizer32->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxBORDER_SUNKEN );
wxBoxSizer* bSizer115;
bSizer115 = new wxBoxSizer( wxHORIZONTAL );
-
+
SizeDoneStaticText = new wxStaticText( m_panel12, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE );
SizeDoneStaticText->Wrap( -1 );
-
- bSizer115->Add( SizeDoneStaticText, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, 3 );
-
-
+ bSizer115->Add( SizeDoneStaticText, 1, wxEXPAND|wxALL, 3 );
+
+
m_panel12->SetSizer( bSizer115 );
m_panel12->Layout();
bSizer115->Fit( m_panel12 );
- bSizer108->Add( m_panel12, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
-
-
- gSizer6->Add( bSizer108, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
-
+ bSizer108->Add( m_panel12, 1, wxEXPAND|wxALL, 5 );
+
+
+ gSizer6->Add( bSizer108, 1, wxEXPAND, 5 );
+
wxBoxSizer* bSizer1081;
bSizer1081 = new wxBoxSizer( wxHORIZONTAL );
-
+
m_staticText311 = new wxStaticText( sbSizer32->GetStaticBox(), wxID_ANY, _("IDT_SPEED"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText311->Wrap( -1 );
-
bSizer1081->Add( m_staticText311, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
-
- m_panel121 = new wxPanel( sbSizer32->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER );
+
+ m_panel121 = new wxPanel( sbSizer32->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN );
wxBoxSizer* bSizer1151;
bSizer1151 = new wxBoxSizer( wxHORIZONTAL );
-
+
SpeedStaticText = new wxStaticText( m_panel121, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE );
SpeedStaticText->Wrap( -1 );
-
- bSizer1151->Add( SpeedStaticText, 1, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 3 );
-
-
+ bSizer1151->Add( SpeedStaticText, 1, wxALL|wxEXPAND, 3 );
+
+
m_panel121->SetSizer( bSizer1151 );
m_panel121->Layout();
bSizer1151->Fit( m_panel121 );
- bSizer1081->Add( m_panel121, 1, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
-
-
- gSizer6->Add( bSizer1081, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
-
+ bSizer1081->Add( m_panel121, 1, wxALL|wxEXPAND, 5 );
+
+
+ gSizer6->Add( bSizer1081, 1, wxEXPAND, 5 );
+
wxBoxSizer* bSizer1082;
bSizer1082 = new wxBoxSizer( wxHORIZONTAL );
-
+
m_staticText312 = new wxStaticText( sbSizer32->GetStaticBox(), wxID_ANY, _("IDT_LEFT"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText312->Wrap( -1 );
-
bSizer1082->Add( m_staticText312, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
-
- m_panel122 = new wxPanel( sbSizer32->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
+
+ m_panel122 = new wxPanel( sbSizer32->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL|wxBORDER_SUNKEN );
wxBoxSizer* bSizer1152;
bSizer1152 = new wxBoxSizer( wxHORIZONTAL );
-
+
TimeLeftStaticText = new wxStaticText( m_panel122, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE );
TimeLeftStaticText->Wrap( -1 );
-
- bSizer1152->Add( TimeLeftStaticText, 1, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 3 );
-
-
+ bSizer1152->Add( TimeLeftStaticText, 1, wxALL|wxEXPAND, 3 );
+
+
m_panel122->SetSizer( bSizer1152 );
m_panel122->Layout();
bSizer1152->Fit( m_panel122 );
bSizer1082->Add( m_panel122, 1, wxALL|wxEXPAND, 5 );
-
-
- gSizer6->Add( bSizer1082, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
-
-
+
+
+ gSizer6->Add( bSizer1082, 1, wxEXPAND, 5 );
+
+
sbSizer32->Add( gSizer6, 0, wxEXPAND|wxTOP, 2 );
-
-
+
+
bSizer105->Add( sbSizer32, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
-
+
InfoStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
InfoStaticText->Wrap( -1 );
-
bSizer105->Add( InfoStaticText, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
-
-
+
+
bSizer104->Add( bSizer105, 1, wxEXPAND, 5 );
-
-
+
+
this->SetSizer( bSizer104 );
this->Layout();
bSizer104->Fit( this );
-
+
// Connect Events
DisplayKeysCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumeCreationProgressWizardPageBase::OnDisplayKeysCheckBoxClick ), NULL, this );
AbortButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( VolumeCreationProgressWizardPageBase::OnAbortButtonClick ), NULL, this );
@@ -3174,81 +3170,80 @@ VolumeCreationProgressWizardPageBase::~VolumeCreationProgressWizardPageBase()
// Disconnect Events
DisplayKeysCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumeCreationProgressWizardPageBase::OnDisplayKeysCheckBoxClick ), NULL, this );
AbortButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( VolumeCreationProgressWizardPageBase::OnAbortButtonClick ), NULL, this );
-
+
}
-VolumeLocationWizardPageBase::VolumeLocationWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : WizardPage( parent, id, pos, size, style )
+VolumeLocationWizardPageBase::VolumeLocationWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : WizardPage( parent, id, pos, size, style, name )
{
wxBoxSizer* bSizer86;
bSizer86 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer87;
bSizer87 = new wxBoxSizer( wxVERTICAL );
-
-
+
+
bSizer87->Add( 0, 0, 0, wxEXPAND|wxTOP, 5 );
-
+
wxBoxSizer* bSizer88;
bSizer88 = new wxBoxSizer( wxHORIZONTAL );
-
+
wxBoxSizer* bSizer89;
bSizer89 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer126;
bSizer126 = new wxBoxSizer( wxHORIZONTAL );
-
- VolumePathComboBox = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN );
+
+ VolumePathComboBox = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN );
bSizer126->Add( VolumePathComboBox, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
-
+
wxBoxSizer* bSizer90;
bSizer90 = new wxBoxSizer( wxVERTICAL );
-
+
SelectFileButton = new wxButton( this, wxID_ANY, _("IDC_SELECT_FILE"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer90->Add( SelectFileButton, 0, wxALL|wxEXPAND, 5 );
-
+
SelectDeviceButton = new wxButton( this, wxID_ANY, _("IDC_SELECT_DEVICE"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer90->Add( SelectDeviceButton, 0, wxALL|wxEXPAND, 5 );
-
-
+
+
bSizer126->Add( bSizer90, 0, wxALIGN_CENTER_VERTICAL, 5 );
-
-
+
+
bSizer89->Add( bSizer126, 0, wxEXPAND, 5 );
-
+
wxBoxSizer* bSizer91;
bSizer91 = new wxBoxSizer( wxHORIZONTAL );
-
-
+
+
bSizer91->Add( 0, 0, 0, wxLEFT, 5 );
-
+
NoHistoryCheckBox = new wxCheckBox( this, wxID_ANY, _("IDC_NO_HISTORY"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer91->Add( NoHistoryCheckBox, 0, wxALL|wxEXPAND, 5 );
-
-
+
+
bSizer89->Add( bSizer91, 0, wxEXPAND, 5 );
-
-
+
+
bSizer88->Add( bSizer89, 1, wxEXPAND, 5 );
-
-
+
+
bSizer87->Add( bSizer88, 0, wxEXPAND, 5 );
-
-
+
+
bSizer87->Add( 0, 0, 0, wxEXPAND|wxBOTTOM, 5 );
-
+
InfoStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
InfoStaticText->Wrap( -1 );
-
bSizer87->Add( InfoStaticText, 0, wxALL|wxEXPAND, 5 );
-
-
+
+
bSizer86->Add( bSizer87, 1, wxEXPAND, 5 );
-
-
+
+
this->SetSizer( bSizer86 );
this->Layout();
bSizer86->Fit( this );
-
+
// Connect Events
VolumePathComboBox->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( VolumeLocationWizardPageBase::OnVolumePathTextChanged ), NULL, this );
SelectFileButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( VolumeLocationWizardPageBase::OnSelectFileButtonClick ), NULL, this );
@@ -3263,66 +3258,64 @@ VolumeLocationWizardPageBase::~VolumeLocationWizardPageBase()
SelectFileButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( VolumeLocationWizardPageBase::OnSelectFileButtonClick ), NULL, this );
SelectDeviceButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( VolumeLocationWizardPageBase::OnSelectDeviceButtonClick ), NULL, this );
NoHistoryCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumeLocationWizardPageBase::OnNoHistoryCheckBoxClick ), NULL, this );
-
+
}
-VolumeFormatOptionsWizardPageBase::VolumeFormatOptionsWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : WizardPage( parent, id, pos, size, style )
+VolumeFormatOptionsWizardPageBase::VolumeFormatOptionsWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : WizardPage( parent, id, pos, size, style, name )
{
wxBoxSizer* bSizer124;
bSizer124 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer125;
bSizer125 = new wxBoxSizer( wxVERTICAL );
-
+
wxStaticBoxSizer* sbSizer33;
sbSizer33 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("IDT_FORMAT_OPTIONS") ), wxVERTICAL );
-
+
wxFlexGridSizer* fgSizer6;
fgSizer6 = new wxFlexGridSizer( 2, 2, 0, 0 );
fgSizer6->SetFlexibleDirection( wxBOTH );
fgSizer6->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
-
+
m_staticText43 = new wxStaticText( sbSizer33->GetStaticBox(), wxID_ANY, _("IDT_FILESYSTEM"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText43->Wrap( -1 );
-
fgSizer6->Add( m_staticText43, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT, 5 );
-
+
wxArrayString FilesystemTypeChoiceChoices;
FilesystemTypeChoice = new wxChoice( sbSizer33->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, FilesystemTypeChoiceChoices, 0 );
FilesystemTypeChoice->SetSelection( 0 );
fgSizer6->Add( FilesystemTypeChoice, 0, wxALL, 5 );
-
-
+
+
sbSizer33->Add( fgSizer6, 1, wxEXPAND, 5 );
-
-
+
+
bSizer125->Add( sbSizer33, 0, wxEXPAND|wxALL, 5 );
-
+
wxStaticBoxSizer* sbSizer34;
sbSizer34 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("IDT_FORMAT_OPTIONS") ), wxVERTICAL );
-
+
QuickFormatCheckBox = new wxCheckBox( sbSizer34->GetStaticBox(), wxID_ANY, _("IDC_QUICKFORMAT"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer34->Add( QuickFormatCheckBox, 0, wxALL, 5 );
-
-
+
+
bSizer125->Add( sbSizer34, 0, wxEXPAND|wxALL, 5 );
-
-
+
+
bSizer125->Add( 0, 0, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 );
-
+
InfoStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
InfoStaticText->Wrap( -1 );
-
bSizer125->Add( InfoStaticText, 0, wxALL, 5 );
-
-
+
+
bSizer124->Add( bSizer125, 0, wxEXPAND, 5 );
-
-
+
+
this->SetSizer( bSizer124 );
this->Layout();
bSizer124->Fit( this );
-
+
// Connect Events
FilesystemTypeChoice->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( VolumeFormatOptionsWizardPageBase::OnFilesystemTypeSelected ), NULL, this );
QuickFormatCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumeFormatOptionsWizardPageBase::OnQuickFormatCheckBoxClick ), NULL, this );
@@ -3333,24 +3326,23 @@ VolumeFormatOptionsWizardPageBase::~VolumeFormatOptionsWizardPageBase()
// Disconnect Events
FilesystemTypeChoice->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( VolumeFormatOptionsWizardPageBase::OnFilesystemTypeSelected ), NULL, this );
QuickFormatCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumeFormatOptionsWizardPageBase::OnQuickFormatCheckBoxClick ), NULL, this );
-
+
}
-VolumePasswordPanelBase::VolumePasswordPanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
+VolumePasswordPanelBase::VolumePasswordPanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
{
wxBoxSizer* bSizer7;
bSizer7 = new wxBoxSizer( wxVERTICAL );
-
+
GridBagSizer = new wxGridBagSizer( 0, 0 );
GridBagSizer->SetFlexibleDirection( wxBOTH );
GridBagSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
GridBagSizer->SetEmptyCellSize( wxSize( 0,0 ) );
-
+
PasswordStaticText = new wxStaticText( this, wxID_ANY, _("IDT_NEW_PASSWORD"), wxDefaultPosition, wxDefaultSize, 0 );
PasswordStaticText->Wrap( -1 );
-
GridBagSizer->Add( PasswordStaticText, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxRIGHT, 5 );
-
+
PasswordTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD );
#ifdef __WXGTK__
if ( !PasswordTextCtrl->HasFlag( wxTE_MULTILINE ) )
@@ -3361,14 +3353,13 @@ VolumePasswordPanelBase::VolumePasswordPanelBase( wxWindow* parent, wxWindowID i
PasswordTextCtrl->SetMaxLength( 1 );
#endif
PasswordTextCtrl->SetMinSize( wxSize( 232,-1 ) );
-
- GridBagSizer->Add( PasswordTextCtrl, wxGBPosition( 1, 1 ), wxGBSpan( 1, 2 ), wxBOTTOM|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
-
+
+ GridBagSizer->Add( PasswordTextCtrl, wxGBPosition( 1, 1 ), wxGBSpan( 1, 2 ), wxBOTTOM|wxEXPAND, 5 );
+
ConfirmPasswordStaticText = new wxStaticText( this, wxID_ANY, _("IDT_CONFIRM_PASSWORD"), wxDefaultPosition, wxDefaultSize, 0 );
ConfirmPasswordStaticText->Wrap( -1 );
-
GridBagSizer->Add( ConfirmPasswordStaticText, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
-
+
ConfirmPasswordTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD );
#ifdef __WXGTK__
if ( !ConfirmPasswordTextCtrl->HasFlag( wxTE_MULTILINE ) )
@@ -3379,14 +3370,13 @@ VolumePasswordPanelBase::VolumePasswordPanelBase( wxWindow* parent, wxWindowID i
ConfirmPasswordTextCtrl->SetMaxLength( 1 );
#endif
ConfirmPasswordTextCtrl->SetMinSize( wxSize( 232,-1 ) );
-
- GridBagSizer->Add( ConfirmPasswordTextCtrl, wxGBPosition( 2, 1 ), wxGBSpan( 1, 2 ), wxBOTTOM|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
-
+
+ GridBagSizer->Add( ConfirmPasswordTextCtrl, wxGBPosition( 2, 1 ), wxGBSpan( 1, 2 ), wxBOTTOM|wxEXPAND, 5 );
+
VolumePimStaticText = new wxStaticText( this, wxID_ANY, _("IDT_PIM"), wxDefaultPosition, wxDefaultSize, 0 );
VolumePimStaticText->Wrap( -1 );
-
GridBagSizer->Add( VolumePimStaticText, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxRIGHT, 5 );
-
+
VolumePimTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD );
#ifdef __WXGTK__
if ( !VolumePimTextCtrl->HasFlag( wxTE_MULTILINE ) )
@@ -3396,73 +3386,67 @@ VolumePasswordPanelBase::VolumePasswordPanelBase( wxWindow* parent, wxWindowID i
#else
VolumePimTextCtrl->SetMaxLength( 7 );
#endif
- GridBagSizer->Add( VolumePimTextCtrl, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND, 5 );
-
+ GridBagSizer->Add( VolumePimTextCtrl, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxEXPAND, 5 );
+
VolumePimHelpStaticText = new wxStaticText( this, wxID_ANY, _("IDC_PIM_HELP"), wxDefaultPosition, wxDefaultSize, 0 );
VolumePimHelpStaticText->Wrap( -1 );
-
GridBagSizer->Add( VolumePimHelpStaticText, wxGBPosition( 3, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxRIGHT, 5 );
-
+
PimCheckBox = new wxCheckBox( this, wxID_ANY, _("IDC_NEW_PIM_ENABLE"), wxDefaultPosition, wxDefaultSize, 0 );
GridBagSizer->Add( PimCheckBox, wxGBPosition( 4, 1 ), wxGBSpan( 1, 2 ), wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
-
+
CacheCheckBox = new wxCheckBox( this, wxID_ANY, _("IDC_CACHE"), wxDefaultPosition, wxDefaultSize, 0 );
GridBagSizer->Add( CacheCheckBox, wxGBPosition( 5, 1 ), wxGBSpan( 1, 2 ), wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
-
+
DisplayPasswordCheckBox = new wxCheckBox( this, wxID_ANY, _("IDC_SHOW_PASSWORD_MO"), wxDefaultPosition, wxDefaultSize, 0 );
GridBagSizer->Add( DisplayPasswordCheckBox, wxGBPosition( 6, 1 ), wxGBSpan( 1, 2 ), wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
-
+
UseKeyfilesCheckBox = new wxCheckBox( this, wxID_ANY, _("IDC_KEYFILES_ENABLE_HIDVOL_PROT"), wxDefaultPosition, wxDefaultSize, 0 );
GridBagSizer->Add( UseKeyfilesCheckBox, wxGBPosition( 7, 1 ), wxGBSpan( 1, 1 ), wxTOP|wxRIGHT|wxLEFT, 5 );
-
+
KeyfilesButton = new wxButton( this, wxID_ANY, _("IDC_KEYFILES_HIDVOL_PROT"), wxDefaultPosition, wxDefaultSize, 0 );
GridBagSizer->Add( KeyfilesButton, wxGBPosition( 7, 2 ), wxGBSpan( 1, 1 ), wxALIGN_RIGHT|wxALIGN_BOTTOM|wxLEFT, 5 );
-
+
Pkcs5PrfSizer = new wxBoxSizer( wxVERTICAL );
-
-
+
+
GridBagSizer->Add( Pkcs5PrfSizer, wxGBPosition( 8, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxTOP|wxBOTTOM, 5 );
-
+
Pkcs5PrfStaticText = new wxStaticText( this, wxID_ANY, _("IDT_NEW_PKCS5_PRF"), wxDefaultPosition, wxDefaultSize, 0 );
Pkcs5PrfStaticText->Wrap( -1 );
-
GridBagSizer->Add( Pkcs5PrfStaticText, wxGBPosition( 9, 0 ), wxGBSpan( 1, 1 ), wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
-
+
wxString Pkcs5PrfChoiceChoices[] = { _("UNCHANGED") };
int Pkcs5PrfChoiceNChoices = sizeof( Pkcs5PrfChoiceChoices ) / sizeof( wxString );
Pkcs5PrfChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, Pkcs5PrfChoiceNChoices, Pkcs5PrfChoiceChoices, 0 );
Pkcs5PrfChoice->SetSelection( 0 );
GridBagSizer->Add( Pkcs5PrfChoice, wxGBPosition( 9, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
-
- TrueCryptModeCheckBox = new wxCheckBox( this, wxID_ANY, _("IDC_TRUECRYPT_MODE"), wxDefaultPosition, wxDefaultSize, 0 );
- GridBagSizer->Add( TrueCryptModeCheckBox, wxGBPosition( 9, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
-
+
HeaderWipeCountText = new wxStaticText( this, wxID_ANY, _("IDT_WIPE_MODE"), wxDefaultPosition, wxDefaultSize, 0 );
HeaderWipeCountText->Wrap( -1 );
-
GridBagSizer->Add( HeaderWipeCountText, wxGBPosition( 10, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT, 5 );
-
+
wxString HeaderWipeCountChoices[] = { _("WIPE_MODE_1_RAND"), _("WIPE_MODE_3_DOD_5220"), _("WIPE_MODE_7_DOD_5220"), _("WIPE_MODE_35_GUTMANN"), _("WIPE_MODE_256") };
int HeaderWipeCountNChoices = sizeof( HeaderWipeCountChoices ) / sizeof( wxString );
HeaderWipeCount = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, HeaderWipeCountNChoices, HeaderWipeCountChoices, 0 );
HeaderWipeCount->SetSelection( 1 );
GridBagSizer->Add( HeaderWipeCount, wxGBPosition( 10, 1 ), wxGBSpan( 1, 1 ), wxALL, 5 );
-
+
PasswordPlaceholderSizer = new wxBoxSizer( wxVERTICAL );
-
-
+
+
GridBagSizer->Add( PasswordPlaceholderSizer, wxGBPosition( 11, 1 ), wxGBSpan( 1, 2 ), wxTOP|wxEXPAND, 5 );
-
-
+
+
GridBagSizer->AddGrowableCol( 1 );
-
+
bSizer7->Add( GridBagSizer, 1, wxALL|wxEXPAND, 5 );
-
-
+
+
this->SetSizer( bSizer7 );
this->Layout();
bSizer7->Fit( this );
-
+
// Connect Events
PasswordTextCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( VolumePasswordPanelBase::OnTextChanged ), NULL, this );
ConfirmPasswordTextCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( VolumePasswordPanelBase::OnTextChanged ), NULL, this );
@@ -3473,7 +3457,6 @@ VolumePasswordPanelBase::VolumePasswordPanelBase( wxWindow* parent, wxWindowID i
KeyfilesButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( VolumePasswordPanelBase::OnKeyfilesButtonClick ), NULL, this );
KeyfilesButton->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( VolumePasswordPanelBase::OnKeyfilesButtonRightDown ), NULL, this );
KeyfilesButton->Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( VolumePasswordPanelBase::OnKeyfilesButtonRightClick ), NULL, this );
- TrueCryptModeCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumePasswordPanelBase::OnTrueCryptModeChecked ), NULL, this );
}
VolumePasswordPanelBase::~VolumePasswordPanelBase()
@@ -3488,32 +3471,30 @@ VolumePasswordPanelBase::~VolumePasswordPanelBase()
KeyfilesButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( VolumePasswordPanelBase::OnKeyfilesButtonClick ), NULL, this );
KeyfilesButton->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( VolumePasswordPanelBase::OnKeyfilesButtonRightDown ), NULL, this );
KeyfilesButton->Disconnect( wxEVT_RIGHT_UP, wxMouseEventHandler( VolumePasswordPanelBase::OnKeyfilesButtonRightClick ), NULL, this );
- TrueCryptModeCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumePasswordPanelBase::OnTrueCryptModeChecked ), NULL, this );
-
+
}
-VolumePasswordWizardPageBase::VolumePasswordWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : WizardPage( parent, id, pos, size, style )
+VolumePasswordWizardPageBase::VolumePasswordWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : WizardPage( parent, id, pos, size, style, name )
{
wxBoxSizer* bSizer101;
bSizer101 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer102;
bSizer102 = new wxBoxSizer( wxVERTICAL );
-
+
PasswordPanelSizer = new wxBoxSizer( wxVERTICAL );
-
-
+
+
bSizer102->Add( PasswordPanelSizer, 0, wxEXPAND, 5 );
-
+
InfoStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
InfoStaticText->Wrap( -1 );
-
bSizer102->Add( InfoStaticText, 0, wxALL|wxEXPAND, 5 );
-
-
+
+
bSizer101->Add( bSizer102, 1, wxEXPAND, 5 );
-
-
+
+
this->SetSizer( bSizer101 );
this->Layout();
bSizer101->Fit( this );
@@ -3523,23 +3504,22 @@ VolumePasswordWizardPageBase::~VolumePasswordWizardPageBase()
{
}
-VolumePimWizardPageBase::VolumePimWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : WizardPage( parent, id, pos, size, style )
+VolumePimWizardPageBase::VolumePimWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : WizardPage( parent, id, pos, size, style, name )
{
wxBoxSizer* bSizer101;
bSizer101 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer102;
bSizer102 = new wxBoxSizer( wxVERTICAL );
-
+
PimPanelSizer = new wxBoxSizer( wxVERTICAL );
-
+
PimSizer = new wxBoxSizer( wxHORIZONTAL );
-
+
VolumePimStaticText = new wxStaticText( this, wxID_ANY, _("IDT_PIM"), wxDefaultPosition, wxDefaultSize, 0 );
VolumePimStaticText->Wrap( -1 );
-
PimSizer->Add( VolumePimStaticText, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
-
+
VolumePimTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD );
#ifdef __WXGTK__
if ( !VolumePimTextCtrl->HasFlag( wxTE_MULTILINE ) )
@@ -3550,40 +3530,38 @@ VolumePimWizardPageBase::VolumePimWizardPageBase( wxWindow* parent, wxWindowID i
VolumePimTextCtrl->SetMaxLength( 7 );
#endif
PimSizer->Add( VolumePimTextCtrl, 0, wxALL, 5 );
-
+
VolumePimHelpStaticText = new wxStaticText( this, wxID_ANY, _("IDC_PIM_HELP"), wxDefaultPosition, wxDefaultSize, 0 );
VolumePimHelpStaticText->Wrap( -1 );
-
PimSizer->Add( VolumePimHelpStaticText, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
-
-
+
+
PimPanelSizer->Add( PimSizer, 1, wxEXPAND, 5 );
-
+
wxBoxSizer* bSizer166;
bSizer166 = new wxBoxSizer( wxHORIZONTAL );
-
+
DisplayPimCheckBox = new wxCheckBox( this, wxID_ANY, _("IDC_SHOW_PIM"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer166->Add( DisplayPimCheckBox, 1, wxALL|wxEXPAND, 5 );
-
-
+
+
PimPanelSizer->Add( bSizer166, 1, wxEXPAND, 5 );
-
-
+
+
bSizer102->Add( PimPanelSizer, 0, wxEXPAND, 5 );
-
+
InfoStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
InfoStaticText->Wrap( -1 );
-
bSizer102->Add( InfoStaticText, 0, wxALL|wxEXPAND, 5 );
-
-
+
+
bSizer101->Add( bSizer102, 1, wxEXPAND, 5 );
-
-
+
+
this->SetSizer( bSizer101 );
this->Layout();
bSizer101->Fit( this );
-
+
// Connect Events
VolumePimTextCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( VolumePimWizardPageBase::OnPimChanged ), NULL, this );
DisplayPimCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumePimWizardPageBase::OnDisplayPimCheckBoxClick ), NULL, this );
@@ -3594,64 +3572,62 @@ VolumePimWizardPageBase::~VolumePimWizardPageBase()
// Disconnect Events
VolumePimTextCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( VolumePimWizardPageBase::OnPimChanged ), NULL, this );
DisplayPimCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumePimWizardPageBase::OnDisplayPimCheckBoxClick ), NULL, this );
-
+
}
-VolumeSizeWizardPageBase::VolumeSizeWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : WizardPage( parent, id, pos, size, style )
+VolumeSizeWizardPageBase::VolumeSizeWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : WizardPage( parent, id, pos, size, style, name )
{
wxBoxSizer* bSizer98;
bSizer98 = new wxBoxSizer( wxVERTICAL );
-
+
wxBoxSizer* bSizer99;
bSizer99 = new wxBoxSizer( wxVERTICAL );
-
-
+
+
bSizer99->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
-
+
wxBoxSizer* bSizer100;
bSizer100 = new wxBoxSizer( wxHORIZONTAL );
-
+
VolumeSizeTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizer100->Add( VolumeSizeTextCtrl, 0, wxALL, 5 );
-
+
wxArrayString VolumeSizePrefixChoiceChoices;
VolumeSizePrefixChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, VolumeSizePrefixChoiceChoices, 0 );
VolumeSizePrefixChoice->SetSelection( 0 );
bSizer100->Add( VolumeSizePrefixChoice, 0, wxALL, 5 );
-
-
+
+
bSizer99->Add( bSizer100, 0, wxEXPAND, 5 );
-
-
+
+
bSizer99->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
-
+
UseAllFreeSpaceCheckBox = new wxCheckBox( this, wxID_ANY, _("IDC_USE_ALL_FREE_SPACE"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer99->Add( UseAllFreeSpaceCheckBox, 0, wxALL|wxEXPAND, 5 );
-
-
+
+
bSizer99->Add( 0, 0, 0, wxBOTTOM|wxEXPAND|wxTOP, 5 );
-
+
FreeSpaceStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
FreeSpaceStaticText->Wrap( -1 );
-
bSizer99->Add( FreeSpaceStaticText, 0, wxALL|wxEXPAND, 5 );
-
-
+
+
bSizer99->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
-
+
InfoStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
InfoStaticText->Wrap( -1 );
-
bSizer99->Add( InfoStaticText, 0, wxALL|wxEXPAND, 5 );
-
-
+
+
bSizer98->Add( bSizer99, 0, wxEXPAND, 5 );
-
-
+
+
this->SetSizer( bSizer98 );
this->Layout();
bSizer98->Fit( this );
-
+
// Connect Events
VolumeSizeTextCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( VolumeSizeWizardPageBase::OnVolumeSizeTextChanged ), NULL, this );
VolumeSizePrefixChoice->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( VolumeSizeWizardPageBase::OnVolumeSizePrefixSelected ), NULL, this );
@@ -3664,32 +3640,31 @@ VolumeSizeWizardPageBase::~VolumeSizeWizardPageBase()
VolumeSizeTextCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( VolumeSizeWizardPageBase::OnVolumeSizeTextChanged ), NULL, this );
VolumeSizePrefixChoice->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( VolumeSizeWizardPageBase::OnVolumeSizePrefixSelected ), NULL, this );
UseAllFreeSpaceCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumeSizeWizardPageBase::OnUseAllFreeSpaceCheckBoxClick ), NULL, this );
-
+
}
WaitDialogBase::WaitDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
-
+
wxBoxSizer* bSizer160;
bSizer160 = new wxBoxSizer( wxVERTICAL );
-
- WaitStaticText = new wxStaticText( this, wxID_ANY, _("MyLabel"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE );
+
+ WaitStaticText = new wxStaticText( this, wxID_ANY, _("MyLabel"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL );
WaitStaticText->Wrap( -1 );
-
- bSizer160->Add( WaitStaticText, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 5 );
-
+ bSizer160->Add( WaitStaticText, 0, wxALL|wxEXPAND, 5 );
+
WaitProgessBar = new wxGauge( this, wxID_ANY, 100, wxDefaultPosition, wxDefaultSize, wxGA_HORIZONTAL|wxGA_SMOOTH );
- WaitProgessBar->SetValue( 0 );
+ WaitProgessBar->SetValue( 0 );
bSizer160->Add( WaitProgessBar, 0, wxALL|wxEXPAND, 5 );
-
-
+
+
this->SetSizer( bSizer160 );
this->Layout();
bSizer160->Fit( this );
-
+
this->Centre( wxBOTH );
-
+
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( WaitDialogBase::OnWaitDialogClose ) );
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( WaitDialogBase::OnWaitDialogInit ) );
@@ -3700,5 +3675,5 @@ WaitDialogBase::~WaitDialogBase()
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( WaitDialogBase::OnWaitDialogClose ) );
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( WaitDialogBase::OnWaitDialogInit ) );
-
+
}
diff --git a/src/Main/Forms/Forms.h b/src/Main/Forms/Forms.h
index b1756876..70a8c230 100644
--- a/src/Main/Forms/Forms.h
+++ b/src/Main/Forms/Forms.h
@@ -1,12 +1,11 @@
///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version Jun 20 2018)
+// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
-#ifndef __FORMS_H__
-#define __FORMS_H__
+#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
@@ -39,6 +38,8 @@
#include <wx/choice.h>
#include <wx/gauge.h>
#include <wx/spinctrl.h>
+#include <wx/wrapsizer.h>
+#include <wx/listbox.h>
#include <wx/notebook.h>
#include "international.h"
@@ -50,10 +51,10 @@ namespace VeraCrypt
///////////////////////////////////////////////////////////////////////////////
/// Class MainFrameBase
///////////////////////////////////////////////////////////////////////////////
- class MainFrameBase : public wxFrame
+ class MainFrameBase : public wxFrame
{
private:
-
+
protected:
wxMenuBar* MainMenuBar;
wxMenu* VolumesMenu;
@@ -91,8 +92,8 @@ namespace VeraCrypt
wxButton* MountAllDevicesButton;
wxButton* DismountAllButton;
wxButton* ExitButton;
-
- // Virtual event handlers, overide them in your derived class
+
+ // Virtual event handlers, override them in your derived class
virtual void OnActivate( wxActivateEvent& event ) { event.Skip(); }
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnCreateVolumeButtonClick( wxCommandEvent& event ) { event.Skip(); }
@@ -117,6 +118,7 @@ namespace VeraCrypt
virtual void OnManageSecurityTokenKeyfilesMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCloseAllSecurityTokenSessionsMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnWipeCacheButtonClick( wxCommandEvent& event ) { event.Skip(); }
+ virtual void OnLanguageMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnHotkeysMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDefaultKeyfilesMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDefaultMountParametersMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
@@ -145,23 +147,23 @@ namespace VeraCrypt
virtual void OnSelectDeviceButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnVolumeButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnExitButtonClick( wxCommandEvent& event ) { event.Skip(); }
-
-
+
+
public:
-
+
MainFrameBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("VeraCrypt"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxCAPTION|wxCLOSE_BOX|wxMINIMIZE_BOX|wxSYSTEM_MENU|wxTAB_TRAVERSAL );
-
+
~MainFrameBase();
-
+
};
-
+
///////////////////////////////////////////////////////////////////////////////
/// Class WizardFrameBase
///////////////////////////////////////////////////////////////////////////////
- class WizardFrameBase : public wxFrame
+ class WizardFrameBase : public wxFrame
{
private:
-
+
protected:
wxBoxSizer* MainSizer;
wxPanel* MainPanel;
@@ -172,8 +174,8 @@ namespace VeraCrypt
wxButton* PreviousButton;
wxButton* NextButton;
wxButton* CancelButton;
-
- // Virtual event handlers, overide them in your derived class
+
+ // Virtual event handlers, override them in your derived class
virtual void OnActivate( wxActivateEvent& event ) { event.Skip(); }
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnMouseMotion( wxMouseEvent& event ) { event.Skip(); }
@@ -181,23 +183,23 @@ namespace VeraCrypt
virtual void OnPreviousButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnNextButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelButtonClick( wxCommandEvent& event ) { event.Skip(); }
-
-
+
+
public:
-
+
WizardFrameBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxCAPTION|wxCLOSE_BOX|wxMINIMIZE_BOX|wxSYSTEM_MENU|wxTAB_TRAVERSAL );
-
+
~WizardFrameBase();
-
+
};
-
+
///////////////////////////////////////////////////////////////////////////////
/// Class AboutDialogBase
///////////////////////////////////////////////////////////////////////////////
- class AboutDialogBase : public wxDialog
+ class AboutDialogBase : public wxDialog
{
private:
-
+
protected:
wxPanel* m_panel14;
wxStaticBitmap* LogoBitmap;
@@ -208,25 +210,26 @@ namespace VeraCrypt
wxTextCtrl* CreditsTextCtrl;
wxStaticLine* m_staticline4;
wxStaticLine* m_staticline5;
-
- // Virtual event handlers, overide them in your derived class
+
+ // Virtual event handlers, override them in your derived class
virtual void OnWebsiteHyperlinkClick( wxHyperlinkEvent& event ) { event.Skip(); }
-
-
+
+
public:
-
- AboutDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
+
+ AboutDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
+
~AboutDialogBase();
-
+
};
-
+
///////////////////////////////////////////////////////////////////////////////
/// Class BenchmarkDialogBase
///////////////////////////////////////////////////////////////////////////////
- class BenchmarkDialogBase : public wxDialog
+ class BenchmarkDialogBase : public wxDialog
{
private:
-
+
protected:
wxStaticText* m_staticText70;
wxChoice* BenchmarkChoice;
@@ -238,26 +241,27 @@ namespace VeraCrypt
wxBoxSizer* RightSizer;
wxButton* BenchmarkButton;
wxStaticText* BenchmarkNoteStaticText;
-
- // Virtual event handlers, overide them in your derived class
+
+ // Virtual event handlers, override them in your derived class
virtual void OnBenchmarkChoiceSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnBenchmarkButtonClick( wxCommandEvent& event ) { event.Skip(); }
-
-
+
+
public:
-
- BenchmarkDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("IDD_BENCHMARK_DLG"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
+
+ BenchmarkDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("IDD_BENCHMARK_DLG"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
+
~BenchmarkDialogBase();
-
+
};
-
+
///////////////////////////////////////////////////////////////////////////////
/// Class ChangePasswordDialogBase
///////////////////////////////////////////////////////////////////////////////
- class ChangePasswordDialogBase : public wxDialog
+ class ChangePasswordDialogBase : public wxDialog
{
private:
-
+
protected:
wxStaticBoxSizer* CurrentSizer;
wxBoxSizer* CurrentPasswordPanelSizer;
@@ -265,51 +269,53 @@ namespace VeraCrypt
wxBoxSizer* NewPasswordPanelSizer;
wxButton* OKButton;
wxButton* CancelButton;
-
- // Virtual event handlers, overide them in your derived class
+
+ // Virtual event handlers, override them in your derived class
virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); }
-
-
+
+
public:
-
- ChangePasswordDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
+
+ ChangePasswordDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
+
~ChangePasswordDialogBase();
-
+
};
-
+
///////////////////////////////////////////////////////////////////////////////
/// Class DeviceSelectionDialogBase
///////////////////////////////////////////////////////////////////////////////
- class DeviceSelectionDialogBase : public wxDialog
+ class DeviceSelectionDialogBase : public wxDialog
{
private:
-
+
protected:
wxListCtrl* DeviceListCtrl;
wxButton* CancelButton;
wxButton* OKButton;
-
- // Virtual event handlers, overide them in your derived class
+
+ // Virtual event handlers, override them in your derived class
virtual void OnListItemActivated( wxListEvent& event ) { event.Skip(); }
virtual void OnListItemDeselected( wxListEvent& event ) { event.Skip(); }
virtual void OnListItemSelected( wxListEvent& event ) { event.Skip(); }
virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); }
-
-
+
+
public:
-
- DeviceSelectionDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("IDD_RAWDEVICES_DLG"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE );
+
+ DeviceSelectionDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("IDD_RAWDEVICES_DLG"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE );
+
~DeviceSelectionDialogBase();
-
+
};
-
+
///////////////////////////////////////////////////////////////////////////////
/// Class EncryptionTestDialogBase
///////////////////////////////////////////////////////////////////////////////
- class EncryptionTestDialogBase : public wxDialog
+ class EncryptionTestDialogBase : public wxDialog
{
private:
-
+
protected:
wxChoice* EncryptionAlgorithmChoice;
wxCheckBox* XtsModeCheckBox;
@@ -325,30 +331,31 @@ namespace VeraCrypt
wxButton* AutoTestAllButton;
wxButton* ResetButton;
wxButton* CloseButton;
-
- // Virtual event handlers, overide them in your derived class
+
+ // Virtual event handlers, override them in your derived class
virtual void OnEncryptionAlgorithmSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnXtsModeCheckBoxClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnEncryptButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDecryptButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnAutoTestAllButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnResetButtonClick( wxCommandEvent& event ) { event.Skip(); }
-
-
+
+
public:
-
- EncryptionTestDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("IDD_CIPHER_TEST_DLG"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
+
+ EncryptionTestDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("IDD_CIPHER_TEST_DLG"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
+
~EncryptionTestDialogBase();
-
+
};
-
+
///////////////////////////////////////////////////////////////////////////////
/// Class FavoriteVolumesDialogBase
///////////////////////////////////////////////////////////////////////////////
- class FavoriteVolumesDialogBase : public wxDialog
+ class FavoriteVolumesDialogBase : public wxDialog
{
private:
-
+
protected:
wxListCtrl* FavoritesListCtrl;
wxButton* MoveUpButton;
@@ -357,8 +364,8 @@ namespace VeraCrypt
wxButton* RemoveAllButton;
wxButton* OKButton;
wxButton* CancelButton;
-
- // Virtual event handlers, overide them in your derived class
+
+ // Virtual event handlers, override them in your derived class
virtual void OnListItemDeselected( wxListEvent& event ) { event.Skip(); }
virtual void OnListItemSelected( wxListEvent& event ) { event.Skip(); }
virtual void OnMoveUpButtonClick( wxCommandEvent& event ) { event.Skip(); }
@@ -366,22 +373,23 @@ namespace VeraCrypt
virtual void OnRemoveButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRemoveAllButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); }
-
-
+
+
public:
-
- FavoriteVolumesDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("IDD_FAVORITE_VOLUMES"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
+
+ FavoriteVolumesDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("IDD_FAVORITE_VOLUMES"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
+
~FavoriteVolumesDialogBase();
-
+
};
-
+
///////////////////////////////////////////////////////////////////////////////
/// Class KeyfilesDialogBase
///////////////////////////////////////////////////////////////////////////////
- class KeyfilesDialogBase : public wxDialog
+ class KeyfilesDialogBase : public wxDialog
{
private:
-
+
protected:
wxBoxSizer* UpperSizer;
wxBoxSizer* PanelSizer;
@@ -392,26 +400,27 @@ namespace VeraCrypt
wxStaticText* KeyfilesNoteStaticText;
wxHyperlinkCtrl* KeyfilesHyperlink;
wxButton* CreateKeyfileButtton;
-
- // Virtual event handlers, overide them in your derived class
+
+ // Virtual event handlers, override them in your derived class
virtual void OnKeyfilesHyperlinkClick( wxHyperlinkEvent& event ) { event.Skip(); }
virtual void OnCreateKeyfileButttonClick( wxCommandEvent& event ) { event.Skip(); }
-
-
+
+
public:
-
- KeyfilesDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("SELECT_TOKEN_KEYFILES"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
+
+ KeyfilesDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("SELECT_TOKEN_KEYFILES"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
+
~KeyfilesDialogBase();
-
+
};
-
+
///////////////////////////////////////////////////////////////////////////////
/// Class KeyfileGeneratorDialogBase
///////////////////////////////////////////////////////////////////////////////
- class KeyfileGeneratorDialogBase : public wxDialog
+ class KeyfileGeneratorDialogBase : public wxDialog
{
private:
-
+
protected:
wxBoxSizer* MainSizer;
wxChoice* HashChoice;
@@ -429,46 +438,48 @@ namespace VeraCrypt
wxTextCtrl* KeyfilesBaseName;
wxPanel* m_panel19;
wxButton* GenerateButton;
-
- // Virtual event handlers, overide them in your derived class
+
+ // Virtual event handlers, override them in your derived class
virtual void OnMouseMotion( wxMouseEvent& event ) { event.Skip(); }
virtual void OnHashSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnShowRandomPoolCheckBoxClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRandomSizeCheckBoxClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void OnGenerateButtonClick( wxCommandEvent& event ) { event.Skip(); }
-
-
+
+
public:
-
- KeyfileGeneratorDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
+
+ KeyfileGeneratorDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
+
~KeyfileGeneratorDialogBase();
-
+
};
-
+
///////////////////////////////////////////////////////////////////////////////
/// Class LegalNoticesDialogBase
///////////////////////////////////////////////////////////////////////////////
- class LegalNoticesDialogBase : public wxDialog
+ class LegalNoticesDialogBase : public wxDialog
{
private:
-
+
protected:
wxTextCtrl* LegalNoticesTextCtrl;
-
+
public:
-
- LegalNoticesDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("LEGAL_NOTICES_DLG_TITLE"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
+
+ LegalNoticesDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("LEGAL_NOTICES_DLG_TITLE"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
+
~LegalNoticesDialogBase();
-
+
};
-
+
///////////////////////////////////////////////////////////////////////////////
/// Class MountOptionsDialogBase
///////////////////////////////////////////////////////////////////////////////
- class MountOptionsDialogBase : public wxDialog
+ class MountOptionsDialogBase : public wxDialog
{
private:
-
+
protected:
wxBoxSizer* MainSizer;
wxBoxSizer* PasswordSizer;
@@ -495,8 +506,8 @@ namespace VeraCrypt
wxButton* MountPointButton;
wxStaticText* FilesystemOptionsStaticText;
wxTextCtrl* FilesystemOptionsTextCtrl;
-
- // Virtual event handlers, overide them in your derived class
+
+ // Virtual event handlers, override them in your derived class
virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOptionsButtonClick( wxCommandEvent& event ) { event.Skip(); }
@@ -505,47 +516,49 @@ namespace VeraCrypt
virtual void OnProtectionHyperlinkClick( wxHyperlinkEvent& event ) { event.Skip(); }
virtual void OnNoFilesystemCheckBoxClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnMountPointButtonClick( wxCommandEvent& event ) { event.Skip(); }
-
-
+
+
public:
-
- MountOptionsDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("IDD_PASSWORD_DLG"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE );
+
+ MountOptionsDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("IDD_PASSWORD_DLG"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE );
+
~MountOptionsDialogBase();
-
+
};
-
+
///////////////////////////////////////////////////////////////////////////////
/// Class NewSecurityTokenKeyfileDialogBase
///////////////////////////////////////////////////////////////////////////////
- class NewSecurityTokenKeyfileDialogBase : public wxDialog
+ class NewSecurityTokenKeyfileDialogBase : public wxDialog
{
private:
-
+
protected:
wxChoice* SecurityTokenChoice;
wxTextCtrl* KeyfileNameTextCtrl;
wxButton* CancelButton;
wxButton* OKButton;
-
- // Virtual event handlers, overide them in your derived class
+
+ // Virtual event handlers, override them in your derived class
virtual void OnKeyfileNameChanged( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); }
-
-
+
+
public:
-
- NewSecurityTokenKeyfileDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("IDD_TOKEN_PREFERENCES"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE );
+
+ NewSecurityTokenKeyfileDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("IDD_TOKEN_PREFERENCES"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE );
+
~NewSecurityTokenKeyfileDialogBase();
-
+
};
-
+
///////////////////////////////////////////////////////////////////////////////
/// Class PreferencesDialogBase
///////////////////////////////////////////////////////////////////////////////
- class PreferencesDialogBase : public wxDialog
+ class PreferencesDialogBase : public wxDialog
{
private:
-
+
protected:
wxBoxSizer* bSizer32;
wxNotebook* PreferencesNotebook;
@@ -564,7 +577,6 @@ namespace VeraCrypt
wxCheckBox* MountReadOnlyCheckBox;
wxCheckBox* MountRemovableCheckBox;
wxCheckBox* CachePasswordsCheckBox;
- wxCheckBox* TrueCryptModeCheckBox;
wxStaticText* Pkcs5PrfStaticText;
wxChoice* Pkcs5PrfChoice;
wxStaticBoxSizer* FilesystemSizer;
@@ -593,6 +605,7 @@ namespace VeraCrypt
wxTextCtrl* Pkcs11ModulePathTextCtrl;
wxButton* SelectPkcs11ModuleButton;
wxCheckBox* CloseSecurityTokenSessionsAfterMountCheckBox;
+ wxCheckBox* EMVSupportEnabledCheckBox;
wxListCtrl* HotkeyListCtrl;
wxTextCtrl* HotkeyTextCtrl;
wxButton* AssignHotkeyButton;
@@ -603,11 +616,17 @@ namespace VeraCrypt
wxButton* RemoveHotkeyButton;
wxCheckBox* BeepAfterHotkeyMountDismountCheckBox;
wxCheckBox* DisplayMessageAfterHotkeyDismountCheckBox;
+ wxStaticText* m_staticText73;
+ wxStaticText* m_staticText74;
+ wxStaticText* m_staticText72;
+ wxStaticText* m_staticText71;
+ wxButton* SysDefaultLangButton;
wxButton* OKButton;
wxButton* CancelButton;
-
- // Virtual event handlers, overide them in your derived class
+
+ // Virtual event handlers, override them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
+ virtual void OnPageChanged( wxNotebookEvent& event ) { event.Skip(); }
virtual void OnDismountOnScreenSaverCheckBoxClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDismountOnPowerSavingCheckBoxClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnForceAutoDismountCheckBoxClick( wxCommandEvent& event ) { event.Skip(); }
@@ -620,27 +639,31 @@ namespace VeraCrypt
virtual void OnHotkeyListItemSelected( wxListEvent& event ) { event.Skip(); }
virtual void OnAssignHotkeyButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRemoveHotkeyButtonClick( wxCommandEvent& event ) { event.Skip(); }
+ virtual void OnSysDefaultLangButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); }
-
-
+
+
public:
wxPanel* DefaultMountOptionsPage;
wxPanel* DefaultKeyfilesPage;
wxPanel* SecurityTokensPage;
wxPanel* HotkeysPage;
-
- PreferencesDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("IDD_PREFERENCES_DLG"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE );
+ wxPanel* LanguagesPage;
+ wxListBox* LanguageListBox;
+
+ PreferencesDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("IDD_PREFERENCES_DLG"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE );
+
~PreferencesDialogBase();
-
+
};
-
+
///////////////////////////////////////////////////////////////////////////////
/// Class RandomPoolEnrichmentDialogBase
///////////////////////////////////////////////////////////////////////////////
- class RandomPoolEnrichmentDialogBase : public wxDialog
+ class RandomPoolEnrichmentDialogBase : public wxDialog
{
private:
-
+
protected:
wxBoxSizer* MainSizer;
wxChoice* HashChoice;
@@ -649,27 +672,28 @@ namespace VeraCrypt
wxGauge* CollectedEntropy;
wxStaticText* MouseStaticText;
wxButton* ContinueButton;
-
- // Virtual event handlers, overide them in your derived class
+
+ // Virtual event handlers, override them in your derived class
virtual void OnMouseMotion( wxMouseEvent& event ) { event.Skip(); }
virtual void OnHashSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnShowRandomPoolCheckBoxClicked( wxCommandEvent& event ) { event.Skip(); }
-
-
+
+
public:
-
- RandomPoolEnrichmentDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("IDD_RANDOM_POOL_ENRICHMENT"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
+
+ RandomPoolEnrichmentDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("IDD_RANDOM_POOL_ENRICHMENT"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
+
~RandomPoolEnrichmentDialogBase();
-
+
};
-
+
///////////////////////////////////////////////////////////////////////////////
/// Class SecurityTokenKeyfilesDialogBase
///////////////////////////////////////////////////////////////////////////////
- class SecurityTokenKeyfilesDialogBase : public wxDialog
+ class SecurityTokenKeyfilesDialogBase : public wxDialog
{
private:
-
+
protected:
wxListCtrl* SecurityTokenKeyfileListCtrl;
wxButton* ExportButton;
@@ -677,8 +701,8 @@ namespace VeraCrypt
wxButton* ImportButton;
wxButton* OKButton;
wxButton* CancelButton;
-
- // Virtual event handlers, overide them in your derived class
+
+ // Virtual event handlers, override them in your derived class
virtual void OnListItemActivated( wxListEvent& event ) { event.Skip(); }
virtual void OnListItemDeselected( wxListEvent& event ) { event.Skip(); }
virtual void OnListItemSelected( wxListEvent& event ) { event.Skip(); }
@@ -686,44 +710,46 @@ namespace VeraCrypt
virtual void OnDeleteButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnImportButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); }
-
-
+
+
public:
-
- SecurityTokenKeyfilesDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("IDD_KEYFILES"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE );
+
+ SecurityTokenKeyfilesDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("IDD_KEYFILES"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE );
+
~SecurityTokenKeyfilesDialogBase();
-
+
};
-
+
///////////////////////////////////////////////////////////////////////////////
/// Class VolumePropertiesDialogBase
///////////////////////////////////////////////////////////////////////////////
- class VolumePropertiesDialogBase : public wxDialog
+ class VolumePropertiesDialogBase : public wxDialog
{
private:
-
+
protected:
wxListCtrl* PropertiesListCtrl;
wxButton* OKButton;
-
- // Virtual event handlers, overide them in your derived class
+
+ // Virtual event handlers, override them in your derived class
virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); }
-
-
+
+
public:
-
- VolumePropertiesDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("IDD_VOLUME_PROPERTIES"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE );
+
+ VolumePropertiesDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("IDD_VOLUME_PROPERTIES"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE );
+
~VolumePropertiesDialogBase();
-
+
};
-
+
///////////////////////////////////////////////////////////////////////////////
/// Class EncryptionOptionsWizardPageBase
///////////////////////////////////////////////////////////////////////////////
class EncryptionOptionsWizardPageBase : public WizardPage
{
private:
-
+
protected:
wxChoice* EncryptionAlgorithmChoice;
wxButton* TestButton;
@@ -732,47 +758,49 @@ namespace VeraCrypt
wxButton* BenchmarkButton;
wxChoice* HashChoice;
wxHyperlinkCtrl* HashHyperlink;
-
- // Virtual event handlers, overide them in your derived class
+
+ // Virtual event handlers, override them in your derived class
virtual void OnEncryptionAlgorithmSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnTestButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnEncryptionAlgorithmHyperlinkClick( wxHyperlinkEvent& event ) { event.Skip(); }
virtual void OnBenchmarkButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnHashHyperlinkClick( wxHyperlinkEvent& event ) { event.Skip(); }
-
-
+
+
public:
-
- EncryptionOptionsWizardPageBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL );
+
+ EncryptionOptionsWizardPageBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
+
~EncryptionOptionsWizardPageBase();
-
+
};
-
+
///////////////////////////////////////////////////////////////////////////////
/// Class InfoWizardPageBase
///////////////////////////////////////////////////////////////////////////////
class InfoWizardPageBase : public WizardPage
{
private:
-
+
protected:
wxBoxSizer* InfoPageSizer;
wxStaticText* InfoStaticText;
-
+
public:
-
- InfoWizardPageBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL );
+
+ InfoWizardPageBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
+
~InfoWizardPageBase();
-
+
};
-
+
///////////////////////////////////////////////////////////////////////////////
/// Class KeyfilesPanelBase
///////////////////////////////////////////////////////////////////////////////
- class KeyfilesPanelBase : public wxPanel
+ class KeyfilesPanelBase : public wxPanel
{
private:
-
+
protected:
wxListCtrl* KeyfilesListCtrl;
wxButton* AddFilesButton;
@@ -780,8 +808,8 @@ namespace VeraCrypt
wxButton* AddSecurityTokenSignatureButton;
wxButton* RemoveButton;
wxButton* RemoveAllButton;
-
- // Virtual event handlers, overide them in your derived class
+
+ // Virtual event handlers, override them in your derived class
virtual void OnListItemDeselected( wxListEvent& event ) { event.Skip(); }
virtual void OnListItemSelected( wxListEvent& event ) { event.Skip(); }
virtual void OnListSizeChanged( wxSizeEvent& event ) { event.Skip(); }
@@ -790,89 +818,93 @@ namespace VeraCrypt
virtual void OnAddSecurityTokenSignatureButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRemoveButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRemoveAllButtonClick( wxCommandEvent& event ) { event.Skip(); }
-
-
+
+
public:
-
- KeyfilesPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL );
+
+ KeyfilesPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
+
~KeyfilesPanelBase();
-
+
};
-
+
///////////////////////////////////////////////////////////////////////////////
/// Class ProgressWizardPageBase
///////////////////////////////////////////////////////////////////////////////
class ProgressWizardPageBase : public WizardPage
{
private:
-
+
protected:
wxBoxSizer* ProgressSizer;
wxGauge* ProgressGauge;
wxButton* AbortButton;
wxStaticText* InfoStaticText;
-
- // Virtual event handlers, overide them in your derived class
+
+ // Virtual event handlers, override them in your derived class
virtual void OnAbortButtonClick( wxCommandEvent& event ) { event.Skip(); }
-
-
+
+
public:
-
- ProgressWizardPageBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL );
+
+ ProgressWizardPageBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
+
~ProgressWizardPageBase();
-
+
};
-
+
///////////////////////////////////////////////////////////////////////////////
/// Class SelectDirectoryWizardPageBase
///////////////////////////////////////////////////////////////////////////////
class SelectDirectoryWizardPageBase : public WizardPage
{
private:
-
+
protected:
wxTextCtrl* DirectoryTextCtrl;
wxButton* BrowseButton;
wxStaticText* InfoStaticText;
-
- // Virtual event handlers, overide them in your derived class
+
+ // Virtual event handlers, override them in your derived class
virtual void OnDirectoryTextChanged( wxCommandEvent& event ) { event.Skip(); }
virtual void OnBrowseButtonClick( wxCommandEvent& event ) { event.Skip(); }
-
-
+
+
public:
-
- SelectDirectoryWizardPageBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL );
+
+ SelectDirectoryWizardPageBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
+
~SelectDirectoryWizardPageBase();
-
+
};
-
+
///////////////////////////////////////////////////////////////////////////////
/// Class SingleChoiceWizardPageBase
///////////////////////////////////////////////////////////////////////////////
class SingleChoiceWizardPageBase : public WizardPage
{
private:
-
+
protected:
wxBoxSizer* OuterChoicesSizer;
wxBoxSizer* ChoicesSizer;
wxStaticText* InfoStaticText;
-
+
public:
-
- SingleChoiceWizardPageBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL );
+
+ SingleChoiceWizardPageBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
+
~SingleChoiceWizardPageBase();
-
+
};
-
+
///////////////////////////////////////////////////////////////////////////////
/// Class VolumeCreationProgressWizardPageBase
///////////////////////////////////////////////////////////////////////////////
class VolumeCreationProgressWizardPageBase : public WizardPage
{
private:
-
+
protected:
wxBoxSizer* KeySamplesUpperSizer;
wxBoxSizer* KeySamplesUpperInnerSizer;
@@ -893,79 +925,82 @@ namespace VeraCrypt
wxPanel* m_panel122;
wxStaticText* TimeLeftStaticText;
wxStaticText* InfoStaticText;
-
- // Virtual event handlers, overide them in your derived class
+
+ // Virtual event handlers, override them in your derived class
virtual void OnDisplayKeysCheckBoxClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnAbortButtonClick( wxCommandEvent& event ) { event.Skip(); }
-
-
+
+
public:
-
- VolumeCreationProgressWizardPageBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL );
+
+ VolumeCreationProgressWizardPageBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
+
~VolumeCreationProgressWizardPageBase();
-
+
};
-
+
///////////////////////////////////////////////////////////////////////////////
/// Class VolumeLocationWizardPageBase
///////////////////////////////////////////////////////////////////////////////
class VolumeLocationWizardPageBase : public WizardPage
{
private:
-
+
protected:
wxComboBox* VolumePathComboBox;
wxButton* SelectFileButton;
wxButton* SelectDeviceButton;
wxCheckBox* NoHistoryCheckBox;
wxStaticText* InfoStaticText;
-
- // Virtual event handlers, overide them in your derived class
+
+ // Virtual event handlers, override them in your derived class
virtual void OnVolumePathTextChanged( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSelectFileButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSelectDeviceButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnNoHistoryCheckBoxClick( wxCommandEvent& event ) { event.Skip(); }
-
-
+
+
public:
-
- VolumeLocationWizardPageBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL );
+
+ VolumeLocationWizardPageBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
+
~VolumeLocationWizardPageBase();
-
+
};
-
+
///////////////////////////////////////////////////////////////////////////////
/// Class VolumeFormatOptionsWizardPageBase
///////////////////////////////////////////////////////////////////////////////
class VolumeFormatOptionsWizardPageBase : public WizardPage
{
private:
-
+
protected:
wxStaticText* m_staticText43;
wxChoice* FilesystemTypeChoice;
wxCheckBox* QuickFormatCheckBox;
wxStaticText* InfoStaticText;
-
- // Virtual event handlers, overide them in your derived class
+
+ // Virtual event handlers, override them in your derived class
virtual void OnFilesystemTypeSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnQuickFormatCheckBoxClick( wxCommandEvent& event ) { event.Skip(); }
-
-
+
+
public:
-
- VolumeFormatOptionsWizardPageBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL );
+
+ VolumeFormatOptionsWizardPageBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
+
~VolumeFormatOptionsWizardPageBase();
-
+
};
-
+
///////////////////////////////////////////////////////////////////////////////
/// Class VolumePasswordPanelBase
///////////////////////////////////////////////////////////////////////////////
- class VolumePasswordPanelBase : public wxPanel
+ class VolumePasswordPanelBase : public wxPanel
{
private:
-
+
protected:
wxGridBagSizer* GridBagSizer;
wxStaticText* PasswordStaticText;
@@ -983,12 +1018,11 @@ namespace VeraCrypt
wxBoxSizer* Pkcs5PrfSizer;
wxStaticText* Pkcs5PrfStaticText;
wxChoice* Pkcs5PrfChoice;
- wxCheckBox* TrueCryptModeCheckBox;
wxStaticText* HeaderWipeCountText;
wxChoice* HeaderWipeCount;
wxBoxSizer* PasswordPlaceholderSizer;
-
- // Virtual event handlers, overide them in your derived class
+
+ // Virtual event handlers, override them in your derived class
virtual void OnTextChanged( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPimChanged( wxCommandEvent& event ) { event.Skip(); }
virtual void OnUsePimCheckBoxClick( wxCommandEvent& event ) { event.Skip(); }
@@ -997,41 +1031,42 @@ namespace VeraCrypt
virtual void OnKeyfilesButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnKeyfilesButtonRightDown( wxMouseEvent& event ) { event.Skip(); }
virtual void OnKeyfilesButtonRightClick( wxMouseEvent& event ) { event.Skip(); }
- virtual void OnTrueCryptModeChecked( wxCommandEvent& event ) { event.Skip(); }
-
-
+
+
public:
-
- VolumePasswordPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL );
+
+ VolumePasswordPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
+
~VolumePasswordPanelBase();
-
+
};
-
+
///////////////////////////////////////////////////////////////////////////////
/// Class VolumePasswordWizardPageBase
///////////////////////////////////////////////////////////////////////////////
class VolumePasswordWizardPageBase : public WizardPage
{
private:
-
+
protected:
wxBoxSizer* PasswordPanelSizer;
wxStaticText* InfoStaticText;
-
+
public:
-
- VolumePasswordWizardPageBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL );
+
+ VolumePasswordWizardPageBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
+
~VolumePasswordWizardPageBase();
-
+
};
-
+
///////////////////////////////////////////////////////////////////////////////
/// Class VolumePimWizardPageBase
///////////////////////////////////////////////////////////////////////////////
class VolumePimWizardPageBase : public WizardPage
{
private:
-
+
protected:
wxBoxSizer* PimPanelSizer;
wxBoxSizer* PimSizer;
@@ -1040,69 +1075,71 @@ namespace VeraCrypt
wxStaticText* VolumePimHelpStaticText;
wxCheckBox* DisplayPimCheckBox;
wxStaticText* InfoStaticText;
-
- // Virtual event handlers, overide them in your derived class
+
+ // Virtual event handlers, override them in your derived class
virtual void OnPimChanged( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDisplayPimCheckBoxClick( wxCommandEvent& event ) { event.Skip(); }
-
-
+
+
public:
-
- VolumePimWizardPageBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL );
+
+ VolumePimWizardPageBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
+
~VolumePimWizardPageBase();
-
+
};
-
+
///////////////////////////////////////////////////////////////////////////////
/// Class VolumeSizeWizardPageBase
///////////////////////////////////////////////////////////////////////////////
class VolumeSizeWizardPageBase : public WizardPage
{
private:
-
+
protected:
wxTextCtrl* VolumeSizeTextCtrl;
wxChoice* VolumeSizePrefixChoice;
wxCheckBox* UseAllFreeSpaceCheckBox;
wxStaticText* FreeSpaceStaticText;
wxStaticText* InfoStaticText;
-
- // Virtual event handlers, overide them in your derived class
+
+ // Virtual event handlers, override them in your derived class
virtual void OnVolumeSizeTextChanged( wxCommandEvent& event ) { event.Skip(); }
virtual void OnVolumeSizePrefixSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnUseAllFreeSpaceCheckBoxClick( wxCommandEvent& event ) { event.Skip(); }
-
-
+
+
public:
-
- VolumeSizeWizardPageBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL );
+
+ VolumeSizeWizardPageBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
+
~VolumeSizeWizardPageBase();
-
+
};
-
+
///////////////////////////////////////////////////////////////////////////////
/// Class WaitDialogBase
///////////////////////////////////////////////////////////////////////////////
- class WaitDialogBase : public wxDialog
+ class WaitDialogBase : public wxDialog
{
private:
-
+
protected:
wxStaticText* WaitStaticText;
wxGauge* WaitProgessBar;
-
- // Virtual event handlers, overide them in your derived class
+
+ // Virtual event handlers, override them in your derived class
virtual void OnWaitDialogClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnWaitDialogInit( wxInitDialogEvent& event ) { event.Skip(); }
-
-
+
+
public:
-
- WaitDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("VeraCrypt"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxCAPTION );
+
+ WaitDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("VeraCrypt"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxCAPTION );
+
~WaitDialogBase();
-
+
};
-
+
} // namespace VeraCrypt
-#endif //__FORMS_H__
diff --git a/src/Main/Forms/KeyfilesPanel.cpp b/src/Main/Forms/KeyfilesPanel.cpp
index c1f26d86..e3d086fc 100644
--- a/src/Main/Forms/KeyfilesPanel.cpp
+++ b/src/Main/Forms/KeyfilesPanel.cpp
@@ -115,7 +115,7 @@ namespace VeraCrypt
SecurityTokenKeyfilesDialog dialog (this);
if (dialog.ShowModal() == wxID_OK)
{
- foreach (const SecurityTokenKeyfilePath &path, dialog.GetSelectedSecurityTokenKeyfilePaths())
+ foreach (const TokenKeyfilePath &path, dialog.GetSelectedSecurityTokenKeyfilePaths())
{
vector <wstring> fields;
fields.push_back (path);
diff --git a/src/Main/Forms/MainFrame.cpp b/src/Main/Forms/MainFrame.cpp
index ab42ac06..07b876ac 100644
--- a/src/Main/Forms/MainFrame.cpp
+++ b/src/Main/Forms/MainFrame.cpp
@@ -642,13 +642,9 @@ namespace VeraCrypt
try
{
MountOptions mountOptions (GetPreferences().DefaultMountOptions);
- if (CmdLine->ArgTrueCryptMode)
- {
- mountOptions.TrueCryptMode = CmdLine->ArgTrueCryptMode;
- }
if (CmdLine->ArgHash)
{
- mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, mountOptions.TrueCryptMode);
+ mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash);
}
if (CmdLine->ArgPim > 0)
{
@@ -671,19 +667,15 @@ namespace VeraCrypt
try
{
MountOptions mountOptions (GetPreferences().DefaultMountOptions);
- if (CmdLine->ArgTrueCryptMode)
- {
- mountOptions.TrueCryptMode = CmdLine->ArgTrueCryptMode;
- }
if (CmdLine->ArgHash)
{
- mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, mountOptions.TrueCryptMode);
+ mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash);
}
if (CmdLine->ArgPim > 0)
{
mountOptions.Pim = CmdLine->ArgPim;
}
-
+ mountOptions.EMVSupportEnabled = GetPreferences().EMVSupportEnabled;
Gui->MountAllFavoriteVolumes (mountOptions);
}
catch (exception &e)
@@ -706,18 +698,15 @@ namespace VeraCrypt
MountOptions mountOptions (GetPreferences().DefaultMountOptions);
mountOptions.SlotNumber = SelectedSlotNumber;
mountOptions.Path = GetSelectedVolumePath();
- if (CmdLine->ArgTrueCryptMode)
- {
- mountOptions.TrueCryptMode = CmdLine->ArgTrueCryptMode;
- }
if (CmdLine->ArgHash)
{
- mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, mountOptions.TrueCryptMode);
+ mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash);
}
if (CmdLine->ArgPim > 0)
{
mountOptions.Pim = CmdLine->ArgPim;
}
+ mountOptions.EMVSupportEnabled = GetPreferences().EMVSupportEnabled;
try
{
@@ -748,6 +737,7 @@ namespace VeraCrypt
#ifdef TC_MACOSX
if (event.GetActive() && Gui->IsInBackgroundMode())
Gui->SetBackgroundMode (false);
+ EnsureVisible();
#endif
event.Skip();
}
@@ -963,13 +953,9 @@ namespace VeraCrypt
SetVolumePath (favorite.Path);
MountOptions mountOptions (GetPreferences().DefaultMountOptions);
- if (CmdLine->ArgTrueCryptMode)
- {
- mountOptions.TrueCryptMode = CmdLine->ArgTrueCryptMode;
- }
if (CmdLine->ArgHash)
{
- mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, mountOptions.TrueCryptMode);
+ mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash);
}
if (CmdLine->ArgPim > 0)
{
@@ -1082,6 +1068,17 @@ namespace VeraCrypt
dialog.ShowModal();
}
+ void MainFrame::OnLanguageMenuItemSelected (wxCommandEvent& event)
+ {
+#ifdef TC_MACOSX
+ if (Gui->IsInBackgroundMode())
+ Gui->SetBackgroundMode (false);
+#endif
+ PreferencesDialog dialog (this);
+ dialog.SelectPage (dialog.LanguagesPage);
+ dialog.ShowModal();
+ }
+
void MainFrame::OnLegalNoticesMenuItemSelected (wxCommandEvent& event)
{
#ifdef TC_MACOSX
@@ -1705,7 +1702,7 @@ namespace VeraCrypt
#endif
fields[ColumnPath] = volume->Path;
fields[ColumnSize] = Gui->SizeToString (volume->Size);
- fields[ColumnType] = Gui->VolumeTypeToString (volume->Type, volume->TrueCryptMode, volume->Protection);
+ fields[ColumnType] = Gui->VolumeTypeToString (volume->Type, volume->Protection);
if (volume->HiddenVolumeProtectionTriggered)
{
@@ -1715,7 +1712,7 @@ namespace VeraCrypt
bool slotUpdated = false;
if (itemIndex == -1)
{
- Gui->InsertToListCtrl (SlotListCtrl, ++prevItemIndex, fields, 0, (void *) volume->SlotNumber);
+ Gui->InsertToListCtrl (SlotListCtrl, ++prevItemIndex, fields, 0, (void *)(intptr_t) volume->SlotNumber);
OnListItemInserted (prevItemIndex);
listChanged |= true;
@@ -1750,7 +1747,7 @@ namespace VeraCrypt
{
if (itemIndex == -1)
{
- Gui->InsertToListCtrl (SlotListCtrl, ++prevItemIndex, fields, 0, (void *) slotNumber);
+ Gui->InsertToListCtrl (SlotListCtrl, ++prevItemIndex, fields, 0, (void *)(intptr_t) slotNumber);
OnListItemInserted (prevItemIndex);
listChanged |= true;
}
diff --git a/src/Main/Forms/MainFrame.h b/src/Main/Forms/MainFrame.h
index 5372adbb..ab70eae3 100644
--- a/src/Main/Forms/MainFrame.h
+++ b/src/Main/Forms/MainFrame.h
@@ -128,6 +128,7 @@ namespace VeraCrypt
void OnHiddenVolumeProtectionTriggered (shared_ptr <VolumeInfo> protectedVolume);
void OnHotkey (wxKeyEvent& event);
void OnHotkeysMenuItemSelected (wxCommandEvent& event);
+ void OnLanguageMenuItemSelected (wxCommandEvent& event);
void OnLegalNoticesMenuItemSelected (wxCommandEvent& event);
void OnListChanged ();
void OnListItemActivated (wxListEvent& event);
diff --git a/src/Main/Forms/MountOptionsDialog.cpp b/src/Main/Forms/MountOptionsDialog.cpp
index 04410922..85a06d1e 100644
--- a/src/Main/Forms/MountOptionsDialog.cpp
+++ b/src/Main/Forms/MountOptionsDialog.cpp
@@ -50,14 +50,8 @@ namespace VeraCrypt
GraphicUserInterface::InstallPasswordEntryCustomKeyboardShortcuts (this);
#endif
- PasswordPanel = new VolumePasswordPanel (this, &options, options.Password, disableMountOptions, options.Keyfiles, !disableMountOptions, true, true, false, true, true);
+ PasswordPanel = new VolumePasswordPanel (this, &options, options.Password, options.Keyfiles, !disableMountOptions, true, true, false, true, true);
PasswordPanel->SetCacheCheckBoxValidator (wxGenericValidator (&Options.CachePassword));
-
- if (options.Path && options.Path->HasTrueCryptExtension() && !disableMountOptions
- && !options.TrueCryptMode && (options.Pim <= 0))
- {
- PasswordPanel->SetTrueCryptMode (true);
- }
PasswordSizer->Add (PasswordPanel, 1, wxALL | wxEXPAND);
@@ -88,7 +82,7 @@ namespace VeraCrypt
OptionsButton->SetLabel (OptionsButtonLabel + L" >");
OptionsPanel->Show (false);
- ProtectionPasswordPanel = new VolumePasswordPanel (ProtectionSizer->GetStaticBox(), &options, options.ProtectionPassword, true, options.ProtectionKeyfiles, false, true, true, false, true, true, LangString["IDT_HIDDEN_PROT_PASSWD"]);
+ ProtectionPasswordPanel = new VolumePasswordPanel (ProtectionSizer->GetStaticBox(), &options, options.ProtectionPassword, options.ProtectionKeyfiles, false, true, true, false, true, true, LangString["IDT_HIDDEN_PROT_PASSWD"]);
ProtectionPasswordPanel->TopOwnerParent = this;
ProtectionPasswordSizer->Add (ProtectionPasswordPanel, 1, wxALL | wxEXPAND);
@@ -110,8 +104,6 @@ namespace VeraCrypt
void MountOptionsDialog::OnOKButtonClick (wxCommandEvent& event)
{
- bool bUnsupportedKdf = false;
-
/* verify that PIM values are valid before continuing*/
int Pim = PasswordPanel->GetVolumePim();
int ProtectionPim = (!ReadOnlyCheckBox->IsChecked() && ProtectionCheckBox->IsChecked())?
@@ -149,13 +141,7 @@ namespace VeraCrypt
}
Options.Pim = Pim;
- Options.Kdf = PasswordPanel->GetPkcs5Kdf(bUnsupportedKdf);
- if (bUnsupportedKdf)
- {
- Gui->ShowWarning (LangString ["ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE"]);
- return;
- }
- Options.TrueCryptMode = PasswordPanel->GetTrueCryptMode();
+ Options.Kdf = PasswordPanel->GetPkcs5Kdf();
Options.Keyfiles = PasswordPanel->GetKeyfiles();
if (ReadOnlyCheckBox->IsChecked())
@@ -166,7 +152,7 @@ namespace VeraCrypt
{
try
{
- Options.ProtectionPassword = ProtectionPasswordPanel->GetPassword(Options.TrueCryptMode);
+ Options.ProtectionPassword = ProtectionPasswordPanel->GetPassword(false);
}
catch (PasswordException& e)
{
@@ -175,12 +161,7 @@ namespace VeraCrypt
}
Options.Protection = VolumeProtection::HiddenVolumeReadOnly;
Options.ProtectionPim = ProtectionPim;
- Options.ProtectionKdf = ProtectionPasswordPanel->GetPkcs5Kdf(Options.TrueCryptMode, bUnsupportedKdf);
- if (bUnsupportedKdf)
- {
- Gui->ShowWarning (LangString ["ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE"]);
- return;
- }
+ Options.ProtectionKdf = ProtectionPasswordPanel->GetPkcs5Kdf();
Options.ProtectionKeyfiles = ProtectionPasswordPanel->GetKeyfiles();
}
else
@@ -193,6 +174,7 @@ namespace VeraCrypt
Options.MountPoint = make_shared <DirectoryPath> (mountPoint);
Options.FilesystemOptions = FilesystemOptionsTextCtrl->GetValue();
+ Options.EMVSupportEnabled = Gui->GetPreferences().EMVSupportEnabled;
EndModal (wxID_OK);
}
diff --git a/src/Main/Forms/PreferencesDialog.cpp b/src/Main/Forms/PreferencesDialog.cpp
index 2815c9b5..90a668e6 100644
--- a/src/Main/Forms/PreferencesDialog.cpp
+++ b/src/Main/Forms/PreferencesDialog.cpp
@@ -14,6 +14,9 @@
#include <wx/dynlib.h>
#ifdef TC_WINDOWS
#include <wx/msw/registry.h>
+#else
+#include <wx/dir.h>
+#include <wx/arrstr.h>
#endif
#include "Common/SecurityToken.h"
#include "Main/Main.h"
@@ -53,12 +56,10 @@ namespace VeraCrypt
FilesystemOptionsTextCtrl->SetValue (Preferences.DefaultMountOptions.FilesystemOptions);
- TrueCryptModeCheckBox->SetValidator (wxGenericValidator (&Preferences.DefaultMountOptions.TrueCryptMode));
-
int index, prfInitialIndex = 0;
Pkcs5PrfChoice->Append (LangString["AUTODETECTION"]);
- foreach_ref (const Pkcs5Kdf &kdf, Pkcs5Kdf::GetAvailableAlgorithms(false))
+ foreach_ref (const Pkcs5Kdf &kdf, Pkcs5Kdf::GetAvailableAlgorithms())
{
index = Pkcs5PrfChoice->Append (kdf.GetName());
if (Preferences.DefaultMountOptions.Kdf
@@ -70,6 +71,30 @@ namespace VeraCrypt
}
Pkcs5PrfChoice->Select (prfInitialIndex);
+ // Language for non-Windows
+#ifndef TC_WINDOWS
+#if defined (TC_MACOSX)
+ wxDir languagesFolder(StringConverter::ToSingle (Application::GetExecutableDirectory()) + "/../Resources/languages/");
+#else
+ wxDir languagesFolder("/usr/share/veracrypt/languages/");
+#endif
+ wxArrayString langArray;
+ LanguageListBox->Append("System default");
+ LanguageListBox->Append("English");
+
+ size_t langCount;
+ langCount = wxDir::GetAllFiles(languagesFolder.GetName(), &langArray, wxEmptyString, wxDIR_FILES);
+ for (size_t i = 0; i < langCount; ++i) {
+ wxFileName filename(langArray[i]);
+ wxString langId = filename.GetName().AfterLast('.');
+ wxString langNative = langEntries[langId];
+ if (!langNative.empty()) {
+ LanguageListBox->Append(langNative);
+ }
+ }
+#endif
+
+
// Keyfiles
TC_CHECK_BOX_VALIDATOR (UseKeyfiles);
@@ -96,6 +121,7 @@ namespace VeraCrypt
// Security tokens
Pkcs11ModulePathTextCtrl->SetValue (wstring (Preferences.SecurityTokenModule));
TC_CHECK_BOX_VALIDATOR (CloseSecurityTokenSessionsAfterMount);
+ TC_CHECK_BOX_VALIDATOR (EMVSupportEnabled);
// System integration
TC_CHECK_BOX_VALIDATOR (StartOnLogon);
@@ -239,6 +265,15 @@ namespace VeraCrypt
}
}
+ void PreferencesDialog::OnSysDefaultLangButtonClick (wxCommandEvent& event)
+ {
+ // SetStringSelection()'s Assert currently broken in sorted ListBoxes on macOS, workaround:
+ int itemIndex = LanguageListBox->FindString("System default", true);
+ if (itemIndex != wxNOT_FOUND) {
+ LanguageListBox->SetSelection(itemIndex);
+ }
+ }
+
void PreferencesDialog::OnAssignHotkeyButtonClick (wxCommandEvent& event)
{
#ifdef TC_WINDOWS
@@ -356,6 +391,13 @@ namespace VeraCrypt
AssignHotkeyButton->Enable (false);
}
+ // Fixes an issue where going through PreferencesNotebook tabs would unintentionally select the first entry
+ // in the LanguageListBox and thus cause a language change on OKButton press.
+ void PreferencesDialog::OnPageChanged(wxBookCtrlEvent &event)
+ {
+ LanguageListBox->DeselectAll();
+ }
+
void PreferencesDialog::OnOKButtonClick (wxCommandEvent& event)
{
#ifdef TC_WINDOWS
@@ -369,11 +411,10 @@ namespace VeraCrypt
{
try
{
- selectedKdf = Pkcs5Kdf::GetAlgorithm (wstring (Pkcs5PrfChoice->GetStringSelection ()), TrueCryptModeCheckBox->IsChecked ());
+ selectedKdf = Pkcs5Kdf::GetAlgorithm (wstring (Pkcs5PrfChoice->GetStringSelection ()));
}
catch (ParameterIncorrect&)
{
- Gui->ShowWarning ("ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE");
return;
}
}
@@ -390,6 +431,19 @@ namespace VeraCrypt
bool securityTokenModuleChanged = (Preferences.SecurityTokenModule != wstring (Pkcs11ModulePathTextCtrl->GetValue()));
Preferences.SecurityTokenModule = wstring (Pkcs11ModulePathTextCtrl->GetValue());
+ if (LanguageListBox->GetSelection() != wxNOT_FOUND) {
+ wxString langToFind = LanguageListBox->GetString(LanguageListBox->GetSelection());
+ for (const auto &each: langEntries) {
+ if (each.second == langToFind) {
+ Preferences.Language = each.first;
+#ifdef DEBUG
+ cout << "Lang set to: " << each.first << endl;
+#endif
+ }
+ }
+ Gui->ShowInfo (LangString["LINUX_RESTART_FOR_LANGUAGE_CHANGE"]);
+ }
+
Gui->SetPreferences (Preferences);
try
diff --git a/src/Main/Forms/PreferencesDialog.h b/src/Main/Forms/PreferencesDialog.h
index 0cd1482a..50e8489e 100644
--- a/src/Main/Forms/PreferencesDialog.h
+++ b/src/Main/Forms/PreferencesDialog.h
@@ -40,9 +40,11 @@ namespace VeraCrypt
void OnNoHardwareCryptoCheckBoxClick (wxCommandEvent& event);
void OnNoKernelCryptoCheckBoxClick (wxCommandEvent& event);
void OnOKButtonClick (wxCommandEvent& event);
+ void OnPageChanged (wxBookCtrlEvent& event);
void OnPreserveTimestampsCheckBoxClick (wxCommandEvent& event);
void OnRemoveHotkeyButtonClick (wxCommandEvent& event);
void OnSelectPkcs11ModuleButtonClick (wxCommandEvent& event);
+ void OnSysDefaultLangButtonClick (wxCommandEvent& event);
void OnTimer ();
void UpdateHotkeyButtons();
@@ -58,6 +60,50 @@ namespace VeraCrypt
UserPreferences Preferences;
bool RestoreValidatorBell;
HotkeyList UnregisteredHotkeys;
+ map<wxString, wstring> langEntries = {
+ {"system", L"System default"},
+ {"ar", L"العربية"},
+ {"be", L"Беларуская"},
+ {"bg", L"Български"},
+ {"ca", L"Català"},
+ {"co", L"Corsu"},
+ {"cs", L"Čeština"},
+ {"da", L"Dansk"},
+ {"de", L"Deutsch"},
+ {"el", L"Ελληνικά"},
+ {"en", L"English"},
+ {"es", L"Español"},
+ {"et", L"Eesti"},
+ {"eu", L"Euskara"},
+ {"fa", L"فارسي"},
+ {"fi", L"Suomi"},
+ {"fr", L"Français"},
+ {"he", L"עברית"},
+ {"hu", L"Magyar"},
+ {"id", L"Bahasa Indonesia"},
+ {"it", L"Italiano"},
+ {"ja", L"日本語"},
+ {"ka", L"ქართული"},
+ {"ko", L"한국어"},
+ {"lv", L"Latviešu"},
+ {"nl", L"Nederlands"},
+ {"nn", L"Norsk Nynorsk"},
+ {"pl", L"Polski"},
+ {"ro", L"Română"},
+ {"ru", L"Русский"},
+ {"pt-br", L"Português-Brasil"},
+ {"sk", L"Slovenčina"},
+ {"sl", L"Slovenščina"},
+ {"sv", L"Svenska"},
+ {"th", L"ภาษาไทย"},
+ {"tr", L"Türkçe"},
+ {"uk", L"Українська"},
+ {"uz", L"Ўзбекча"},
+ {"vi", L"Tiếng Việt"},
+ {"zh-cn", L"简体中文"},
+ {"zh-hk", L"繁體中文(香港)"},
+ {"zh-tw", L"繁體中文"}
+ };
};
}
diff --git a/src/Main/Forms/SecurityTokenKeyfilesDialog.cpp b/src/Main/Forms/SecurityTokenKeyfilesDialog.cpp
index c4492599..8f51cfa8 100644
--- a/src/Main/Forms/SecurityTokenKeyfilesDialog.cpp
+++ b/src/Main/Forms/SecurityTokenKeyfilesDialog.cpp
@@ -12,7 +12,6 @@
#include "System.h"
#include "Main/GraphicUserInterface.h"
-#include "Common/SecurityToken.h"
#include "NewSecurityTokenKeyfileDialog.h"
#include "SecurityTokenKeyfilesDialog.h"
@@ -54,18 +53,17 @@ namespace VeraCrypt
wxBusyCursor busy;
SecurityTokenKeyfileListCtrl->DeleteAllItems();
- SecurityTokenKeyfileList = SecurityToken::GetAvailableKeyfiles();
+ SecurityTokenKeyfileList = Token::GetAvailableKeyfiles(Gui->GetPreferences().EMVSupportEnabled);
- size_t i = 0;
- foreach (const SecurityTokenKeyfile &key, SecurityTokenKeyfileList)
+ foreach (const shared_ptr<TokenKeyfile> key, SecurityTokenKeyfileList)
{
vector <wstring> fields (SecurityTokenKeyfileListCtrl->GetColumnCount());
- fields[ColumnSecurityTokenSlotId] = StringConverter::ToWide ((uint64) key.SlotId);
- fields[ColumnSecurityTokenLabel] = key.Token.Label;
- fields[ColumnSecurityTokenKeyfileLabel] = key.Id;
+ fields[ColumnSecurityTokenSlotId] = StringConverter::ToWide ((uint64) key->Token->SlotId);
+ fields[ColumnSecurityTokenLabel] = key->Token->Label;
+ fields[ColumnSecurityTokenKeyfileLabel] = key->Id;
- Gui->AppendToListCtrl (SecurityTokenKeyfileListCtrl, fields, 0, &SecurityTokenKeyfileList[i++]);
+ Gui->AppendToListCtrl (SecurityTokenKeyfileListCtrl, fields, 0, key.get());
}
}
@@ -97,7 +95,7 @@ namespace VeraCrypt
{
foreach (long item, Gui->GetListCtrlSelectedItems (SecurityTokenKeyfileListCtrl))
{
- SecurityTokenKeyfile *keyfile = reinterpret_cast <SecurityTokenKeyfile *> (SecurityTokenKeyfileListCtrl->GetItemData (item));
+ TokenKeyfile *keyfile = reinterpret_cast <TokenKeyfile *> (SecurityTokenKeyfileListCtrl->GetItemData (item));
FilePathList files = Gui->SelectFiles (this, wxEmptyString, true);
@@ -106,7 +104,7 @@ namespace VeraCrypt
wxBusyCursor busy;
vector <byte> keyfileData;
- SecurityToken::GetKeyfileData (*keyfile, keyfileData);
+ keyfile->GetKeyfileData (keyfileData);
BufferPtr keyfileDataBuf (&keyfileData.front(), keyfileData.size());
finally_do_arg (BufferPtr, keyfileDataBuf, { finally_arg.Erase(); });
@@ -178,11 +176,25 @@ namespace VeraCrypt
}
}
- void SecurityTokenKeyfilesDialog::OnListItemSelected (wxListEvent& event)
+ void SecurityTokenKeyfilesDialog::OnListItemSelected(wxListEvent &event)
{
if (event.GetItem().GetData() != (wxUIntPtr) nullptr)
{
- DeleteButton->Enable();
+ BOOL deletable = true;
+ foreach(long
+ item, Gui->GetListCtrlSelectedItems(SecurityTokenKeyfileListCtrl))
+ {
+ TokenKeyfile *keyfile = reinterpret_cast <TokenKeyfile *> (SecurityTokenKeyfileListCtrl->GetItemData(item));
+ if (!keyfile->Token->isEditable())
+ {
+ deletable = false;
+ break;
+ }
+ }
+ if (deletable)
+ {
+ DeleteButton->Enable();
+ }
ExportButton->Enable();
OKButton->Enable();
}
@@ -192,10 +204,10 @@ namespace VeraCrypt
{
foreach (long item, Gui->GetListCtrlSelectedItems (SecurityTokenKeyfileListCtrl))
{
- SecurityTokenKeyfile *key = reinterpret_cast <SecurityTokenKeyfile *> (SecurityTokenKeyfileListCtrl->GetItemData (item));
- SelectedSecurityTokenKeyfilePaths.push_back (*key);
- }
+ TokenKeyfile *key = reinterpret_cast <TokenKeyfile *> (SecurityTokenKeyfileListCtrl->GetItemData(item));
+ SelectedSecurityTokenKeyfilePaths.push_back(*key);
+ }
EndModal (wxID_OK);
}
}
diff --git a/src/Main/Forms/SecurityTokenKeyfilesDialog.h b/src/Main/Forms/SecurityTokenKeyfilesDialog.h
index 8ba7fa9d..92119e1e 100644
--- a/src/Main/Forms/SecurityTokenKeyfilesDialog.h
+++ b/src/Main/Forms/SecurityTokenKeyfilesDialog.h
@@ -14,7 +14,9 @@
#define TC_HEADER_Main_Forms_SecurityTokenKeyfilesDialog
#include "Forms.h"
+#include "Common/Token.h"
#include "Common/SecurityToken.h"
+#include "Common/EMVToken.h"
#include "Main/Main.h"
namespace VeraCrypt
@@ -23,7 +25,7 @@ namespace VeraCrypt
{
public:
SecurityTokenKeyfilesDialog (wxWindow* parent, bool selectionMode = true);
- list <SecurityTokenKeyfilePath> GetSelectedSecurityTokenKeyfilePaths() const { return SelectedSecurityTokenKeyfilePaths; }
+ list <TokenKeyfilePath> GetSelectedSecurityTokenKeyfilePaths() const { return SelectedSecurityTokenKeyfilePaths; }
protected:
enum
@@ -43,8 +45,8 @@ namespace VeraCrypt
void OnOKButtonClick ();
void OnOKButtonClick (wxCommandEvent& event) { OnOKButtonClick(); }
- vector <SecurityTokenKeyfile> SecurityTokenKeyfileList;
- list <SecurityTokenKeyfilePath> SelectedSecurityTokenKeyfilePaths;
+ vector <shared_ptr<TokenKeyfile>> SecurityTokenKeyfileList;
+ list <TokenKeyfilePath> SelectedSecurityTokenKeyfilePaths;
};
}
diff --git a/src/Main/Forms/TrueCrypt.fbp b/src/Main/Forms/TrueCrypt.fbp
index 24689fcf..0b40a99e 100644
--- a/src/Main/Forms/TrueCrypt.fbp
+++ b/src/Main/Forms/TrueCrypt.fbp
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
- <FileVersion major="1" minor="13" />
+ <FileVersion major="1" minor="16" />
<object class="Project" expanded="1">
<property name="class_decoration">; international.h</property>
<property name="code_generation">C++</property>
@@ -14,6 +14,7 @@
<property name="file">Forms</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
+ <property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">VeraCrypt</property>
@@ -25,6 +26,7 @@
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
+ <property name="use_array_enum">0</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<object class="Frame" expanded="0">
@@ -50,45 +52,13 @@
<property name="subclass"></property>
<property name="title">VeraCrypt</property>
<property name="tooltip"></property>
+ <property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<property name="xrc_skip_sizer">1</property>
<event name="OnActivate">OnActivate</event>
- <event name="OnActivateApp"></event>
- <event name="OnAuiFindManager"></event>
- <event name="OnAuiPaneButton"></event>
- <event name="OnAuiPaneClose"></event>
- <event name="OnAuiPaneMaximize"></event>
- <event name="OnAuiPaneRestore"></event>
- <event name="OnAuiRender"></event>
- <event name="OnChar"></event>
<event name="OnClose">OnClose</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnHibernate"></event>
- <event name="OnIconize"></event>
- <event name="OnIdle"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxMenuBar" expanded="0">
<property name="bg"></property>
<property name="context_help"></property>
@@ -98,7 +68,6 @@
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
- <property name="label">MainMenuBar</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">MainMenuBar</property>
@@ -111,29 +80,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxMenu" expanded="0">
<property name="label">MENU_VOLUMES</property>
<property name="name">VolumesMenu</property>
@@ -151,7 +97,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnCreateVolumeButtonClick</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="separator" expanded="0">
<property name="name">m_separator1</property>
@@ -170,7 +115,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnMountVolumeMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
@@ -185,7 +129,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnMountAllDevicesButtonClick</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="separator" expanded="0">
<property name="name">m_separator2</property>
@@ -204,7 +147,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnDismountVolumeMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
@@ -219,7 +161,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnDismountAllButtonClick</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="separator" expanded="0">
<property name="name">m_separator3</property>
@@ -238,7 +179,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnChangePasswordMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
@@ -253,7 +193,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnChangePkcs5PrfMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
@@ -268,7 +207,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnChangeKeyfilesMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
@@ -283,7 +221,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnRemoveKeyfilesMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="separator" expanded="0">
<property name="name">m_separator4</property>
@@ -302,7 +239,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnVolumePropertiesButtonClick</event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="wxMenu" expanded="0">
@@ -322,7 +258,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnAddToFavoritesMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
@@ -337,7 +272,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnAddAllMountedToFavoritesMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
@@ -352,7 +286,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnOrganizeFavoritesMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="separator" expanded="0">
<property name="name">m_separator5</property>
@@ -371,7 +304,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnMountAllFavoritesMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="separator" expanded="0">
<property name="name">m_separator6</property>
@@ -395,7 +327,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnBenchmarkMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
@@ -410,7 +341,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnEncryptionTestMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="separator" expanded="0">
<property name="name">m_separator7</property>
@@ -429,7 +359,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnCreateVolumeButtonClick</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="separator" expanded="0">
<property name="name">m_separator8</property>
@@ -448,7 +377,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnBackupVolumeHeadersMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
@@ -463,7 +391,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnRestoreVolumeHeaderMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="separator" expanded="0">
<property name="name">m_separator9</property>
@@ -482,7 +409,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnCreateKeyfileMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
@@ -497,7 +423,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnManageSecurityTokenKeyfilesMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
@@ -512,7 +437,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnCloseAllSecurityTokenSessionsMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="separator" expanded="0">
<property name="name">m_separator10</property>
@@ -531,7 +455,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnWipeCacheButtonClick</event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="wxMenu" expanded="0">
@@ -545,13 +468,26 @@
<property name="help"></property>
<property name="id">wxID_ANY</property>
<property name="kind">wxITEM_NORMAL</property>
+ <property name="label">IDM_LANGUAGE</property>
+ <property name="name">LanguageMenuItem</property>
+ <property name="permission">none</property>
+ <property name="shortcut"></property>
+ <property name="unchecked_bitmap"></property>
+ <event name="OnMenuSelection">OnLanguageMenuItemSelected</event>
+ </object>
+ <object class="wxMenuItem" expanded="0">
+ <property name="bitmap"></property>
+ <property name="checked">0</property>
+ <property name="enabled">1</property>
+ <property name="help"></property>
+ <property name="id">wxID_ANY</property>
+ <property name="kind">wxITEM_NORMAL</property>
<property name="label">IDM_HOTKEY_SETTINGS</property>
<property name="name">HotkeysMenuItem</property>
<property name="permission">protected</property>
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnHotkeysMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
@@ -566,7 +502,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnDefaultKeyfilesMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
@@ -581,7 +516,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnDefaultMountParametersMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
@@ -596,7 +530,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnSecurityTokenPreferencesMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="separator" expanded="0">
<property name="name">m_separator11</property>
@@ -615,7 +548,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnPreferencesMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="wxMenu" expanded="0">
@@ -635,7 +567,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnUserGuideMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
@@ -650,7 +581,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnOnlineHelpMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
@@ -665,7 +595,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnBeginnersTutorialMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
@@ -680,7 +609,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnFaqMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="separator" expanded="0">
<property name="name">m_separator12</property>
@@ -699,7 +627,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnWebsiteMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
@@ -714,7 +641,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnDownloadsMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
@@ -729,7 +655,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnNewsMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
@@ -744,7 +669,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnVersionHistoryMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="separator" expanded="0">
<property name="name">m_separator13</property>
@@ -763,7 +687,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnDonateMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
@@ -778,7 +701,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnContactMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
@@ -793,7 +715,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnLegalNoticesMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
@@ -808,7 +729,6 @@
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnAboutMenuItemSelected</event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -872,29 +792,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer2</property>
@@ -921,7 +818,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
@@ -981,50 +877,11 @@
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
- <property name="window_style">wxSUNKEN_BORDER</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnListBeginDrag"></event>
- <event name="OnListBeginLabelEdit"></event>
- <event name="OnListBeginRDrag"></event>
- <event name="OnListCacheHint"></event>
- <event name="OnListColBeginDrag"></event>
- <event name="OnListColClick"></event>
- <event name="OnListColDragging"></event>
- <event name="OnListColEndDrag"></event>
- <event name="OnListColRightClick"></event>
- <event name="OnListDeleteAllItems"></event>
- <event name="OnListDeleteItem"></event>
- <event name="OnListEndLabelEdit"></event>
- <event name="OnListInsertItem"></event>
+ <property name="window_style">wxBORDER_SUNKEN</property>
<event name="OnListItemActivated">OnListItemActivated</event>
<event name="OnListItemDeselected">OnListItemDeselected</event>
- <event name="OnListItemFocused"></event>
- <event name="OnListItemMiddleClick"></event>
<event name="OnListItemRightClick">OnListItemRightClick</event>
<event name="OnListItemSelected">OnListItemSelected</event>
- <event name="OnListKeyDown"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -1041,7 +898,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">protected</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">2</property>
<property name="flag">wxEXPAND|wxTOP</property>
@@ -1087,27 +943,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDC_CREATE_VOLUME</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -1123,6 +985,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -1138,29 +1002,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnCreateVolumeButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -1176,7 +1017,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
- <property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND</property>
+ <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxButton" expanded="0">
<property name="BottomDockable">1</property>
@@ -1187,27 +1028,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDC_VOLUME_PROPERTIES</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -1223,6 +1070,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -1238,29 +1087,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnVolumePropertiesButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -1276,7 +1102,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
- <property name="flag">wxALL|wxALIGN_RIGHT|wxEXPAND</property>
+ <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxButton" expanded="0">
<property name="BottomDockable">1</property>
@@ -1287,27 +1113,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">HK_WIPE_CACHE</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -1323,6 +1155,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -1338,29 +1172,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnWipeCacheButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -1389,7 +1200,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">protected</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">4</property>
<property name="flag">wxEXPAND|wxALL</property>
@@ -1463,30 +1273,8 @@
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
- <property name="window_style">wxSUNKEN_BORDER</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
+ <property name="window_style">wxBORDER_SUNKEN</property>
<event name="OnLeftDown">OnLogoBitmapClick</event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="gbsizeritem" expanded="0">
@@ -1555,34 +1343,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnCombobox"></event>
- <event name="OnComboboxCloseup"></event>
- <event name="OnComboboxDropdown"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnText"></event>
- <event name="OnTextEnter"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="gbsizeritem" expanded="0">
@@ -1610,27 +1370,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDC_SELECT_FILE</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -1646,6 +1412,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -1661,29 +1429,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnSelectFileButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -1753,30 +1498,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
<event name="OnCheckBox">OnNoHistoryCheckBoxClick</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="gbsizeritem" expanded="0">
@@ -1804,27 +1526,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDC_VOLUME_TOOLS</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -1840,6 +1568,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -1855,29 +1585,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnVolumeToolsButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -1907,27 +1614,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDC_SELECT_DEVICE</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -1943,6 +1656,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -1958,29 +1673,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnSelectDeviceButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -2023,10 +1715,9 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">2</property>
- <property name="flag">wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxALL</property>
+ <property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">1</property>
<object class="wxButton" expanded="0">
<property name="BottomDockable">1</property>
@@ -2037,27 +1728,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">1</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">MOUNT_BUTTON</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -2073,6 +1770,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -2088,29 +1787,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnVolumeButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -2127,10 +1803,9 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">2</property>
- <property name="flag">wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxALL</property>
+ <property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">1</property>
<object class="wxButton" expanded="0">
<property name="BottomDockable">1</property>
@@ -2141,27 +1816,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDC_MOUNTALL</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -2177,6 +1858,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -2192,29 +1875,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnMountAllDevicesButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -2231,10 +1891,9 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">2</property>
- <property name="flag">wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxALL</property>
+ <property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">1</property>
<object class="wxButton" expanded="0">
<property name="BottomDockable">1</property>
@@ -2245,27 +1904,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDC_UNMOUNTALL</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -2281,6 +1946,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -2296,29 +1963,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnDismountAllButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -2335,10 +1979,9 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">2</property>
- <property name="flag">wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxALL</property>
+ <property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">1</property>
<object class="wxButton" expanded="0">
<property name="BottomDockable">1</property>
@@ -2349,27 +1992,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDC_EXIT</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -2385,6 +2034,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -2400,29 +2051,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnExitButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -2461,45 +2089,13 @@
<property name="subclass"></property>
<property name="title"></property>
<property name="tooltip"></property>
+ <property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<property name="xrc_skip_sizer">1</property>
<event name="OnActivate">OnActivate</event>
- <event name="OnActivateApp"></event>
- <event name="OnAuiFindManager"></event>
- <event name="OnAuiPaneButton"></event>
- <event name="OnAuiPaneClose"></event>
- <event name="OnAuiPaneMaximize"></event>
- <event name="OnAuiPaneRestore"></event>
- <event name="OnAuiRender"></event>
- <event name="OnChar"></event>
<event name="OnClose">OnClose</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnHibernate"></event>
- <event name="OnIconize"></event>
- <event name="OnIdle"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">MainSizer</property>
@@ -2560,29 +2156,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
<event name="OnMotion">OnMouseMotion</event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer63</property>
@@ -2609,7 +2183,6 @@
<property name="orient">wxHORIZONTAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
@@ -2666,29 +2239,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -2768,29 +2318,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -2812,7 +2339,7 @@
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
- <property name="flag">wxEXPAND|wxALIGN_RIGHT|wxALL</property>
+ <property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
@@ -2831,7 +2358,7 @@
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
- <property name="flag">wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL</property>
+ <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="0">
<property name="BottomDockable">1</property>
@@ -2842,27 +2369,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_HELP</property>
<property name="label">IDHELP</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -2878,6 +2411,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -2893,44 +2428,21 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnHelpButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
- <property name="flag">wxLEFT|wxALIGN_RIGHT</property>
+ <property name="flag">wxLEFT</property>
<property name="proportion">0</property>
<object class="spacer" expanded="0">
<property name="height">0</property>
<property name="permission">protected</property>
- <property name="width">0</property>
+ <property name="width">2</property>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
- <property name="flag">wxTOP|wxBOTTOM|wxLEFT|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL</property>
+ <property name="flag">wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="0">
<property name="BottomDockable">1</property>
@@ -2941,27 +2453,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">PREV</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -2977,6 +2495,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -2992,34 +2512,11 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnPreviousButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
- <property name="flag">wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL</property>
+ <property name="flag">wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="0">
<property name="BottomDockable">1</property>
@@ -3030,27 +2527,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">1</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">NEXT</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -3066,6 +2569,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -3081,44 +2586,21 @@
<property name="window_name"></property>
<property name="window_style">wxWANTS_CHARS</property>
<event name="OnButtonClick">OnNextButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
- <property name="flag">wxLEFT|wxALIGN_RIGHT</property>
+ <property name="flag">wxLEFT</property>
<property name="proportion">0</property>
<object class="spacer" expanded="0">
<property name="height">0</property>
<property name="permission">protected</property>
- <property name="width">0</property>
+ <property name="width">2</property>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
- <property name="flag">wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL</property>
+ <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="0">
<property name="BottomDockable">1</property>
@@ -3129,27 +2611,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_CANCEL</property>
<property name="label">IDCANCEL</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -3165,6 +2653,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -3180,29 +2670,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnCancelButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -3237,45 +2704,10 @@
<property name="subclass"></property>
<property name="title"></property>
<property name="tooltip"></property>
+ <property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnActivate"></event>
- <event name="OnActivateApp"></event>
- <event name="OnAuiFindManager"></event>
- <event name="OnAuiPaneButton"></event>
- <event name="OnAuiPaneClose"></event>
- <event name="OnAuiPaneMaximize"></event>
- <event name="OnAuiPaneRestore"></event>
- <event name="OnAuiRender"></event>
- <event name="OnChar"></event>
- <event name="OnClose"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnHibernate"></event>
- <event name="OnIconize"></event>
- <event name="OnIdle"></event>
- <event name="OnInitDialog"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer116</property>
@@ -3354,29 +2786,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer121</property>
@@ -3457,29 +2866,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -3566,29 +2952,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -3660,29 +3023,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -3756,30 +3096,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
<event name="OnHyperlink">OnWebsiteHyperlinkClick</event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -3842,29 +3159,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -3928,34 +3222,7 @@
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
- <property name="window_style">wxSUNKEN_BORDER</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnText"></event>
- <event name="OnTextEnter"></event>
- <event name="OnTextMaxLen"></event>
- <event name="OnTextURL"></event>
- <event name="OnUpdateUI"></event>
+ <property name="window_style">wxBORDER_SUNKEN</property>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -4024,29 +3291,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -4105,29 +3349,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -4162,27 +3383,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">1</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_OK</property>
<property name="label">IDOK</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -4198,6 +3425,8 @@
<property name="permission">none</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -4212,30 +3441,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnButtonClick"></event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -4277,45 +3482,10 @@
<property name="subclass"></property>
<property name="title">IDD_BENCHMARK_DLG</property>
<property name="tooltip"></property>
+ <property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnActivate"></event>
- <event name="OnActivateApp"></event>
- <event name="OnAuiFindManager"></event>
- <event name="OnAuiPaneButton"></event>
- <event name="OnAuiPaneClose"></event>
- <event name="OnAuiPaneMaximize"></event>
- <event name="OnAuiPaneRestore"></event>
- <event name="OnAuiRender"></event>
- <event name="OnChar"></event>
- <event name="OnClose"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnHibernate"></event>
- <event name="OnIconize"></event>
- <event name="OnIdle"></event>
- <event name="OnInitDialog"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer153</property>
@@ -4405,29 +3575,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -4492,30 +3639,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
<event name="OnChoice">OnBenchmarkChoiceSelected</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -4577,29 +3701,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -4664,30 +3765,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnChoice"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -4749,29 +3826,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -4836,33 +3890,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnText"></event>
- <event name="OnTextEnter"></event>
- <event name="OnTextMaxLen"></event>
- <event name="OnTextURL"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -4923,29 +3950,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -5016,50 +4020,7 @@
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
- <property name="window_style">wxSUNKEN_BORDER</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnListBeginDrag"></event>
- <event name="OnListBeginLabelEdit"></event>
- <event name="OnListBeginRDrag"></event>
- <event name="OnListCacheHint"></event>
- <event name="OnListColBeginDrag"></event>
- <event name="OnListColClick"></event>
- <event name="OnListColDragging"></event>
- <event name="OnListColEndDrag"></event>
- <event name="OnListColRightClick"></event>
- <event name="OnListDeleteAllItems"></event>
- <event name="OnListDeleteItem"></event>
- <event name="OnListEndLabelEdit"></event>
- <event name="OnListInsertItem"></event>
- <event name="OnListItemActivated"></event>
- <event name="OnListItemDeselected"></event>
- <event name="OnListItemFocused"></event>
- <event name="OnListItemMiddleClick"></event>
- <event name="OnListItemRightClick"></event>
- <event name="OnListItemSelected"></event>
- <event name="OnListKeyDown"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
+ <property name="window_style">wxBORDER_SUNKEN</property>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -5084,27 +4045,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">1</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_OK</property>
<property name="label">IDC_PERFORM_BENCHMARK</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -5120,6 +4087,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -5135,29 +4104,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnBenchmarkButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -5173,27 +4119,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_CANCEL</property>
<property name="label">IDCLOSE</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -5209,6 +4161,8 @@
<property name="permission">none</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -5223,30 +4177,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnButtonClick"></event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -5318,29 +4248,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -5374,45 +4281,10 @@
<property name="subclass"></property>
<property name="title"></property>
<property name="tooltip"></property>
+ <property name="two_step_creation">0</property>
<property name="window_extra_style">wxWS_EX_VALIDATE_RECURSIVELY</property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnActivate"></event>
- <event name="OnActivateApp"></event>
- <event name="OnAuiFindManager"></event>
- <event name="OnAuiPaneButton"></event>
- <event name="OnAuiPaneClose"></event>
- <event name="OnAuiPaneMaximize"></event>
- <event name="OnAuiPaneRestore"></event>
- <event name="OnAuiRender"></event>
- <event name="OnChar"></event>
- <event name="OnClose"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnHibernate"></event>
- <event name="OnIconize"></event>
- <event name="OnIdle"></event>
- <event name="OnInitDialog"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer30</property>
@@ -5448,7 +4320,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">protected</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_LEFT</property>
@@ -5474,7 +4345,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">protected</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_LEFT</property>
@@ -5512,27 +4382,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">1</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_OK</property>
<property name="label">IDOK</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -5548,6 +4424,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -5563,29 +4441,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnOKButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -5601,27 +4456,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_CANCEL</property>
<property name="label">IDCANCEL</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -5637,6 +4498,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -5651,30 +4514,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnButtonClick"></event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -5706,45 +4545,10 @@
<property name="subclass"></property>
<property name="title">IDD_RAWDEVICES_DLG</property>
<property name="tooltip"></property>
+ <property name="two_step_creation">0</property>
<property name="window_extra_style">wxWS_EX_VALIDATE_RECURSIVELY</property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnActivate"></event>
- <event name="OnActivateApp"></event>
- <event name="OnAuiFindManager"></event>
- <event name="OnAuiPaneButton"></event>
- <event name="OnAuiPaneClose"></event>
- <event name="OnAuiPaneMaximize"></event>
- <event name="OnAuiPaneRestore"></event>
- <event name="OnAuiRender"></event>
- <event name="OnChar"></event>
- <event name="OnClose"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnHibernate"></event>
- <event name="OnIconize"></event>
- <event name="OnIdle"></event>
- <event name="OnInitDialog"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer3</property>
@@ -5818,57 +4622,17 @@
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
- <property name="window_style">wxSUNKEN_BORDER</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnListBeginDrag"></event>
- <event name="OnListBeginLabelEdit"></event>
- <event name="OnListBeginRDrag"></event>
- <event name="OnListCacheHint"></event>
- <event name="OnListColBeginDrag"></event>
- <event name="OnListColClick"></event>
- <event name="OnListColDragging"></event>
- <event name="OnListColEndDrag"></event>
- <event name="OnListColRightClick"></event>
- <event name="OnListDeleteAllItems"></event>
- <event name="OnListDeleteItem"></event>
- <event name="OnListEndLabelEdit"></event>
- <event name="OnListInsertItem"></event>
+ <property name="window_style">wxBORDER_SUNKEN</property>
<event name="OnListItemActivated">OnListItemActivated</event>
<event name="OnListItemDeselected">OnListItemDeselected</event>
- <event name="OnListItemFocused"></event>
- <event name="OnListItemMiddleClick"></event>
- <event name="OnListItemRightClick"></event>
<event name="OnListItemSelected">OnListItemSelected</event>
- <event name="OnListKeyDown"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
- <property name="flag">wxALIGN_RIGHT|wxALL|wxEXPAND</property>
+ <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
@@ -5898,27 +4662,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_CANCEL</property>
<property name="label">IDCANCEL</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -5934,6 +4704,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -5948,30 +4720,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnButtonClick"></event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -5987,27 +4735,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">1</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_OK</property>
<property name="label">IDOK</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -6023,6 +4777,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -6038,29 +4794,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnOKButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -6090,45 +4823,10 @@
<property name="subclass"></property>
<property name="title">IDD_CIPHER_TEST_DLG</property>
<property name="tooltip"></property>
+ <property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnActivate"></event>
- <event name="OnActivateApp"></event>
- <event name="OnAuiFindManager"></event>
- <event name="OnAuiPaneButton"></event>
- <event name="OnAuiPaneClose"></event>
- <event name="OnAuiPaneMaximize"></event>
- <event name="OnAuiPaneRestore"></event>
- <event name="OnAuiRender"></event>
- <event name="OnChar"></event>
- <event name="OnClose"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnHibernate"></event>
- <event name="OnIconize"></event>
- <event name="OnIdle"></event>
- <event name="OnInitDialog"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer132</property>
@@ -6211,29 +4909,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -6298,30 +4973,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
<event name="OnChoice">OnEncryptionAlgorithmSelected</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -6386,30 +5038,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
<event name="OnCheckBox">OnXtsModeCheckBoxClick</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -6426,7 +5055,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
@@ -6489,33 +5117,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnText"></event>
- <event name="OnTextEnter"></event>
- <event name="OnTextMaxLen"></event>
- <event name="OnTextURL"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -6586,29 +5187,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -6670,29 +5248,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -6711,7 +5266,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
@@ -6771,29 +5325,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -6858,33 +5389,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnText"></event>
- <event name="OnTextEnter"></event>
- <event name="OnTextMaxLen"></event>
- <event name="OnTextURL"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -6946,29 +5450,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -7033,33 +5514,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnText"></event>
- <event name="OnTextEnter"></event>
- <event name="OnTextMaxLen"></event>
- <event name="OnTextURL"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -7121,29 +5575,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -7208,33 +5639,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnText"></event>
- <event name="OnTextEnter"></event>
- <event name="OnTextMaxLen"></event>
- <event name="OnTextURL"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -7251,7 +5655,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
@@ -7314,33 +5717,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnText"></event>
- <event name="OnTextEnter"></event>
- <event name="OnTextMaxLen"></event>
- <event name="OnTextURL"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -7357,7 +5733,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
@@ -7420,33 +5795,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnText"></event>
- <event name="OnTextEnter"></event>
- <event name="OnTextMaxLen"></event>
- <event name="OnTextURL"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -7473,27 +5821,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">ENCRYPT</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -7509,6 +5863,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -7524,29 +5880,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnEncryptButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -7562,27 +5895,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">DECRYPT</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -7598,6 +5937,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -7613,29 +5954,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnDecryptButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -7651,27 +5969,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDC_AUTO</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -7687,6 +6011,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -7702,29 +6028,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnAutoTestAllButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -7740,27 +6043,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDC_RESET</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -7776,6 +6085,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -7791,29 +6102,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnResetButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -7829,27 +6117,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_CANCEL</property>
<property name="label">IDCLOSE</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -7865,6 +6159,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -7879,30 +6175,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnButtonClick"></event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -7934,45 +6206,10 @@
<property name="subclass"></property>
<property name="title">IDD_FAVORITE_VOLUMES</property>
<property name="tooltip"></property>
+ <property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnActivate"></event>
- <event name="OnActivateApp"></event>
- <event name="OnAuiFindManager"></event>
- <event name="OnAuiPaneButton"></event>
- <event name="OnAuiPaneClose"></event>
- <event name="OnAuiPaneMaximize"></event>
- <event name="OnAuiPaneRestore"></event>
- <event name="OnAuiRender"></event>
- <event name="OnChar"></event>
- <event name="OnClose"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnHibernate"></event>
- <event name="OnIconize"></event>
- <event name="OnIdle"></event>
- <event name="OnInitDialog"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer57</property>
@@ -8055,50 +6292,9 @@
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
- <property name="window_style">wxSUNKEN_BORDER</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnListBeginDrag"></event>
- <event name="OnListBeginLabelEdit"></event>
- <event name="OnListBeginRDrag"></event>
- <event name="OnListCacheHint"></event>
- <event name="OnListColBeginDrag"></event>
- <event name="OnListColClick"></event>
- <event name="OnListColDragging"></event>
- <event name="OnListColEndDrag"></event>
- <event name="OnListColRightClick"></event>
- <event name="OnListDeleteAllItems"></event>
- <event name="OnListDeleteItem"></event>
- <event name="OnListEndLabelEdit"></event>
- <event name="OnListInsertItem"></event>
- <event name="OnListItemActivated"></event>
+ <property name="window_style">wxBORDER_SUNKEN</property>
<event name="OnListItemDeselected">OnListItemDeselected</event>
- <event name="OnListItemFocused"></event>
- <event name="OnListItemMiddleClick"></event>
- <event name="OnListItemRightClick"></event>
<event name="OnListItemSelected">OnListItemSelected</event>
- <event name="OnListKeyDown"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -8126,27 +6322,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDC_FAVORITE_MOVE_UP</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -8162,6 +6364,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -8177,29 +6381,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnMoveUpButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -8215,27 +6396,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDC_FAVORITE_MOVE_DOWN</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -8251,6 +6438,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -8266,34 +6455,11 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnMoveDownButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
- <property name="flag">wxALIGN_RIGHT|wxEXPAND|wxTOP|wxBOTTOM|wxLEFT</property>
+ <property name="flag">wxEXPAND|wxTOP|wxBOTTOM|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
@@ -8304,27 +6470,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDC_KEYREMOVE</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -8340,6 +6512,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -8355,29 +6529,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnRemoveButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -8393,27 +6544,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDC_KEYREMOVEALL</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -8429,6 +6586,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -8444,29 +6603,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnRemoveAllButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -8523,27 +6659,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">1</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_OK</property>
<property name="label">IDOK</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -8559,6 +6701,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -8574,29 +6718,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnOKButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -8612,27 +6733,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_CANCEL</property>
<property name="label">IDCANCEL</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -8648,6 +6775,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -8662,30 +6791,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnButtonClick"></event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -8717,45 +6822,10 @@
<property name="subclass"></property>
<property name="title">SELECT_TOKEN_KEYFILES</property>
<property name="tooltip"></property>
+ <property name="two_step_creation">0</property>
<property name="window_extra_style">wxWS_EX_VALIDATE_RECURSIVELY</property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnActivate"></event>
- <event name="OnActivateApp"></event>
- <event name="OnAuiFindManager"></event>
- <event name="OnAuiPaneButton"></event>
- <event name="OnAuiPaneClose"></event>
- <event name="OnAuiPaneMaximize"></event>
- <event name="OnAuiPaneRestore"></event>
- <event name="OnAuiRender"></event>
- <event name="OnChar"></event>
- <event name="OnClose"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnHibernate"></event>
- <event name="OnIconize"></event>
- <event name="OnIdle"></event>
- <event name="OnInitDialog"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer26</property>
@@ -8803,27 +6873,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">1</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_OK</property>
<property name="label">IDOK</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -8839,6 +6915,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -8853,30 +6931,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnButtonClick"></event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -8892,27 +6946,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_CANCEL</property>
<property name="label">IDCANCEL</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -8928,6 +6988,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -8942,30 +7004,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnButtonClick"></event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -9027,29 +7065,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -9130,29 +7145,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -9214,29 +7206,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -9295,29 +7264,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -9399,30 +7345,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
<event name="OnHyperlink">OnKeyfilesHyperlinkClick</event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -9438,27 +7361,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDC_GENERATE_KEYFILE</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -9474,6 +7403,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -9489,29 +7420,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnCreateKeyfileButttonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -9543,45 +7451,11 @@
<property name="subclass"></property>
<property name="title"></property>
<property name="tooltip"></property>
+ <property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnActivate"></event>
- <event name="OnActivateApp"></event>
- <event name="OnAuiFindManager"></event>
- <event name="OnAuiPaneButton"></event>
- <event name="OnAuiPaneClose"></event>
- <event name="OnAuiPaneMaximize"></event>
- <event name="OnAuiPaneRestore"></event>
- <event name="OnAuiRender"></event>
- <event name="OnChar"></event>
- <event name="OnClose"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnHibernate"></event>
- <event name="OnIconize"></event>
- <event name="OnIdle"></event>
- <event name="OnInitDialog"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
<event name="OnMotion">OnMouseMotion</event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">MainSizer</property>
@@ -9674,29 +7548,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -9761,30 +7612,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
<event name="OnChoice">OnHashSelected</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -9811,7 +7639,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP</property>
@@ -9880,29 +7707,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -9964,29 +7768,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -10051,30 +7832,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
<event name="OnCheckBox">OnShowRandomPoolCheckBoxClicked</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -10101,7 +7859,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
@@ -10164,29 +7921,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -10260,29 +7994,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -10381,29 +8092,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -10466,32 +8154,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnSpinCtrl"></event>
- <event name="OnSpinCtrlText"></event>
- <event name="OnTextEnter"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -10549,29 +8211,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -10633,29 +8272,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -10718,32 +8334,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnSpinCtrl"></event>
- <event name="OnSpinCtrlText"></event>
- <event name="OnTextEnter"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -10808,30 +8398,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
<event name="OnCheckBox">OnRandomSizeCheckBoxClicked</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -10893,29 +8460,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -10980,33 +8524,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnText"></event>
- <event name="OnTextEnter"></event>
- <event name="OnTextMaxLen"></event>
- <event name="OnTextURL"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -11064,29 +8581,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -11115,27 +8609,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDC_GENERATE_AND_SAVE_KEYFILE</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -11151,6 +8651,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -11166,29 +8668,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnGenerateButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -11214,27 +8693,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_CANCEL</property>
<property name="label">IDCLOSE</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -11250,6 +8735,8 @@
<property name="permission">none</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -11264,30 +8751,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnButtonClick"></event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -11319,45 +8782,10 @@
<property name="subclass"></property>
<property name="title">LEGAL_NOTICES_DLG_TITLE</property>
<property name="tooltip"></property>
+ <property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnActivate"></event>
- <event name="OnActivateApp"></event>
- <event name="OnAuiFindManager"></event>
- <event name="OnAuiPaneButton"></event>
- <event name="OnAuiPaneClose"></event>
- <event name="OnAuiPaneMaximize"></event>
- <event name="OnAuiPaneRestore"></event>
- <event name="OnAuiRender"></event>
- <event name="OnChar"></event>
- <event name="OnClose"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnHibernate"></event>
- <event name="OnIconize"></event>
- <event name="OnIdle"></event>
- <event name="OnInitDialog"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer114</property>
@@ -11434,33 +8862,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnText"></event>
- <event name="OnTextEnter"></event>
- <event name="OnTextMaxLen"></event>
- <event name="OnTextURL"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -11476,27 +8877,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">1</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_OK</property>
<property name="label">IDOK</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -11512,6 +8919,8 @@
<property name="permission">none</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -11526,30 +8935,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnButtonClick"></event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -11579,45 +8964,11 @@
<property name="subclass"></property>
<property name="title">IDD_PASSWORD_DLG</property>
<property name="tooltip"></property>
+ <property name="two_step_creation">0</property>
<property name="window_extra_style">wxWS_EX_VALIDATE_RECURSIVELY</property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnActivate"></event>
- <event name="OnActivateApp"></event>
- <event name="OnAuiFindManager"></event>
- <event name="OnAuiPaneButton"></event>
- <event name="OnAuiPaneClose"></event>
- <event name="OnAuiPaneMaximize"></event>
- <event name="OnAuiPaneRestore"></event>
- <event name="OnAuiRender"></event>
- <event name="OnChar"></event>
- <event name="OnClose"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnHibernate"></event>
- <event name="OnIconize"></event>
- <event name="OnIdle"></event>
<event name="OnInitDialog">OnInitDialog</event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">MainSizer</property>
@@ -11674,27 +9025,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">1</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_OK</property>
<property name="label">IDOK</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -11710,6 +9067,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -11725,29 +9084,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnOKButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -11763,27 +9099,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_CANCEL</property>
<property name="label">IDCANCEL</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -11799,6 +9141,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -11813,30 +9157,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnButtonClick"></event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -11862,27 +9182,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDT_FORMAT_OPTIONS</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -11898,6 +9224,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -11913,29 +9241,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnOptionsButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -12006,29 +9311,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxStaticBoxSizer" expanded="0">
<property name="id">wxID_ANY</property>
<property name="label"></property>
@@ -12037,7 +9319,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">protected</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxTOP</property>
@@ -12110,30 +9391,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
<event name="OnCheckBox">OnReadOnlyCheckBoxClick</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -12198,30 +9456,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnCheckBox"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -12286,30 +9520,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnCheckBox"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -12374,30 +9584,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnCheckBox"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -12412,7 +9598,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">protected</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
@@ -12475,30 +9660,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
<event name="OnCheckBox">OnProtectionCheckBoxClick</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -12573,30 +9735,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
<event name="OnHyperlink">OnProtectionHyperlinkClick</event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -12665,29 +9804,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxStaticBoxSizer" expanded="0">
<property name="id">wxID_ANY</property>
<property name="label">IDT_FILESYSTEM</property>
@@ -12696,7 +9812,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM</property>
@@ -12777,30 +9892,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
<event name="OnCheckBox">OnNoFilesystemCheckBoxClick</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -12896,36 +9988,13 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="gbsizeritem" expanded="0">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">1</property>
- <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>
+ <property name="flag">wxALL|wxEXPAND</property>
<property name="row">1</property>
<property name="rowspan">1</property>
<object class="wxTextCtrl" expanded="0">
@@ -12986,33 +10055,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnText"></event>
- <event name="OnTextEnter"></event>
- <event name="OnTextMaxLen"></event>
- <event name="OnTextURL"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="gbsizeritem" expanded="0">
@@ -13031,27 +10073,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">LINUX_SELECT</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -13067,6 +10115,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -13082,29 +10132,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnMountPointButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="gbsizeritem" expanded="0">
@@ -13169,36 +10196,13 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="gbsizeritem" expanded="0">
<property name="border">5</property>
<property name="colspan">2</property>
<property name="column">1</property>
- <property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
+ <property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="row">2</property>
<property name="rowspan">1</property>
<object class="wxTextCtrl" expanded="0">
@@ -13259,33 +10263,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnText"></event>
- <event name="OnTextEnter"></event>
- <event name="OnTextMaxLen"></event>
- <event name="OnTextURL"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -13329,45 +10306,10 @@
<property name="subclass"></property>
<property name="title">IDD_TOKEN_PREFERENCES</property>
<property name="tooltip"></property>
+ <property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnActivate"></event>
- <event name="OnActivateApp"></event>
- <event name="OnAuiFindManager"></event>
- <event name="OnAuiPaneButton"></event>
- <event name="OnAuiPaneClose"></event>
- <event name="OnAuiPaneMaximize"></event>
- <event name="OnAuiPaneRestore"></event>
- <event name="OnAuiRender"></event>
- <event name="OnChar"></event>
- <event name="OnClose"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnHibernate"></event>
- <event name="OnIconize"></event>
- <event name="OnIdle"></event>
- <event name="OnInitDialog"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer143</property>
@@ -13394,7 +10336,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP</property>
@@ -13470,34 +10411,11 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
- <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>
+ <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxChoice" expanded="0">
<property name="BottomDockable">1</property>
@@ -13557,30 +10475,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnChoice"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -13642,34 +10536,11 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
- <property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL</property>
+ <property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="0">
<property name="BottomDockable">1</property>
@@ -13729,33 +10600,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
<event name="OnText">OnKeyfileNameChanged</event>
- <event name="OnTextEnter"></event>
- <event name="OnTextMaxLen"></event>
- <event name="OnTextURL"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -13794,27 +10639,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_CANCEL</property>
<property name="label">IDCANCEL</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -13830,6 +10681,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -13844,30 +10697,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnButtonClick"></event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -13883,27 +10712,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">1</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_OK</property>
<property name="label">IDOK</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -13919,6 +10754,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -13934,29 +10771,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnOKButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -13988,45 +10802,11 @@
<property name="subclass"></property>
<property name="title">IDD_PREFERENCES_DLG</property>
<property name="tooltip"></property>
+ <property name="two_step_creation">0</property>
<property name="window_extra_style">wxWS_EX_VALIDATE_RECURSIVELY</property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnActivate"></event>
- <event name="OnActivateApp"></event>
- <event name="OnAuiFindManager"></event>
- <event name="OnAuiPaneButton"></event>
- <event name="OnAuiPaneClose"></event>
- <event name="OnAuiPaneMaximize"></event>
- <event name="OnAuiPaneRestore"></event>
- <event name="OnAuiRender"></event>
- <event name="OnChar"></event>
<event name="OnClose">OnClose</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnHibernate"></event>
- <event name="OnIconize"></event>
- <event name="OnIdle"></event>
- <event name="OnInitDialog"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer32</property>
@@ -14098,31 +10878,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnNotebookPageChanged"></event>
- <event name="OnNotebookPageChanging"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
+ <event name="OnNotebookPageChanged">OnPageChanged</event>
<object class="notebookpage" expanded="0">
<property name="bitmap"></property>
<property name="label">LINUX_PREF_TAB_SECURITY</property>
@@ -14178,29 +10934,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer44</property>
@@ -14227,7 +10960,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">protected</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property>
@@ -14240,7 +10972,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
@@ -14303,30 +11034,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnCheckBox"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -14391,30 +11098,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
<event name="OnCheckBox">OnDismountOnScreenSaverCheckBoxClick</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -14479,30 +11163,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
<event name="OnCheckBox">OnDismountOnPowerSavingCheckBoxClick</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -14578,30 +11239,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnCheckBox"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -14664,32 +11301,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnSpinCtrl"></event>
- <event name="OnSpinCtrlText"></event>
- <event name="OnTextEnter"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -14751,29 +11362,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -14840,30 +11428,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
<event name="OnCheckBox">OnForceAutoDismountCheckBoxClick</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -14880,7 +11445,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">protected</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
@@ -14943,30 +11507,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
<event name="OnCheckBox">OnPreserveTimestampsCheckBoxClick</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -14983,7 +11524,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
@@ -15046,30 +11586,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnCheckBox"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -15134,30 +11650,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnCheckBox"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -15222,29 +11714,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer46</property>
@@ -15271,7 +11740,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
@@ -15334,30 +11802,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnCheckBox"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -15422,30 +11866,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnCheckBox"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -15510,118 +11930,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnCheckBox"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
- </object>
- </object>
- <object class="sizeritem" expanded="0">
- <property name="border">5</property>
- <property name="flag">wxALL</property>
- <property name="proportion">0</property>
- <object class="wxCheckBox" expanded="0">
- <property name="BottomDockable">1</property>
- <property name="LeftDockable">1</property>
- <property name="RightDockable">1</property>
- <property name="TopDockable">1</property>
- <property name="aui_layer"></property>
- <property name="aui_name"></property>
- <property name="aui_position"></property>
- <property name="aui_row"></property>
- <property name="best_size"></property>
- <property name="bg"></property>
- <property name="caption"></property>
- <property name="caption_visible">1</property>
- <property name="center_pane">0</property>
- <property name="checked">0</property>
- <property name="close_button">1</property>
- <property name="context_help"></property>
- <property name="context_menu">1</property>
- <property name="default_pane">0</property>
- <property name="dock">Dock</property>
- <property name="dock_fixed">0</property>
- <property name="docking">Left</property>
- <property name="enabled">1</property>
- <property name="fg"></property>
- <property name="floatable">1</property>
- <property name="font"></property>
- <property name="gripper">0</property>
- <property name="hidden">0</property>
- <property name="id">wxID_ANY</property>
- <property name="label">IDC_TRUECRYPT_MODE</property>
- <property name="max_size"></property>
- <property name="maximize_button">0</property>
- <property name="maximum_size"></property>
- <property name="min_size"></property>
- <property name="minimize_button">0</property>
- <property name="minimum_size"></property>
- <property name="moveable">1</property>
- <property name="name">TrueCryptModeCheckBox</property>
- <property name="pane_border">1</property>
- <property name="pane_position"></property>
- <property name="pane_size"></property>
- <property name="permission">protected</property>
- <property name="pin_button">1</property>
- <property name="pos"></property>
- <property name="resize">Resizable</property>
- <property name="show">1</property>
- <property name="size"></property>
- <property name="style"></property>
- <property name="subclass"></property>
- <property name="toolbar_pane">0</property>
- <property name="tooltip"></property>
- <property name="validator_data_type"></property>
- <property name="validator_style">wxFILTER_NONE</property>
- <property name="validator_type">wxDefaultValidator</property>
- <property name="validator_variable"></property>
- <property name="window_extra_style"></property>
- <property name="window_name"></property>
- <property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnCheckBox"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -15692,29 +12000,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -15779,30 +12064,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnChoice"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -15821,7 +12082,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">protected</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
@@ -15897,34 +12157,11 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
- <property name="flag">wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL</property>
+ <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="0">
<property name="BottomDockable">1</property>
@@ -15984,33 +12221,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnText"></event>
- <event name="OnTextEnter"></event>
- <event name="OnTextMaxLen"></event>
- <event name="OnTextURL"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -16077,29 +12287,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer61</property>
@@ -16126,7 +12313,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
@@ -16189,30 +12375,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
<event name="OnCheckBox">OnBackgroundTaskEnabledCheckBoxClick</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -16277,30 +12440,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnCheckBox"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -16315,7 +12454,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
@@ -16378,30 +12516,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnCheckBox"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -16466,30 +12580,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnCheckBox"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -16554,30 +12644,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnCheckBox"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -16644,29 +12710,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer49</property>
@@ -16693,7 +12736,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">protected</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
@@ -16756,30 +12798,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnCheckBox"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -16844,30 +12862,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnCheckBox"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -16932,30 +12926,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnCheckBox"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -16972,7 +12942,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">protected</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
@@ -17035,30 +13004,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnCheckBox"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -17123,30 +13068,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnCheckBox"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -17163,7 +13084,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">protected</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
@@ -17226,30 +13146,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
<event name="OnCheckBox">OnNoKernelCryptoCheckBoxClick</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -17314,29 +13211,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer151</property>
@@ -17363,7 +13237,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
@@ -17432,29 +13305,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -17514,31 +13364,8 @@
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
- <property name="window_style">wxSUNKEN_BORDER</property>
+ <property name="window_style">wxBORDER_SUNKEN</property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -17615,30 +13442,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
<event name="OnCheckBox">OnNoHardwareCryptoCheckBoxClick</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -17703,29 +13507,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer40</property>
@@ -17752,7 +13533,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
@@ -17828,30 +13608,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnCheckBox"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -17914,29 +13670,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer127</property>
@@ -17963,7 +13696,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
@@ -18035,33 +13767,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnText"></event>
- <event name="OnTextEnter"></event>
- <event name="OnTextMaxLen"></event>
- <event name="OnTextURL"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -18077,27 +13782,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDC_SELECT_PKCS11_MODULE</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -18113,6 +13824,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -18128,29 +13841,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnSelectPkcs11ModuleButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -18169,7 +13859,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
@@ -18232,30 +13921,84 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnCheckBox"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxALL|wxEXPAND</property>
+ <property name="proportion">0</property>
+ <object class="wxStaticBoxSizer" expanded="0">
+ <property name="id">wxID_ANY</property>
+ <property name="label">IDT_EMV_OPTIONS</property>
+ <property name="minimum_size"></property>
+ <property name="name">sbSizer38</property>
+ <property name="orient">wxVERTICAL</property>
+ <property name="parent">1</property>
+ <property name="permission">none</property>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxALL</property>
+ <property name="proportion">0</property>
+ <object class="wxCheckBox" expanded="0">
+ <property name="BottomDockable">1</property>
+ <property name="LeftDockable">1</property>
+ <property name="RightDockable">1</property>
+ <property name="TopDockable">1</property>
+ <property name="aui_layer"></property>
+ <property name="aui_name"></property>
+ <property name="aui_position"></property>
+ <property name="aui_row"></property>
+ <property name="best_size"></property>
+ <property name="bg"></property>
+ <property name="caption"></property>
+ <property name="caption_visible">1</property>
+ <property name="center_pane">0</property>
+ <property name="checked">0</property>
+ <property name="close_button">1</property>
+ <property name="context_help"></property>
+ <property name="context_menu">1</property>
+ <property name="default_pane">0</property>
+ <property name="dock">Dock</property>
+ <property name="dock_fixed">0</property>
+ <property name="docking">Left</property>
+ <property name="enabled">1</property>
+ <property name="fg"></property>
+ <property name="floatable">1</property>
+ <property name="font"></property>
+ <property name="gripper">0</property>
+ <property name="hidden">0</property>
+ <property name="id">wxID_ANY</property>
+ <property name="label">IDC_ENABLE_EMV_SUPPORT</property>
+ <property name="max_size"></property>
+ <property name="maximize_button">0</property>
+ <property name="maximum_size"></property>
+ <property name="min_size"></property>
+ <property name="minimize_button">0</property>
+ <property name="minimum_size"></property>
+ <property name="moveable">1</property>
+ <property name="name">EMVSupportEnabledCheckBox</property>
+ <property name="pane_border">1</property>
+ <property name="pane_position"></property>
+ <property name="pane_size"></property>
+ <property name="permission">protected</property>
+ <property name="pin_button">1</property>
+ <property name="pos"></property>
+ <property name="resize">Resizable</property>
+ <property name="show">1</property>
+ <property name="size"></property>
+ <property name="style"></property>
+ <property name="subclass">; ; forward_declare</property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></property>
+ <property name="validator_data_type"></property>
+ <property name="validator_style">wxFILTER_NONE</property>
+ <property name="validator_type">wxDefaultValidator</property>
+ <property name="validator_variable"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style"></property>
</object>
</object>
</object>
@@ -18320,29 +14063,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer51</property>
@@ -18369,7 +14089,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
@@ -18429,50 +14148,9 @@
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
- <property name="window_style">wxSUNKEN_BORDER</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnListBeginDrag"></event>
- <event name="OnListBeginLabelEdit"></event>
- <event name="OnListBeginRDrag"></event>
- <event name="OnListCacheHint"></event>
- <event name="OnListColBeginDrag"></event>
- <event name="OnListColClick"></event>
- <event name="OnListColDragging"></event>
- <event name="OnListColEndDrag"></event>
- <event name="OnListColRightClick"></event>
- <event name="OnListDeleteAllItems"></event>
- <event name="OnListDeleteItem"></event>
- <event name="OnListEndLabelEdit"></event>
- <event name="OnListInsertItem"></event>
- <event name="OnListItemActivated"></event>
+ <property name="window_style">wxBORDER_SUNKEN</property>
<event name="OnListItemDeselected">OnHotkeyListItemDeselected</event>
- <event name="OnListItemFocused"></event>
- <event name="OnListItemMiddleClick"></event>
- <event name="OnListItemRightClick"></event>
<event name="OnListItemSelected">OnHotkeyListItemSelected</event>
- <event name="OnListKeyDown"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -18487,7 +14165,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_RIGHT</property>
@@ -18563,34 +14240,11 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
- <property name="flag">wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL</property>
+ <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="0">
<property name="BottomDockable">1</property>
@@ -18650,33 +14304,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnText"></event>
- <event name="OnTextEnter"></event>
- <event name="OnTextMaxLen"></event>
- <event name="OnTextURL"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -18692,27 +14319,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDC_HOTKEY_ASSIGN</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -18728,6 +14361,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -18743,29 +14378,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnAssignHotkeyButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -18852,30 +14464,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnCheckBox"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -18940,30 +14528,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnCheckBox"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -19028,30 +14592,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnCheckBox"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -19116,30 +14656,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnCheckBox"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -19157,27 +14673,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDC_KEYREMOVE</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -19193,6 +14715,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -19208,29 +14732,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnRemoveHotkeyButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -19249,7 +14750,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
@@ -19312,30 +14812,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnCheckBox"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -19400,30 +14876,509 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnCheckBox"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object class="notebookpage" expanded="0">
+ <property name="bitmap"></property>
+ <property name="label">LINUX_LANGUAGE</property>
+ <property name="select">0</property>
+ <object class="wxPanel" expanded="0">
+ <property name="BottomDockable">1</property>
+ <property name="LeftDockable">1</property>
+ <property name="RightDockable">1</property>
+ <property name="TopDockable">1</property>
+ <property name="aui_layer"></property>
+ <property name="aui_name"></property>
+ <property name="aui_position"></property>
+ <property name="aui_row"></property>
+ <property name="best_size"></property>
+ <property name="bg"></property>
+ <property name="caption"></property>
+ <property name="caption_visible">1</property>
+ <property name="center_pane">0</property>
+ <property name="close_button">1</property>
+ <property name="context_help"></property>
+ <property name="context_menu">1</property>
+ <property name="default_pane">0</property>
+ <property name="dock">Dock</property>
+ <property name="dock_fixed">0</property>
+ <property name="docking">Left</property>
+ <property name="enabled">1</property>
+ <property name="fg"></property>
+ <property name="floatable">1</property>
+ <property name="font"></property>
+ <property name="gripper">0</property>
+ <property name="hidden">0</property>
+ <property name="id">wxID_ANY</property>
+ <property name="max_size"></property>
+ <property name="maximize_button">0</property>
+ <property name="maximum_size"></property>
+ <property name="min_size"></property>
+ <property name="minimize_button">0</property>
+ <property name="minimum_size"></property>
+ <property name="moveable">1</property>
+ <property name="name">LanguagesPage</property>
+ <property name="pane_border">1</property>
+ <property name="pane_position"></property>
+ <property name="pane_size"></property>
+ <property name="permission">public</property>
+ <property name="pin_button">1</property>
+ <property name="pos"></property>
+ <property name="resize">Resizable</property>
+ <property name="show">1</property>
+ <property name="size"></property>
+ <property name="subclass">; ; forward_declare</property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style">wxTAB_TRAVERSAL</property>
+ <object class="wxBoxSizer" expanded="0">
+ <property name="minimum_size"></property>
+ <property name="name">bSizer170</property>
+ <property name="orient">wxVERTICAL</property>
+ <property name="permission">none</property>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxALL|wxEXPAND</property>
+ <property name="proportion">1</property>
+ <object class="wxBoxSizer" expanded="0">
+ <property name="minimum_size"></property>
+ <property name="name">bSizer171</property>
+ <property name="orient">wxVERTICAL</property>
+ <property name="permission">none</property>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxEXPAND</property>
+ <property name="proportion">1</property>
+ <object class="wxBoxSizer" expanded="0">
+ <property name="minimum_size"></property>
+ <property name="name">bSizer173</property>
+ <property name="orient">wxVERTICAL</property>
+ <property name="permission">none</property>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxALL|wxEXPAND</property>
+ <property name="proportion">1</property>
+ <object class="wxStaticBoxSizer" expanded="0">
+ <property name="id">wxID_ANY</property>
+ <property name="label">LINUX_LANGUAGE</property>
+ <property name="minimum_size"></property>
+ <property name="name">sbSizer49</property>
+ <property name="orient">wxVERTICAL</property>
+ <property name="parent">1</property>
+ <property name="permission">none</property>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxBOTTOM</property>
+ <property name="proportion">0</property>
+ <object class="wxBoxSizer" expanded="0">
+ <property name="minimum_size"></property>
+ <property name="name">bSizer174</property>
+ <property name="orient">wxHORIZONTAL</property>
+ <property name="permission">none</property>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxLEFT|wxTOP</property>
+ <property name="proportion">0</property>
+ <object class="wxStaticText" expanded="0">
+ <property name="BottomDockable">1</property>
+ <property name="LeftDockable">1</property>
+ <property name="RightDockable">1</property>
+ <property name="TopDockable">1</property>
+ <property name="aui_layer"></property>
+ <property name="aui_name"></property>
+ <property name="aui_position"></property>
+ <property name="aui_row"></property>
+ <property name="best_size"></property>
+ <property name="bg"></property>
+ <property name="caption"></property>
+ <property name="caption_visible">1</property>
+ <property name="center_pane">0</property>
+ <property name="close_button">1</property>
+ <property name="context_help"></property>
+ <property name="context_menu">1</property>
+ <property name="default_pane">0</property>
+ <property name="dock">Dock</property>
+ <property name="dock_fixed">0</property>
+ <property name="docking">Left</property>
+ <property name="enabled">1</property>
+ <property name="fg"></property>
+ <property name="floatable">1</property>
+ <property name="font"></property>
+ <property name="gripper">0</property>
+ <property name="hidden">0</property>
+ <property name="id">wxID_ANY</property>
+ <property name="label">IDT_ACTIVE_LANG_PACK</property>
+ <property name="markup">0</property>
+ <property name="max_size"></property>
+ <property name="maximize_button">0</property>
+ <property name="maximum_size"></property>
+ <property name="min_size"></property>
+ <property name="minimize_button">0</property>
+ <property name="minimum_size"></property>
+ <property name="moveable">1</property>
+ <property name="name">m_staticText73</property>
+ <property name="pane_border">1</property>
+ <property name="pane_position"></property>
+ <property name="pane_size"></property>
+ <property name="permission">protected</property>
+ <property name="pin_button">1</property>
+ <property name="pos"></property>
+ <property name="resize">Resizable</property>
+ <property name="show">1</property>
+ <property name="size"></property>
+ <property name="style"></property>
+ <property name="subclass">; ; forward_declare</property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style"></property>
+ <property name="wrap">-1</property>
+ </object>
+ </object>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxLEFT|wxRIGHT|wxTOP</property>
+ <property name="proportion">0</property>
+ <object class="wxStaticText" expanded="0">
+ <property name="BottomDockable">1</property>
+ <property name="LeftDockable">1</property>
+ <property name="RightDockable">1</property>
+ <property name="TopDockable">1</property>
+ <property name="aui_layer"></property>
+ <property name="aui_name"></property>
+ <property name="aui_position"></property>
+ <property name="aui_row"></property>
+ <property name="best_size"></property>
+ <property name="bg"></property>
+ <property name="caption"></property>
+ <property name="caption_visible">1</property>
+ <property name="center_pane">0</property>
+ <property name="close_button">1</property>
+ <property name="context_help"></property>
+ <property name="context_menu">1</property>
+ <property name="default_pane">0</property>
+ <property name="dock">Dock</property>
+ <property name="dock_fixed">0</property>
+ <property name="docking">Left</property>
+ <property name="enabled">1</property>
+ <property name="fg"></property>
+ <property name="floatable">1</property>
+ <property name="font"></property>
+ <property name="gripper">0</property>
+ <property name="hidden">0</property>
+ <property name="id">wxID_ANY</property>
+ <property name="label">CURRENT_LANGUAGE_PACK</property>
+ <property name="markup">0</property>
+ <property name="max_size"></property>
+ <property name="maximize_button">0</property>
+ <property name="maximum_size"></property>
+ <property name="min_size"></property>
+ <property name="minimize_button">0</property>
+ <property name="minimum_size"></property>
+ <property name="moveable">1</property>
+ <property name="name">m_staticText74</property>
+ <property name="pane_border">1</property>
+ <property name="pane_position"></property>
+ <property name="pane_size"></property>
+ <property name="permission">protected</property>
+ <property name="pin_button">1</property>
+ <property name="pos"></property>
+ <property name="resize">Resizable</property>
+ <property name="show">1</property>
+ <property name="size"></property>
+ <property name="style"></property>
+ <property name="subclass">; ; forward_declare</property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style"></property>
+ <property name="wrap">-1</property>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag"></property>
+ <property name="proportion">0</property>
+ <object class="wxWrapSizer" expanded="0">
+ <property name="flags">wxWRAPSIZER_DEFAULT_FLAGS</property>
+ <property name="minimum_size"></property>
+ <property name="name">wSizer1</property>
+ <property name="orient">wxHORIZONTAL</property>
+ <property name="permission">none</property>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxBOTTOM|wxLEFT</property>
+ <property name="proportion">0</property>
+ <object class="wxStaticText" expanded="0">
+ <property name="BottomDockable">1</property>
+ <property name="LeftDockable">1</property>
+ <property name="RightDockable">1</property>
+ <property name="TopDockable">1</property>
+ <property name="aui_layer"></property>
+ <property name="aui_name"></property>
+ <property name="aui_position"></property>
+ <property name="aui_row"></property>
+ <property name="best_size"></property>
+ <property name="bg"></property>
+ <property name="caption"></property>
+ <property name="caption_visible">1</property>
+ <property name="center_pane">0</property>
+ <property name="close_button">1</property>
+ <property name="context_help"></property>
+ <property name="context_menu">1</property>
+ <property name="default_pane">0</property>
+ <property name="dock">Dock</property>
+ <property name="dock_fixed">0</property>
+ <property name="docking">Left</property>
+ <property name="enabled">1</property>
+ <property name="fg"></property>
+ <property name="floatable">1</property>
+ <property name="font"></property>
+ <property name="gripper">0</property>
+ <property name="hidden">0</property>
+ <property name="id">wxID_ANY</property>
+ <property name="label">IDT_LANGPACK_AUTHORS</property>
+ <property name="markup">0</property>
+ <property name="max_size"></property>
+ <property name="maximize_button">0</property>
+ <property name="maximum_size"></property>
+ <property name="min_size"></property>
+ <property name="minimize_button">0</property>
+ <property name="minimum_size"></property>
+ <property name="moveable">1</property>
+ <property name="name">m_staticText72</property>
+ <property name="pane_border">1</property>
+ <property name="pane_position"></property>
+ <property name="pane_size"></property>
+ <property name="permission">protected</property>
+ <property name="pin_button">1</property>
+ <property name="pos"></property>
+ <property name="resize">Resizable</property>
+ <property name="show">1</property>
+ <property name="size"></property>
+ <property name="style"></property>
+ <property name="subclass">; ; forward_declare</property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style"></property>
+ <property name="wrap">-1</property>
+ </object>
+ </object>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT</property>
+ <property name="proportion">0</property>
+ <object class="wxStaticText" expanded="0">
+ <property name="BottomDockable">1</property>
+ <property name="LeftDockable">1</property>
+ <property name="RightDockable">1</property>
+ <property name="TopDockable">1</property>
+ <property name="aui_layer"></property>
+ <property name="aui_name"></property>
+ <property name="aui_position"></property>
+ <property name="aui_row"></property>
+ <property name="best_size"></property>
+ <property name="bg"></property>
+ <property name="caption"></property>
+ <property name="caption_visible">1</property>
+ <property name="center_pane">0</property>
+ <property name="close_button">1</property>
+ <property name="context_help"></property>
+ <property name="context_menu">1</property>
+ <property name="default_pane">0</property>
+ <property name="dock">Dock</property>
+ <property name="dock_fixed">0</property>
+ <property name="docking">Left</property>
+ <property name="enabled">1</property>
+ <property name="fg"></property>
+ <property name="floatable">1</property>
+ <property name="font"></property>
+ <property name="gripper">0</property>
+ <property name="hidden">0</property>
+ <property name="id">wxID_ANY</property>
+ <property name="label">LANGUAGE_TRANSLATORS</property>
+ <property name="markup">0</property>
+ <property name="max_size"></property>
+ <property name="maximize_button">0</property>
+ <property name="maximum_size"></property>
+ <property name="min_size"></property>
+ <property name="minimize_button">0</property>
+ <property name="minimum_size"></property>
+ <property name="moveable">1</property>
+ <property name="name">m_staticText71</property>
+ <property name="pane_border">1</property>
+ <property name="pane_position"></property>
+ <property name="pane_size"></property>
+ <property name="permission">protected</property>
+ <property name="pin_button">1</property>
+ <property name="pos"></property>
+ <property name="resize">Resizable</property>
+ <property name="show">1</property>
+ <property name="size"></property>
+ <property name="style"></property>
+ <property name="subclass">; ; forward_declare</property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style"></property>
+ <property name="wrap">-1</property>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxEXPAND|wxLEFT|wxRIGHT|wxTOP</property>
+ <property name="proportion">1</property>
+ <object class="wxListBox" expanded="0">
+ <property name="BottomDockable">1</property>
+ <property name="LeftDockable">1</property>
+ <property name="RightDockable">1</property>
+ <property name="TopDockable">1</property>
+ <property name="aui_layer"></property>
+ <property name="aui_name"></property>
+ <property name="aui_position"></property>
+ <property name="aui_row"></property>
+ <property name="best_size"></property>
+ <property name="bg"></property>
+ <property name="caption"></property>
+ <property name="caption_visible">1</property>
+ <property name="center_pane">0</property>
+ <property name="choices"></property>
+ <property name="close_button">1</property>
+ <property name="context_help"></property>
+ <property name="context_menu">1</property>
+ <property name="default_pane">0</property>
+ <property name="dock">Dock</property>
+ <property name="dock_fixed">0</property>
+ <property name="docking">Left</property>
+ <property name="enabled">1</property>
+ <property name="fg"></property>
+ <property name="floatable">1</property>
+ <property name="font"></property>
+ <property name="gripper">0</property>
+ <property name="hidden">0</property>
+ <property name="id">wxID_ANY</property>
+ <property name="max_size"></property>
+ <property name="maximize_button">0</property>
+ <property name="maximum_size"></property>
+ <property name="min_size"></property>
+ <property name="minimize_button">0</property>
+ <property name="minimum_size">-1,-1</property>
+ <property name="moveable">1</property>
+ <property name="name">LanguageListBox</property>
+ <property name="pane_border">1</property>
+ <property name="pane_position"></property>
+ <property name="pane_size"></property>
+ <property name="permission">public</property>
+ <property name="pin_button">1</property>
+ <property name="pos"></property>
+ <property name="resize">Resizable</property>
+ <property name="show">1</property>
+ <property name="size"></property>
+ <property name="style">wxLB_SINGLE|wxLB_SORT</property>
+ <property name="subclass">; ; forward_declare</property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></property>
+ <property name="validator_data_type"></property>
+ <property name="validator_style">wxFILTER_NONE</property>
+ <property name="validator_type">wxDefaultValidator</property>
+ <property name="validator_variable"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style"></property>
+ </object>
+ </object>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxALIGN_BOTTOM|wxALL|wxEXPAND</property>
+ <property name="proportion">0</property>
+ <object class="wxButton" expanded="0">
+ <property name="BottomDockable">1</property>
+ <property name="LeftDockable">1</property>
+ <property name="RightDockable">1</property>
+ <property name="TopDockable">1</property>
+ <property name="aui_layer"></property>
+ <property name="aui_name"></property>
+ <property name="aui_position"></property>
+ <property name="aui_row"></property>
+ <property name="auth_needed">0</property>
+ <property name="best_size"></property>
+ <property name="bg"></property>
+ <property name="bitmap"></property>
+ <property name="caption"></property>
+ <property name="caption_visible">1</property>
+ <property name="center_pane">0</property>
+ <property name="close_button">1</property>
+ <property name="context_help"></property>
+ <property name="context_menu">1</property>
+ <property name="current"></property>
+ <property name="default">0</property>
+ <property name="default_pane">0</property>
+ <property name="disabled"></property>
+ <property name="dock">Dock</property>
+ <property name="dock_fixed">0</property>
+ <property name="docking">Left</property>
+ <property name="enabled">1</property>
+ <property name="fg"></property>
+ <property name="floatable">1</property>
+ <property name="focus"></property>
+ <property name="font"></property>
+ <property name="gripper">0</property>
+ <property name="hidden">0</property>
+ <property name="id">wxID_ANY</property>
+ <property name="label">LINUX_SELECT_SYS_DEFAULT_LANG</property>
+ <property name="margins"></property>
+ <property name="markup">0</property>
+ <property name="max_size"></property>
+ <property name="maximize_button">0</property>
+ <property name="maximum_size"></property>
+ <property name="min_size"></property>
+ <property name="minimize_button">0</property>
+ <property name="minimum_size"></property>
+ <property name="moveable">1</property>
+ <property name="name">SysDefaultLangButton</property>
+ <property name="pane_border">1</property>
+ <property name="pane_position"></property>
+ <property name="pane_size"></property>
+ <property name="permission">protected</property>
+ <property name="pin_button">1</property>
+ <property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
+ <property name="resize">Resizable</property>
+ <property name="show">1</property>
+ <property name="size"></property>
+ <property name="style"></property>
+ <property name="subclass">; ; forward_declare</property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></property>
+ <property name="validator_data_type"></property>
+ <property name="validator_style">wxFILTER_NONE</property>
+ <property name="validator_type">wxDefaultValidator</property>
+ <property name="validator_variable"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style"></property>
+ <event name="OnButtonClick">OnSysDefaultLangButtonClick</event>
</object>
</object>
</object>
@@ -19458,7 +15413,7 @@
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
- <property name="flag">wxALIGN_RIGHT|wxALL</property>
+ <property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="0">
<property name="BottomDockable">1</property>
@@ -19469,27 +15424,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">1</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_OK</property>
<property name="label">IDOK</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -19505,6 +15466,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -19520,29 +15483,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnOKButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -19558,27 +15498,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_CANCEL</property>
<property name="label">IDCANCEL</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -19594,6 +15540,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -19608,30 +15556,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnButtonClick"></event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -19663,45 +15587,11 @@
<property name="subclass"></property>
<property name="title">IDD_RANDOM_POOL_ENRICHMENT</property>
<property name="tooltip"></property>
+ <property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnActivate"></event>
- <event name="OnActivateApp"></event>
- <event name="OnAuiFindManager"></event>
- <event name="OnAuiPaneButton"></event>
- <event name="OnAuiPaneClose"></event>
- <event name="OnAuiPaneMaximize"></event>
- <event name="OnAuiPaneRestore"></event>
- <event name="OnAuiRender"></event>
- <event name="OnChar"></event>
- <event name="OnClose"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnHibernate"></event>
- <event name="OnIconize"></event>
- <event name="OnIdle"></event>
- <event name="OnInitDialog"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
<event name="OnMotion">OnMouseMotion</event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">MainSizer</property>
@@ -19794,29 +15684,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -19881,30 +15748,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
<event name="OnChoice">OnHashSelected</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -19931,7 +15775,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP</property>
@@ -20000,29 +15843,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -20084,29 +15904,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -20171,30 +15968,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
<event name="OnCheckBox">OnShowRandomPoolCheckBoxClicked</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -20221,7 +15995,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
@@ -20284,29 +16057,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -20380,29 +16130,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -20449,27 +16176,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">1</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_OK</property>
<property name="label">CONTINUE</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -20485,6 +16218,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -20499,30 +16234,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnButtonClick"></event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -20564,45 +16275,10 @@
<property name="subclass"></property>
<property name="title">IDD_KEYFILES</property>
<property name="tooltip"></property>
+ <property name="two_step_creation">0</property>
<property name="window_extra_style">wxWS_EX_VALIDATE_RECURSIVELY</property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnActivate"></event>
- <event name="OnActivateApp"></event>
- <event name="OnAuiFindManager"></event>
- <event name="OnAuiPaneButton"></event>
- <event name="OnAuiPaneClose"></event>
- <event name="OnAuiPaneMaximize"></event>
- <event name="OnAuiPaneRestore"></event>
- <event name="OnAuiRender"></event>
- <event name="OnChar"></event>
- <event name="OnClose"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnHibernate"></event>
- <event name="OnIconize"></event>
- <event name="OnIdle"></event>
- <event name="OnInitDialog"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer3</property>
@@ -20685,50 +16361,10 @@
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
- <property name="window_style">wxSUNKEN_BORDER</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnListBeginDrag"></event>
- <event name="OnListBeginLabelEdit"></event>
- <event name="OnListBeginRDrag"></event>
- <event name="OnListCacheHint"></event>
- <event name="OnListColBeginDrag"></event>
- <event name="OnListColClick"></event>
- <event name="OnListColDragging"></event>
- <event name="OnListColEndDrag"></event>
- <event name="OnListColRightClick"></event>
- <event name="OnListDeleteAllItems"></event>
- <event name="OnListDeleteItem"></event>
- <event name="OnListEndLabelEdit"></event>
- <event name="OnListInsertItem"></event>
+ <property name="window_style">wxBORDER_SUNKEN</property>
<event name="OnListItemActivated">OnListItemActivated</event>
<event name="OnListItemDeselected">OnListItemDeselected</event>
- <event name="OnListItemFocused"></event>
- <event name="OnListItemMiddleClick"></event>
- <event name="OnListItemRightClick"></event>
<event name="OnListItemSelected">OnListItemSelected</event>
- <event name="OnListKeyDown"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -20753,27 +16389,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDC_EXPORT</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -20789,6 +16431,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -20804,29 +16448,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnExportButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -20842,27 +16463,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">VKEY_2E</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -20878,6 +16505,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -20893,29 +16522,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnDeleteButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -20941,27 +16547,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDC_IMPORT_KEYFILE</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -20977,6 +16589,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -20992,29 +16606,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnImportButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -21043,27 +16634,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">1</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_OK</property>
<property name="label">IDOK</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -21079,6 +16676,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -21094,29 +16693,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnOKButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -21132,27 +16708,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_CANCEL</property>
<property name="label">IDCANCEL</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -21168,6 +16750,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -21182,30 +16766,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnButtonClick"></event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -21237,45 +16797,10 @@
<property name="subclass"></property>
<property name="title">IDD_VOLUME_PROPERTIES</property>
<property name="tooltip"></property>
+ <property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnActivate"></event>
- <event name="OnActivateApp"></event>
- <event name="OnAuiFindManager"></event>
- <event name="OnAuiPaneButton"></event>
- <event name="OnAuiPaneClose"></event>
- <event name="OnAuiPaneMaximize"></event>
- <event name="OnAuiPaneRestore"></event>
- <event name="OnAuiRender"></event>
- <event name="OnChar"></event>
- <event name="OnClose"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnHibernate"></event>
- <event name="OnIconize"></event>
- <event name="OnIdle"></event>
- <event name="OnInitDialog"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer49</property>
@@ -21349,50 +16874,7 @@
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
- <property name="window_style">wxSUNKEN_BORDER</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnListBeginDrag"></event>
- <event name="OnListBeginLabelEdit"></event>
- <event name="OnListBeginRDrag"></event>
- <event name="OnListCacheHint"></event>
- <event name="OnListColBeginDrag"></event>
- <event name="OnListColClick"></event>
- <event name="OnListColDragging"></event>
- <event name="OnListColEndDrag"></event>
- <event name="OnListColRightClick"></event>
- <event name="OnListDeleteAllItems"></event>
- <event name="OnListDeleteItem"></event>
- <event name="OnListEndLabelEdit"></event>
- <event name="OnListInsertItem"></event>
- <event name="OnListItemActivated"></event>
- <event name="OnListItemDeselected"></event>
- <event name="OnListItemFocused"></event>
- <event name="OnListItemMiddleClick"></event>
- <event name="OnListItemRightClick"></event>
- <event name="OnListItemSelected"></event>
- <event name="OnListKeyDown"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
+ <property name="window_style">wxBORDER_SUNKEN</property>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -21427,27 +16909,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">1</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_OK</property>
<property name="label">IDOK</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -21463,6 +16951,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -21478,29 +16968,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnOKButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -21538,39 +17005,10 @@
<property name="size">-1,-1</property>
<property name="subclass">WizardPage; WizardPage.h</property>
<property name="tooltip"></property>
+ <property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
- <event name="OnAuiFindManager"></event>
- <event name="OnAuiPaneButton"></event>
- <event name="OnAuiPaneClose"></event>
- <event name="OnAuiPaneMaximize"></event>
- <event name="OnAuiPaneRestore"></event>
- <event name="OnAuiRender"></event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnInitDialog"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer93</property>
@@ -21606,7 +17044,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
@@ -21678,35 +17115,12 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
<event name="OnChoice">OnEncryptionAlgorithmSelected</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
- <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>
+ <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="0">
<property name="BottomDockable">1</property>
@@ -21717,27 +17131,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">TEST</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -21753,6 +17173,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -21768,29 +17190,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnTestButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -21854,29 +17253,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -21949,30 +17325,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
<event name="OnHyperlink">OnEncryptionAlgorithmHyperlinkClick</event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -21998,27 +17351,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDC_BENCHMARK</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -22034,6 +17393,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -22049,29 +17410,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnBenchmarkButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -22090,7 +17428,6 @@
<property name="orient">wxHORIZONTAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
@@ -22153,30 +17490,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnChoice"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -22240,30 +17553,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
<event name="OnHyperlink">OnHashHyperlinkClick</event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -22293,39 +17583,10 @@
<property name="size">-1,-1</property>
<property name="subclass">WizardPage; WizardPage.h</property>
<property name="tooltip"></property>
+ <property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
- <event name="OnAuiFindManager"></event>
- <event name="OnAuiPaneButton"></event>
- <event name="OnAuiPaneClose"></event>
- <event name="OnAuiPaneMaximize"></event>
- <event name="OnAuiPaneRestore"></event>
- <event name="OnAuiRender"></event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnInitDialog"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer71</property>
@@ -22399,29 +17660,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -22447,39 +17685,10 @@
<property name="size">-1,-1</property>
<property name="subclass"></property>
<property name="tooltip"></property>
+ <property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
- <event name="OnAuiFindManager"></event>
- <event name="OnAuiPaneButton"></event>
- <event name="OnAuiPaneClose"></event>
- <event name="OnAuiPaneMaximize"></event>
- <event name="OnAuiPaneRestore"></event>
- <event name="OnAuiRender"></event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnInitDialog"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer19</property>
@@ -22562,50 +17771,10 @@
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
- <property name="window_style">wxSUNKEN_BORDER</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnListBeginDrag"></event>
- <event name="OnListBeginLabelEdit"></event>
- <event name="OnListBeginRDrag"></event>
- <event name="OnListCacheHint"></event>
- <event name="OnListColBeginDrag"></event>
- <event name="OnListColClick"></event>
- <event name="OnListColDragging"></event>
- <event name="OnListColEndDrag"></event>
- <event name="OnListColRightClick"></event>
- <event name="OnListDeleteAllItems"></event>
- <event name="OnListDeleteItem"></event>
- <event name="OnListEndLabelEdit"></event>
- <event name="OnListInsertItem"></event>
- <event name="OnListItemActivated"></event>
+ <property name="window_style">wxBORDER_SUNKEN</property>
<event name="OnListItemDeselected">OnListItemDeselected</event>
- <event name="OnListItemFocused"></event>
- <event name="OnListItemMiddleClick"></event>
- <event name="OnListItemRightClick"></event>
<event name="OnListItemSelected">OnListItemSelected</event>
- <event name="OnListKeyDown"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
<event name="OnSize">OnListSizeChanged</event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -22619,7 +17788,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
- <property name="flag">wxEXPAND|wxTOP|wxBOTTOM|wxLEFT</property>
+ <property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxTOP</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="0">
<property name="BottomDockable">1</property>
@@ -22630,27 +17799,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDC_KEYADD</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -22666,6 +17841,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -22681,34 +17858,11 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnAddFilesButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
- <property name="flag">wxEXPAND|wxTOP|wxBOTTOM|wxLEFT</property>
+ <property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxTOP</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="0">
<property name="BottomDockable">1</property>
@@ -22719,27 +17873,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDC_ADD_KEYFILE_PATH</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -22755,6 +17915,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -22770,34 +17932,11 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnAddDirectoryButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
- <property name="flag">wxEXPAND|wxTOP|wxBOTTOM|wxLEFT</property>
+ <property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxTOP</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="0">
<property name="BottomDockable">1</property>
@@ -22808,27 +17947,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDC_TOKEN_FILES_ADD</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -22844,6 +17989,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -22859,34 +18006,11 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnAddSecurityTokenSignatureButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
- <property name="flag">wxEXPAND|wxTOP|wxBOTTOM|wxLEFT</property>
+ <property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxTOP</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="0">
<property name="BottomDockable">1</property>
@@ -22897,27 +18021,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDC_KEYREMOVE</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -22933,6 +18063,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -22948,34 +18080,11 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnRemoveButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
- <property name="flag">wxEXPAND|wxALL</property>
+ <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="0">
<property name="BottomDockable">1</property>
@@ -22986,27 +18095,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDC_KEYREMOVEALL</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -23022,6 +18137,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -23037,29 +18154,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnRemoveAllButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -23089,39 +18183,10 @@
<property name="size">-1,-1</property>
<property name="subclass">WizardPage; WizardPage.h</property>
<property name="tooltip"></property>
+ <property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
- <event name="OnAuiFindManager"></event>
- <event name="OnAuiPaneButton"></event>
- <event name="OnAuiPaneClose"></event>
- <event name="OnAuiPaneMaximize"></event>
- <event name="OnAuiPaneRestore"></event>
- <event name="OnAuiRender"></event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnInitDialog"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer81</property>
@@ -23207,29 +18272,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -23245,27 +18287,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">0</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDC_ABORT_BUTTON</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -23281,6 +18329,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -23296,29 +18346,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnAbortButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -23382,29 +18409,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -23430,39 +18434,10 @@
<property name="size">-1,-1</property>
<property name="subclass">WizardPage; WizardPage.h</property>
<property name="tooltip"></property>
+ <property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
- <event name="OnAuiFindManager"></event>
- <event name="OnAuiPaneButton"></event>
- <event name="OnAuiPaneClose"></event>
- <event name="OnAuiPaneMaximize"></event>
- <event name="OnAuiPaneRestore"></event>
- <event name="OnAuiRender"></event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnInitDialog"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer68</property>
@@ -23548,33 +18523,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
<event name="OnText">OnDirectoryTextChanged</event>
- <event name="OnTextEnter"></event>
- <event name="OnTextMaxLen"></event>
- <event name="OnTextURL"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -23590,27 +18539,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDC_BROWSE_FILES</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -23626,6 +18581,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -23641,29 +18598,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnBrowseButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -23727,29 +18661,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">300</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -23775,39 +18686,10 @@
<property name="size">-1,-1</property>
<property name="subclass">WizardPage; WizardPage.h</property>
<property name="tooltip"></property>
+ <property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
- <event name="OnAuiFindManager"></event>
- <event name="OnAuiPaneButton"></event>
- <event name="OnAuiPaneClose"></event>
- <event name="OnAuiPaneMaximize"></event>
- <event name="OnAuiPaneRestore"></event>
- <event name="OnAuiRender"></event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnInitDialog"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer71</property>
@@ -23913,29 +18795,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -23961,39 +18820,10 @@
<property name="size">-1,-1</property>
<property name="subclass">WizardPage; WizardPage.h</property>
<property name="tooltip"></property>
+ <property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
- <event name="OnAuiFindManager"></event>
- <event name="OnAuiPaneButton"></event>
- <event name="OnAuiPaneClose"></event>
- <event name="OnAuiPaneMaximize"></event>
- <event name="OnAuiPaneRestore"></event>
- <event name="OnAuiRender"></event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnInitDialog"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer104</property>
@@ -24020,7 +18850,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">30</property>
<property name="flag">wxEXPAND</property>
@@ -24118,34 +18947,11 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
- <property name="flag">wxEXPAND|wxALIGN_BOTTOM</property>
+ <property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
@@ -24154,7 +18960,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">7</property>
- <property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxALIGN_BOTTOM</property>
+ <property name="flag">wxEXPAND|wxTOP|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@@ -24211,29 +19017,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -24298,30 +19081,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
<event name="OnCheckBox">OnDisplayKeysCheckBoxClick</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -24385,34 +19145,11 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">2</property>
- <property name="flag">wxALIGN_BOTTOM|wxEXPAND|wxTOP|wxRIGHT</property>
+ <property name="flag">wxEXPAND|wxTOP|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@@ -24469,29 +19206,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -24553,34 +19267,11 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">2</property>
- <property name="flag">wxEXPAND|wxALIGN_BOTTOM|wxTOP|wxRIGHT</property>
+ <property name="flag">wxEXPAND|wxTOP|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@@ -24637,29 +19328,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -24678,7 +19346,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
@@ -24741,29 +19408,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -24780,7 +19424,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
@@ -24852,29 +19495,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -24890,27 +19510,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDC_ABORT_BUTTON</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -24926,6 +19552,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -24941,29 +19569,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnAbortButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -24982,7 +19587,7 @@
<property name="vgap">0</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
- <property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND</property>
+ <property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
@@ -25048,34 +19653,11 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
- <property name="flag">wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL</property>
+ <property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">1</property>
<object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property>
@@ -25127,30 +19709,7 @@
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
- <property name="window_style">wxSUNKEN_BORDER</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
+ <property name="window_style">wxBORDER_SUNKEN</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer115</property>
@@ -25158,7 +19717,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
- <property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL</property>
+ <property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">1</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@@ -25215,29 +19774,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -25247,7 +19783,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
- <property name="flag">wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL</property>
+ <property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
@@ -25313,34 +19849,11 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
- <property name="flag">wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL</property>
+ <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property>
@@ -25392,30 +19905,7 @@
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
- <property name="window_style">wxSUNKEN_BORDER</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
+ <property name="window_style">wxBORDER_SUNKEN</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer1151</property>
@@ -25423,7 +19913,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
- <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>
+ <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@@ -25480,29 +19970,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -25512,7 +19979,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
- <property name="flag">wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT</property>
+ <property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
@@ -25578,29 +20045,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -25657,30 +20101,7 @@
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
- <property name="window_style">wxSUNKEN_BORDER|wxTAB_TRAVERSAL</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
+ <property name="window_style">wxTAB_TRAVERSAL|wxBORDER_SUNKEN</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer1152</property>
@@ -25688,7 +20109,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
- <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>
+ <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@@ -25745,29 +20166,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -25838,29 +20236,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -25886,39 +20261,10 @@
<property name="size">-1,-1</property>
<property name="subclass">WizardPage; WizardPage.h</property>
<property name="tooltip"></property>
+ <property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
- <event name="OnAuiFindManager"></event>
- <event name="OnAuiPaneButton"></event>
- <event name="OnAuiPaneClose"></event>
- <event name="OnAuiPaneMaximize"></event>
- <event name="OnAuiPaneRestore"></event>
- <event name="OnAuiRender"></event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnInitDialog"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer86</property>
@@ -26033,34 +20379,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnCombobox"></event>
- <event name="OnComboboxCloseup"></event>
- <event name="OnComboboxDropdown"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
<event name="OnText">OnVolumePathTextChanged</event>
- <event name="OnTextEnter"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -26085,27 +20404,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDC_SELECT_FILE</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -26121,6 +20446,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -26136,29 +20463,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnSelectFileButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -26174,27 +20478,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDC_SELECT_DEVICE</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -26210,6 +20520,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -26225,29 +20537,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnSelectDeviceButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -26335,30 +20624,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
<event name="OnCheckBox">OnNoHistoryCheckBoxClick</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -26436,29 +20702,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -26484,39 +20727,10 @@
<property name="size">-1,-1</property>
<property name="subclass">WizardPage; WizardPage.h</property>
<property name="tooltip"></property>
+ <property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
- <event name="OnAuiFindManager"></event>
- <event name="OnAuiPaneButton"></event>
- <event name="OnAuiPaneClose"></event>
- <event name="OnAuiPaneMaximize"></event>
- <event name="OnAuiPaneRestore"></event>
- <event name="OnAuiRender"></event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnInitDialog"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer124</property>
@@ -26543,7 +20757,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
@@ -26619,29 +20832,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -26706,30 +20896,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
<event name="OnChoice">OnFilesystemTypeSelected</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -26748,7 +20915,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
- <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
@@ -26811,30 +20977,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
<event name="OnCheckBox">OnQuickFormatCheckBoxClick</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -26908,29 +21051,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -26956,49 +21076,20 @@
<property name="size">-1,-1</property>
<property name="subclass"></property>
<property name="tooltip"></property>
+ <property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
- <event name="OnAuiFindManager"></event>
- <event name="OnAuiPaneButton"></event>
- <event name="OnAuiPaneClose"></event>
- <event name="OnAuiPaneMaximize"></event>
- <event name="OnAuiPaneRestore"></event>
- <event name="OnAuiRender"></event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnInitDialog"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
- <object class="wxBoxSizer" expanded="1">
+ <object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer7</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
- <object class="sizeritem" expanded="1">
+ <object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
- <object class="wxGridBagSizer" expanded="1">
+ <object class="wxGridBagSizer" expanded="0">
<property name="empty_cell_size">0,0</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">1</property>
@@ -27009,14 +21100,14 @@
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">protected</property>
<property name="vgap">0</property>
- <object class="gbsizeritem" expanded="1">
+ <object class="gbsizeritem" expanded="0">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxRIGHT</property>
<property name="row">1</property>
<property name="rowspan">1</property>
- <object class="wxStaticText" expanded="1">
+ <object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@@ -27071,39 +21162,16 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
- <object class="gbsizeritem" expanded="1">
+ <object class="gbsizeritem" expanded="0">
<property name="border">5</property>
<property name="colspan">2</property>
<property name="column">1</property>
- <property name="flag">wxBOTTOM|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>
+ <property name="flag">wxBOTTOM|wxEXPAND</property>
<property name="row">1</property>
<property name="rowspan">1</property>
- <object class="wxTextCtrl" expanded="1">
+ <object class="wxTextCtrl" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@@ -27161,43 +21229,17 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
<event name="OnText">OnTextChanged</event>
- <event name="OnTextEnter"></event>
- <event name="OnTextMaxLen"></event>
- <event name="OnTextURL"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
- <object class="gbsizeritem" expanded="1">
+ <object class="gbsizeritem" expanded="0">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT</property>
<property name="row">2</property>
<property name="rowspan">1</property>
- <object class="wxStaticText" expanded="1">
+ <object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@@ -27252,39 +21294,16 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
- <object class="gbsizeritem" expanded="1">
+ <object class="gbsizeritem" expanded="0">
<property name="border">5</property>
<property name="colspan">2</property>
<property name="column">1</property>
- <property name="flag">wxBOTTOM|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>
+ <property name="flag">wxBOTTOM|wxEXPAND</property>
<property name="row">2</property>
<property name="rowspan">1</property>
- <object class="wxTextCtrl" expanded="1">
+ <object class="wxTextCtrl" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@@ -27342,36 +21361,10 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
<event name="OnText">OnTextChanged</event>
- <event name="OnTextEnter"></event>
- <event name="OnTextMaxLen"></event>
- <event name="OnTextURL"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
- <object class="gbsizeritem" expanded="1">
+ <object class="gbsizeritem" expanded="0">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">0</property>
@@ -27433,36 +21426,13 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="gbsizeritem" expanded="0">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">1</property>
- <property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND</property>
+ <property name="flag">wxBOTTOM|wxEXPAND</property>
<property name="row">3</property>
<property name="rowspan">1</property>
<object class="wxTextCtrl" expanded="0">
@@ -27523,33 +21493,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
<event name="OnText">OnPimChanged</event>
- <event name="OnTextEnter"></event>
- <event name="OnTextMaxLen"></event>
- <event name="OnTextURL"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="gbsizeritem" expanded="0">
@@ -27614,29 +21558,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="gbsizeritem" expanded="0">
@@ -27646,7 +21567,7 @@
<property name="flag">wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL</property>
<property name="row">4</property>
<property name="rowspan">1</property>
- <object class="wxCheckBox" expanded="1">
+ <object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@@ -27704,30 +21625,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
<event name="OnCheckBox">OnUsePimCheckBoxClick</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="gbsizeritem" expanded="0">
@@ -27795,40 +21693,16 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnCheckBox"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
- <object class="gbsizeritem" expanded="1">
+ <object class="gbsizeritem" expanded="0">
<property name="border">5</property>
<property name="colspan">2</property>
<property name="column">1</property>
<property name="flag">wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL</property>
<property name="row">6</property>
<property name="rowspan">1</property>
- <object class="wxCheckBox" expanded="1">
+ <object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@@ -27886,40 +21760,17 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
<event name="OnCheckBox">OnDisplayPasswordCheckBoxClick</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
- <object class="gbsizeritem" expanded="1">
+ <object class="gbsizeritem" expanded="0">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="row">7</property>
<property name="rowspan">1</property>
- <object class="wxCheckBox" expanded="1">
+ <object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@@ -27977,40 +21828,17 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
<event name="OnCheckBox">OnUseKeyfilesCheckBoxClick</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
- <object class="gbsizeritem" expanded="1">
+ <object class="gbsizeritem" expanded="0">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">2</property>
<property name="flag">wxALIGN_RIGHT|wxALIGN_BOTTOM|wxLEFT</property>
<property name="row">7</property>
<property name="rowspan">1</property>
- <object class="wxButton" expanded="1">
+ <object class="wxButton" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@@ -28019,27 +21847,33 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
+ <property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
+ <property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
+ <property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
+ <property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">IDC_KEYFILES_HIDVOL_PROT</property>
+ <property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -28055,6 +21889,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
+ <property name="position"></property>
+ <property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@@ -28070,53 +21906,32 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnKeyfilesButtonClick</event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
<event name="OnRightDown">OnKeyfilesButtonRightDown</event>
<event name="OnRightUp">OnKeyfilesButtonRightClick</event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
- <object class="gbsizeritem" expanded="1">
+ <object class="gbsizeritem" expanded="0">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="row">8</property>
<property name="rowspan">1</property>
- <object class="wxBoxSizer" expanded="1">
+ <object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">Pkcs5PrfSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">protected</property>
</object>
</object>
- <object class="gbsizeritem" expanded="1">
+ <object class="gbsizeritem" expanded="0">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
<property name="row">9</property>
<property name="rowspan">1</property>
- <object class="wxStaticText" expanded="1">
+ <object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@@ -28171,39 +21986,16 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
- <object class="gbsizeritem" expanded="1">
+ <object class="gbsizeritem" expanded="0">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
<property name="row">9</property>
<property name="rowspan">1</property>
- <object class="wxChoice" expanded="1">
+ <object class="wxChoice" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@@ -28261,121 +22053,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnChoice"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
- </object>
- </object>
- <object class="gbsizeritem" expanded="1">
- <property name="border">5</property>
- <property name="colspan">1</property>
- <property name="column">2</property>
- <property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
- <property name="row">9</property>
- <property name="rowspan">1</property>
- <object class="wxCheckBox" expanded="0">
- <property name="BottomDockable">1</property>
- <property name="LeftDockable">1</property>
- <property name="RightDockable">1</property>
- <property name="TopDockable">1</property>
- <property name="aui_layer"></property>
- <property name="aui_name"></property>
- <property name="aui_position"></property>
- <property name="aui_row"></property>
- <property name="best_size"></property>
- <property name="bg"></property>
- <property name="caption"></property>
- <property name="caption_visible">1</property>
- <property name="center_pane">0</property>
- <property name="checked">0</property>
- <property name="close_button">1</property>
- <property name="context_help"></property>
- <property name="context_menu">1</property>
- <property name="default_pane">0</property>
- <property name="dock">Dock</property>
- <property name="dock_fixed">0</property>
- <property name="docking">Left</property>
- <property name="enabled">1</property>
- <property name="fg"></property>
- <property name="floatable">1</property>
- <property name="font"></property>
- <property name="gripper">0</property>
- <property name="hidden">0</property>
- <property name="id">wxID_ANY</property>
- <property name="label">IDC_TRUECRYPT_MODE</property>
- <property name="max_size"></property>
- <property name="maximize_button">0</property>
- <property name="maximum_size"></property>
- <property name="min_size"></property>
- <property name="minimize_button">0</property>
- <property name="minimum_size"></property>
- <property name="moveable">1</property>
- <property name="name">TrueCryptModeCheckBox</property>
- <property name="pane_border">1</property>
- <property name="pane_position"></property>
- <property name="pane_size"></property>
- <property name="permission">protected</property>
- <property name="pin_button">1</property>
- <property name="pos"></property>
- <property name="resize">Resizable</property>
- <property name="show">1</property>
- <property name="size"></property>
- <property name="style"></property>
- <property name="subclass"></property>
- <property name="toolbar_pane">0</property>
- <property name="tooltip"></property>
- <property name="validator_data_type"></property>
- <property name="validator_style">wxFILTER_NONE</property>
- <property name="validator_type">wxDefaultValidator</property>
- <property name="validator_variable"></property>
- <property name="window_extra_style"></property>
- <property name="window_name"></property>
- <property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnCheckBox">OnTrueCryptModeChecked</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="gbsizeritem" expanded="0">
@@ -28385,7 +22062,7 @@
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT</property>
<property name="row">10</property>
<property name="rowspan">1</property>
- <object class="wxStaticText" expanded="1">
+ <object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@@ -28440,39 +22117,16 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
- <object class="gbsizeritem" expanded="1">
+ <object class="gbsizeritem" expanded="0">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxALL</property>
<property name="row">10</property>
<property name="rowspan">1</property>
- <object class="wxChoice" expanded="1">
+ <object class="wxChoice" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@@ -28530,40 +22184,16 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnChoice"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
- <object class="gbsizeritem" expanded="1">
+ <object class="gbsizeritem" expanded="0">
<property name="border">5</property>
<property name="colspan">2</property>
<property name="column">1</property>
<property name="flag">wxTOP|wxEXPAND</property>
<property name="row">11</property>
<property name="rowspan">1</property>
- <object class="wxBoxSizer" expanded="1">
+ <object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">PasswordPlaceholderSizer</property>
<property name="orient">wxVERTICAL</property>
@@ -28593,39 +22223,10 @@
<property name="size">-1,-1</property>
<property name="subclass">WizardPage; WizardPage.h</property>
<property name="tooltip"></property>
+ <property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
- <event name="OnAuiFindManager"></event>
- <event name="OnAuiPaneButton"></event>
- <event name="OnAuiPaneClose"></event>
- <event name="OnAuiPaneMaximize"></event>
- <event name="OnAuiPaneRestore"></event>
- <event name="OnAuiRender"></event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnInitDialog"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer101</property>
@@ -28710,29 +22311,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -28758,39 +22336,10 @@
<property name="size">-1,-1</property>
<property name="subclass">WizardPage; WizardPage.h</property>
<property name="tooltip"></property>
+ <property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
- <event name="OnAuiFindManager"></event>
- <event name="OnAuiPaneButton"></event>
- <event name="OnAuiPaneClose"></event>
- <event name="OnAuiPaneMaximize"></event>
- <event name="OnAuiPaneRestore"></event>
- <event name="OnAuiRender"></event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnInitDialog"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer101</property>
@@ -28882,29 +22431,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -28969,33 +22495,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
<event name="OnText">OnPimChanged</event>
- <event name="OnTextEnter"></event>
- <event name="OnTextMaxLen"></event>
- <event name="OnTextURL"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -29057,29 +22557,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -29155,30 +22632,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
<event name="OnCheckBox">OnDisplayPimCheckBoxClick</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -29244,29 +22698,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -29292,77 +22723,48 @@
<property name="size">-1,-1</property>
<property name="subclass">WizardPage; WizardPage.h</property>
<property name="tooltip"></property>
+ <property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
- <event name="OnAuiFindManager"></event>
- <event name="OnAuiPaneButton"></event>
- <event name="OnAuiPaneClose"></event>
- <event name="OnAuiPaneMaximize"></event>
- <event name="OnAuiPaneRestore"></event>
- <event name="OnAuiRender"></event>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnInitDialog"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
- <object class="wxBoxSizer" expanded="1">
+ <object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer98</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
- <object class="sizeritem" expanded="1">
+ <object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
- <object class="wxBoxSizer" expanded="1">
+ <object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer99</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
- <object class="sizeritem" expanded="1">
+ <object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
- <object class="spacer" expanded="1">
+ <object class="spacer" expanded="0">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
- <object class="sizeritem" expanded="1">
+ <object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
- <object class="wxBoxSizer" expanded="1">
+ <object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer100</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
- <object class="sizeritem" expanded="1">
+ <object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
- <object class="wxTextCtrl" expanded="1">
+ <object class="wxTextCtrl" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@@ -29420,40 +22822,14 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
<event name="OnText">OnVolumeSizeTextChanged</event>
- <event name="OnTextEnter"></event>
- <event name="OnTextMaxLen"></event>
- <event name="OnTextURL"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
- <object class="sizeritem" expanded="1">
+ <object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
- <object class="wxChoice" expanded="1">
+ <object class="wxChoice" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@@ -29511,45 +22887,22 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
<event name="OnChoice">OnVolumeSizePrefixSelected</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
- <object class="sizeritem" expanded="1">
+ <object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
- <object class="spacer" expanded="1">
+ <object class="spacer" expanded="0">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
- <object class="sizeritem" expanded="1">
+ <object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
@@ -29611,30 +22964,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
<event name="OnCheckBox">OnUseAllFreeSpaceCheckBoxClick</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -29651,7 +22981,7 @@
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
- <object class="wxStaticText" expanded="1">
+ <object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@@ -29706,46 +23036,23 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
- <object class="sizeritem" expanded="1">
+ <object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
- <object class="spacer" expanded="1">
+ <object class="spacer" expanded="0">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
- <object class="sizeritem" expanded="1">
+ <object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
- <object class="wxStaticText" expanded="1">
+ <object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@@ -29800,29 +23107,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -29852,45 +23136,12 @@
<property name="subclass"></property>
<property name="title">VeraCrypt</property>
<property name="tooltip"></property>
+ <property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnActivate"></event>
- <event name="OnActivateApp"></event>
- <event name="OnAuiFindManager"></event>
- <event name="OnAuiPaneButton"></event>
- <event name="OnAuiPaneClose"></event>
- <event name="OnAuiPaneMaximize"></event>
- <event name="OnAuiPaneRestore"></event>
- <event name="OnAuiRender"></event>
- <event name="OnChar"></event>
<event name="OnClose">OnWaitDialogClose</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnHibernate"></event>
- <event name="OnIconize"></event>
- <event name="OnIdle"></event>
<event name="OnInitDialog">OnWaitDialogInit</event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer160</property>
@@ -29898,7 +23149,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
- <property name="flag">wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND</property>
+ <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property>
@@ -29947,7 +23198,7 @@
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
- <property name="style">wxALIGN_CENTRE</property>
+ <property name="style">wxALIGN_CENTER_HORIZONTAL</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
@@ -29955,29 +23206,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -30042,29 +23270,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
</object>
</object>
</object>
diff --git a/src/Main/Forms/VolumeCreationWizard.cpp b/src/Main/Forms/VolumeCreationWizard.cpp
index dbb01974..2653ff66 100644
--- a/src/Main/Forms/VolumeCreationWizard.cpp
+++ b/src/Main/Forms/VolumeCreationWizard.cpp
@@ -479,7 +479,6 @@ namespace VeraCrypt
mountOptions.Pim = Pim;
mountOptions.Keyfiles = Keyfiles;
mountOptions.Kdf = Kdf;
- mountOptions.TrueCryptMode = false;
shared_ptr <VolumeInfo> volume = Core->MountVolume (mountOptions);
finally_do_arg (shared_ptr <VolumeInfo>, volume, { Core->DismountVolume (finally_arg, true); });
@@ -795,7 +794,7 @@ namespace VeraCrypt
shared_ptr <VolumePassword> hiddenPassword;
try
{
- hiddenPassword = Keyfile::ApplyListToPassword (Keyfiles, Password);
+ hiddenPassword = Keyfile::ApplyListToPassword (Keyfiles, Password, Gui->GetPreferences().EMVSupportEnabled);
}
catch (...)
{
@@ -846,7 +845,7 @@ namespace VeraCrypt
shared_ptr <VolumePassword> hiddenPassword;
try
{
- hiddenPassword = Keyfile::ApplyListToPassword (Keyfiles, Password);
+ hiddenPassword = Keyfile::ApplyListToPassword (Keyfiles, Password, Gui->GetPreferences().EMVSupportEnabled);
}
catch (...)
{
@@ -1031,7 +1030,9 @@ namespace VeraCrypt
options->Quick = QuickFormatEnabled;
options->Size = VolumeSize;
options->Type = OuterVolume ? VolumeType::Normal : SelectedVolumeType;
- options->VolumeHeaderKdf = Pkcs5Kdf::GetAlgorithm (*SelectedHash, false);
+ options->VolumeHeaderKdf = Pkcs5Kdf::GetAlgorithm (*SelectedHash);
+ options->EMVSupportEnabled = Gui->GetPreferences().EMVSupportEnabled;
+
Creator.reset (new VolumeCreator);
VolumeCreatorThreadRoutine routine(options, Creator);
@@ -1125,7 +1126,7 @@ namespace VeraCrypt
});
#endif
- shared_ptr <Volume> outerVolume = Core->OpenVolume (make_shared <VolumePath> (SelectedVolumePath), true, Password, Pim, Kdf, false, Keyfiles, VolumeProtection::ReadOnly);
+ shared_ptr <Volume> outerVolume = Core->OpenVolume (make_shared <VolumePath> (SelectedVolumePath), true, Password, Pim, Kdf, Keyfiles, VolumeProtection::ReadOnly);
try
{
MaxHiddenVolumeSize = Core->GetMaxHiddenVolumeSize (outerVolume);
@@ -1160,7 +1161,7 @@ namespace VeraCrypt
// remember Outer password and keyfiles in order to be able to compare it with those of Hidden volume
try
{
- OuterPassword = Keyfile::ApplyListToPassword (Keyfiles, Password);
+ OuterPassword = Keyfile::ApplyListToPassword (Keyfiles, Password, Gui->GetPreferences().EMVSupportEnabled);
}
catch (...)
{
diff --git a/src/Main/Forms/VolumePasswordPanel.cpp b/src/Main/Forms/VolumePasswordPanel.cpp
index 3525abf5..56804a49 100644
--- a/src/Main/Forms/VolumePasswordPanel.cpp
+++ b/src/Main/Forms/VolumePasswordPanel.cpp
@@ -18,7 +18,7 @@
namespace VeraCrypt
{
- VolumePasswordPanel::VolumePasswordPanel (wxWindow* parent, MountOptions* options, shared_ptr <VolumePassword> password, bool disableTruecryptMode, shared_ptr <KeyfileList> keyfiles, bool enableCache, bool enablePassword, bool enableKeyfiles, bool enableConfirmation, bool enablePkcs5Prf, bool isMountPassword, const wxString &passwordLabel)
+ VolumePasswordPanel::VolumePasswordPanel (wxWindow* parent, MountOptions* options, shared_ptr <VolumePassword> password, shared_ptr <KeyfileList> keyfiles, bool enableCache, bool enablePassword, bool enableKeyfiles, bool enableConfirmation, bool enablePkcs5Prf, bool isMountPassword, const wxString &passwordLabel)
: VolumePasswordPanelBase (parent), TopOwnerParent(NULL), Keyfiles (new KeyfileList), EnablePimEntry (true)
{
size_t maxPasswordLength = CmdLine->ArgUseLegacyPassword? VolumePassword::MaxLegacySize : VolumePassword::MaxSize;
@@ -78,22 +78,9 @@ namespace VeraCrypt
Pkcs5PrfStaticText->Show (enablePkcs5Prf);
Pkcs5PrfChoice->Show (enablePkcs5Prf);
- TrueCryptModeCheckBox->Show (!disableTruecryptMode);
HeaderWipeCountText->Show (enablePkcs5Prf && !isMountPassword);
HeaderWipeCount->Show (enablePkcs5Prf && !isMountPassword);
- if (options && !disableTruecryptMode)
- {
- TrueCryptModeCheckBox->SetValue (options->TrueCryptMode);
- if (options->TrueCryptMode)
- {
- PimCheckBox->Enable (false);
- VolumePimStaticText->Enable (false);
- VolumePimTextCtrl->Enable (false);
- VolumePimHelpStaticText->Enable (false);
- }
- }
-
if (EnablePimEntry && options && options->Pim > 0)
{
PimCheckBox->SetValue (true);
@@ -113,7 +100,7 @@ namespace VeraCrypt
Pkcs5PrfChoice->Delete (0);
Pkcs5PrfChoice->Append (LangString["AUTODETECTION"]);
}
- foreach_ref (const Pkcs5Kdf &kdf, Pkcs5Kdf::GetAvailableAlgorithms(false))
+ foreach_ref (const Pkcs5Kdf &kdf, Pkcs5Kdf::GetAvailableAlgorithms())
{
if (!kdf.IsDeprecated() || isMountPassword)
{
@@ -185,9 +172,7 @@ namespace VeraCrypt
void VolumePasswordPanel::SetPimValidator ()
{
- wxTextValidator validator (wxFILTER_INCLUDE_CHAR_LIST); // wxFILTER_NUMERIC does not exclude - . , etc.
- const wxChar *valArr[] = { L"0", L"1", L"2", L"3", L"4", L"5", L"6", L"7", L"8", L"9" };
- validator.SetIncludes (wxArrayString (array_capacity (valArr), (const wxChar **) &valArr));
+ wxTextValidator validator (wxFILTER_DIGITS);
VolumePimTextCtrl->SetValidator (validator);
}
@@ -204,7 +189,7 @@ namespace VeraCrypt
newTextCtrl->SetMinSize ((*textCtrl)->GetSize());
GridBagSizer->Detach ((*textCtrl));
- GridBagSizer->Add (newTextCtrl, wxGBPosition (row, 1), wxGBSpan (1, colspan), wxEXPAND|wxBOTTOM|wxALIGN_CENTER_VERTICAL, 5);
+ GridBagSizer->Add (newTextCtrl, wxGBPosition (row, 1), wxGBSpan (1, colspan), wxEXPAND|wxBOTTOM, 5);
(*textCtrl)->Show (false);
WipeTextCtrl (*textCtrl);
@@ -221,7 +206,7 @@ namespace VeraCrypt
shared_ptr <VolumePassword> VolumePasswordPanel::GetPassword (bool bForceLegacyPassword) const
{
- return GetPassword (PasswordTextCtrl, bForceLegacyPassword || GetTrueCryptMode());
+ return GetPassword (PasswordTextCtrl, bForceLegacyPassword);
}
shared_ptr <VolumePassword> VolumePasswordPanel::GetPassword (wxTextCtrl *textCtrl, bool bLegacyPassword) const
@@ -246,14 +231,8 @@ namespace VeraCrypt
return password;
}
- shared_ptr <Pkcs5Kdf> VolumePasswordPanel::GetPkcs5Kdf (bool &bUnsupportedKdf) const
+ shared_ptr <Pkcs5Kdf> VolumePasswordPanel::GetPkcs5Kdf () const
{
- return GetPkcs5Kdf (GetTrueCryptMode(), bUnsupportedKdf);
- }
-
- shared_ptr <Pkcs5Kdf> VolumePasswordPanel::GetPkcs5Kdf (bool bTrueCryptMode, bool &bUnsupportedKdf) const
- {
- bUnsupportedKdf = false;
try
{
int index = Pkcs5PrfChoice->GetSelection ();
@@ -263,11 +242,10 @@ namespace VeraCrypt
return shared_ptr <Pkcs5Kdf> ();
}
else
- return Pkcs5Kdf::GetAlgorithm (wstring (Pkcs5PrfChoice->GetStringSelection()), bTrueCryptMode);
+ return Pkcs5Kdf::GetAlgorithm (wstring (Pkcs5PrfChoice->GetStringSelection()));
}
catch (ParameterIncorrect&)
{
- bUnsupportedKdf = true;
return shared_ptr <Pkcs5Kdf> ();
}
}
@@ -303,21 +281,6 @@ namespace VeraCrypt
}
}
- bool VolumePasswordPanel::GetTrueCryptMode () const
- {
- return TrueCryptModeCheckBox->GetValue ();
- }
-
- void VolumePasswordPanel::SetTrueCryptMode (bool trueCryptMode)
- {
- bool bEnablePIM = !trueCryptMode;
- TrueCryptModeCheckBox->SetValue (trueCryptMode);
- PimCheckBox->Enable (bEnablePIM);
- VolumePimStaticText->Enable (bEnablePIM);
- VolumePimTextCtrl->Enable (bEnablePIM);
- VolumePimHelpStaticText->Enable (bEnablePIM);
- }
-
int VolumePasswordPanel::GetHeaderWipeCount () const
{
try
@@ -383,7 +346,7 @@ namespace VeraCrypt
SecurityTokenKeyfilesDialog dialog (this);
if (dialog.ShowModal() == wxID_OK)
{
- foreach (const SecurityTokenKeyfilePath &path, dialog.GetSelectedSecurityTokenKeyfilePaths())
+ foreach (const TokenKeyfilePath &path, dialog.GetSelectedSecurityTokenKeyfilePaths())
{
Keyfiles->push_back (make_shared <Keyfile> (wstring (path)));
}
@@ -459,7 +422,11 @@ namespace VeraCrypt
void VolumePasswordPanel::WipeTextCtrl (wxTextCtrl *textCtrl)
{
- textCtrl->SetValue (wxString (L'X', textCtrl->GetLineLength(0)));
+ int txtLen = textCtrl->GetLineLength(0);
+ if (txtLen > 0)
+ {
+ textCtrl->SetValue (wxString (L'X', txtLen));
+ }
GetPassword (textCtrl);
}
@@ -498,6 +465,7 @@ namespace VeraCrypt
VolumePimStaticText->Show (true);
VolumePimTextCtrl->Show (true);
VolumePimHelpStaticText->Show (true);
+ VolumePimTextCtrl->SetFocus();
if (DisplayPasswordCheckBox->IsChecked ())
DisplayPassword (true, &VolumePimTextCtrl, 3);
@@ -511,13 +479,4 @@ namespace VeraCrypt
layoutParent->Fit();
}
}
-
- void VolumePasswordPanel::OnTrueCryptModeChecked( wxCommandEvent& event )
- {
- bool bEnablePIM = !GetTrueCryptMode ();
- PimCheckBox->Enable (bEnablePIM);
- VolumePimStaticText->Enable (bEnablePIM);
- VolumePimTextCtrl->Enable (bEnablePIM);
- VolumePimHelpStaticText->Enable (bEnablePIM);
- }
}
diff --git a/src/Main/Forms/VolumePasswordPanel.h b/src/Main/Forms/VolumePasswordPanel.h
index e9b81e29..7019e8fd 100644
--- a/src/Main/Forms/VolumePasswordPanel.h
+++ b/src/Main/Forms/VolumePasswordPanel.h
@@ -22,17 +22,14 @@ namespace VeraCrypt
class VolumePasswordPanel : public VolumePasswordPanelBase
{
public:
- VolumePasswordPanel (wxWindow* parent, MountOptions* options, shared_ptr <VolumePassword> password, bool disableTruecryptMode, shared_ptr <KeyfileList> keyfiles, bool enableCache = false, bool enablePassword = true, bool enableKeyfiles = true, bool enableConfirmation = false, bool enablePkcs5Prf = false, bool isMountPassword = false, const wxString &passwordLabel = wxString());
+ VolumePasswordPanel (wxWindow* parent, MountOptions* options, shared_ptr <VolumePassword> password, shared_ptr <KeyfileList> keyfiles, bool enableCache = false, bool enablePassword = true, bool enableKeyfiles = true, bool enableConfirmation = false, bool enablePkcs5Prf = false, bool isMountPassword = false, const wxString &passwordLabel = wxString());
virtual ~VolumePasswordPanel ();
void AddKeyfile (shared_ptr <Keyfile> keyfile);
shared_ptr <KeyfileList> GetKeyfiles () const { return UseKeyfilesCheckBox->IsChecked() ? Keyfiles : shared_ptr <KeyfileList> (); }
shared_ptr <VolumePassword> GetPassword (bool bForceLegacyPassword = false) const;
- shared_ptr <Pkcs5Kdf> GetPkcs5Kdf (bool &bUnsupportedKdf) const;
- shared_ptr <Pkcs5Kdf> GetPkcs5Kdf (bool bTrueCryptMode, bool &bUnsupportedKdf) const;
+ shared_ptr <Pkcs5Kdf> GetPkcs5Kdf () const;
int GetVolumePim () const;
- bool GetTrueCryptMode () const;
- void SetTrueCryptMode (bool trueCryptMode);
int GetHeaderWipeCount () const;
void SetCacheCheckBoxValidator (const wxGenericValidator &validator) { CacheCheckBox->SetValidator (validator); }
void SetFocusToPasswordTextCtrl () { PasswordTextCtrl->SetSelection (-1, -1); PasswordTextCtrl->SetFocus(); }
@@ -64,7 +61,6 @@ namespace VeraCrypt
void OnUpdate () { UpdateEvent.Raise(); }
void OnUseKeyfilesCheckBoxClick (wxCommandEvent& event) { OnUpdate(); }
void WipeTextCtrl (wxTextCtrl *textCtrl);
- void OnTrueCryptModeChecked( wxCommandEvent& event );
shared_ptr <KeyfileList> Keyfiles;
shared_ptr <Functor> UpdateCallback;
diff --git a/src/Main/Forms/VolumePasswordWizardPage.cpp b/src/Main/Forms/VolumePasswordWizardPage.cpp
index 274a59f5..859a613a 100644
--- a/src/Main/Forms/VolumePasswordWizardPage.cpp
+++ b/src/Main/Forms/VolumePasswordWizardPage.cpp
@@ -19,7 +19,7 @@ namespace VeraCrypt
VolumePasswordWizardPage::VolumePasswordWizardPage (wxPanel* parent, shared_ptr <VolumePassword> password, shared_ptr <KeyfileList> keyfiles, bool enableConfirmation)
: VolumePasswordWizardPageBase (parent), ConfirmationMode (enableConfirmation)
{
- PasswordPanel = new VolumePasswordPanel (this, NULL, password, true, keyfiles, false, true, true, enableConfirmation, !enableConfirmation, !enableConfirmation);
+ PasswordPanel = new VolumePasswordPanel (this, NULL, password, keyfiles, false, true, true, enableConfirmation, !enableConfirmation, !enableConfirmation);
PasswordPanel->UpdateEvent.Connect (EventConnector <VolumePasswordWizardPage> (this, &VolumePasswordWizardPage::OnPasswordPanelUpdate));
PasswordPanelSizer->Add (PasswordPanel, 1, wxALL | wxEXPAND);
diff --git a/src/Main/Forms/VolumePasswordWizardPage.h b/src/Main/Forms/VolumePasswordWizardPage.h
index a9a2872c..525db216 100644
--- a/src/Main/Forms/VolumePasswordWizardPage.h
+++ b/src/Main/Forms/VolumePasswordWizardPage.h
@@ -30,7 +30,7 @@ namespace VeraCrypt
bool IsPimSelected () const { return PasswordPanel->IsUsePimChecked ();}
void SetPimSelected (bool selected) const { PasswordPanel->SetUsePimChecked (selected);}
- shared_ptr <Pkcs5Kdf> GetPkcs5Kdf () const { bool bUnsupportedKdf; return PasswordPanel->GetPkcs5Kdf(bUnsupportedKdf); }
+ shared_ptr <Pkcs5Kdf> GetPkcs5Kdf () const { return PasswordPanel->GetPkcs5Kdf(); }
bool IsValid ();
void SetMaxStaticTextWidth (int width) { InfoStaticText->Wrap (width); }
void SetPageText (const wxString &text) { InfoStaticText->SetLabel (text); }
diff --git a/src/Main/Forms/VolumePimWizardPage.cpp b/src/Main/Forms/VolumePimWizardPage.cpp
index 7ef8a3a0..6500affb 100644
--- a/src/Main/Forms/VolumePimWizardPage.cpp
+++ b/src/Main/Forms/VolumePimWizardPage.cpp
@@ -23,6 +23,7 @@ namespace VeraCrypt
VolumePimWizardPage::VolumePimWizardPage (wxPanel* parent)
: VolumePimWizardPageBase (parent)
{
+ VolumePimTextCtrl->SetMinSize (wxSize (Gui->GetCharWidth (VolumePimTextCtrl) * 15, -1));
SetPimValidator ();
}
@@ -91,9 +92,7 @@ namespace VeraCrypt
void VolumePimWizardPage::SetPimValidator ()
{
- wxTextValidator validator (wxFILTER_INCLUDE_CHAR_LIST); // wxFILTER_NUMERIC does not exclude - . , etc.
- const wxChar *valArr[] = { L"0", L"1", L"2", L"3", L"4", L"5", L"6", L"7", L"8", L"9" };
- validator.SetIncludes (wxArrayString (array_capacity (valArr), (const wxChar **) &valArr));
+ wxTextValidator validator (wxFILTER_DIGITS);
VolumePimTextCtrl->SetValidator (validator);
}
@@ -110,7 +109,11 @@ namespace VeraCrypt
PimSizer->Replace (VolumePimTextCtrl, newTextCtrl);
VolumePimTextCtrl->Show (false);
- VolumePimTextCtrl->SetValue (wxString (L'X', VolumePimTextCtrl->GetLineLength(0)));
+ int txtLen = VolumePimTextCtrl->GetLineLength(0);
+ if (txtLen > 0)
+ {
+ VolumePimTextCtrl->SetValue (wxString (L'X', txtLen));
+ }
GetVolumePim ();
Fit();
diff --git a/src/Main/Forms/VolumePropertiesDialog.cpp b/src/Main/Forms/VolumePropertiesDialog.cpp
index 4332e844..3bba33bc 100644
--- a/src/Main/Forms/VolumePropertiesDialog.cpp
+++ b/src/Main/Forms/VolumePropertiesDialog.cpp
@@ -36,7 +36,7 @@ namespace VeraCrypt
AppendToList ("VIRTUAL_DEVICE", wstring (volumeInfo.VirtualDevice));
#endif
AppendToList ("SIZE", Gui->SizeToString (volumeInfo.Size));
- AppendToList ("TYPE", Gui->VolumeTypeToString (volumeInfo.Type, volumeInfo.TrueCryptMode, volumeInfo.Protection));
+ AppendToList ("TYPE", Gui->VolumeTypeToString (volumeInfo.Type, volumeInfo.Protection));
AppendToList ("READ_ONLY", LangString [volumeInfo.Protection == VolumeProtection::ReadOnly ? "UISTR_YES" : "UISTR_NO"]);
wxString protection;
diff --git a/src/Main/Forms/VolumeSizeWizardPage.cpp b/src/Main/Forms/VolumeSizeWizardPage.cpp
index 61427ea5..08aa7052 100644
--- a/src/Main/Forms/VolumeSizeWizardPage.cpp
+++ b/src/Main/Forms/VolumeSizeWizardPage.cpp
@@ -39,6 +39,12 @@ namespace VeraCrypt
}
else
{
+ if (!volumePath.IsDevice())
+ {
+ wxULongLong containerSizeUnsigned = wxFileName (wstring (volumePath)).GetSize();
+ if (containerSizeUnsigned != wxInvalidSize)
+ diskSpace += static_cast<wxLongLong_t>(containerSizeUnsigned.GetValue());
+ }
AvailableDiskSpace = (uint64) diskSpace.GetValue ();
}
@@ -67,9 +73,7 @@ namespace VeraCrypt
VolumeSizeTextCtrl->SetMinSize (wxSize (Gui->GetCharWidth (VolumeSizeTextCtrl) * 20, -1));
- wxTextValidator validator (wxFILTER_INCLUDE_CHAR_LIST); // wxFILTER_NUMERIC does not exclude - . , etc.
- const wxChar *valArr[] = { L"0", L"1", L"2", L"3", L"4", L"5", L"6", L"7", L"8", L"9" };
- validator.SetIncludes (wxArrayString (array_capacity (valArr), (const wxChar **) &valArr));
+ wxTextValidator validator (wxFILTER_DIGITS);
VolumeSizeTextCtrl->SetValidator (validator);
}
@@ -79,7 +83,7 @@ namespace VeraCrypt
uint64 val;
if (UseAllFreeSpaceCheckBox->IsChecked ())
{
- val = AvailableDiskSpace;
+ val = MaxVolumeSizeValid ? MaxVolumeSize : AvailableDiskSpace;
}
else
{
diff --git a/src/Main/Forms/WaitDialog.cpp b/src/Main/Forms/WaitDialog.cpp
index 2976a6e8..102d479a 100644
--- a/src/Main/Forms/WaitDialog.cpp
+++ b/src/Main/Forms/WaitDialog.cpp
@@ -8,7 +8,11 @@
#include "System.h"
#include "Volume/EncryptionModeXTS.h"
+#ifdef WOLFCRYPT_BACKEND
+#include "Volume/EncryptionModeWolfCryptXTS.h"
+#endif
#include "Main/GraphicUserInterface.h"
+#include "Common/PCSCException.h"
#include "Common/SecurityToken.h"
#include "WaitDialog.h"
@@ -74,6 +78,7 @@ namespace VeraCrypt
VC_CONVERT_EXCEPTION (ParameterTooLarge);
VC_CONVERT_EXCEPTION (PartitionDeviceRequired);
VC_CONVERT_EXCEPTION (StringConversionFailed);
+ VC_CONVERT_EXCEPTION (TerminalNotFound);
VC_CONVERT_EXCEPTION (TestFailed);
VC_CONVERT_EXCEPTION (TimeOut);
VC_CONVERT_EXCEPTION (UnknownException);
@@ -94,12 +99,24 @@ namespace VeraCrypt
VC_CONVERT_EXCEPTION (SecurityTokenLibraryNotInitialized);
VC_CONVERT_EXCEPTION (SecurityTokenKeyfileAlreadyExists);
VC_CONVERT_EXCEPTION (SecurityTokenKeyfileNotFound);
- VC_CONVERT_EXCEPTION (UnsupportedAlgoInTrueCryptMode);
- VC_CONVERT_EXCEPTION (UnsupportedTrueCryptFormat);
VC_CONVERT_EXCEPTION (SystemException);
VC_CONVERT_EXCEPTION (CipherException);
VC_CONVERT_EXCEPTION (VolumeException);
VC_CONVERT_EXCEPTION (PasswordException);
+
+ VC_CONVERT_EXCEPTION (PCSCException);
+ VC_CONVERT_EXCEPTION (CommandAPDUNotValid);
+ VC_CONVERT_EXCEPTION (ExtendedAPDUNotSupported);
+ VC_CONVERT_EXCEPTION (ScardLibraryInitializationFailed);
+ VC_CONVERT_EXCEPTION (EMVUnknownCardType);
+ VC_CONVERT_EXCEPTION (EMVSelectAIDFailed);
+ VC_CONVERT_EXCEPTION (EMVIccCertNotFound);
+ VC_CONVERT_EXCEPTION (EMVIssuerCertNotFound);
+ VC_CONVERT_EXCEPTION (EMVCPLCNotFound);
+ VC_CONVERT_EXCEPTION (InvalidEMVPath);
+ VC_CONVERT_EXCEPTION (EMVKeyfileDataNotFound);
+ VC_CONVERT_EXCEPTION (EMVPANNotFound);
+
throw *ex;
}
}
diff --git a/src/Main/Forms/WizardPage.h b/src/Main/Forms/WizardPage.h
index 9f175063..1bc5b82e 100644
--- a/src/Main/Forms/WizardPage.h
+++ b/src/Main/Forms/WizardPage.h
@@ -20,8 +20,8 @@ namespace VeraCrypt
class WizardPage : public wxPanel
{
public:
- WizardPage (wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style)
- : wxPanel (parent, id, pos, size, style)
+ WizardPage (wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style, const wxString &name)
+ : wxPanel (parent, id, pos, size, style, name)
{ }
virtual ~WizardPage () { }
diff --git a/src/Main/GraphicUserInterface.cpp b/src/Main/GraphicUserInterface.cpp
index 7d1cee7c..16db8f83 100644
--- a/src/Main/GraphicUserInterface.cpp
+++ b/src/Main/GraphicUserInterface.cpp
@@ -191,8 +191,8 @@ namespace VeraCrypt
options->Password,
options->Pim,
options->Kdf,
- false,
options->Keyfiles,
+ options->EMVSupportEnabled,
options->Protection,
options->ProtectionPassword,
options->ProtectionPim,
@@ -219,8 +219,8 @@ namespace VeraCrypt
options->Password,
options->Pim,
options->Kdf,
- false,
options->Keyfiles,
+ options->EMVSupportEnabled,
options->Protection,
options->ProtectionPassword,
options->ProtectionPim,
@@ -315,7 +315,7 @@ namespace VeraCrypt
// Re-encrypt volume header
SecureBuffer newHeaderBuffer (normalVolume->GetLayout()->GetHeaderSize());
- ReEncryptHeaderThreadRoutine routine(newHeaderBuffer, normalVolume->GetHeader(), normalVolumeMountOptions.Password, normalVolumeMountOptions.Pim, normalVolumeMountOptions.Keyfiles);
+ ReEncryptHeaderThreadRoutine routine(newHeaderBuffer, normalVolume->GetHeader(), normalVolumeMountOptions.Password, normalVolumeMountOptions.Pim, normalVolumeMountOptions.Keyfiles, normalVolumeMountOptions.EMVSupportEnabled);
ExecuteWaitThreadRoutine (parent, &routine);
@@ -324,7 +324,7 @@ namespace VeraCrypt
if (hiddenVolume)
{
// Re-encrypt hidden volume header
- ReEncryptHeaderThreadRoutine hiddenRoutine(newHeaderBuffer, hiddenVolume->GetHeader(), hiddenVolumeMountOptions.Password, hiddenVolumeMountOptions.Pim, hiddenVolumeMountOptions.Keyfiles);
+ ReEncryptHeaderThreadRoutine hiddenRoutine(newHeaderBuffer, hiddenVolume->GetHeader(), hiddenVolumeMountOptions.Password, hiddenVolumeMountOptions.Pim, hiddenVolumeMountOptions.Keyfiles, hiddenVolumeMountOptions.EMVSupportEnabled);
ExecuteWaitThreadRoutine (parent, &hiddenRoutine);
}
@@ -677,11 +677,21 @@ namespace VeraCrypt
return true;
}
- void GraphicUserInterface::ListSecurityTokenKeyfiles () const
+ void GraphicUserInterface::ListTokenKeyfiles () const
{
SecurityTokenKeyfilesDialog dialog (nullptr);
dialog.ShowModal();
}
+ void GraphicUserInterface::ListSecurityTokenKeyfiles () const
+ {
+ SecurityTokenKeyfilesDialog dialog (nullptr);
+ dialog.ShowModal();
+ }
+ void GraphicUserInterface::ListEMVTokenKeyfiles () const
+ {
+ SecurityTokenKeyfilesDialog dialog (nullptr);
+ dialog.ShowModal();
+ }
#ifdef TC_MACOSX
void GraphicUserInterface::MacOpenFiles (const wxArrayString &fileNames)
@@ -823,7 +833,7 @@ namespace VeraCrypt
options.Keyfiles = make_shared <KeyfileList> (GetPreferences().DefaultKeyfiles);
if ((options.Password && !options.Password->IsEmpty())
- || (options.Keyfiles && !options.Keyfiles->empty() && (options.TrueCryptMode || options.Password)))
+ || (options.Keyfiles && !options.Keyfiles->empty() && options.Password))
{
try
{
@@ -1317,7 +1327,14 @@ namespace VeraCrypt
{
/* check if local file exists */
wxFileName htmlFile = htmlPath + url;
- htmlFile.Normalize();
+ htmlFile.Normalize (
+ wxPATH_NORM_ENV_VARS |
+ wxPATH_NORM_DOTS |
+ wxPATH_NORM_CASE |
+ wxPATH_NORM_LONG |
+ wxPATH_NORM_SHORTCUT |
+ wxPATH_NORM_TILDE
+ );
localFile = htmlFile.FileExists();
}
@@ -1447,8 +1464,8 @@ namespace VeraCrypt
options.Password,
options.Pim,
options.Kdf,
- options.TrueCryptMode,
options.Keyfiles,
+ options.EMVSupportEnabled,
options.Protection,
options.ProtectionPassword,
options.ProtectionPim,
@@ -1481,7 +1498,7 @@ namespace VeraCrypt
// Re-encrypt volume header
wxBusyCursor busy;
SecureBuffer newHeaderBuffer (volume->GetLayout()->GetHeaderSize());
- ReEncryptHeaderThreadRoutine routine(newHeaderBuffer, volume->GetHeader(), options.Password, options.Pim, options.Keyfiles);
+ ReEncryptHeaderThreadRoutine routine(newHeaderBuffer, volume->GetHeader(), options.Password, options.Pim, options.Keyfiles, options.EMVSupportEnabled);
ExecuteWaitThreadRoutine (parent, &routine);
@@ -1562,12 +1579,12 @@ namespace VeraCrypt
backupFile.ReadAt (headerBuffer, layout->GetType() == VolumeType::Hidden ? layout->GetHeaderSize() : 0);
// Decrypt header
- shared_ptr <VolumePassword> passwordKey = Keyfile::ApplyListToPassword (options.Keyfiles, options.Password);
- Pkcs5KdfList keyDerivationFunctions = layout->GetSupportedKeyDerivationFunctions(options.TrueCryptMode);
+ shared_ptr <VolumePassword> passwordKey = Keyfile::ApplyListToPassword (options.Keyfiles, options.Password, options.EMVSupportEnabled);
+ Pkcs5KdfList keyDerivationFunctions = layout->GetSupportedKeyDerivationFunctions();
EncryptionAlgorithmList encryptionAlgorithms = layout->GetSupportedEncryptionAlgorithms();
EncryptionModeList encryptionModes = layout->GetSupportedEncryptionModes();
- DecryptThreadRoutine decryptRoutine(layout->GetHeader(), headerBuffer, *passwordKey, options.Pim, options.Kdf, options.TrueCryptMode, keyDerivationFunctions, encryptionAlgorithms, encryptionModes);
+ DecryptThreadRoutine decryptRoutine(layout->GetHeader(), headerBuffer, *passwordKey, options.Pim, options.Kdf, keyDerivationFunctions, encryptionAlgorithms, encryptionModes);
ExecuteWaitThreadRoutine (parent, &decryptRoutine);
@@ -1596,7 +1613,7 @@ namespace VeraCrypt
// Re-encrypt volume header
wxBusyCursor busy;
SecureBuffer newHeaderBuffer (decryptedLayout->GetHeaderSize());
- ReEncryptHeaderThreadRoutine routine(newHeaderBuffer, decryptedLayout->GetHeader(), options.Password, options.Pim, options.Keyfiles);
+ ReEncryptHeaderThreadRoutine routine(newHeaderBuffer, decryptedLayout->GetHeader(), options.Password, options.Pim, options.Keyfiles, options.EMVSupportEnabled);
ExecuteWaitThreadRoutine (parent, &routine);
@@ -1612,7 +1629,7 @@ namespace VeraCrypt
if (decryptedLayout->HasBackupHeader())
{
// Re-encrypt backup volume header
- ReEncryptHeaderThreadRoutine backupRoutine(newHeaderBuffer, decryptedLayout->GetHeader(), options.Password, options.Pim, options.Keyfiles);
+ ReEncryptHeaderThreadRoutine backupRoutine(newHeaderBuffer, decryptedLayout->GetHeader(), options.Password, options.Pim, options.Keyfiles, options.EMVSupportEnabled);
ExecuteWaitThreadRoutine (parent, &backupRoutine);
diff --git a/src/Main/GraphicUserInterface.h b/src/Main/GraphicUserInterface.h
index 06ea6772..d48b7973 100644
--- a/src/Main/GraphicUserInterface.h
+++ b/src/Main/GraphicUserInterface.h
@@ -34,7 +34,7 @@ namespace VeraCrypt
virtual void BackupVolumeHeaders (shared_ptr <VolumePath> volumePath) const;
virtual void BeginBusyState () const { wxBeginBusyCursor(); }
virtual void BeginInteractiveBusyState (wxWindow *window);
- virtual void ChangePassword (shared_ptr <VolumePath> volumePath = shared_ptr <VolumePath>(), shared_ptr <VolumePassword> password = shared_ptr <VolumePassword>(), int pim = 0, shared_ptr <Hash> currentHash = shared_ptr <Hash>(), bool truecryptMode = false, shared_ptr <KeyfileList> keyfiles = shared_ptr <KeyfileList>(), shared_ptr <VolumePassword> newPassword = shared_ptr <VolumePassword>(), int newPim = 0, shared_ptr <KeyfileList> newKeyfiles = shared_ptr <KeyfileList>(), shared_ptr <Hash> newHash = shared_ptr <Hash>()) const { ThrowTextModeRequired(); }
+ virtual void ChangePassword (shared_ptr <VolumePath> volumePath = shared_ptr <VolumePath>(), shared_ptr <VolumePassword> password = shared_ptr <VolumePassword>(), int pim = 0, shared_ptr <Hash> currentHash = shared_ptr <Hash>(), shared_ptr <KeyfileList> keyfiles = shared_ptr <KeyfileList>(), shared_ptr <VolumePassword> newPassword = shared_ptr <VolumePassword>(), int newPim = 0, shared_ptr <KeyfileList> newKeyfiles = shared_ptr <KeyfileList>(), shared_ptr <Hash> newHash = shared_ptr <Hash>()) const { ThrowTextModeRequired(); }
wxHyperlinkCtrl *CreateHyperlink (wxWindow *parent, const wxString &linkUrl, const wxString &linkText) const;
virtual void CreateKeyfile (shared_ptr <FilePath> keyfilePath = shared_ptr <FilePath>()) const;
virtual void CreateVolume (shared_ptr <VolumeCreationOptions> options) const { ThrowTextModeRequired(); }
@@ -46,7 +46,7 @@ namespace VeraCrypt
virtual void DoShowWarning (const wxString &message) const;
virtual void EndBusyState () const { wxEndBusyCursor(); }
virtual void EndInteractiveBusyState (wxWindow *window) const;
- virtual void ExportSecurityTokenKeyfile () const { ThrowTextModeRequired(); }
+ virtual void ExportTokenKeyfile () const { ThrowTextModeRequired(); }
virtual wxTopLevelWindow *GetActiveWindow () const;
virtual shared_ptr <GetStringFunctor> GetAdminPasswordRequestHandler ();
virtual int GetCharHeight (wxWindow *window) const;
@@ -58,12 +58,14 @@ namespace VeraCrypt
virtual int GetScrollbarWidth (wxWindow *window, bool noScrollBar = false) const;
virtual list <long> GetListCtrlSelectedItems (wxListCtrl *listCtrl) const;
virtual wxString GetListCtrlSubItemText (wxListCtrl *listCtrl, long itemIndex, int columnIndex) const;
- virtual void ImportSecurityTokenKeyfiles () const { ThrowTextModeRequired(); }
+ virtual void ImportTokenKeyfiles () const { ThrowTextModeRequired(); }
virtual void InitSecurityTokenLibrary () const;
virtual void InsertToListCtrl (wxListCtrl *listCtrl, long itemIndex, const vector <wstring> &itemFields, int imageIndex = -1, void *itemDataPtr = nullptr) const;
virtual bool IsInBackgroundMode () const { return BackgroundMode; }
virtual bool IsTheOnlyTopLevelWindow (const wxWindow *window) const;
- virtual void ListSecurityTokenKeyfiles () const;
+ virtual void ListTokenKeyfiles () const;
+ virtual void ListSecurityTokenKeyfiles () const;
+ virtual void ListEMVTokenKeyfiles () const;
virtual VolumeInfoList MountAllDeviceHostedVolumes (MountOptions &options) const;
virtual shared_ptr <VolumeInfo> MountVolume (MountOptions &options) const;
virtual void MoveListCtrlItem (wxListCtrl *listCtrl, long itemIndex, long newItemIndex) const;
diff --git a/src/Main/LanguageStrings.cpp b/src/Main/LanguageStrings.cpp
index 71914ec7..0e13ebc7 100644
--- a/src/Main/LanguageStrings.cpp
+++ b/src/Main/LanguageStrings.cpp
@@ -56,12 +56,17 @@ namespace VeraCrypt
Map[StringConverter::ToSingle (wstring (node.Attributes[L"key"]))] = text;
}
- foreach (XmlNode node, XmlParser (Resources::GetLanguageXml()).GetNodes (L"entry"))
+ string translatedXml = Resources::GetLanguageXml();
+ foreach (XmlNode node, XmlParser (translatedXml).GetNodes (L"entry"))
{
wxString text = node.InnerText;
text.Replace (L"\\n", L"\n");
Map[StringConverter::ToSingle (wstring (node.Attributes[L"key"]))] = text;
}
+
+ XmlNode node = XmlParser (translatedXml).GetNodes (L"language").front();
+ Map["LANGUAGE_TRANSLATORS"] = wxString (node.Attributes[L"translators"]);
+ Map["CURRENT_LANGUAGE_PACK"] = wxString (node.Attributes[L"name"]);
}
LanguageStrings LangString;
diff --git a/src/Main/Main.make b/src/Main/Main.make
index 8def8aaa..dd85f842 100755
--- a/src/Main/Main.make
+++ b/src/Main/Main.make
@@ -102,7 +102,7 @@ endif
#------ FUSE configuration ------
-FUSE_LIBS = $(shell pkg-config fuse --libs)
+FUSE_LIBS = $(shell $(PKG_CONFIG) fuse --libs)
#------ Executable ------
@@ -159,7 +159,7 @@ endif
$(APPNAME): $(LIBS) $(OBJS)
@echo Linking $@
- $(CXX) -o $(APPNAME) $(OBJS) $(LIBS) $(FUSE_LIBS) $(WX_LIBS) $(LFLAGS)
+ $(CXX) -o $(APPNAME) $(OBJS) $(LIBS) $(AYATANA_LIBS) $(FUSE_LIBS) $(WX_LIBS) $(LFLAGS)
ifeq "$(TC_BUILD_CONFIG)" "Release"
ifndef NOSTRIP
@@ -200,7 +200,7 @@ endif
cp $(BASE_DIR)/Resources/Icons/VeraCrypt.icns $(APPNAME).app/Contents/Resources
cp $(BASE_DIR)/Resources/Icons/VeraCrypt_Volume.icns $(APPNAME).app/Contents/Resources
- cp $(BASE_DIR)/../doc/html/* $(APPNAME).app/Contents/Resources/doc/HTML
+ cp -R $(BASE_DIR)/../doc/html/* $(APPNAME).app/Contents/Resources/doc/HTML
cp $(BASE_DIR)/../Translations/* $(APPNAME).app/Contents/Resources/languages
echo -n APPLTRUE >$(APPNAME).app/Contents/PkgInfo
@@ -252,7 +252,7 @@ prepare: $(APPNAME)
cp $(BASE_DIR)/Setup/Linux/$(APPNAME)-uninstall.sh $(BASE_DIR)/Setup/Linux/usr/bin/$(APPNAME)-uninstall.sh
chmod +x $(BASE_DIR)/Setup/Linux/usr/bin/$(APPNAME)-uninstall.sh
cp $(BASE_DIR)/License.txt $(BASE_DIR)/Setup/Linux/usr/share/doc/$(APPNAME)/License.txt
- cp $(BASE_DIR)/../doc/html/* "$(BASE_DIR)/Setup/Linux/usr/share/doc/$(APPNAME)/HTML"
+ cp -R $(BASE_DIR)/../doc/html/* "$(BASE_DIR)/Setup/Linux/usr/share/doc/$(APPNAME)/HTML"
mkdir -p $(BASE_DIR)/Setup/Linux/usr/share/veracrypt/languages
cp -r $(BASE_DIR)/../Translations/* $(BASE_DIR)/Setup/Linux/usr/share/veracrypt/languages/
@@ -284,7 +284,7 @@ package: prepare
@echo "VERSION=$(TC_VERSION)" >> $(INTERNAL_INSTALLER_NAME)
@echo "PACKAGE_TYPE=tar" >> $(INTERNAL_INSTALLER_NAME)
@echo "PACKAGE_NAME=$(PACKAGE_NAME)" >> $(INTERNAL_INSTALLER_NAME)
- @echo "PACKAGE_START=1107" >> $(INTERNAL_INSTALLER_NAME)
+ @echo "PACKAGE_START=1112" >> $(INTERNAL_INSTALLER_NAME)
@echo "INSTALLER_TYPE=$(INSTALLER_TYPE)" >> $(INTERNAL_INSTALLER_NAME)
@cat $(BASE_DIR)/Setup/Linux/veracrypt_install_template.sh >> $(INTERNAL_INSTALLER_NAME)
@@ -309,7 +309,9 @@ prepare: $(APPNAME)
cp $(BASE_DIR)/Setup/Linux/$(APPNAME)-uninstall.sh $(BASE_DIR)/Setup/FreeBSD/usr/bin/$(APPNAME)-uninstall.sh
chmod +x $(BASE_DIR)/Setup/FreeBSD/usr/bin/$(APPNAME)-uninstall.sh
cp $(BASE_DIR)/License.txt $(BASE_DIR)/Setup/FreeBSD/usr/share/doc/$(APPNAME)/License.txt
- cp $(BASE_DIR)/../doc/html/* "$(BASE_DIR)/Setup/FreeBSD/usr/share/doc/$(APPNAME)/HTML"
+ cp -R $(BASE_DIR)/../doc/html/* "$(BASE_DIR)/Setup/FreeBSD/usr/share/doc/$(APPNAME)/HTML"
+ mkdir -p $(BASE_DIR)/Setup/FreeBSD/usr/share/veracrypt/languages
+ cp -r $(BASE_DIR)/../Translations/* $(BASE_DIR)/Setup/FreeBSD/usr/share/veracrypt/languages/
ifndef TC_NO_GUI
mkdir -p $(BASE_DIR)/Setup/FreeBSD/usr/share/applications
@@ -338,7 +340,7 @@ package: prepare
@echo "VERSION=$(TC_VERSION)" >> $(INTERNAL_INSTALLER_NAME)
@echo "PACKAGE_TYPE=tar" >> $(INTERNAL_INSTALLER_NAME)
@echo "PACKAGE_NAME=$(PACKAGE_NAME)" >> $(INTERNAL_INSTALLER_NAME)
- @echo "PACKAGE_START=1107" >> $(INTERNAL_INSTALLER_NAME)
+ @echo "PACKAGE_START=1108" >> $(INTERNAL_INSTALLER_NAME)
@echo "INSTALLER_TYPE=$(INSTALLER_TYPE)" >> $(INTERNAL_INSTALLER_NAME)
@cat $(BASE_DIR)/Setup/FreeBSD/veracrypt_install_template.sh >> $(INTERNAL_INSTALLER_NAME)
diff --git a/src/Main/Resources.cpp b/src/Main/Resources.cpp
index d9a787a5..d8bab977 100644
--- a/src/Main/Resources.cpp
+++ b/src/Main/Resources.cpp
@@ -23,6 +23,7 @@
#include "Platform/File.h"
#include "Platform/StringConverter.h"
#include <stdio.h>
+#include "UserPreferences.h"
#endif
namespace VeraCrypt
@@ -46,7 +47,6 @@ namespace VeraCrypt
}
#endif // TC_WINDOWS
-
string Resources::GetLanguageXml ()
{
#ifdef TC_WINDOWS
@@ -68,53 +68,65 @@ namespace VeraCrypt
#endif
string filenamePost(".xml");
string filename = filenamePrefix + defaultLang + filenamePost;
- if(const char* env_p = getenv("LANG")){
- string lang(env_p);
+
+ UserPreferences Preferences;
+ Preferences.Load();
+ wstring preferredLang = Preferences.Language;
#ifdef DEBUG
- std::cout << lang << std::endl;
+ std::cout << "Config language: " << preferredLang << std::endl;
#endif
- if ( lang.size() > 1 ){
- int found = lang.find(".");
- if ( found > 1 ){
- string langTag = lang.substr (0,found);
- string lowerLangTag(StringConverter::ToLower (langTag) );
- int foundUnderscore = lowerLangTag.find("_");
- if ( foundUnderscore > 0 ) {
- lowerLangTag.replace(foundUnderscore,1,1,'-');
- filename = filenamePrefix + lowerLangTag + filenamePost;
- FilesystemPath xml(filename);
- if (! xml.IsFile()){
- string shortLangTag = lowerLangTag.substr(0,foundUnderscore);
- filename = filenamePrefix + shortLangTag + filenamePost;
+
+ if (preferredLang == L"system") {
+ if (const char *env_p = getenv("LANG")) {
+ string lang(env_p);
+#ifdef DEBUG
+ std::cout << "env $LANG: " << lang << std::endl;
+#endif
+ if (lang.size() > 1) {
+ int found = lang.find(".");
+ if (found > 1) {
+ string langTag = lang.substr(0, found);
+ string lowerLangTag(StringConverter::ToLower(langTag));
+ int foundUnderscore = lowerLangTag.find("_");
+ if (foundUnderscore > 0) {
+ lowerLangTag.replace(foundUnderscore, 1, 1, '-');
+ filename = filenamePrefix + lowerLangTag + filenamePost;
FilesystemPath xml(filename);
- if (! xml.IsFile()){
+ if (!xml.IsFile()) {
+ string shortLangTag = lowerLangTag.substr(0, foundUnderscore);
+ filename = filenamePrefix + shortLangTag + filenamePost;
+ FilesystemPath xml(filename);
+ if (!xml.IsFile()) {
+ filename = filenamePrefix + defaultLang + filenamePost;
+ }
+ }
+ } else {
+ filename = filenamePrefix + langTag + filenamePost;
+ FilesystemPath xml(filename);
+ if (!xml.IsFile()) {
filename = filenamePrefix + defaultLang + filenamePost;
}
}
- }else{
- filename = filenamePrefix + langTag + filenamePost;
+ } else {
+ string lowerLang(StringConverter::ToLower(lang));
+ filename = filenamePrefix + lowerLang + filenamePost;
FilesystemPath xml(filename);
- if (! xml.IsFile()){
- filename = filenamePrefix + defaultLang + filenamePost;
- }
- }
- }else{
- string lowerLang(StringConverter::ToLower (lang) );
- filename = filenamePrefix + lowerLang + filenamePost;
- FilesystemPath xml(filename);
- if (! xml.IsFile()){
- int foundUnderscore = lowerLang.find("_");
- if ( foundUnderscore > 0 ) {
- lowerLang.replace(foundUnderscore,1,1,'-');
- filename = filenamePrefix + lowerLang + filenamePost;
- FilesystemPath xml(filename);
- if (! xml.IsFile()){
- filename = filenamePrefix + defaultLang + filenamePost;
+ if (!xml.IsFile()) {
+ int foundUnderscore = lowerLang.find("_");
+ if (foundUnderscore > 0) {
+ lowerLang.replace(foundUnderscore, 1, 1, '-');
+ filename = filenamePrefix + lowerLang + filenamePost;
+ FilesystemPath xml(filename);
+ if (!xml.IsFile()) {
+ filename = filenamePrefix + defaultLang + filenamePost;
+ }
}
}
}
}
}
+ } else {
+ filename = filenamePrefix + preferredLang + filenamePost;
}
FilesystemPath xml(filename);
if ( xml.IsFile() ){
@@ -189,7 +201,7 @@ namespace VeraCrypt
wxImage image (stream);
image.Resize (wxSize (16, 12), wxPoint (0, 0));
-# ifdef __WXGTK__
+# if defined __WXGTK__ || defined TC_MACOSX
return wxBitmap (image.ConvertToMono (0, 0, 0), 1);
# else
return wxBitmap (image);
diff --git a/src/Main/TextUserInterface.cpp b/src/Main/TextUserInterface.cpp
index 7233b8b6..0de76c6b 100644
--- a/src/Main/TextUserInterface.cpp
+++ b/src/Main/TextUserInterface.cpp
@@ -21,7 +21,9 @@
#endif
#include <wx/platinfo.h>
+#include "Common/Token.h"
#include "Common/SecurityToken.h"
+#include "Common/EMVToken.h"
#include "Core/RandomNumberGenerator.h"
#include "Application.h"
#include "TextUserInterface.h"
@@ -175,9 +177,13 @@ namespace VeraCrypt
wxString msg = _("Enter new PIM: ");
if (!message.empty())
msg = message + L": ";
+ SetTerminalEcho (false);
+ finally_do ({ TextUserInterface::SetTerminalEcho (true); });
while (pim < 0)
{
wstring pimStr = AskString (msg);
+ ShowString (L"\n");
+
if (pimStr.empty())
pim = 0;
else
@@ -271,7 +277,7 @@ namespace VeraCrypt
shared_ptr <Pkcs5Kdf> kdf;
if (CmdLine->ArgHash)
{
- kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, false);
+ kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash);
}
shared_ptr <Volume> normalVolume;
@@ -283,6 +289,9 @@ namespace VeraCrypt
normalVolumeMountOptions.Path = volumePath;
hiddenVolumeMountOptions.Path = volumePath;
+ normalVolumeMountOptions.EMVSupportEnabled = true;
+ hiddenVolumeMountOptions.EMVSupportEnabled = true;
+
VolumeType::Enum volumeType = VolumeType::Normal;
// Open both types of volumes
@@ -306,8 +315,8 @@ namespace VeraCrypt
options->Password,
options->Pim,
kdf,
- false,
options->Keyfiles,
+ options->EMVSupportEnabled,
options->Protection,
options->ProtectionPassword,
options->ProtectionPim,
@@ -331,8 +340,8 @@ namespace VeraCrypt
options->Password,
options->Pim,
kdf,
- false,
options->Keyfiles,
+ options->EMVSupportEnabled,
options->Protection,
options->ProtectionPassword,
options->ProtectionPim,
@@ -403,14 +412,14 @@ namespace VeraCrypt
// Re-encrypt volume header
SecureBuffer newHeaderBuffer (normalVolume->GetLayout()->GetHeaderSize());
- Core->ReEncryptVolumeHeaderWithNewSalt (newHeaderBuffer, normalVolume->GetHeader(), normalVolumeMountOptions.Password, normalVolumeMountOptions.Pim, normalVolumeMountOptions.Keyfiles);
+ Core->ReEncryptVolumeHeaderWithNewSalt (newHeaderBuffer, normalVolume->GetHeader(), normalVolumeMountOptions.Password, normalVolumeMountOptions.Pim, normalVolumeMountOptions.Keyfiles, normalVolumeMountOptions.EMVSupportEnabled);
backupFile.Write (newHeaderBuffer);
if (hiddenVolume)
{
// Re-encrypt hidden volume header
- Core->ReEncryptVolumeHeaderWithNewSalt (newHeaderBuffer, hiddenVolume->GetHeader(), hiddenVolumeMountOptions.Password, hiddenVolumeMountOptions.Pim, hiddenVolumeMountOptions.Keyfiles);
+ Core->ReEncryptVolumeHeaderWithNewSalt (newHeaderBuffer, hiddenVolume->GetHeader(), hiddenVolumeMountOptions.Password, hiddenVolumeMountOptions.Pim, hiddenVolumeMountOptions.Keyfiles, hiddenVolumeMountOptions.EMVSupportEnabled);
}
else
{
@@ -426,7 +435,7 @@ namespace VeraCrypt
ShowInfo ("VOL_HEADER_BACKED_UP");
}
- void TextUserInterface::ChangePassword (shared_ptr <VolumePath> volumePath, shared_ptr <VolumePassword> password, int pim, shared_ptr <Hash> currentHash, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, shared_ptr <Hash> newHash) const
+ void TextUserInterface::ChangePassword (shared_ptr <VolumePath> volumePath, shared_ptr <VolumePassword> password, int pim, shared_ptr <Hash> currentHash, shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, shared_ptr <Hash> newHash) const
{
shared_ptr <Volume> volume;
@@ -448,7 +457,7 @@ namespace VeraCrypt
shared_ptr<Pkcs5Kdf> kdf;
if (currentHash)
{
- kdf = Pkcs5Kdf::GetAlgorithm (*currentHash, truecryptMode);
+ kdf = Pkcs5Kdf::GetAlgorithm (*currentHash);
}
while (true)
@@ -464,7 +473,7 @@ namespace VeraCrypt
}
// current PIM
- if (!truecryptMode && !Preferences.NonInteractive && (pim < 0))
+ if (!Preferences.NonInteractive && (pim < 0))
{
pim = AskPim (_("Enter current PIM"));
}
@@ -478,7 +487,7 @@ namespace VeraCrypt
try
{
keyfiles.reset (new KeyfileList);
- volume = Core->OpenVolume (volumePath, Preferences.DefaultMountOptions.PreserveTimestamps, password, pim, kdf, truecryptMode, keyfiles);
+ volume = Core->OpenVolume (volumePath, Preferences.DefaultMountOptions.PreserveTimestamps, password, pim, kdf, keyfiles, true);
}
catch (PasswordException&)
{
@@ -488,7 +497,7 @@ namespace VeraCrypt
}
if (!volume.get())
- volume = Core->OpenVolume (volumePath, Preferences.DefaultMountOptions.PreserveTimestamps, password, pim, kdf, truecryptMode, keyfiles);
+ volume = Core->OpenVolume (volumePath, Preferences.DefaultMountOptions.PreserveTimestamps, password, pim, kdf, keyfiles, true);
}
catch (PasswordException &e)
{
@@ -523,8 +532,8 @@ namespace VeraCrypt
RandomNumberGenerator::SetEnrichedByUserStatus (false);
UserEnrichRandomPool();
- Core->ChangePassword (volume, newPassword, newPim, newKeyfiles,
- newHash ? Pkcs5Kdf::GetAlgorithm (*newHash, false) : shared_ptr <Pkcs5Kdf>());
+ Core->ChangePassword (volume, newPassword, newPim, newKeyfiles, true,
+ newHash ? Pkcs5Kdf::GetAlgorithm (*newHash) : shared_ptr <Pkcs5Kdf>());
ShowInfo ("PASSWORD_CHANGED");
}
@@ -647,12 +656,24 @@ namespace VeraCrypt
else
{
uint64 AvailableDiskSpace = 0;
- wxLongLong diskSpace = 0;
- if (wxGetDiskSpace (wxFileName (wstring (options->Path)).GetPath(), nullptr, &diskSpace))
+ if (options->Path.IsDevice())
{
- AvailableDiskSpace = (uint64) diskSpace.GetValue ();
- if (maxVolumeSize > AvailableDiskSpace)
- maxVolumeSize = AvailableDiskSpace;
+ AvailableDiskSpace = maxVolumeSize;
+ }
+ else
+ {
+ wxLongLong diskSpace = 0;
+ wxString parentDir = wxFileName (wstring (options->Path)).GetPath();
+ if (parentDir.IsEmpty())
+ {
+ parentDir = wxT(".");
+ }
+ if (wxDirExists(parentDir) && wxGetDiskSpace (parentDir, nullptr, &diskSpace))
+ {
+ AvailableDiskSpace = (uint64) diskSpace.GetValue ();
+ if (maxVolumeSize > AvailableDiskSpace)
+ maxVolumeSize = AvailableDiskSpace;
+ }
}
if (options->Size == (uint64) (-1))
@@ -799,12 +820,13 @@ namespace VeraCrypt
shared_ptr <Hash> selectedHash = hashes[AskSelection (hashes.size(), 1) - 1];
RandomNumberGenerator::SetHash (selectedHash);
- options->VolumeHeaderKdf = Pkcs5Kdf::GetAlgorithm (*selectedHash, false);
+ options->VolumeHeaderKdf = Pkcs5Kdf::GetAlgorithm (*selectedHash);
}
// Filesystem
options->FilesystemClusterSize = 0;
+ uint64 filesystemSize = layout->GetMaxDataSize (options->Size);
if (options->Filesystem == VolumeCreationOptions::FilesystemType::Unknown)
{
@@ -818,33 +840,40 @@ namespace VeraCrypt
vector <VolumeCreationOptions::FilesystemType::Enum> filesystems;
- ShowInfo (L" 1) " + LangString["NONE"]); filesystems.push_back (VolumeCreationOptions::FilesystemType::None);
- ShowInfo (L" 2) FAT"); filesystems.push_back (VolumeCreationOptions::FilesystemType::FAT);
-
+ ShowInfo (wxString::Format (L" %li) %s", filesystems.size() + 1, LangString["NONE"])); filesystems.push_back (VolumeCreationOptions::FilesystemType::None);
+ ShowInfo (wxString::Format (L" %li) %s", filesystems.size() + 1, "FAT")); filesystems.push_back (VolumeCreationOptions::FilesystemType::FAT);
#if defined (TC_LINUX)
- ShowInfo (L" 3) Linux Ext2"); filesystems.push_back (VolumeCreationOptions::FilesystemType::Ext2);
- ShowInfo (L" 4) Linux Ext3"); filesystems.push_back (VolumeCreationOptions::FilesystemType::Ext3);
- ShowInfo (L" 5) Linux Ext4"); filesystems.push_back (VolumeCreationOptions::FilesystemType::Ext4);
- ShowInfo (L" 6) NTFS"); filesystems.push_back (VolumeCreationOptions::FilesystemType::NTFS);
- ShowInfo (L" 7) exFAT"); filesystems.push_back (VolumeCreationOptions::FilesystemType::exFAT);
- ShowInfo (L" 8) Btrfs"); filesystems.push_back (VolumeCreationOptions::FilesystemType::Btrfs);
+ ShowInfo (wxString::Format (L" %li) %s", filesystems.size() + 1, "Linux Ext2")); filesystems.push_back (VolumeCreationOptions::FilesystemType::Ext2);
+ ShowInfo (wxString::Format (L" %li) %s", filesystems.size() + 1, "Linux Ext3")); filesystems.push_back (VolumeCreationOptions::FilesystemType::Ext3);
+ ShowInfo (wxString::Format (L" %li) %s", filesystems.size() + 1, "Linux Ext4")); filesystems.push_back (VolumeCreationOptions::FilesystemType::Ext4);
+ ShowInfo (wxString::Format (L" %li) %s", filesystems.size() + 1, "NTFS")); filesystems.push_back (VolumeCreationOptions::FilesystemType::NTFS);
+ if (VolumeCreationOptions::FilesystemType::IsFsFormatterPresent (VolumeCreationOptions::FilesystemType::exFAT))
+ {
+ ShowInfo (wxString::Format (L" %li) %s", filesystems.size() + 1, "exFAT")); filesystems.push_back (VolumeCreationOptions::FilesystemType::exFAT);
+ }
+ if (VolumeCreationOptions::FilesystemType::IsFsFormatterPresent (VolumeCreationOptions::FilesystemType::Btrfs))
+ {
+ // minimum size to be able to format as Btrfs is 16777216 bytes
+ if (filesystemSize >= VC_MIN_SMALL_BTRFS_VOLUME_SIZE)
+ {
+ ShowInfo (wxString::Format (L" %li) %s", filesystems.size() + 1, "Btrfs")); filesystems.push_back (VolumeCreationOptions::FilesystemType::Btrfs);
+ }
+ }
#elif defined (TC_MACOSX)
- ShowInfo (L" 3) Mac OS Extended"); filesystems.push_back (VolumeCreationOptions::FilesystemType::MacOsExt);
- ShowInfo (L" 4) exFAT"); filesystems.push_back (VolumeCreationOptions::FilesystemType::exFAT);
+ ShowInfo (wxString::Format (L" %li) %s", filesystems.size() + 1, "Mac OS Extended")); filesystems.push_back (VolumeCreationOptions::FilesystemType::MacOsExt);
+ ShowInfo (wxString::Format (L" %li) %s", filesystems.size() + 1, "exFAT")); filesystems.push_back (VolumeCreationOptions::FilesystemType::exFAT);
if (wxPlatformInfo::Get().CheckOSVersion (10, 13))
{
- ShowInfo (L" 5) APFS"); filesystems.push_back (VolumeCreationOptions::FilesystemType::APFS);
+ ShowInfo (wxString::Format (L" %li) %s", filesystems.size() + 1, "APFS")); filesystems.push_back (VolumeCreationOptions::FilesystemType::APFS);
}
#elif defined (TC_FREEBSD) || defined (TC_SOLARIS)
- ShowInfo (L" 3) UFS"); filesystems.push_back (VolumeCreationOptions::FilesystemType::UFS);
+ ShowInfo (wxString::Format (L" %li) %s", filesystems.size() + 1, "UFS")); filesystems.push_back (VolumeCreationOptions::FilesystemType::UFS);
#endif
options->Filesystem = filesystems[AskSelection (filesystems.size(), 2) - 1];
}
}
- uint64 filesystemSize = layout->GetMaxDataSize (options->Size);
-
if (options->Filesystem == VolumeCreationOptions::FilesystemType::FAT
&& (filesystemSize < TC_MIN_FAT_FS_SIZE || filesystemSize > TC_MAX_FAT_SECTOR_COUNT * options->SectorSize))
{
@@ -894,6 +923,7 @@ namespace VeraCrypt
wxLongLong startTime = wxGetLocalTimeMillis();
VolumeCreator creator;
+ options->EMVSupportEnabled = true;
creator.CreateVolume (options);
bool volumeCreated = false;
@@ -935,6 +965,7 @@ namespace VeraCrypt
mountOptions.Password = options->Password;
mountOptions.Pim = options->Pim;
mountOptions.Keyfiles = options->Keyfiles;
+ mountOptions.EMVSupportEnabled = true;
shared_ptr <VolumeInfo> volume = Core->MountVolume (mountOptions);
finally_do_arg (shared_ptr <VolumeInfo>, volume, { Core->DismountVolume (finally_arg, true); });
@@ -1007,7 +1038,7 @@ namespace VeraCrypt
foreach_ref (const Keyfile &keyfile, *keyfiles)
{
- SecurityToken::DeleteKeyfile (SecurityTokenKeyfilePath (FilePath (keyfile)));
+ SecurityToken::DeleteKeyfile (TokenKeyfilePath (FilePath (keyfile)));
}
}
@@ -1023,7 +1054,7 @@ namespace VeraCrypt
void TextUserInterface::DoShowString (const wxString &str) const
{
- wcout << str.c_str();
+ wcout << str.c_str() << flush;
}
void TextUserInterface::DoShowWarning (const wxString &message) const
@@ -1031,17 +1062,17 @@ namespace VeraCrypt
wcerr << L"Warning: " << static_cast<wstring> (message) << endl;
}
- void TextUserInterface::ExportSecurityTokenKeyfile () const
+ void TextUserInterface::ExportTokenKeyfile () const
{
- wstring keyfilePath = AskString (_("Enter security token keyfile path: "));
+ wstring keyfilePath = AskString (_("Enter token keyfile path: "));
if (keyfilePath.empty())
throw UserAbort (SRC_POS);
- SecurityTokenKeyfile tokenKeyfile (keyfilePath);
+ shared_ptr<TokenKeyfile> tokenKeyfile = Token::getTokenKeyfile(keyfilePath);
vector <byte> keyfileData;
- SecurityToken::GetKeyfileData (tokenKeyfile, keyfileData);
+ tokenKeyfile->GetKeyfileData (keyfileData);
BufferPtr keyfileDataBuf (&keyfileData.front(), keyfileData.size());
finally_do_arg (BufferPtr, keyfileDataBuf, { finally_arg.Erase(); });
@@ -1081,9 +1112,9 @@ namespace VeraCrypt
return shared_ptr <GetStringFunctor> (new AdminPasswordRequestHandler (this));
}
- void TextUserInterface::ImportSecurityTokenKeyfiles () const
+ void TextUserInterface::ImportTokenKeyfiles () const
{
- list <SecurityTokenInfo> tokens = SecurityToken::GetAvailableTokens();
+ list <shared_ptr<TokenInfo>> tokens = Token::GetAvailableTokens();
if (tokens.empty())
throw_err (LangString ["NO_TOKENS_FOUND"]);
@@ -1092,19 +1123,19 @@ namespace VeraCrypt
if (tokens.size() == 1)
{
- slotId = tokens.front().SlotId;
+ slotId = tokens.front()->SlotId;
}
else
{
- foreach (const SecurityTokenInfo &token, tokens)
+ foreach (const shared_ptr<TokenInfo> &token, tokens)
{
wstringstream tokenLabel;
- tokenLabel << L"[" << token.SlotId << L"] " << LangString["TOKEN_SLOT_ID"].c_str() << L" " << token.SlotId << L" " << token.Label;
+ tokenLabel << L"[" << token->SlotId << L"] " << LangString["TOKEN_SLOT_ID"].c_str() << L" " << token->SlotId << L" " << token->Label;
ShowInfo (tokenLabel.str());
}
- slotId = (CK_SLOT_ID) AskSelection (tokens.back().SlotId, tokens.front().SlotId);
+ slotId = (CK_SLOT_ID) AskSelection (tokens.back()->SlotId, tokens.front()->SlotId);
}
shared_ptr <KeyfileList> keyfiles;
@@ -1208,14 +1239,30 @@ namespace VeraCrypt
}
}
- void TextUserInterface::ListSecurityTokenKeyfiles () const
+ void TextUserInterface::ListTokenKeyfiles () const
{
- foreach (const SecurityTokenKeyfile &keyfile, SecurityToken::GetAvailableKeyfiles())
+ foreach (const shared_ptr<TokenKeyfile> keyfile, Token::GetAvailableKeyfiles(true))
{
- ShowString (wstring (SecurityTokenKeyfilePath (keyfile)));
+ ShowString (wstring (TokenKeyfilePath (*keyfile)));
ShowString (L"\n");
}
}
+ void TextUserInterface::ListSecurityTokenKeyfiles () const
+ {
+ foreach (const TokenKeyfile &keyfile, SecurityToken::GetAvailableKeyfiles())
+ {
+ ShowString (wstring (TokenKeyfilePath (keyfile)));
+ ShowString (L"\n");
+ }
+ }
+ void TextUserInterface::ListEMVTokenKeyfiles () const
+ {
+ foreach (const TokenKeyfile &keyfile, EMVToken::GetAvailableKeyfiles())
+ {
+ ShowString (wstring (TokenKeyfilePath (keyfile)));
+ ShowString (L"\n");
+ }
+ }
VolumeInfoList TextUserInterface::MountAllDeviceHostedVolumes (MountOptions &options) const
{
@@ -1224,12 +1271,14 @@ namespace VeraCrypt
if (!options.Password)
options.Password = AskPassword();
- if (!options.TrueCryptMode && (options.Pim < 0))
+ if (options.Pim < 0)
options.Pim = AskPim (_("Enter PIM"));
if (!options.Keyfiles)
options.Keyfiles = AskKeyfiles();
+ options.EMVSupportEnabled = true;
+
VolumeInfoList mountedVolumes = UserInterface::MountAllDeviceHostedVolumes (options);
if (!mountedVolumes.empty())
@@ -1268,6 +1317,8 @@ namespace VeraCrypt
VolumePassword password;
KeyfileList keyfiles;
+ options.EMVSupportEnabled = true;
+
if ((!options.Password || options.Password->IsEmpty())
&& (!options.Keyfiles || options.Keyfiles->empty())
&& !Core->IsPasswordCacheEmpty())
@@ -1290,7 +1341,7 @@ namespace VeraCrypt
options.Password = AskPassword (StringFormatter (_("Enter password for {0}"), wstring (*options.Path)));
}
- if (!options.TrueCryptMode && (options.Pim < 0))
+ if (options.Pim < 0)
{
options.Pim = AskPim (StringFormatter (_("Enter PIM for {0}"), wstring (*options.Path)));
}
@@ -1309,7 +1360,7 @@ namespace VeraCrypt
{
if (!options.ProtectionPassword)
options.ProtectionPassword = AskPassword (_("Enter password for hidden volume"));
- if (!options.TrueCryptMode && (options.ProtectionPim < 0))
+ if (options.ProtectionPim < 0)
options.ProtectionPim = AskPim (_("Enter PIM for hidden volume"));
if (!options.ProtectionKeyfiles)
options.ProtectionKeyfiles = AskKeyfiles (_("Enter keyfile for hidden volume"));
@@ -1342,12 +1393,14 @@ namespace VeraCrypt
options.UseBackupHeaders = false;
ShowInfo (e);
options.Password.reset();
+ options.Pim = -1;
}
}
else
{
ShowInfo (e);
options.Password.reset();
+ options.Pim = -1;
}
ShowString (L"\n");
@@ -1455,7 +1508,7 @@ namespace VeraCrypt
shared_ptr <Pkcs5Kdf> kdf;
if (CmdLine->ArgHash)
{
- kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, false);
+ kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash);
}
ShowInfo (LangString["HEADER_RESTORE_EXTERNAL_INTERNAL"]);
@@ -1485,6 +1538,7 @@ namespace VeraCrypt
shared_ptr <Volume> volume;
MountOptions options;
options.Path = volumePath;
+ options.EMVSupportEnabled = true;
while (!volume)
{
@@ -1501,8 +1555,8 @@ namespace VeraCrypt
options.Password,
options.Pim,
kdf,
- false,
options.Keyfiles,
+ options.EMVSupportEnabled,
options.Protection,
options.ProtectionPassword,
options.ProtectionPim,
@@ -1530,7 +1584,7 @@ namespace VeraCrypt
// Re-encrypt volume header
SecureBuffer newHeaderBuffer (volume->GetLayout()->GetHeaderSize());
- Core->ReEncryptVolumeHeaderWithNewSalt (newHeaderBuffer, volume->GetHeader(), options.Password, options.Pim, options.Keyfiles);
+ Core->ReEncryptVolumeHeaderWithNewSalt (newHeaderBuffer, volume->GetHeader(), options.Password, options.Pim, options.Keyfiles, options.EMVSupportEnabled);
// Write volume header
int headerOffset = volume->GetLayout()->GetHeaderOffset();
@@ -1580,6 +1634,7 @@ namespace VeraCrypt
// Open the volume header stored in the backup file
MountOptions options;
+ options.EMVSupportEnabled = true;
shared_ptr <VolumeLayout> decryptedLayout;
@@ -1607,8 +1662,8 @@ namespace VeraCrypt
backupFile.ReadAt (headerBuffer, layout->GetType() == VolumeType::Hidden ? layout->GetHeaderSize() : 0);
// Decrypt header
- shared_ptr <VolumePassword> passwordKey = Keyfile::ApplyListToPassword (options.Keyfiles, options.Password);
- if (layout->GetHeader()->Decrypt (headerBuffer, *passwordKey, options.Pim, kdf, false, layout->GetSupportedKeyDerivationFunctions(false), layout->GetSupportedEncryptionAlgorithms(), layout->GetSupportedEncryptionModes()))
+ shared_ptr <VolumePassword> passwordKey = Keyfile::ApplyListToPassword (options.Keyfiles, options.Password, options.EMVSupportEnabled);
+ if (layout->GetHeader()->Decrypt (headerBuffer, *passwordKey, options.Pim, kdf, layout->GetSupportedKeyDerivationFunctions(), layout->GetSupportedEncryptionAlgorithms(), layout->GetSupportedEncryptionModes()))
{
decryptedLayout = layout;
break;
@@ -1632,7 +1687,7 @@ namespace VeraCrypt
// Re-encrypt volume header
SecureBuffer newHeaderBuffer (decryptedLayout->GetHeaderSize());
- Core->ReEncryptVolumeHeaderWithNewSalt (newHeaderBuffer, decryptedLayout->GetHeader(), options.Password, options.Pim, options.Keyfiles);
+ Core->ReEncryptVolumeHeaderWithNewSalt (newHeaderBuffer, decryptedLayout->GetHeader(), options.Password, options.Pim, options.Keyfiles, options.EMVSupportEnabled);
// Write volume header
int headerOffset = decryptedLayout->GetHeaderOffset();
@@ -1646,7 +1701,7 @@ namespace VeraCrypt
if (decryptedLayout->HasBackupHeader())
{
// Re-encrypt backup volume header
- Core->ReEncryptVolumeHeaderWithNewSalt (newHeaderBuffer, decryptedLayout->GetHeader(), options.Password, options.Pim, options.Keyfiles);
+ Core->ReEncryptVolumeHeaderWithNewSalt (newHeaderBuffer, decryptedLayout->GetHeader(), options.Password, options.Pim, options.Keyfiles, options.EMVSupportEnabled);
// Write backup volume header
headerOffset = decryptedLayout->GetBackupHeaderOffset();
diff --git a/src/Main/TextUserInterface.h b/src/Main/TextUserInterface.h
index 14eb2c0e..becb1d59 100644
--- a/src/Main/TextUserInterface.h
+++ b/src/Main/TextUserInterface.h
@@ -35,7 +35,7 @@ namespace VeraCrypt
virtual bool AskYesNo (const wxString &message, bool defaultYes = false, bool warning = false) const;
virtual void BackupVolumeHeaders (shared_ptr <VolumePath> volumePath) const;
virtual void BeginBusyState () const { }
- virtual void ChangePassword (shared_ptr <VolumePath> volumePath = shared_ptr <VolumePath>(), shared_ptr <VolumePassword> password = shared_ptr <VolumePassword>(), int pim = 0, shared_ptr <Hash> currentHash = shared_ptr <Hash>(), bool truecryptMode = false, shared_ptr <KeyfileList> keyfiles = shared_ptr <KeyfileList>(), shared_ptr <VolumePassword> newPassword = shared_ptr <VolumePassword>(), int newPim = 0, shared_ptr <KeyfileList> newKeyfiles = shared_ptr <KeyfileList>(), shared_ptr <Hash> newHash = shared_ptr <Hash>()) const;
+ virtual void ChangePassword (shared_ptr <VolumePath> volumePath = shared_ptr <VolumePath>(), shared_ptr <VolumePassword> password = shared_ptr <VolumePassword>(), int pim = 0, shared_ptr <Hash> currentHash = shared_ptr <Hash>(), shared_ptr <KeyfileList> keyfiles = shared_ptr <KeyfileList>(), shared_ptr <VolumePassword> newPassword = shared_ptr <VolumePassword>(), int newPim = 0, shared_ptr <KeyfileList> newKeyfiles = shared_ptr <KeyfileList>(), shared_ptr <Hash> newHash = shared_ptr <Hash>()) const;
virtual void CreateKeyfile (shared_ptr <FilePath> keyfilePath = shared_ptr <FilePath>()) const;
virtual void CreateVolume (shared_ptr <VolumeCreationOptions> options) const;
virtual void DeleteSecurityTokenKeyfiles () const;
@@ -44,14 +44,16 @@ namespace VeraCrypt
virtual void DoShowString (const wxString &str) const;
virtual void DoShowWarning (const wxString &message) const;
virtual void EndBusyState () const { }
- virtual void ExportSecurityTokenKeyfile () const;
+ virtual void ExportTokenKeyfile () const;
virtual shared_ptr <GetStringFunctor> GetAdminPasswordRequestHandler ();
- virtual void ImportSecurityTokenKeyfiles () const;
+ virtual void ImportTokenKeyfiles () const;
#ifndef TC_NO_GUI
virtual bool Initialize (int &argc, wxChar **argv) { return wxAppBase::Initialize(argc, argv); }
#endif
virtual void InitSecurityTokenLibrary () const;
- virtual void ListSecurityTokenKeyfiles () const;
+ virtual void ListTokenKeyfiles () const;
+ virtual void ListSecurityTokenKeyfiles () const;
+ virtual void ListEMVTokenKeyfiles () const;
virtual VolumeInfoList MountAllDeviceHostedVolumes (MountOptions &options) const;
virtual shared_ptr <VolumeInfo> MountVolume (MountOptions &options) const;
virtual bool OnInit ();
diff --git a/src/Main/Unix/Main.cpp b/src/Main/Unix/Main.cpp
index 39a2eaba..ffc71a8d 100644
--- a/src/Main/Unix/Main.cpp
+++ b/src/Main/Unix/Main.cpp
@@ -76,7 +76,7 @@ int main (int argc, char **argv)
#endif
#ifdef __WXGTK__
- if (!getenv ("DISPLAY"))
+ if (!getenv ("DISPLAY") && !getenv ("WAYLAND_DISPLAY"))
forceTextUI = true;
#endif
diff --git a/src/Main/UserInterface.cpp b/src/Main/UserInterface.cpp
index d0e2f9a1..3ec2e8dc 100644
--- a/src/Main/UserInterface.cpp
+++ b/src/Main/UserInterface.cpp
@@ -17,6 +17,7 @@
#include <wx/cmdline.h>
#include "Crypto/cpu.h"
#include "Platform/PlatformTest.h"
+#include "Common/PCSCException.h"
#ifdef TC_UNIX
#include <errno.h>
#include "Platform/Unix/Process.h"
@@ -254,7 +255,7 @@ namespace VeraCrypt
#endif
prop << LangString["MOUNT_POINT"] << L": " << wstring (volume.MountPoint) << L'\n';
prop << LangString["SIZE"] << L": " << SizeToString (volume.Size) << L'\n';
- prop << LangString["TYPE"] << L": " << VolumeTypeToString (volume.Type, volume.TrueCryptMode, volume.Protection) << L'\n';
+ prop << LangString["TYPE"] << L": " << VolumeTypeToString (volume.Type, volume.Protection) << L'\n';
prop << LangString["READ_ONLY"] << L": " << LangString [volume.Protection == VolumeProtection::ReadOnly ? "UISTR_YES" : "UISTR_NO"] << L'\n';
@@ -436,6 +437,27 @@ namespace VeraCrypt
return LangString["SECURITY_TOKEN_ERROR"] + L":\n\n" + StringConverter::ToWide (errorString);
}
+
+ // PCSC Exception
+ if (dynamic_cast <const PCSCException *> (&ex))
+ {
+ string errorString = string (dynamic_cast <const PCSCException &> (ex));
+
+ if (LangString.Exists (errorString))
+ return LangString[errorString];
+
+ if (errorString.find("SCARD_E_") == 0 || errorString.find("SCARD_F_") == 0 || errorString.find("SCARD_W_") == 0)
+ {
+ errorString = errorString.substr(8);
+ for (size_t i = 0; i < errorString.size(); ++i)
+ {
+ if (errorString[i] == '_')
+ errorString[i] = ' ';
+ }
+ }
+ return LangString["PCSC_ERROR"] + L":\n\n" + StringConverter::ToWide (errorString);
+ }
+
// Other library exceptions
return ExceptionTypeToString (typeid (ex));
}
@@ -480,7 +502,20 @@ namespace VeraCrypt
EX2MSG (TemporaryDirectoryFailure, LangString["LINUX_EX2MSG_TEMPORARYDIRECTORYFAILURE"]);
EX2MSG (UnportablePassword, LangString["UNSUPPORTED_CHARS_IN_PWD"]);
+ EX2MSG (CommandAPDUNotValid, LangString["COMMAND_APDU_INVALID"]);
+ EX2MSG (ExtendedAPDUNotSupported, LangString["EXTENDED_APDU_UNSUPPORTED"]);
+ EX2MSG (ScardLibraryInitializationFailed, LangString["SCARD_MODULE_INIT_FAILED"]);
+ EX2MSG (EMVUnknownCardType, LangString["EMV_UNKNOWN_CARD_TYPE"]);
+ EX2MSG (EMVSelectAIDFailed, LangString["EMV_SELECT_AID_FAILED"]);
+ EX2MSG (EMVIccCertNotFound, LangString["EMV_ICC_CERT_NOTFOUND"]);
+ EX2MSG (EMVIssuerCertNotFound, LangString["EMV_ISSUER_CERT_NOTFOUND"]);
+ EX2MSG (EMVCPLCNotFound, LangString["EMV_CPLC_NOTFOUND"]);
+ EX2MSG (InvalidEMVPath, LangString["INVALID_EMV_PATH"]);
+ EX2MSG (EMVKeyfileDataNotFound, LangString["EMV_KEYFILE_DATA_NOTFOUND"]);
+ EX2MSG (EMVPANNotFound, LangString["EMV_PAN_NOTFOUND"]);
+
#if defined (TC_LINUX)
+ EX2MSG (TerminalNotFound, LangString["LINUX_EX2MSG_TERMINALNOTFOUND"]);
EX2MSG (UnsupportedSectorSize, LangString["SECTOR_SIZE_UNSUPPORTED"]);
EX2MSG (UnsupportedSectorSizeHiddenVolumeProtection, LangString["LINUX_EX2MSG_UNSUPPORTEDSECTORSIZEHIDDENVOLUMEPROTECTION"]);
EX2MSG (UnsupportedSectorSizeNoKernelCrypto, LangString["LINUX_EX2MSG_UNSUPPORTEDSECTORSIZENOKERNELCRYPTO"]);
@@ -492,8 +527,6 @@ namespace VeraCrypt
EX2MSG (VolumeEncryptionNotCompleted, LangString["ERR_ENCRYPTION_NOT_COMPLETED"]);
EX2MSG (VolumeHostInUse, LangString["LINUX_EX2MSG_VOLUMEHOSTINUSE"]);
EX2MSG (VolumeSlotUnavailable, LangString["LINUX_EX2MSG_VOLUMESLOTUNAVAILABLE"]);
- EX2MSG (UnsupportedAlgoInTrueCryptMode, LangString["ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE"]);
- EX2MSG (UnsupportedTrueCryptFormat, LangString["UNSUPPORTED_TRUECRYPT_FORMAT"]);
#ifdef TC_MACOSX
EX2MSG (HigherFuseVersionRequired, LangString["LINUX_EX2MSG_HIGHERFUSEVERSIONREQUIRED"]);
@@ -932,10 +965,9 @@ namespace VeraCrypt
cmdLine.ArgMountOptions.Pim = cmdLine.ArgPim;
cmdLine.ArgMountOptions.Keyfiles = cmdLine.ArgKeyfiles;
cmdLine.ArgMountOptions.SharedAccessAllowed = cmdLine.ArgForce;
- cmdLine.ArgMountOptions.TrueCryptMode = cmdLine.ArgTrueCryptMode;
if (cmdLine.ArgHash)
{
- cmdLine.ArgMountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*cmdLine.ArgHash, cmdLine.ArgTrueCryptMode);
+ cmdLine.ArgMountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*cmdLine.ArgHash);
}
@@ -1008,7 +1040,7 @@ namespace VeraCrypt
{
if (!message.IsEmpty())
message += L'\n';
- message += StringFormatter (LangString["LINUX_VOL_DISMOUNTED"], wstring (volume.Path));
+ message += StringFormatter (LangString["LINUX_VOL_MOUNTED"], wstring (volume.Path));
}
ShowInfo (message);
}
@@ -1020,7 +1052,7 @@ namespace VeraCrypt
return true;
case CommandId::ChangePassword:
- ChangePassword (cmdLine.ArgVolumePath, cmdLine.ArgPassword, cmdLine.ArgPim, cmdLine.ArgHash, cmdLine.ArgTrueCryptMode, cmdLine.ArgKeyfiles, cmdLine.ArgNewPassword, cmdLine.ArgNewPim, cmdLine.ArgNewKeyfiles, cmdLine.ArgNewHash);
+ ChangePassword (cmdLine.ArgVolumePath, cmdLine.ArgPassword, cmdLine.ArgPim, cmdLine.ArgHash, cmdLine.ArgKeyfiles, cmdLine.ArgNewPassword, cmdLine.ArgNewPim, cmdLine.ArgNewKeyfiles, cmdLine.ArgNewHash);
return true;
case CommandId::CreateKeyfile:
@@ -1033,7 +1065,7 @@ namespace VeraCrypt
if (cmdLine.ArgHash)
{
- options->VolumeHeaderKdf = Pkcs5Kdf::GetAlgorithm (*cmdLine.ArgHash, false);
+ options->VolumeHeaderKdf = Pkcs5Kdf::GetAlgorithm (*cmdLine.ArgHash);
RandomNumberGenerator::SetHash (cmdLine.ArgHash);
}
@@ -1121,7 +1153,7 @@ namespace VeraCrypt
" Delete keyfiles from security tokens. See also command --list-token-keyfiles.\n"
"\n"
"--export-token-keyfile\n"
- " Export a keyfile from a security token. See also command --list-token-keyfiles.\n"
+ " Export a keyfile from a token. See also command --list-token-keyfiles.\n"
"\n"
"--import-token-keyfiles\n"
" Import keyfiles to a security token. See also option --token-lib.\n"
@@ -1133,9 +1165,15 @@ namespace VeraCrypt
" output option (-v). See below for description of MOUNTED_VOLUME.\n"
"\n"
"--list-token-keyfiles\n"
- " Display a list of all available security token keyfiles. See also command\n"
+ " Display a list of all available token keyfiles. See also command\n"
" --import-token-keyfiles.\n"
- "\n"
+ "\n""--list-securitytoken-keyfiles\n"
+ " Display a list of all available security token keyfiles. See also command\n"
+ " --import-token-keyfiles.\n"
+ "\n"
+ "\n""--list-emvtoken-keyfiles\n"
+ " Display a list of all available emv token keyfiles. See also command\n"
+ "\n"
"--mount[=VOLUME_PATH]\n"
" Mount a volume. Volume path and other options are requested from the user\n"
" if not specified on command line.\n"
@@ -1170,7 +1208,8 @@ namespace VeraCrypt
" Display password characters while typing.\n"
"\n"
"--encryption=ENCRYPTION_ALGORITHM\n"
- " Use specified encryption algorithm when creating a new volume.\n"
+ " Use specified encryption algorithm when creating a new volume. When cascading\n"
+ " algorithms, they must be separated by a dash. For example: AES-Twofish.\n"
"\n"
"--filesystem=TYPE\n"
" Filesystem type to mount. The TYPE argument is passed to mount(8) command\n"
@@ -1198,9 +1237,12 @@ namespace VeraCrypt
" used (non-recursively). Multiple keyfiles must be separated by comma.\n"
" Use double comma (,,) to specify a comma contained in keyfile's name.\n"
" Keyfile stored on a security token must be specified as\n"
- " token://slot/SLOT_NUMBER/file/FILENAME. An empty keyfile (-k \"\") disables\n"
+ " token://slot/SLOT_NUMBER/file/FILENAME for a security token keyfile\n"
+ " and emv://slot/SLOT_NUMBER for an EMV token keyfile.\n"
+ " An empty keyfile (-k \"\") disables\n"
" interactive requests for keyfiles. See also options --import-token-keyfiles,\n"
- " --list-token-keyfiles, --new-keyfiles, --protection-keyfiles.\n"
+ " --list-token-keyfiles, --list-securitytoken-keyfiles, --list-emvtoken-keyfiles,\n"
+ " --new-keyfiles, --protection-keyfiles.\n"
"\n"
"--load-preferences\n"
" Load user preferences.\n"
@@ -1280,11 +1322,6 @@ namespace VeraCrypt
" Use text user interface. Graphical user interface is used by default if\n"
" available. This option must be specified as the first argument.\n"
"\n"
- "-tc, --truecrypt\n"
- " Enable TrueCrypt compatibility mode to enable mounting volumes created\n"
- " by TrueCrypt 6.x or 7.x. This option must be specified as the first\n"
- " argument, or immediately after --text.\n"
- "\n"
"--token-lib=LIB_PATH\n"
" Use specified PKCS #11 security token library.\n"
"\n"
@@ -1355,18 +1392,26 @@ namespace VeraCrypt
}
return true;
- case CommandId::ExportSecurityTokenKeyfile:
- ExportSecurityTokenKeyfile();
+ case CommandId::ExportTokenKeyfile:
+ ExportTokenKeyfile();
return true;
- case CommandId::ImportSecurityTokenKeyfiles:
- ImportSecurityTokenKeyfiles();
+ case CommandId::ImportTokenKeyfiles:
+ ImportTokenKeyfiles();
return true;
- case CommandId::ListSecurityTokenKeyfiles:
- ListSecurityTokenKeyfiles();
+ case CommandId::ListTokenKeyfiles:
+ ListTokenKeyfiles();
return true;
+ case CommandId::ListSecurityTokenKeyfiles:
+ ListSecurityTokenKeyfiles();
+ return true;
+
+ case CommandId::ListEMVTokenKeyfiles:
+ ListEMVTokenKeyfiles();
+ return true;
+
case CommandId::ListVolumes:
if (Preferences.Verbose)
DisplayVolumeProperties (cmdLine.ArgVolumes);
@@ -1548,7 +1593,7 @@ namespace VeraCrypt
return dateStr;
}
- wxString UserInterface::VolumeTypeToString (VolumeType::Enum type, bool truecryptMode, VolumeProtection::Enum protection) const
+ wxString UserInterface::VolumeTypeToString (VolumeType::Enum type, VolumeProtection::Enum protection) const
{
wxString sResult;
switch (type)
@@ -1566,8 +1611,6 @@ namespace VeraCrypt
break;
}
- if (truecryptMode)
- sResult = wxT("TrueCrypt-") + sResult;
return sResult;
}
@@ -1620,6 +1663,7 @@ namespace VeraCrypt
VC_CONVERT_EXCEPTION (ParameterTooLarge);
VC_CONVERT_EXCEPTION (PartitionDeviceRequired);
VC_CONVERT_EXCEPTION (StringConversionFailed);
+ VC_CONVERT_EXCEPTION (TerminalNotFound);
VC_CONVERT_EXCEPTION (TestFailed);
VC_CONVERT_EXCEPTION (TimeOut);
VC_CONVERT_EXCEPTION (UnknownException);
@@ -1640,12 +1684,24 @@ namespace VeraCrypt
VC_CONVERT_EXCEPTION (SecurityTokenLibraryNotInitialized);
VC_CONVERT_EXCEPTION (SecurityTokenKeyfileAlreadyExists);
VC_CONVERT_EXCEPTION (SecurityTokenKeyfileNotFound);
- VC_CONVERT_EXCEPTION (UnsupportedAlgoInTrueCryptMode);
- VC_CONVERT_EXCEPTION (UnsupportedTrueCryptFormat);
VC_CONVERT_EXCEPTION (SystemException);
VC_CONVERT_EXCEPTION (CipherException);
VC_CONVERT_EXCEPTION (VolumeException);
VC_CONVERT_EXCEPTION (PasswordException);
+
+ VC_CONVERT_EXCEPTION (PCSCException);
+ VC_CONVERT_EXCEPTION (CommandAPDUNotValid);
+ VC_CONVERT_EXCEPTION (ExtendedAPDUNotSupported);
+ VC_CONVERT_EXCEPTION (ScardLibraryInitializationFailed);
+ VC_CONVERT_EXCEPTION (EMVUnknownCardType);
+ VC_CONVERT_EXCEPTION (EMVSelectAIDFailed);
+ VC_CONVERT_EXCEPTION (EMVIccCertNotFound);
+ VC_CONVERT_EXCEPTION (EMVIssuerCertNotFound);
+ VC_CONVERT_EXCEPTION (EMVCPLCNotFound);
+ VC_CONVERT_EXCEPTION (InvalidEMVPath);
+ VC_CONVERT_EXCEPTION (EMVKeyfileDataNotFound);
+ VC_CONVERT_EXCEPTION (EMVPANNotFound);
+
throw *ex;
}
}
diff --git a/src/Main/UserInterface.h b/src/Main/UserInterface.h
index 8c8cca7b..41415e9d 100644
--- a/src/Main/UserInterface.h
+++ b/src/Main/UserInterface.h
@@ -33,7 +33,7 @@ namespace VeraCrypt
virtual bool AskYesNo (const wxString &message, bool defaultYes = false, bool warning = false) const = 0;
virtual void BackupVolumeHeaders (shared_ptr <VolumePath> volumePath) const = 0;
virtual void BeginBusyState () const = 0;
- virtual void ChangePassword (shared_ptr <VolumePath> volumePath = shared_ptr <VolumePath>(), shared_ptr <VolumePassword> password = shared_ptr <VolumePassword>(), int pim = 0, shared_ptr <Hash> currentHash = shared_ptr <Hash>(), bool truecryptMode = false, shared_ptr <KeyfileList> keyfiles = shared_ptr <KeyfileList>(), shared_ptr <VolumePassword> newPassword = shared_ptr <VolumePassword>(), int newPim = 0, shared_ptr <KeyfileList> newKeyfiles = shared_ptr <KeyfileList>(), shared_ptr <Hash> newHash = shared_ptr <Hash>()) const = 0;
+ virtual void ChangePassword (shared_ptr <VolumePath> volumePath = shared_ptr <VolumePath>(), shared_ptr <VolumePassword> password = shared_ptr <VolumePassword>(), int pim = 0, shared_ptr <Hash> currentHash = shared_ptr <Hash>(), shared_ptr <KeyfileList> keyfiles = shared_ptr <KeyfileList>(), shared_ptr <VolumePassword> newPassword = shared_ptr <VolumePassword>(), int newPim = 0, shared_ptr <KeyfileList> newKeyfiles = shared_ptr <KeyfileList>(), shared_ptr <Hash> newHash = shared_ptr <Hash>()) const = 0;
virtual void CheckRequirementsForMountingVolume () const;
virtual void CloseExplorerWindows (shared_ptr <VolumeInfo> mountedVolume) const;
virtual void CreateKeyfile (shared_ptr <FilePath> keyfilePath = shared_ptr <FilePath>()) const = 0;
@@ -49,14 +49,16 @@ namespace VeraCrypt
virtual void DoShowWarning (const wxString &message) const = 0;
virtual void EndBusyState () const = 0;
static wxString ExceptionToMessage (const exception &ex);
- virtual void ExportSecurityTokenKeyfile () const = 0;
+ virtual void ExportTokenKeyfile () const = 0;
virtual shared_ptr <GetStringFunctor> GetAdminPasswordRequestHandler () = 0;
virtual const UserPreferences &GetPreferences () const { return Preferences; }
- virtual void ImportSecurityTokenKeyfiles () const = 0;
+ virtual void ImportTokenKeyfiles () const = 0;
virtual void Init ();
virtual void InitSecurityTokenLibrary () const = 0;
virtual void ListMountedVolumes (const VolumeInfoList &volumes) const;
+ virtual void ListTokenKeyfiles () const = 0;
virtual void ListSecurityTokenKeyfiles () const = 0;
+ virtual void ListEMVTokenKeyfiles () const = 0;
virtual shared_ptr <VolumeInfo> MountVolume (MountOptions &options) const;
virtual shared_ptr <VolumeInfo> MountVolumeThread (MountOptions &options) const { return Core->MountVolume (options);}
virtual VolumeInfoList MountAllDeviceHostedVolumes (MountOptions &options) const;
@@ -83,7 +85,7 @@ namespace VeraCrypt
virtual WaitThreadUI* GetWaitThreadUI(WaitThreadRoutine *pRoutine) const { return new WaitThreadUI(pRoutine);}
virtual wxDateTime VolumeTimeToDateTime (VolumeTime volumeTime) const { return wxDateTime ((time_t) (volumeTime / 1000ULL / 1000 / 10 - 134774ULL * 24 * 3600)); }
virtual wxString VolumeTimeToString (VolumeTime volumeTime) const;
- virtual wxString VolumeTypeToString (VolumeType::Enum type, bool truecryptMode, VolumeProtection::Enum protection) const;
+ virtual wxString VolumeTypeToString (VolumeType::Enum type, VolumeProtection::Enum protection) const;
Event PreferencesUpdatedEvent;
diff --git a/src/Main/UserPreferences.cpp b/src/Main/UserPreferences.cpp
index db54b4a4..194cb6df 100644
--- a/src/Main/UserPreferences.cpp
+++ b/src/Main/UserPreferences.cpp
@@ -58,6 +58,9 @@ namespace VeraCrypt
void UserPreferences::Load()
{
+ // first we clear the unknown config map entries
+ UnknownConfigMapEntries.clear();
+
// Preferences
FilePath cfgPath = Application::GetConfigFilePath (GetPreferencesFileName());
if (cfgPath.IsFile())
@@ -68,17 +71,18 @@ namespace VeraCrypt
configMap[node.Attributes[L"key"]] = node.InnerText;
}
-#define TC_CONFIG_SET(NAME) SetValue (configMap[L###NAME], NAME)
+#define TC_CONFIG_SET(NAME) if (configMap.count(L###NAME) > 0) { SetValue (configMap[L###NAME], NAME); configMap.erase (L###NAME); }
TC_CONFIG_SET (BackgroundTaskEnabled);
TC_CONFIG_SET (BackgroundTaskMenuDismountItemsEnabled);
TC_CONFIG_SET (BackgroundTaskMenuMountItemsEnabled);
TC_CONFIG_SET (BackgroundTaskMenuOpenItemsEnabled);
TC_CONFIG_SET (BeepAfterHotkeyMountDismount);
- SetValue (configMap[L"CachePasswords"], DefaultMountOptions.CachePassword);
+ if (configMap.count(L"CachePasswords") > 0) { SetValue (configMap[L"CachePasswords"], DefaultMountOptions.CachePassword); configMap.erase (L"CachePasswords"); }
TC_CONFIG_SET (CloseBackgroundTaskOnNoVolumes);
TC_CONFIG_SET (CloseExplorerWindowsOnDismount);
TC_CONFIG_SET (CloseSecurityTokenSessionsAfterMount);
+ TC_CONFIG_SET (EMVSupportEnabled);
TC_CONFIG_SET (DisableKernelEncryptionModeWarning);
TC_CONFIG_SET (DismountOnInactivity);
TC_CONFIG_SET (DismountOnLogOff);
@@ -86,39 +90,40 @@ namespace VeraCrypt
TC_CONFIG_SET (DismountOnScreenSaver);
TC_CONFIG_SET (DisplayMessageAfterHotkeyDismount);
TC_CONFIG_SET (BackgroundTaskEnabled);
- SetValue (configMap[L"FilesystemOptions"], DefaultMountOptions.FilesystemOptions);
+ if (configMap.count(L"FilesystemOptions") > 0) { SetValue (configMap[L"FilesystemOptions"], DefaultMountOptions.FilesystemOptions); configMap.erase (L"FilesystemOptions"); }
TC_CONFIG_SET (ForceAutoDismount);
+ TC_CONFIG_SET (Language);
TC_CONFIG_SET (LastSelectedSlotNumber);
TC_CONFIG_SET (MaxVolumeIdleTime);
TC_CONFIG_SET (MountDevicesOnLogon);
TC_CONFIG_SET (MountFavoritesOnLogon);
bool readOnly = false;
- SetValue (configMap[L"MountVolumesReadOnly"], readOnly);
+ if (configMap.count(L"MountVolumesReadOnly") > 0) { SetValue (configMap[L"MountVolumesReadOnly"], readOnly); configMap.erase (L"MountVolumesReadOnly"); }
DefaultMountOptions.Protection = readOnly ? VolumeProtection::ReadOnly : VolumeProtection::None;
- SetValue (configMap[L"MountVolumesRemovable"], DefaultMountOptions.Removable);
- SetValue (configMap[L"NoHardwareCrypto"], DefaultMountOptions.NoHardwareCrypto);
- SetValue (configMap[L"NoKernelCrypto"], DefaultMountOptions.NoKernelCrypto);
+ if (configMap.count(L"MountVolumesRemovable") > 0) { SetValue (configMap[L"MountVolumesRemovable"], DefaultMountOptions.Removable); configMap.erase (L"MountVolumesRemovable"); }
+ if (configMap.count(L"NoHardwareCrypto") > 0) { SetValue (configMap[L"NoHardwareCrypto"], DefaultMountOptions.NoHardwareCrypto); configMap.erase (L"NoHardwareCrypto"); }
+ if (configMap.count(L"NoKernelCrypto") > 0) { SetValue (configMap[L"NoKernelCrypto"], DefaultMountOptions.NoKernelCrypto); configMap.erase (L"NoKernelCrypto"); }
TC_CONFIG_SET (OpenExplorerWindowAfterMount);
- SetValue (configMap[L"PreserveTimestamps"], DefaultMountOptions.PreserveTimestamps);
+ if (configMap.count(L"PreserveTimestamps") > 0) { SetValue (configMap[L"PreserveTimestamps"], DefaultMountOptions.PreserveTimestamps); configMap.erase (L"PreserveTimestamps"); }
TC_CONFIG_SET (SaveHistory);
- SetValue (configMap[L"SecurityTokenLibrary"], SecurityTokenModule);
+ if (configMap.count(L"SecurityTokenLibrary") > 0) { SetValue (configMap[L"SecurityTokenLibrary"], SecurityTokenModule); configMap.erase (L"SecurityTokenLibrary"); }
TC_CONFIG_SET (StartOnLogon);
TC_CONFIG_SET (UseKeyfiles);
TC_CONFIG_SET (WipeCacheOnAutoDismount);
TC_CONFIG_SET (WipeCacheOnClose);
- SetValue (configMap[L"DefaultTrueCryptMode"], DefaultMountOptions.TrueCryptMode);
-
wstring defaultPrf;
- SetValue (configMap[L"DefaultPRF"], defaultPrf);
+ if (configMap.count(L"DefaultPRF") > 0) { SetValue (configMap[L"DefaultPRF"], defaultPrf); configMap.erase (L"DefaultPRF"); }
+ if (defaultPrf.empty())
+ defaultPrf = L"autodetection";
shared_ptr <Pkcs5Kdf> savedKdf;
try
{
if (defaultPrf != L"autodetection")
- savedKdf = Pkcs5Kdf::GetAlgorithm (defaultPrf, DefaultMountOptions.TrueCryptMode);
+ savedKdf = Pkcs5Kdf::GetAlgorithm (defaultPrf);
}
catch (ParameterIncorrect&)
{
@@ -126,6 +131,9 @@ namespace VeraCrypt
DefaultMountOptions.Kdf = savedKdf;
DefaultMountOptions.ProtectionKdf = savedKdf;
+
+ // at this point, the configMap should be empty, if not, we have unknown config entries that we need to store
+ UnknownConfigMapEntries = configMap;
}
// Default keyfiles
@@ -197,6 +205,7 @@ namespace VeraCrypt
TC_CONFIG_ADD (CloseBackgroundTaskOnNoVolumes);
TC_CONFIG_ADD (CloseExplorerWindowsOnDismount);
TC_CONFIG_ADD (CloseSecurityTokenSessionsAfterMount);
+ TC_CONFIG_ADD (EMVSupportEnabled);
TC_CONFIG_ADD (DisableKernelEncryptionModeWarning);
TC_CONFIG_ADD (DismountOnInactivity);
TC_CONFIG_ADD (DismountOnLogOff);
@@ -206,6 +215,7 @@ namespace VeraCrypt
TC_CONFIG_ADD (BackgroundTaskEnabled);
formatter.AddEntry (L"FilesystemOptions", DefaultMountOptions.FilesystemOptions);
TC_CONFIG_ADD (ForceAutoDismount);
+ TC_CONFIG_ADD (Language);
TC_CONFIG_ADD (LastSelectedSlotNumber);
TC_CONFIG_ADD (MaxVolumeIdleTime);
TC_CONFIG_ADD (MountDevicesOnLogon);
@@ -223,13 +233,17 @@ namespace VeraCrypt
TC_CONFIG_ADD (WipeCacheOnAutoDismount);
TC_CONFIG_ADD (WipeCacheOnClose);
- formatter.AddEntry (L"DefaultTrueCryptMode", DefaultMountOptions.TrueCryptMode);
-
wstring defaultPrf = L"autodetection";
if (DefaultMountOptions.Kdf)
defaultPrf = DefaultMountOptions.Kdf->GetName ();
formatter.AddEntry (L"DefaultPRF", defaultPrf);
+ // add unknown config entries by iterating over all elements of the UnknownConfigMapEntries map
+ for (map<wxString, wxString>::const_iterator it = UnknownConfigMapEntries.begin(); it != UnknownConfigMapEntries.end(); ++it)
+ {
+ formatter.AddEntry(it->first.c_str(), it->second);
+ }
+
XmlWriter writer (Application::GetConfigFilePath (GetPreferencesFileName(), true));
writer.WriteNode (formatter.XmlConfig);
writer.Close();
diff --git a/src/Main/UserPreferences.h b/src/Main/UserPreferences.h
index 96faf8a2..25621656 100644
--- a/src/Main/UserPreferences.h
+++ b/src/Main/UserPreferences.h
@@ -31,6 +31,7 @@ namespace VeraCrypt
CloseBackgroundTaskOnNoVolumes (true),
CloseExplorerWindowsOnDismount (true),
CloseSecurityTokenSessionsAfterMount (false),
+ EMVSupportEnabled (false),
DisableKernelEncryptionModeWarning (false),
DismountOnInactivity (false),
DismountOnLogOff (true),
@@ -38,6 +39,7 @@ namespace VeraCrypt
DismountOnScreenSaver (false),
DisplayMessageAfterHotkeyDismount (false),
ForceAutoDismount (true),
+ Language (L"system"),
LastSelectedSlotNumber (0),
MaxVolumeIdleTime (60),
MountDevicesOnLogon (false),
@@ -72,6 +74,7 @@ namespace VeraCrypt
bool CloseBackgroundTaskOnNoVolumes;
bool CloseExplorerWindowsOnDismount;
bool CloseSecurityTokenSessionsAfterMount;
+ bool EMVSupportEnabled;
bool DisableKernelEncryptionModeWarning;
bool DismountOnInactivity;
bool DismountOnLogOff;
@@ -79,6 +82,7 @@ namespace VeraCrypt
bool DismountOnScreenSaver;
bool DisplayMessageAfterHotkeyDismount;
bool ForceAutoDismount;
+ wstring Language;
uint64 LastSelectedSlotNumber;
int32 MaxVolumeIdleTime;
bool MountDevicesOnLogon;
@@ -94,6 +98,10 @@ namespace VeraCrypt
bool WipeCacheOnAutoDismount;
bool WipeCacheOnClose;
+ // A map used to store unknown entries from the configuration file in order to preserve them when saving the configuration.
+ // This helps to preserve unknown entries that may be used by future versions of VeraCrypt or entries used by old versions that were removed from current version.
+ map <wxString, wxString> UnknownConfigMapEntries;
+
protected:
wxString GetDefaultKeyfilesFileName () const { return L"Default Keyfiles.xml"; }
#ifdef TC_PROTOTYPE
diff --git a/src/Makefile b/src/Makefile
index c1ea2bae..a2c6f834 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -24,6 +24,7 @@
# SSE41: Enable SSE4.1 support in compiler
# NOSSE2: Disable SEE2 support in compiler
# WITHGTK3: Build wxWidgets against GTK3
+# WOLFCRYPT: Build with wolfCrypt as crypto provider (see Crypto/wolfCrypt.md)
#------ Targets ------
# all
@@ -49,6 +50,7 @@ C_CXX_FLAGS := -MMD -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES -I
export ASFLAGS := -D __GNUC__ -D __YASM__
export LFLAGS :=
+export PKG_CONFIG ?= pkg-config
export PKG_CONFIG_PATH ?= /usr/local/lib/pkgconfig
export WX_CONFIG ?= wx-config
@@ -101,8 +103,8 @@ ifeq "$(origin INDICATOR)" "command line"
else
INDICATOR_LIBRARY=ayatana-appindicator-0.1
endif
- export LIBS += $(shell pkg-config --libs $(INDICATOR_LIBRARY))
- C_CXX_FLAGS += $(shell pkg-config --cflags $(INDICATOR_LIBRARY)) -DHAVE_INDICATORS
+ export AYATANA_LIBS += $(shell $(PKG_CONFIG) --libs $(INDICATOR_LIBRARY))
+ C_CXX_FLAGS += $(shell $(PKG_CONFIG) --cflags $(INDICATOR_LIBRARY)) -DHAVE_INDICATORS
endif
#------ Release configuration ------
@@ -144,6 +146,7 @@ export PLATFORM_UNSUPPORTED := 0
export CPU_ARCH ?= unknown
export SIMD_SUPPORTED := 0
export DISABLE_AESNI ?= 0
+export ENABLE_WOLFCRYPT ?= 0
export GCC_GTEQ_440 := 0
export GCC_GTEQ_430 := 0
@@ -184,20 +187,38 @@ ifeq "$(origin NOAESNI)" "command line"
DISABLE_AESNI := 1
endif
+ifeq "$(origin WOLFCRYPT)" "command line"
+ ENABLE_WOLFCRYPT := 1
+ C_CXX_FLAGS += -DWOLFCRYPT_BACKEND
+ export LIBS += -lwolfssl
+ export LD_LIBRARY_PATH=/usr/local/lib
+endif
+
#------ Linux configuration ------
ifeq "$(shell uname -s)" "Linux"
PLATFORM := Linux
C_CXX_FLAGS += -DTC_UNIX -DTC_LINUX
-
- # GNU GCC version 11 and higher compile with -std=gnu++17 by default
- # which breaks "byte" definitions in Crypto++ library. So set
- # -std=gnu++14 instead.
- GCC11PLUS := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 11)
- ifeq "$(GCC11PLUS)" "1"
- CXXFLAGS += -std=gnu++14
- endif
+
+ # PCSC
+ C_CXX_FLAGS += $(shell pkg-config --cflags libpcsclite)
+
+ # Extract the major and minor version numbers of GCC in a combined format for easy comparison
+ GCC_VERSION := $(shell $(CC) -dumpversion | awk -F. '{printf "%d%02d", $$1, $$2}')
+
+ # Set the C++ standard based on the version numbers
+ ifeq ($(shell expr $(GCC_VERSION) \< 408), 1)
+ # GCC version below 4.8 support minimal C++11 features through the switch -std=c++0x
+ CXXFLAGS += -std=c++0x
+ else ifeq ($(GCC_VERSION), 408)
+ # GCC version 4.8 supports C++11 features through the switch -std=c++11
+ CXXFLAGS += -std=c++11
+ else ifeq ($(shell expr $(GCC_VERSION) \>= 1100), 1)
+ # GNU GCC version 11 and higher compile with -std=gnu++17 by default
+ # which breaks "byte" definitions in Crypto++ library. So set -std=gnu++14 instead.
+ CXXFLAGS += -std=gnu++14
+ endif
ifeq "$(SIMD_SUPPORTED)" "1"
@@ -261,6 +282,8 @@ ifeq "$(shell uname -s)" "Linux"
ifeq "$(origin WITHGTK3)" "command line"
WX_CONFIGURE_FLAGS += --with-gtk=3
+ else
+ WX_CONFIGURE_FLAGS += --with-gtk=2
endif
endif
@@ -289,6 +312,8 @@ ifeq "$(shell uname -s)" "Darwin"
CC := gcc
CXX := g++
+ GCC_GTEQ_430 := 1
+
C_CXX_FLAGS += -DTC_UNIX -DTC_BSD -DTC_MACOSX -mmacosx-version-min=$(VC_OSX_TARGET) -isysroot $(VC_OSX_SDK_PATH)
LFLAGS += -mmacosx-version-min=$(VC_OSX_TARGET) -Wl,-syslibroot $(VC_OSX_SDK_PATH)
WX_CONFIGURE_FLAGS += --with-macosx-version-min=$(VC_OSX_TARGET) --with-macosx-sdk=$(VC_OSX_SDK_PATH)
@@ -361,9 +386,14 @@ ifeq "$(shell uname -s)" "FreeBSD"
PLATFORM := FreeBSD
PLATFORM_UNSUPPORTED := 1
C_CXX_FLAGS += -DTC_UNIX -DTC_BSD -DTC_FREEBSD
+
+ # PCSC
+ C_CXX_FLAGS += $(shell pkg-config --cflags libpcsclite)
CC := cc
CXX := c++
+
+ GCC_GTEQ_430 := 1
ifeq "$(TC_BUILD_CONFIG)" "Release"
C_CXX_FLAGS += -fdata-sections -ffunction-sections -fpie
@@ -418,9 +448,14 @@ ifeq "$(shell uname -s)" "OpenBSD"
PLATFORM_UNSUPPORTED := 1
C_CXX_FLAGS += -DTC_UNIX -DTC_BSD -DTC_OPENBSD
+ # PCSC
+ C_CXX_FLAGS += $(shell pkg-config --cflags libpcsclite)
+
CC := cc
CXX := c++
+ GCC_GTEQ_430 := 1
+
ifeq "$(TC_BUILD_CONFIG)" "Release"
C_CXX_FLAGS += -fdata-sections -ffunction-sections -fpie
LFLAGS += -Wl,--gc-sections -pie
@@ -440,6 +475,9 @@ ifeq "$(shell uname -s)" "SunOS"
C_CXX_FLAGS += -DTC_UNIX -DTC_SOLARIS
WX_CONFIGURE_FLAGS += --with-gtk
+ # PCSC
+ C_CXX_FLAGS += $(shell pkg-config --cflags libpcsclite)
+
endif
@@ -452,8 +490,8 @@ LFLAGS := $(LFLAGS) $(TC_EXTRA_LFLAGS)
WX_CONFIGURE_FLAGS += --enable-unicode -disable-shared --disable-dependency-tracking --enable-exceptions --enable-std_string --enable-dataobj --enable-mimetype
ifdef VC_WX_MINIMAL
-WX_CONFIGURE_FLAGS += --disable-protocol --disable-protocols --disable-url --disable-ipc --disable-sockets --disable-fs_inet --disable-ole --disable-docview --disable-clipboard \
- --disable-help --disable-html --disable-mshtmlhelp --disable-htmlhelp --disable-mdi --disable-metafile --disable-webkit --disable-webview \
+WX_CONFIGURE_FLAGS += --disable-protocol --disable-protocols --disable-url --disable-ipc --disable-sockets --without-libcurl --disable-fs_inet --disable-ole --disable-docview --disable-clipboard \
+ --disable-help --disable-html --disable-mshtmlhelp --disable-htmlhelp --disable-mdi --disable-metafile --disable-addremovectrl --disable-webview \
--disable-xrc --disable-aui --disable-postscript --disable-printarch \
--disable-arcstream --disable-fs_archive --disable-fs_zip --disable-tarstream --disable-zipstream \
--disable-animatectrl --disable-bmpcombobox --disable-calendar --disable-caret --disable-checklst --disable-collpane --disable-colourpicker --disable-comboctrl \
@@ -469,7 +507,7 @@ WX_CONFIGURE_FLAGS += --disable-protocol --disable-protocols --disable-url --dis
--disable-gif --disable-pcx --disable-tga --disable-iff --disable-gif --disable-pnm --disable-svg \
--without-expat --without-libtiff --without-libjpeg --without-libpng -without-regex --without-zlib
-ifeq "$(PLATFORM)" "Linux"
+ifneq (,$(filter Linux FreeBSD,$(PLATFORM)))
WX_CONFIGURE_FLAGS += --disable-tooltips
ifneq "$(origin WITHGTK3)" "command line"
WX_CONFIGURE_FLAGS += --disable-graphics_ctx
diff --git a/src/Mount/Favorites.cpp b/src/Mount/Favorites.cpp
index 0428b8fd..93b7a5a6 100644
--- a/src/Mount/Favorites.cpp
+++ b/src/Mount/Favorites.cpp
@@ -100,7 +100,6 @@ namespace VeraCrypt
favorite.OpenExplorerWindow = (bExplore == TRUE);
favorite.Pim = prop.volumePim;
favorite.Pkcs5 = prop.pkcs5;
- favorite.TrueCryptMode = (prop.pkcs5Iterations == get_pkcs5_iteration_count(prop.pkcs5, 0, TRUE, prop.partitionInInactiveSysEncScope))? 1 : 0;
memcpy (favorite.VolumeID, prop.volumeID, VOLUME_ID_SIZE);
if (favorite.VolumePathId.empty()
@@ -693,15 +692,6 @@ namespace VeraCrypt
favorite.DisconnectedDevice = true;
}
- XmlGetAttributeText (xml, "TrueCryptMode", boolVal, sizeof (boolVal));
- if (boolVal[0])
- favorite.TrueCryptMode = (boolVal[0] == '1')? 1 : 0;
- else
- favorite.TrueCryptMode = -1;
-
- if (favorite.TrueCryptMode > 0)
- favorite.Pim = 0;
-
XmlGetAttributeText (xml, "pkcs5", label, sizeof (label));
if (label[0])
favorite.Pkcs5 = strtol (label, NULL, 10);
@@ -710,7 +700,6 @@ namespace VeraCrypt
if ( (favorite.Pkcs5 != -1)
&& ( (favorite.Pkcs5 < FIRST_PRF_ID)
|| (favorite.Pkcs5 > LAST_PRF_ID)
- || (favorite.TrueCryptMode == 1 && (0 == get_pkcs5_iteration_count (favorite.Pkcs5, 0, TRUE, favorite.SystemEncryption? TRUE : FALSE)))
)
)
{
@@ -819,17 +808,12 @@ namespace VeraCrypt
if (!favorite.Label.empty())
s += L" label=\"" + favorite.Label + L"\"";
- if ((favorite.Pim >= 0) && (favorite.TrueCryptMode <= 0))
+ if (favorite.Pim >= 0)
s += L" pim=\"" + IntToWideString(favorite.Pim) + L"\"";
if (favorite.Pkcs5 > 0)
s += L" pkcs5=\"" + IntToWideString(favorite.Pkcs5) + L"\"";
- if (favorite.TrueCryptMode > 0)
- s += L" TrueCryptMode=\"1\"";
- else if (favorite.TrueCryptMode == 0)
- s += L" TrueCryptMode=\"0\"";
-
if (favorite.ReadOnly)
s += L" readonly=\"1\"";
@@ -951,7 +935,6 @@ namespace VeraCrypt
SetCheckBox (hwndDlg, IDC_FAVORITE_MOUNT_READONLY, favorite.ReadOnly);
SetCheckBox (hwndDlg, IDC_FAVORITE_MOUNT_REMOVABLE, favorite.Removable);
SetCheckBox (hwndDlg, IDC_FAVORITE_USE_VOLUME_ID, favorite.UseVolumeID && bIsDevice);
- SetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE, (favorite.TrueCryptMode > 0)? TRUE : FALSE);
/* Populate the PRF algorithms list */
int nIndex, i, nSelected = 0;
@@ -963,13 +946,10 @@ namespace VeraCrypt
for (i = FIRST_PRF_ID; i <= LAST_PRF_ID; i++)
{
- if (!favorite.SystemEncryption || (favorite.TrueCryptMode != 1))
- {
- nIndex = (int) SendMessage (hComboBox, CB_ADDSTRING, 0, (LPARAM) get_pkcs5_prf_name(i));
- SendMessage (hComboBox, CB_SETITEMDATA, nIndex, (LPARAM) i);
- if (favorite.Pkcs5 == i)
- nSelected = nIndex;
- }
+ nIndex = (int) SendMessage (hComboBox, CB_ADDSTRING, 0, (LPARAM) get_pkcs5_prf_name(i));
+ SendMessage (hComboBox, CB_SETITEMDATA, nIndex, (LPARAM) i);
+ if (favorite.Pkcs5 == i)
+ nSelected = nIndex;
}
if (favorite.Pkcs5 >= 0)
@@ -1003,7 +983,6 @@ namespace VeraCrypt
EnableWindow (GetDlgItem (hwndDlg, IDC_FAVORITE_REMOVE), enable);
EnableWindow (GetDlgItem (hwndDlg, IDT_PKCS5_PRF), enable && !favorite.SystemEncryption);
EnableWindow (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), enable && !favorite.SystemEncryption);
- EnableWindow (GetDlgItem (hwndDlg, IDC_TRUECRYPT_MODE), enable && !favorite.SystemEncryption);
EnableWindow (GetDlgItem (hwndDlg, IDT_PIM), enable);
EnableWindow (GetDlgItem (hwndDlg, IDC_PIM), enable);
EnableWindow (GetDlgItem (hwndDlg, IDC_SHOW_PIM), enable);
@@ -1082,24 +1061,6 @@ namespace VeraCrypt
favorite.Pkcs5 = (int) SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETITEMDATA, nSelected, 0);
else
favorite.Pkcs5 = -1;
- BOOL selectedTrueCryptMode = (IsDlgButtonChecked (hwndDlg, IDC_TRUECRYPT_MODE) != 0)? 1 : 0;
- if ((favorite.TrueCryptMode >= 0) || selectedTrueCryptMode)
- favorite.TrueCryptMode = selectedTrueCryptMode;
-
- if (favorite.TrueCryptMode == 1)
- {
- if ((favorite.Pkcs5 > 0) && !is_pkcs5_prf_supported (favorite.Pkcs5, TRUE, favorite.SystemEncryption? PRF_BOOT_MBR : PRF_BOOT_NO))
- {
- Error ("ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE", hwndDlg);
- favorite.Pkcs5 = 0;
- }
-
- if (favorite.Pim > 0)
- {
- Error ("PIM_NOT_SUPPORTED_FOR_TRUECRYPT_MODE", hwndDlg);
- favorite.Pim = 0;
- }
- }
favorite.ReadOnly = (IsDlgButtonChecked (hwndDlg, IDC_FAVORITE_MOUNT_READONLY) != 0);
favorite.Removable = (IsDlgButtonChecked (hwndDlg, IDC_FAVORITE_MOUNT_REMOVABLE) != 0);
diff --git a/src/Mount/Favorites.h b/src/Mount/Favorites.h
index 28230578..9384cbc8 100644
--- a/src/Mount/Favorites.h
+++ b/src/Mount/Favorites.h
@@ -23,7 +23,6 @@ namespace VeraCrypt
:
Pim (0),
Pkcs5 (-1),
- TrueCryptMode (-1),
DisableHotkeyMount (false),
DisconnectedDevice (false),
MountOnLogOn (false),
@@ -44,7 +43,6 @@ namespace VeraCrypt
wstring Label;
int Pim;
int Pkcs5;
- int TrueCryptMode;
BYTE VolumeID[VOLUME_ID_SIZE];
bool DisableHotkeyMount;
diff --git a/src/Mount/MainCom.cpp b/src/Mount/MainCom.cpp
index 8525a284..ce6803ac 100644
--- a/src/Mount/MainCom.cpp
+++ b/src/Mount/MainCom.cpp
@@ -97,7 +97,7 @@ public:
virtual int STDMETHODCALLTYPE ChangePassword (BSTR volumePath, Password *oldPassword, Password *newPassword, int pkcs5, int wipePassCount, __int64 hWnd)
{
MainDlg = (HWND) hWnd;
- return ::ChangePwd (volumePath, oldPassword, 0, 0, FALSE, newPassword, pkcs5, 0, wipePassCount, (HWND) hWnd);
+ return ::ChangePwd (volumePath, oldPassword, 0, 0, newPassword, pkcs5, 0, wipePassCount, (HWND) hWnd);
}
virtual DWORD STDMETHODCALLTYPE CopyFile (BSTR sourceFile, BSTR destinationFile)
@@ -143,19 +143,19 @@ public:
virtual int STDMETHODCALLTYPE ChangePasswordEx (BSTR volumePath, Password *oldPassword, int old_pkcs5, Password *newPassword, int pkcs5, int wipePassCount, __int64 hWnd)
{
MainDlg = (HWND) hWnd;
- return ::ChangePwd (volumePath, oldPassword, old_pkcs5, 0, FALSE, newPassword, pkcs5, 0, wipePassCount, (HWND) hWnd);
+ return ::ChangePwd (volumePath, oldPassword, old_pkcs5, 0, newPassword, pkcs5, 0, wipePassCount, (HWND) hWnd);
}
- virtual int STDMETHODCALLTYPE ChangePasswordEx2 (BSTR volumePath, Password *oldPassword, int old_pkcs5, BOOL truecryptMode, Password *newPassword, int pkcs5, int wipePassCount, __int64 hWnd)
+ virtual int STDMETHODCALLTYPE ChangePasswordEx2 (BSTR volumePath, Password *oldPassword, int old_pkcs5, Password *newPassword, int pkcs5, int wipePassCount, __int64 hWnd)
{
MainDlg = (HWND) hWnd;
- return ::ChangePwd (volumePath, oldPassword, old_pkcs5, 0, truecryptMode, newPassword, pkcs5, 0, wipePassCount, (HWND) hWnd);
+ return ::ChangePwd (volumePath, oldPassword, old_pkcs5, 0, newPassword, pkcs5, 0, wipePassCount, (HWND) hWnd);
}
- virtual int STDMETHODCALLTYPE ChangePasswordEx3 (BSTR volumePath, Password *oldPassword, int old_pkcs5, int old_pim, BOOL truecryptMode, Password *newPassword, int pkcs5, int pim, int wipePassCount, __int64 hWnd)
+ virtual int STDMETHODCALLTYPE ChangePasswordEx3 (BSTR volumePath, Password *oldPassword, int old_pkcs5, int old_pim, Password *newPassword, int pkcs5, int pim, int wipePassCount, __int64 hWnd)
{
MainDlg = (HWND) hWnd;
- return ::ChangePwd (volumePath, oldPassword, old_pkcs5, old_pim, truecryptMode, newPassword, pkcs5, pim, wipePassCount, (HWND) hWnd);
+ return ::ChangePwd (volumePath, oldPassword, old_pkcs5, old_pim, newPassword, pkcs5, pim, wipePassCount, (HWND) hWnd);
}
virtual DWORD STDMETHODCALLTYPE GetFileSize (BSTR filePath, unsigned __int64 *pSize)
@@ -203,6 +203,16 @@ public:
return BaseCom::UpdateSetupConfigFile (bForInstall);
}
+ virtual DWORD STDMETHODCALLTYPE NotifyService (DWORD dwNotifyCode)
+ {
+ return BaseCom::NotifyService (dwNotifyCode);
+ }
+
+ virtual DWORD STDMETHODCALLTYPE FastFileResize (BSTR filePath, __int64 fileSize)
+ {
+ return BaseCom::FastFileResize (filePath, fileSize);
+ }
+
protected:
DWORD MessageThreadId;
LONG RefCount;
@@ -265,7 +275,7 @@ extern "C" int UacBackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, w
CComPtr<ITrueCryptMainCom> tc;
int r;
- CoInitialize (NULL);
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
if (ComGetInstance (hwndDlg, &tc))
{
@@ -293,7 +303,7 @@ extern "C" int UacRestoreVolumeHeader (HWND hwndDlg, wchar_t *lpszVolume)
CComPtr<ITrueCryptMainCom> tc;
int r;
- CoInitialize (NULL);
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
if (ComGetInstance (hwndDlg, &tc))
{
@@ -316,18 +326,18 @@ extern "C" int UacRestoreVolumeHeader (HWND hwndDlg, wchar_t *lpszVolume)
}
-extern "C" int UacChangePwd (wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5, int old_pim, BOOL truecryptMode, Password *newPassword, int pkcs5, int pim, int wipePassCount, HWND hwndDlg)
+extern "C" int UacChangePwd (wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5, int old_pim, Password *newPassword, int pkcs5, int pim, int wipePassCount, HWND hwndDlg)
{
CComPtr<ITrueCryptMainCom> tc;
int r;
- CoInitialize (NULL);
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
if (ComGetInstance (hwndDlg, &tc))
{
CComBSTR bstrVolume (lpszVolume);
WaitCursor ();
- r = tc->ChangePasswordEx3 (bstrVolume, oldPassword, old_pkcs5, old_pim, truecryptMode, newPassword, pkcs5, pim, wipePassCount, (__int64) hwndDlg);
+ r = tc->ChangePasswordEx3 (bstrVolume, oldPassword, old_pkcs5, old_pim, newPassword, pkcs5, pim, wipePassCount, (__int64) hwndDlg);
NormalCursor ();
}
else
diff --git a/src/Mount/MainCom.h b/src/Mount/MainCom.h
index 88cd0221..aeafa549 100644
--- a/src/Mount/MainCom.h
+++ b/src/Mount/MainCom.h
@@ -26,7 +26,7 @@ extern "C" {
BOOL ComServerMain ();
int UacBackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, wchar_t *lpszVolume);
int UacRestoreVolumeHeader (HWND hwndDlg, wchar_t *lpszVolume);
-int UacChangePwd (wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5, int old_pim, BOOL truecryptMode, Password *newPassword, int pkcs5, int pim, int wipePassCount, HWND hwndDlg);
+int UacChangePwd (wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5, int old_pim, Password *newPassword, int pkcs5, int pim, int wipePassCount, HWND hwndDlg);
#ifdef __cplusplus
}
diff --git a/src/Mount/MainCom.idl b/src/Mount/MainCom.idl
index fae86c52..06c2e48f 100644
--- a/src/Mount/MainCom.idl
+++ b/src/Mount/MainCom.idl
@@ -16,7 +16,7 @@ import "..\Common\Password.h";
[
uuid(9ACF6176-5FC4-4690-A025-B3306A50EB6A),
helpstring("VeraCrypt Main UAC Support Library"),
- version(2.11) // Update ComSetup.cpp when changing version number
+ version(2.13) // Update ComSetup.cpp when changing version number
]
library TrueCryptMainCom
{
@@ -42,8 +42,8 @@ library TrueCryptMainCom
DWORD SetDriverServiceStartType (DWORD startType);
DWORD WriteLocalMachineRegistryDwordValue (BSTR keyPath, BSTR valueName, DWORD value);
int ChangePasswordEx (BSTR volumePath, Password *oldPassword, int old_pkcs5, Password *newPassword, int pkcs5, int wipePassCount, __int64 hWnd);
- int ChangePasswordEx2 (BSTR volumePath, Password *oldPassword, int old_pkcs5, BOOL truecryptMode, Password *newPassword, int pkcs5, int wipePassCount, __int64 hWnd);
- int ChangePasswordEx3 (BSTR volumePath, Password *oldPassword, int old_pkcs5, int old_pim, BOOL truecryptMode, Password *newPassword, int pkcs5, int pim, int wipePassCount, __int64 hWnd);
+ int ChangePasswordEx2 (BSTR volumePath, Password *oldPassword, int old_pkcs5, Password *newPassword, int pkcs5, int wipePassCount, __int64 hWnd);
+ int ChangePasswordEx3 (BSTR volumePath, Password *oldPassword, int old_pkcs5, int old_pim, Password *newPassword, int pkcs5, int pim, int wipePassCount, __int64 hWnd);
DWORD GetFileSize (BSTR filePath, unsigned __int64* pSize);
DWORD DeviceIoControl (BOOL readOnly, BOOL device, BSTR filePath, DWORD dwIoControlCode, BSTR input, BSTR *output);
DWORD InstallEfiBootLoader (BOOL preserveUserConfig, BOOL hiddenOSCreation, int pim, int hashAlg);
@@ -53,6 +53,8 @@ library TrueCryptMainCom
DWORD WriteEfiBootSectorUserConfig (DWORD userConfig, BSTR customUserMessage, int pim, int hashAlg);
DWORD UpdateSetupConfigFile (BOOL bForInstall);
DWORD GetSecureBootConfig (BOOL* pSecureBootEnabled, BOOL *pVeraCryptKeysLoaded);
+ DWORD NotifyService (DWORD dwNotifyCode);
+ DWORD FastFileResize (BSTR filePath, __int64 fileSize);
};
[
diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c
index a5798afc..76de34b6 100644
--- a/src/Mount/Mount.c
+++ b/src/Mount/Mount.c
@@ -54,7 +54,12 @@
#include <Strsafe.h>
#include <InitGuid.h>
#include <devguid.h>
+#include <devpkey.h>
+#include <SetupAPI.h>
+#include <Cfgmgr32.h>
#include <intrin.h>
+#include <vector>
+#include <algorithm>
#pragma intrinsic(_InterlockedCompareExchange, _InterlockedExchange)
@@ -162,9 +167,6 @@ int CmdVolumePkcs5 = 0;
int VolumePim = -1;
int CmdVolumePim = -1;
int DefaultVolumePkcs5 = 0;
-BOOL VolumeTrueCryptMode = FALSE;
-BOOL CmdVolumeTrueCryptMode = FALSE;
-BOOL DefaultVolumeTrueCryptMode = FALSE;
BOOL CmdVolumePasswordValid = FALSE;
MountOptions CmdMountOptions;
BOOL CmdMountOptionsValid = FALSE;
@@ -293,7 +295,7 @@ static std::vector<MSXML2::IXMLDOMNodePtr> GetReadChildNodes (MSXML2::IXMLDOMNod
static bool validateDcsPropXml(const char* xmlData)
{
bool bValid = false;
- HRESULT hr = CoInitialize(NULL);
+ HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
if(FAILED(hr))
return false;
else
@@ -407,8 +409,6 @@ static void localcleanup (void)
burn (&CmdVolumePkcs5, sizeof (CmdVolumePkcs5));
burn (&VolumePim, sizeof (VolumePim));
burn (&CmdVolumePim, sizeof (CmdVolumePim));
- burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode));
- burn (&CmdVolumeTrueCryptMode, sizeof (CmdVolumeTrueCryptMode));
burn (&mountOptions, sizeof (mountOptions));
burn (&defaultMountOptions, sizeof (defaultMountOptions));
burn (szFileName, sizeof(szFileName));
@@ -428,6 +428,59 @@ static void localcleanup (void)
RandStop (TRUE);
}
+#ifndef BS_SPLITBUTTON
+#define BS_SPLITBUTTON 0x0000000C
+#endif
+
+#ifndef BCN_DROPDOWN
+#define BCN_DROPDOWN (0U-1250U) + 2U
+#endif
+
+static void EnableSplitButton(HWND hwndDlg, int buttonId)
+{
+ HWND hwndButton = GetDlgItem(hwndDlg, buttonId);
+ if (hwndButton != NULL)
+ {
+ // change the button style
+ SetWindowLongPtr(hwndButton, GWL_STYLE, GetWindowLongPtr(hwndButton, GWL_STYLE) | BS_SPLITBUTTON);
+ }
+}
+
+static void DisableSplitButton(HWND hwndDlg, int buttonId)
+{
+ HWND hwndButton = GetDlgItem(hwndDlg, buttonId);
+ if (hwndButton != NULL)
+ {
+ // change the button style
+ SetWindowLongPtr(hwndButton, GWL_STYLE, GetWindowLongPtr(hwndButton, GWL_STYLE) & ~BS_SPLITBUTTON);
+ }
+}
+
+static HMENU CreateMountNoCacheDropdownMenu()
+{
+ HMENU hmenu = CreatePopupMenu();
+
+ // add menu items
+ AppendMenu(hmenu, MF_STRING, IDM_MOUNIT_NO_CACHE, GetString("IDM_MOUNT_NO_CACHE"));
+
+ return hmenu;
+}
+
+static void HandleMountButtonDropdown(HWND hwndButton, HWND hwndOwner, HMENU hmenu)
+{
+ RECT rc;
+ POINT pt;
+
+ if (GetClientRect(hwndButton, &rc))
+ {
+ pt.x = rc.left;
+ pt.y = rc.bottom;
+ ClientToScreen(hwndButton, &pt);
+
+ TrackPopupMenu(hmenu, TPM_LEFTALIGN | TPM_TOPALIGN, pt.x, pt.y, 0, hwndOwner, NULL);
+ }
+}
+
void RefreshMainDlg (HWND hwndDlg)
{
if (Silent)
@@ -625,7 +678,10 @@ void EnableDisableButtons (HWND hwndDlg)
case TC_MLIST_ITEM_NONSYS_VOL:
{
SetWindowTextW (hOKButton, GetString ("UNMOUNT_BUTTON"));
+ DisableSplitButton(hwndDlg, IDOK);
EnableWindow (hOKButton, TRUE);
+ // Invalid the button IDOK so that it will be redrawn
+ InvalidateRect (hOKButton, NULL, TRUE);
EnableMenuItem (GetMenu (hwndDlg), IDM_UNMOUNT_VOLUME, MF_ENABLED);
EnableWindow (GetDlgItem (hwndDlg, IDC_VOLUME_PROPERTIES), TRUE);
@@ -635,15 +691,21 @@ void EnableDisableButtons (HWND hwndDlg)
case TC_MLIST_ITEM_SYS_PARTITION:
case TC_MLIST_ITEM_SYS_DRIVE:
+ EnableSplitButton(hwndDlg, IDOK);
EnableWindow (hOKButton, FALSE);
SetWindowTextW (hOKButton, GetString ("MOUNT_BUTTON"));
+ // Invalid the button IDOK so that it will be redrawn
+ InvalidateRect (hOKButton, NULL, TRUE);
EnableWindow (GetDlgItem (hwndDlg, IDC_VOLUME_PROPERTIES), TRUE);
EnableMenuItem (GetMenu (hwndDlg), IDM_UNMOUNT_VOLUME, MF_GRAYED);
break;
case TC_MLIST_ITEM_FREE:
default:
+ EnableSplitButton(hwndDlg, IDOK);
SetWindowTextW (hOKButton, GetString ("MOUNT_BUTTON"));
+ // Invalid the button IDOK so that it will be redrawn
+ InvalidateRect (hOKButton, NULL, TRUE);
EnableWindow (GetDlgItem (hwndDlg, IDC_VOLUME_PROPERTIES), FALSE);
EnableMenuItem (GetMenu (hwndDlg), IDM_VOLUME_PROPERTIES, MF_GRAYED);
EnableMenuItem (GetMenu (hwndDlg), IDM_UNMOUNT_VOLUME, MF_GRAYED);
@@ -948,11 +1010,13 @@ void LoadSettingsAndCheckModified (HWND hwndDlg, BOOL bOnlyCheckModified, BOOL*
defaultMountOptions.PartitionInInactiveSysEncScope = FALSE;
defaultMountOptions.RecoveryMode = FALSE;
defaultMountOptions.UseBackupHeader = FALSE;
+ defaultMountOptions.SkipCachedPasswords = FALSE;
mountOptions = defaultMountOptions;
}
ConfigReadCompareInt ("CloseSecurityTokenSessionsAfterMount", 0, &CloseSecurityTokenSessionsAfterMount, bOnlyCheckModified, pbSettingsModified);
+ ConfigReadCompareInt ("EMVSupportEnabled", 0, &EMVSupportEnabled, bOnlyCheckModified, pbSettingsModified);
if (IsHiddenOSRunning())
ConfigReadCompareInt ("HiddenSystemLeakProtNotifStatus", TC_HIDDEN_OS_READ_ONLY_NOTIF_MODE_NONE, &HiddenSysLeakProtectionNotificationStatus, bOnlyCheckModified, pbSettingsModified);
@@ -1019,7 +1083,6 @@ void LoadSettingsAndCheckModified (HWND hwndDlg, BOOL bOnlyCheckModified, BOOL*
// Mount Options
ConfigReadCompareInt ("DefaultPRF", 0, &DefaultVolumePkcs5, bOnlyCheckModified, pbSettingsModified);
- ConfigReadCompareInt ("DefaultTrueCryptMode", FALSE, &DefaultVolumeTrueCryptMode, bOnlyCheckModified, pbSettingsModified);
if (bOnlyCheckModified)
{
@@ -1043,8 +1106,6 @@ void LoadSettingsAndCheckModified (HWND hwndDlg, BOOL bOnlyCheckModified, BOOL*
if (DefaultVolumePkcs5 < 0 || DefaultVolumePkcs5 > LAST_PRF_ID)
DefaultVolumePkcs5 = 0;
- if (DefaultVolumeTrueCryptMode != TRUE && DefaultVolumeTrueCryptMode != FALSE)
- DefaultVolumeTrueCryptMode = FALSE;
}
@@ -1125,6 +1186,7 @@ void SaveSettings (HWND hwndDlg)
}
ConfigWriteInt ("CloseSecurityTokenSessionsAfterMount", CloseSecurityTokenSessionsAfterMount);
+ ConfigWriteInt ("EMVSupportEnabled", EMVSupportEnabled);
// Hotkeys
ConfigWriteInt ("HotkeyModAutoMountDevices", Hotkeys[HK_AUTOMOUNT_DEVICES].vKeyModifiers);
@@ -1156,7 +1218,6 @@ void SaveSettings (HWND hwndDlg)
// Mount Options
ConfigWriteInt ("DefaultPRF", DefaultVolumePkcs5);
- ConfigWriteInt ("DefaultTrueCryptMode", DefaultVolumeTrueCryptMode);
ConfigWriteEnd (hwndDlg);
}
@@ -1962,13 +2023,7 @@ void LoadDriveLetters (HWND hwndDlg, HWND hTree, int drive)
ws = L"?";
}
- if (driver.truecryptMode[i])
- {
- StringCbPrintfW (szTmpW, sizeof(szTmpW), L"TrueCrypt-%s", ws);
- ListSubItemSet (hTree, listItem.iItem, 4, szTmpW);
- }
- else
- ListSubItemSet (hTree, listItem.iItem, 4, ws);
+ ListSubItemSet (hTree, listItem.iItem, 4, ws);
if (driver.volumeType[i] == PROP_VOL_TYPE_OUTER_VOL_WRITE_PREVENTED) // Normal/outer volume (hidden volume protected AND write denied)
{
@@ -2095,7 +2150,6 @@ typedef struct
int pkcs5;
int pim;
int wipePassCount;
- BOOL truecryptMode;
int* pnStatus;
} ChangePwdThreadParam;
@@ -2132,14 +2186,14 @@ void CALLBACK ChangePwdWaitThreadProc(void* pArg, HWND hwndDlg)
{
// Non-system
- *pThreadParam->pnStatus = ChangePwd (szFileName, pThreadParam->oldPassword, pThreadParam->old_pkcs5, pThreadParam->old_pim, pThreadParam->truecryptMode, pThreadParam->newPassword, pThreadParam->pkcs5, pThreadParam->pim, pThreadParam->wipePassCount, hwndDlg);
+ *pThreadParam->pnStatus = ChangePwd (szFileName, pThreadParam->oldPassword, pThreadParam->old_pkcs5, pThreadParam->old_pim, pThreadParam->newPassword, pThreadParam->pkcs5, pThreadParam->pim, pThreadParam->wipePassCount, hwndDlg);
if (*pThreadParam->pnStatus == ERR_OS_ERROR
&& GetLastError () == ERROR_ACCESS_DENIED
&& IsUacSupported ()
&& IsVolumeDeviceHosted (szFileName))
{
- *pThreadParam->pnStatus = UacChangePwd (szFileName, pThreadParam->oldPassword, pThreadParam->old_pkcs5, pThreadParam->old_pim, pThreadParam->truecryptMode, pThreadParam->newPassword, pThreadParam->pkcs5, pThreadParam->pim, pThreadParam->wipePassCount, hwndDlg);
+ *pThreadParam->pnStatus = UacChangePwd (szFileName, pThreadParam->oldPassword, pThreadParam->old_pkcs5, pThreadParam->old_pim, pThreadParam->newPassword, pThreadParam->pkcs5, pThreadParam->pim, pThreadParam->wipePassCount, hwndDlg);
}
}
}
@@ -2214,7 +2268,6 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
int i;
WipeAlgorithmId headerWipeMode = TC_WIPE_3_DOD_5220;
int EffectiveVolumePkcs5 = CmdVolumePkcs5;
- BOOL EffectiveVolumeTrueCryptMode = CmdVolumeTrueCryptMode;
int EffectiveVolumePim = CmdVolumePim;
/* Priority is given to command line parameters
@@ -2222,8 +2275,6 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
*/
if (EffectiveVolumePkcs5 == 0)
EffectiveVolumePkcs5 = DefaultVolumePkcs5;
- if (!EffectiveVolumeTrueCryptMode)
- EffectiveVolumeTrueCryptMode = DefaultVolumeTrueCryptMode;
NewPimValuePtr = (int*) lParam;
@@ -2270,9 +2321,6 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
SendMessage (hComboBox, CB_SETCURSEL, nSelectedIndex, 0);
- /* check TrueCrypt Mode if it was set as default*/
- SetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE, EffectiveVolumeTrueCryptMode);
-
/* set default PIM if set in the command line*/
if (EffectiveVolumePim > 0)
{
@@ -2371,10 +2419,6 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
if (bSysEncPwdChangeDlgMode)
{
- /* No support for changing the password of TrueCrypt system partition */
- SetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE, FALSE);
- EnableWindow (GetDlgItem (hwndDlg, IDC_TRUECRYPT_MODE), FALSE);
-
ToBootPwdField (hwndDlg, IDC_PASSWORD);
ToBootPwdField (hwndDlg, IDC_VERIFY);
ToBootPwdField (hwndDlg, IDC_OLD_PASSWORD);
@@ -2702,14 +2746,6 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
}
- if (lw == IDC_TRUECRYPT_MODE)
- {
- BOOL bEnablePim = GetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE) ? FALSE: TRUE;
- EnableWindow (GetDlgItem (hwndDlg, IDT_OLD_PIM), bEnablePim);
- EnableWindow (GetDlgItem (hwndDlg, IDC_OLD_PIM), bEnablePim);
- EnableWindow (GetDlgItem (hwndDlg, IDC_OLD_PIM_HELP), bEnablePim);
- }
-
if (lw == IDC_SHOW_PASSWORD_CHPWD_ORI)
{
HandleShowPasswordFieldAction (hwndDlg, IDC_SHOW_PASSWORD_CHPWD_ORI, IDC_OLD_PASSWORD, IDC_OLD_PIM);
@@ -2738,22 +2774,10 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_OLD_PRF_ID), CB_GETCURSEL, 0, 0), 0);
int pkcs5 = (int) SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETITEMDATA,
SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETCURSEL, 0, 0), 0);
- BOOL truecryptMode = GetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE);
int old_pim = GetPim (hwndDlg, IDC_OLD_PIM, 0);
int pim = GetPim (hwndDlg, IDC_PIM, 0);
- int iMaxPasswordLength = (bUseLegacyMaxPasswordLength || truecryptMode)? MAX_LEGACY_PASSWORD : MAX_PASSWORD;
-
- if (truecryptMode && !is_pkcs5_prf_supported (old_pkcs5, TRUE, PRF_BOOT_NO))
- {
- Error ("ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE", hwndDlg);
- return 1;
- }
- else if (truecryptMode && (old_pim != 0))
- {
- Error ("PIM_NOT_SUPPORTED_FOR_TRUECRYPT_MODE", hwndDlg);
- return 1;
- }
+ int iMaxPasswordLength = (bUseLegacyMaxPasswordLength)? MAX_LEGACY_PASSWORD : MAX_PASSWORD;
if (bSysEncPwdChangeDlgMode && !CheckPasswordCharEncoding (GetDlgItem (hwndDlg, IDC_PASSWORD), NULL))
{
@@ -2800,7 +2824,7 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
GetVolumePath (hParent, szFileName, ARRAYSIZE (szFileName));
- if (GetPassword (hwndDlg, IDC_OLD_PASSWORD, (LPSTR) oldPassword.Text, iMaxPasswordLength + 1, truecryptMode, TRUE))
+ if (GetPassword (hwndDlg, IDC_OLD_PASSWORD, (LPSTR) oldPassword.Text, iMaxPasswordLength + 1, FALSE, TRUE))
oldPassword.Length = (unsigned __int32) strlen ((char *) oldPassword.Text);
else
{
@@ -2847,7 +2871,6 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
changePwdParam.pim = pim;
changePwdParam.wipePassCount = GetWipePassCount(headerWiperMode);
changePwdParam.pnStatus = &nStatus;
- changePwdParam.truecryptMode = truecryptMode;
ShowWaitDialog(hwndDlg, TRUE, ChangePwdWaitThreadProc, &changePwdParam);
@@ -2922,7 +2945,6 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
static Password *szXPwd;
static int *pkcs5;
static int *pim;
- static BOOL* truecryptMode;
switch (msg)
{
@@ -2932,7 +2954,6 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
szXPwd = ((PasswordDlgParam *) lParam) -> password;
pkcs5 = ((PasswordDlgParam *) lParam) -> pkcs5;
pim = ((PasswordDlgParam *) lParam) -> pim;
- truecryptMode = ((PasswordDlgParam *) lParam) -> truecryptMode;
LocalizeDialog (hwndDlg, "IDD_PASSWORD_DLG");
DragAcceptFiles (hwndDlg, TRUE);
@@ -3010,14 +3031,6 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
{
EnableWindow (GetDlgItem (hwndDlg, IDC_CACHE), FALSE);
EnableWindow (GetDlgItem (hwndDlg, IDC_MOUNT_OPTIONS), FALSE);
- /* Disable TrueCrypt mode option in case of backup/restore header operation */
- SetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE, FALSE);
- EnableWindow (GetDlgItem (hwndDlg, IDC_TRUECRYPT_MODE), FALSE);
- }
- else if (*truecryptMode)
- {
- /* Check TrueCryptMode if it is enabled on the command line */
- SetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE, TRUE);
}
if (!SetForegroundWindow (hwndDlg) && (FavoriteMountOnArrivalInProgress || LogOn))
@@ -3214,14 +3227,6 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
return 1;
}
- if (lw == IDC_TRUECRYPT_MODE)
- {
- BOOL bEnablePim = GetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE) ? FALSE: TRUE;
- EnableWindow (GetDlgItem (hwndDlg, IDT_PIM), bEnablePim);
- EnableWindow (GetDlgItem (hwndDlg, IDC_PIM), bEnablePim);
- EnableWindow (GetDlgItem (hwndDlg, IDC_PIM_HELP), bEnablePim);
- }
-
if (lw == IDC_KEY_FILES)
{
KeyFilesDlgParam param;
@@ -3254,38 +3259,19 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
if (lw == IDOK)
{
- BOOL bTrueCryptMode = GetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE);
- int iMaxPasswordLength = (bUseLegacyMaxPasswordLength || bTrueCryptMode)? MAX_LEGACY_PASSWORD : MAX_PASSWORD;
+ int iMaxPasswordLength = (bUseLegacyMaxPasswordLength)? MAX_LEGACY_PASSWORD : MAX_PASSWORD;
if (mountOptions.ProtectHiddenVolume && hidVolProtKeyFilesParam.EnableKeyFiles)
KeyFilesApply (hwndDlg, &mountOptions.ProtectedHidVolPassword, hidVolProtKeyFilesParam.FirstKeyFile, wcslen (PasswordDlgVolume) > 0 ? PasswordDlgVolume : NULL);
- if (GetPassword (hwndDlg, IDC_PASSWORD, (LPSTR) szXPwd->Text, iMaxPasswordLength + 1, bTrueCryptMode, TRUE))
+ if (GetPassword (hwndDlg, IDC_PASSWORD, (LPSTR) szXPwd->Text, iMaxPasswordLength + 1, FALSE, TRUE))
szXPwd->Length = (unsigned __int32) strlen ((char *) szXPwd->Text);
else
return 1;
bCacheInDriver = IsButtonChecked (GetDlgItem (hwndDlg, IDC_CACHE));
*pkcs5 = (int) SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETITEMDATA, SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETCURSEL, 0, 0), 0);
- *truecryptMode = bTrueCryptMode;
*pim = GetPim (hwndDlg, IDC_PIM, 0);
-
- /* check that PRF is supported in TrueCrypt Mode */
- if ( (*truecryptMode)
- && ((!is_pkcs5_prf_supported (*pkcs5, TRUE, PRF_BOOT_NO)) || (mountOptions.ProtectHiddenVolume && !is_pkcs5_prf_supported (mountOptions.ProtectedHidVolPkcs5Prf, TRUE, PRF_BOOT_NO)))
- )
- {
- Error ("ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE", hwndDlg);
- return 1;
- }
-
- if ( (*truecryptMode)
- && (*pim != 0)
- )
- {
- Error ("PIM_NOT_SUPPORTED_FOR_TRUECRYPT_MODE", hwndDlg);
- return 1;
- }
}
// Attempt to wipe password stored in the input field buffer
@@ -4185,17 +4171,10 @@ BOOL CALLBACK VolumePropertiesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP
ListSubItemSet (list, i++, 1, GetString (IsHiddenOSRunning() ? "TYPE_HIDDEN_SYSTEM_ADJECTIVE" : "SYSTEM_VOLUME_TYPE_ADJECTIVE"));
else
{
- bool truecryptMode = prop.pkcs5Iterations == get_pkcs5_iteration_count(prop.pkcs5, 0, TRUE, prop.partitionInInactiveSysEncScope);
s = prop.hiddenVolume ? GetString ("HIDDEN") :
(prop.hiddenVolProtection != HIDVOL_PROT_STATUS_NONE ? GetString ("OUTER") : GetString ("NORMAL"));
- if (truecryptMode)
- {
- StringCbPrintfW (sw, sizeof(sw), L"TrueCrypt - %s", s);
- ListSubItemSet (list, i++, 1, sw);
- }
- else
- ListSubItemSet (list, i++, 1, s);
+ ListSubItemSet (list, i++, 1, s);
}
if (!bSysEnc)
@@ -4535,7 +4514,7 @@ BOOL CALLBACK TravelerDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
wchar_t dstPath[MAX_PATH * 2];
GetDlgItemText (hwndDlg, IDC_DIRECTORY, dstPath, ARRAYSIZE (dstPath));
- if (BrowseDirectories (hwndDlg, "SELECT_DEST_DIR", dstPath))
+ if (BrowseDirectories (hwndDlg, "SELECT_DEST_DIR", dstPath, dstPath))
SetDlgItemText (hwndDlg, IDC_DIRECTORY, dstPath);
return 1;
@@ -5136,7 +5115,7 @@ LPARAM GetItemLong (HWND hTree, int itemNo)
return item.lParam;
}
-static int AskVolumePassword (HWND hwndDlg, Password *password, int *pkcs5, int *pim, BOOL* truecryptMode, char *titleStringId, BOOL enableMountOptions)
+static int AskVolumePassword (HWND hwndDlg, Password *password, int *pkcs5, int *pim, char *titleStringId, BOOL enableMountOptions)
{
INT_PTR result;
PasswordDlgParam dlgParam;
@@ -5147,7 +5126,6 @@ static int AskVolumePassword (HWND hwndDlg, Password *password, int *pkcs5, int
dlgParam.password = password;
dlgParam.pkcs5 = pkcs5;
dlgParam.pim = pim;
- dlgParam.truecryptMode = truecryptMode;
result = SecureDesktopDialogBoxParam (hInst,
MAKEINTRESOURCEW (IDD_PASSWORD_DLG), hwndDlg,
@@ -5158,7 +5136,6 @@ static int AskVolumePassword (HWND hwndDlg, Password *password, int *pkcs5, int
password->Length = 0;
*pkcs5 = 0;
*pim = -1;
- *truecryptMode = FALSE;
burn (&mountOptions.ProtectedHidVolPassword, sizeof (mountOptions.ProtectedHidVolPassword));
burn (&mountOptions.ProtectedHidVolPkcs5Prf, sizeof (mountOptions.ProtectedHidVolPkcs5Prf));
}
@@ -5168,12 +5145,11 @@ static int AskVolumePassword (HWND hwndDlg, Password *password, int *pkcs5, int
// GUI actions
-static BOOL Mount (HWND hwndDlg, int nDosDriveNo, wchar_t *szFileName, int pim, int pkcs5, int trueCryptMode)
+static BOOL Mount (HWND hwndDlg, int nDosDriveNo, wchar_t *szFileName, int pim, int pkcs5)
{
BOOL status = FALSE;
wchar_t fileName[MAX_PATH];
int mounted = 0, EffectiveVolumePkcs5 = 0;
- BOOL EffectiveVolumeTrueCryptMode = FALSE;
int EffectiveVolumePim = (pim < 0)? CmdVolumePim : pim;
BOOL bEffectiveCacheDuringMultipleMount = bCmdCacheDuringMultipleMount? TRUE: bCacheDuringMultipleMount;
BOOL bEffectiveTryEmptyPasswordWhenKeyfileUsed = bCmdTryEmptyPasswordWhenKeyfileUsedValid? bCmdTryEmptyPasswordWhenKeyfileUsed : bTryEmptyPasswordWhenKeyfileUsed;
@@ -5189,23 +5165,6 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, wchar_t *szFileName, int pim,
else
EffectiveVolumePkcs5 = DefaultVolumePkcs5;
- if (trueCryptMode >= 0)
- EffectiveVolumeTrueCryptMode = (trueCryptMode == 0)? FALSE : TRUE;
- else if (CmdVolumeTrueCryptMode)
- EffectiveVolumeTrueCryptMode = TRUE;
- else
- EffectiveVolumeTrueCryptMode = DefaultVolumeTrueCryptMode;
-
- if (EffectiveVolumeTrueCryptMode)
- {
- /* No PIM Mode if TrueCrypt Mode specified */
- EffectiveVolumePim = 0;
-
- /* valdate the effective PRF is compatible with TrueCrypt Mode */
- if (!is_pkcs5_prf_supported (EffectiveVolumePkcs5, TRUE, mountOptions.PartitionInInactiveSysEncScope? PRF_BOOT_MBR : PRF_BOOT_NO))
- EffectiveVolumePkcs5 = 0;
- }
-
bPrebootPasswordDlgMode = mountOptions.PartitionInInactiveSysEncScope;
if (nDosDriveNo == -1)
@@ -5215,7 +5174,6 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, wchar_t *szFileName, int pim,
{
VolumePassword.Length = 0;
VolumePkcs5 = 0;
- VolumeTrueCryptMode = FALSE;
VolumePim = -1;
}
@@ -5263,10 +5221,7 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, wchar_t *szFileName, int pim,
if (!bUseCmdVolumePassword)
{
// First try cached passwords and if they fail ask user for a new one
- if (EffectiveVolumeTrueCryptMode)
- mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, NULL, EffectiveVolumePkcs5, 0, TRUE, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, FALSE);
- else
- mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, NULL, EffectiveVolumePkcs5, EffectiveVolumePim, FALSE, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, FALSE);
+ mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, NULL, EffectiveVolumePkcs5, EffectiveVolumePim, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, FALSE);
// If keyfiles are enabled, test empty password first
if (!mounted && KeyFilesEnable && FirstKeyFile && bEffectiveTryEmptyPasswordWhenKeyfileUsed)
@@ -5275,10 +5230,7 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, wchar_t *szFileName, int pim,
KeyFilesApply (hwndDlg, &emptyPassword, FirstKeyFile, szFileName);
- if (EffectiveVolumeTrueCryptMode)
- mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &emptyPassword, EffectiveVolumePkcs5, 0, TRUE, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, FALSE);
- else
- mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &emptyPassword, EffectiveVolumePkcs5, EffectiveVolumePim, FALSE, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, FALSE);
+ mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &emptyPassword, EffectiveVolumePkcs5, EffectiveVolumePim, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, FALSE);
burn (&emptyPassword, sizeof (emptyPassword));
}
@@ -5287,11 +5239,8 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, wchar_t *szFileName, int pim,
// Test password and/or keyfiles used for the previous volume
if (!mounted && bEffectiveCacheDuringMultipleMount && MultipleMountOperationInProgress && VolumePassword.Length != 0)
{
- // try TrueCrypt mode first as it is quick, only if no custom pim specified
- if (EffectiveVolumeTrueCryptMode)
- mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &VolumePassword, EffectiveVolumePkcs5, 0, TRUE, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, FALSE);
- else // if no PIM specified for favorite, we use also the PIM of the previous volume alongside its password.
- mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &VolumePassword, EffectiveVolumePkcs5, (EffectiveVolumePim < 0)? VolumePim : EffectiveVolumePim, FALSE, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, FALSE);
+ // if no PIM specified for favorite, we use also the PIM of the previous volume alongside its password.
+ mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &VolumePassword, EffectiveVolumePkcs5, (EffectiveVolumePim < 0)? VolumePim : EffectiveVolumePim, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, FALSE);
}
NormalCursor ();
@@ -5310,25 +5259,21 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, wchar_t *szFileName, int pim,
{
VolumePassword = CmdVolumePassword;
VolumePkcs5 = EffectiveVolumePkcs5;
- VolumeTrueCryptMode = EffectiveVolumeTrueCryptMode;
VolumePim = EffectiveVolumePim;
}
else if (!Silent)
{
int GuiPkcs5 = EffectiveVolumePkcs5;
- BOOL GuiTrueCryptMode = EffectiveVolumeTrueCryptMode || IsTrueCryptFileExtension (szFileName)? TRUE : FALSE;
int GuiPim = EffectiveVolumePim;
StringCbCopyW (PasswordDlgVolume, sizeof(PasswordDlgVolume), szFileName);
- if (!AskVolumePassword (hwndDlg, &VolumePassword, &GuiPkcs5, &GuiPim, &GuiTrueCryptMode, NULL, TRUE))
+ if (!AskVolumePassword (hwndDlg, &VolumePassword, &GuiPkcs5, &GuiPim, NULL, TRUE))
goto ret;
else
{
VolumePkcs5 = GuiPkcs5;
- VolumeTrueCryptMode = GuiTrueCryptMode;
VolumePim = GuiPim;
burn (&GuiPkcs5, sizeof(GuiPkcs5));
- burn (&GuiTrueCryptMode, sizeof(GuiTrueCryptMode));
burn (&GuiPim, sizeof(GuiPim));
}
}
@@ -5338,7 +5283,7 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, wchar_t *szFileName, int pim,
if (KeyFilesEnable)
KeyFilesApply (hwndDlg, &VolumePassword, FirstKeyFile, szFileName);
- mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &VolumePassword, VolumePkcs5, VolumePim, VolumeTrueCryptMode, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, !Silent);
+ mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &VolumePassword, VolumePkcs5, VolumePim, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, !Silent);
NormalCursor ();
// Check for problematic file extensions (exe, dll, sys)
@@ -5349,7 +5294,6 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, wchar_t *szFileName, int pim,
{
burn (&VolumePassword, sizeof (VolumePassword));
burn (&VolumePkcs5, sizeof (VolumePkcs5));
- burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode));
burn (&VolumePim, sizeof (VolumePim));
}
@@ -5385,20 +5329,21 @@ ret:
{
burn (&VolumePassword, sizeof (VolumePassword));
burn (&VolumePkcs5, sizeof (VolumePkcs5));
- burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode));
burn (&VolumePim, sizeof (VolumePim));
}
burn (&mountOptions.ProtectedHidVolPassword, sizeof (mountOptions.ProtectedHidVolPassword));
burn (&mountOptions.ProtectedHidVolPkcs5Prf, sizeof (mountOptions.ProtectedHidVolPkcs5Prf));
+ mountOptions.SkipCachedPasswords = FALSE;
+
RestoreDefaultKeyFilesParam ();
if (UsePreferences)
bCacheInDriver = bCacheInDriverDefault;
if (status && CloseSecurityTokenSessionsAfterMount && !MultipleMountOperationInProgress)
- SecurityToken::CloseAllSessions();
+ SecurityToken::CloseAllSessions(); // TODO Use Token
return status;
}
@@ -5445,7 +5390,7 @@ void __cdecl mountThreadFunction (void *hwndDlgArg)
EnableWindow(hwndDlg, FALSE);
finally_do_arg2 (HWND, hwndDlg, BOOL, bIsForeground, { EnableWindow(finally_arg, TRUE); if (finally_arg2) BringToForeground (finally_arg); bPrebootPasswordDlgMode = FALSE;});
- Mount (hwndDlg, -1, 0, -1, -1, -1);
+ Mount (hwndDlg, -1, 0, -1, -1);
}
typedef struct
@@ -5620,21 +5565,18 @@ retry:
goto retry;
}
- if (IsOSAtLeast (WIN_7))
+ // Undo SHCNE_DRIVEREMOVED
+ if ( DeviceIoControl (hDriver, TC_IOCTL_GET_MOUNTED_VOLUMES, NULL, 0, &mountList, sizeof (mountList), &dwResult, NULL)
+ && mountList.ulMountedDrives
+ && (mountList.ulMountedDrives < (1 << 26))
+ )
{
- // Undo SHCNE_DRIVEREMOVED
- if ( DeviceIoControl (hDriver, TC_IOCTL_GET_MOUNTED_VOLUMES, NULL, 0, &mountList, sizeof (mountList), &dwResult, NULL)
- && mountList.ulMountedDrives
- && (mountList.ulMountedDrives < (1 << 26))
- )
+ for (i = 0; i < 26; i++)
{
- for (i = 0; i < 26; i++)
+ if (mountList.ulMountedDrives & (1 << i))
{
- if (mountList.ulMountedDrives & (1 << i))
- {
- wchar_t root[] = { (wchar_t) i + L'A', L':', L'\\', 0 };
- SHChangeNotify (SHCNE_DRIVEADD, SHCNF_PATH, root, NULL);
- }
+ wchar_t root[] = { (wchar_t) i + L'A', L':', L'\\', 0 };
+ SHChangeNotify (SHCNE_DRIVEADD, SHCNF_PATH, root, NULL);
}
}
}
@@ -5662,18 +5604,16 @@ static BOOL MountAllDevicesThreadCode (HWND hwndDlg, BOOL bPasswordPrompt)
int mountedVolCount = 0;
vector <HostDevice> devices;
int EffectiveVolumePkcs5 = CmdVolumePkcs5;
- BOOL EffectiveVolumeTrueCryptMode = CmdVolumeTrueCryptMode;
/* Priority is given to command line parameters
* Default values used only when nothing specified in command line
*/
if (EffectiveVolumePkcs5 == 0)
EffectiveVolumePkcs5 = DefaultVolumePkcs5;
- if (!EffectiveVolumeTrueCryptMode)
- EffectiveVolumeTrueCryptMode = DefaultVolumeTrueCryptMode;
VolumePassword.Length = 0;
mountOptions = defaultMountOptions;
+ mountOptions.SkipCachedPasswords = FALSE;
bPrebootPasswordDlgMode = FALSE;
VolumePim = -1;
@@ -5691,18 +5631,15 @@ static BOOL MountAllDevicesThreadCode (HWND hwndDlg, BOOL bPasswordPrompt)
if (!CmdVolumePasswordValid && bPasswordPrompt)
{
int GuiPkcs5 = EffectiveVolumePkcs5;
- BOOL GuiTrueCryptMode = EffectiveVolumeTrueCryptMode;
int GuiPim = CmdVolumePim;
PasswordDlgVolume[0] = '\0';
- if (!AskVolumePassword (hwndDlg, &VolumePassword, &GuiPkcs5, &GuiPim, &GuiTrueCryptMode, NULL, TRUE))
+ if (!AskVolumePassword (hwndDlg, &VolumePassword, &GuiPkcs5, &GuiPim, NULL, TRUE))
goto ret;
else
{
VolumePkcs5 = GuiPkcs5;
- VolumeTrueCryptMode = GuiTrueCryptMode;
VolumePim = GuiPim;
burn (&GuiPkcs5, sizeof(GuiPkcs5));
- burn (&GuiTrueCryptMode, sizeof(GuiTrueCryptMode));
burn (&GuiPim, sizeof(GuiPim));
}
}
@@ -5711,7 +5648,6 @@ static BOOL MountAllDevicesThreadCode (HWND hwndDlg, BOOL bPasswordPrompt)
bPasswordPrompt = FALSE;
VolumePassword = CmdVolumePassword;
VolumePkcs5 = EffectiveVolumePkcs5;
- VolumeTrueCryptMode = EffectiveVolumeTrueCryptMode;
VolumePim = CmdVolumePim;
}
@@ -5795,8 +5731,8 @@ static BOOL MountAllDevicesThreadCode (HWND hwndDlg, BOOL bPasswordPrompt)
}
// First try user password then cached passwords
- if ((mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &VolumePassword, VolumePkcs5, VolumePim, VolumeTrueCryptMode, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, TRUE, FALSE)) > 0
- || ((VolumePassword.Length > 0) && ((mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, NULL, VolumePkcs5, VolumePim, VolumeTrueCryptMode, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, TRUE, FALSE)) > 0)))
+ if ((mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &VolumePassword, VolumePkcs5, VolumePim, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, TRUE, FALSE)) > 0
+ || ((VolumePassword.Length > 0) && ((mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, NULL, VolumePkcs5, VolumePim, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, TRUE, FALSE)) > 0)))
{
// A volume has been successfully mounted
@@ -5875,7 +5811,6 @@ static BOOL MountAllDevicesThreadCode (HWND hwndDlg, BOOL bPasswordPrompt)
{
burn (&VolumePassword, sizeof (VolumePassword));
burn (&VolumePkcs5, sizeof (VolumePkcs5));
- burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode));
burn (&VolumePim, sizeof (VolumePim));
burn (&mountOptions.ProtectedHidVolPassword, sizeof (mountOptions.ProtectedHidVolPassword));
burn (&mountOptions.ProtectedHidVolPkcs5Prf, sizeof (mountOptions.ProtectedHidVolPkcs5Prf));
@@ -5899,14 +5834,13 @@ static BOOL MountAllDevicesThreadCode (HWND hwndDlg, BOOL bPasswordPrompt)
}
if (status && CloseSecurityTokenSessionsAfterMount)
- SecurityToken::CloseAllSessions();
+ SecurityToken::CloseAllSessions(); // TODO Use Token
ret:
MultipleMountOperationInProgress = FALSE;
burn (&VolumePassword, sizeof (VolumePassword));
burn (&VolumePkcs5, sizeof (VolumePkcs5));
- burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode));
burn (&VolumePim, sizeof (VolumePim));
burn (&mountOptions.ProtectedHidVolPassword, sizeof (mountOptions.ProtectedHidVolPassword));
burn (&mountOptions.ProtectedHidVolPkcs5Prf, sizeof (mountOptions.ProtectedHidVolPkcs5Prf));
@@ -6633,7 +6567,7 @@ static void ResumeInterruptedNonSysInplaceEncProcess (BOOL bDecrypt)
BOOL SelectContainer (HWND hwndDlg)
{
- if (BrowseFiles (hwndDlg, "OPEN_VOL_TITLE", szFileName, bHistory, FALSE, NULL) == FALSE)
+ if (BrowseFiles (hwndDlg, "OPEN_VOL_TITLE", szFileName, bHistory, FALSE) == FALSE)
return FALSE;
AddComboItem (GetDlgItem (hwndDlg, IDC_VOLUME), szFileName, bHistory);
@@ -6964,12 +6898,12 @@ void DisplayDriveListContextMenu (HWND hwndDlg, LPARAM lParam)
{
case IDPM_SELECT_FILE_AND_MOUNT:
if (SelectContainer (hwndDlg))
- MountSelectedVolume (hwndDlg, FALSE);
+ MountSelectedVolume (hwndDlg, FALSE, FALSE);
break;
case IDPM_SELECT_DEVICE_AND_MOUNT:
if (SelectPartition (hwndDlg))
- MountSelectedVolume (hwndDlg, FALSE);
+ MountSelectedVolume (hwndDlg, FALSE, FALSE);
break;
case IDPM_CHECK_FILESYS:
@@ -7021,6 +6955,7 @@ void DisplayDriveListContextMenu (HWND hwndDlg, LPARAM lParam)
else
{
mountOptions = defaultMountOptions;
+ mountOptions.SkipCachedPasswords = FALSE;
bPrebootPasswordDlgMode = FALSE;
if (CheckMountList (hwndDlg, FALSE))
@@ -7161,7 +7096,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (EnableMemoryProtection)
{
/* Protect this process memory from being accessed by non-admin users */
- EnableProcessProtection ();
+ ActivateMemoryProtection ();
}
if (ComServerMode)
@@ -7249,7 +7184,6 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
BOOL mounted = FALSE;
int EffectiveVolumePkcs5 = CmdVolumePkcs5;
- BOOL EffectiveVolumeTrueCryptMode = CmdVolumeTrueCryptMode;
BOOL bEffectiveTryEmptyPasswordWhenKeyfileUsed = bCmdTryEmptyPasswordWhenKeyfileUsedValid? bCmdTryEmptyPasswordWhenKeyfileUsed : bTryEmptyPasswordWhenKeyfileUsed;
if (!VolumePathExists (szFileName))
@@ -7263,8 +7197,6 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
*/
if (EffectiveVolumePkcs5 == 0)
EffectiveVolumePkcs5 = DefaultVolumePkcs5;
- if (!EffectiveVolumeTrueCryptMode)
- EffectiveVolumeTrueCryptMode = DefaultVolumeTrueCryptMode;
// Command line password or keyfiles
if (CmdVolumePassword.Length != 0 || (FirstCmdKeyFile && (CmdVolumePasswordValid || bEffectiveTryEmptyPasswordWhenKeyfileUsed)))
@@ -7275,7 +7207,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
KeyFilesApply (hwndDlg, &CmdVolumePassword, FirstCmdKeyFile, szFileName);
mounted = MountVolume (hwndDlg, szDriveLetter[0] - L'A',
- szFileName, &CmdVolumePassword, EffectiveVolumePkcs5, CmdVolumePim, EffectiveVolumeTrueCryptMode, bCacheInDriver, bIncludePimInCache, bForceMount,
+ szFileName, &CmdVolumePassword, EffectiveVolumePkcs5, CmdVolumePim, bCacheInDriver, bIncludePimInCache, bForceMount,
&mountOptions, Silent, reportBadPasswd);
burn (&CmdVolumePassword, sizeof (CmdVolumePassword));
@@ -7283,7 +7215,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
else
{
// Cached password
- mounted = MountVolume (hwndDlg, szDriveLetter[0] - L'A', szFileName, NULL, EffectiveVolumePkcs5, CmdVolumePim, EffectiveVolumeTrueCryptMode, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, FALSE);
+ mounted = MountVolume (hwndDlg, szDriveLetter[0] - L'A', szFileName, NULL, EffectiveVolumePkcs5, CmdVolumePim, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, FALSE);
}
if (FirstCmdKeyFile)
@@ -7298,20 +7230,17 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
int GuiPkcs5 = EffectiveVolumePkcs5;
int GuiPim = CmdVolumePim;
- BOOL GuiTrueCryptMode = EffectiveVolumeTrueCryptMode;
VolumePassword.Length = 0;
StringCbCopyW (PasswordDlgVolume, sizeof(PasswordDlgVolume),szFileName);
- if (!AskVolumePassword (hwndDlg, &VolumePassword, &GuiPkcs5, &GuiPim, &GuiTrueCryptMode, NULL, TRUE))
+ if (!AskVolumePassword (hwndDlg, &VolumePassword, &GuiPkcs5, &GuiPim, NULL, TRUE))
break;
else
{
VolumePkcs5 = GuiPkcs5;
VolumePim = GuiPim;
- VolumeTrueCryptMode = GuiTrueCryptMode;
burn (&GuiPkcs5, sizeof(GuiPkcs5));
burn (&GuiPim, sizeof(GuiPim));
- burn (&GuiTrueCryptMode, sizeof(GuiTrueCryptMode));
}
WaitCursor ();
@@ -7319,12 +7248,11 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (KeyFilesEnable && FirstKeyFile)
KeyFilesApply (hwndDlg, &VolumePassword, FirstKeyFile, szFileName);
- mounted = MountVolume (hwndDlg, szDriveLetter[0] - L'A', szFileName, &VolumePassword, VolumePkcs5, VolumePim, VolumeTrueCryptMode, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, FALSE, TRUE);
+ mounted = MountVolume (hwndDlg, szDriveLetter[0] - L'A', szFileName, &VolumePassword, VolumePkcs5, VolumePim, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, FALSE, TRUE);
burn (&VolumePassword, sizeof (VolumePassword));
burn (&VolumePkcs5, sizeof (VolumePkcs5));
burn (&VolumePim, sizeof (VolumePim));
- burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode));
burn (&mountOptions.ProtectedHidVolPassword, sizeof (mountOptions.ProtectedHidVolPassword));
burn (&mountOptions.ProtectedHidVolPkcs5Prf, sizeof (mountOptions.ProtectedHidVolPkcs5Prf));
@@ -7604,7 +7532,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (bWipeCacheOnAutoDismount)
{
DeviceIoControl (hDriver, TC_IOCTL_WIPE_PASSWORD_CACHE, NULL, 0, NULL, 0, &dwResult, NULL);
- SecurityToken::CloseAllSessions();
+ SecurityToken::CloseAllSessions(); // TODO Use Token
}
DismountAll (hwndDlg, bForceAutoDismount, TRUE, UNMOUNT_MAX_AUTO_RETRIES, UNMOUNT_AUTO_RETRY_DELAY);
@@ -7643,7 +7571,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (bWipeCacheOnAutoDismount)
{
DeviceIoControl (hDriver, TC_IOCTL_WIPE_PASSWORD_CACHE, NULL, 0, NULL, 0, &dwResult, NULL);
- SecurityToken::CloseAllSessions();
+ SecurityToken::CloseAllSessions(); // TODO Use Token
}
DismountAll (hwndDlg, bForceAutoDismount, TRUE, UNMOUNT_MAX_AUTO_RETRIES, UNMOUNT_AUTO_RETRY_DELAY);
@@ -7700,7 +7628,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (bWipeCacheOnAutoDismount)
{
DeviceIoControl (hDriver, TC_IOCTL_WIPE_PASSWORD_CACHE, NULL, 0, NULL, 0, &dwResult, NULL);
- SecurityToken::CloseAllSessions();
+ SecurityToken::CloseAllSessions(); // TODO Use Token
}
DismountAll (hwndDlg, bForceAutoDismount, FALSE, UNMOUNT_MAX_AUTO_RETRIES, UNMOUNT_AUTO_RETRY_DELAY);
@@ -8130,6 +8058,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
else if (LOWORD (GetSelectedLong (GetDlgItem (hwndDlg, IDC_DRIVELIST))) == TC_MLIST_ITEM_FREE)
{
mountOptions = defaultMountOptions;
+ mountOptions.SkipCachedPasswords = FALSE;
bPrebootPasswordDlgMode = FALSE;
if (GetAsyncKeyState (VK_CONTROL) < 0)
@@ -8179,6 +8108,18 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
}
}
}
+ else
+ {
+ LPNMHDR pnmh = (LPNMHDR)lParam;
+
+ if (pnmh->idFrom == IDOK && pnmh->code == BCN_DROPDOWN)
+ {
+ // Create a popup menu for the split button
+ HMENU hmenu = CreateMountNoCacheDropdownMenu();
+ HandleMountButtonDropdown(pnmh->hwndFrom, hwndDlg, hmenu);
+ DestroyMenu(hmenu);
+ }
+ }
return 0;
case WM_ERASEBKGND:
@@ -8225,9 +8166,9 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
return 1;
}
- if ((lw == IDOK || lw == IDM_MOUNT_VOLUME || lw == IDM_MOUNT_VOLUME_OPTIONS))
+ if ((lw == IDOK || lw == IDM_MOUNT_VOLUME || lw == IDM_MOUNT_VOLUME_OPTIONS || lw == IDM_MOUNIT_NO_CACHE))
{
- MountSelectedVolume (hwndDlg, lw == IDM_MOUNT_VOLUME_OPTIONS);
+ MountSelectedVolume (hwndDlg, lw == IDM_MOUNT_VOLUME_OPTIONS, lw == IDM_MOUNIT_NO_CACHE);
return 1;
}
@@ -8300,6 +8241,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
mountOptions = defaultMountOptions;
mountOptions.PartitionInInactiveSysEncScope = TRUE;
+ mountOptions.SkipCachedPasswords = FALSE;
bPrebootPasswordDlgMode = TRUE;
if (CheckMountList (hwndDlg, FALSE))
@@ -8585,7 +8527,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
WaitCursor();
finally_do ({ NormalCursor(); });
- SecurityToken::CloseAllSessions();
+ SecurityToken::CloseAllSessions(); // TODO Use Token
}
InfoBalloon (NULL, "ALL_TOKEN_SESSIONS_CLOSED", hwndDlg);
@@ -9147,6 +9089,7 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine)
/* Defaults */
mountOptions.PreserveTimestamp = TRUE;
+ mountOptions.SkipCachedPasswords = FALSE;
if (_wcsicmp (lpszCommandLine, L"-Embedding") == 0)
{
@@ -9184,7 +9127,6 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine)
OptionVolume,
CommandWipeCache,
OptionPkcs5,
- OptionTrueCryptMode,
OptionPim,
OptionTryEmptyPassword,
OptionNoWaitDlg,
@@ -9214,7 +9156,6 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine)
{ OptionSilent, L"/silent", L"/s", FALSE },
{ OptionTokenLib, L"/tokenlib", NULL, FALSE },
{ OptionTokenPin, L"/tokenpin", NULL, FALSE },
- { OptionTrueCryptMode, L"/truecrypt", L"/tc", FALSE },
{ OptionVolume, L"/volume", L"/v", FALSE },
{ CommandWipeCache, L"/wipecache", L"/w", FALSE },
{ OptionTryEmptyPassword, L"/tryemptypass", NULL, FALSE },
@@ -9573,7 +9514,7 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine)
case OptionTokenPin:
{
- wchar_t szTmp[SecurityToken::MaxPasswordLength + 1] = {0};
+ wchar_t szTmp[SecurityToken::MaxPasswordLength + 1] = {0}; // TODO Use Token
if (GetArgumentValue (lpszCommandLineArgs, &i, nNoCommandLineArgs, szTmp, ARRAYSIZE (szTmp)) == HAS_ARGUMENT)
{
if (0 == WideCharToMultiByte (CP_UTF8, 0, szTmp, -1, CmdTokenPin, TC_MAX_PATH, nullptr, nullptr))
@@ -9643,10 +9584,6 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine)
}
break;
- case OptionTrueCryptMode:
- CmdVolumeTrueCryptMode = TRUE;
- break;
-
// no option = file name if there is only one argument
default:
{
@@ -9665,9 +9602,9 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine)
}
}
- if (CmdVolumePasswordValid && (CmdVolumeTrueCryptMode || (CmdMountOptionsValid && bPrebootPasswordDlgMode)))
+ if (CmdVolumePasswordValid && CmdMountOptionsValid && bPrebootPasswordDlgMode)
{
- /* truncate the password to 64 first characer in case of TrueCrypt Mode or System Encryption */
+ /* truncate the password to 64 first characer in case of System Encryption */
if (lstrlen (CmdRawPassword) > MAX_LEGACY_PASSWORD)
{
int iLen;
@@ -9705,6 +9642,70 @@ static HDEVNOTIFY SystemFavoriteServiceNotify = NULL;
DEFINE_GUID(OCL_GUID_DEVCLASS_SOFTWARECOMPONENT, 0x5c4c3332, 0x344d, 0x483c, 0x87, 0x39, 0x25, 0x9e, 0x93, 0x4c, 0x9c, 0xc8);
+// This functions returns a vector containing all devices currently connected to the system
+void BuildDeviceList(std::vector<CDevice>& devices)
+{
+ devices.clear();
+
+ // Get device info set for all devices
+ HDEVINFO hDevInfo = SetupDiGetClassDevs(NULL, NULL, NULL, DIGCF_ALLCLASSES | DIGCF_PRESENT);
+ if (hDevInfo != INVALID_HANDLE_VALUE)
+ {
+ SP_DEVINFO_DATA deviceInfoData;
+ deviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
+
+ // Enumerate through all devices in set
+ for (DWORD i = 0; SetupDiEnumDeviceInfo(hDevInfo, i, &deviceInfoData); i++)
+ {
+ // Get device path
+ WCHAR szDeviceID[MAX_PATH];
+ if (CR_SUCCESS == CM_Get_Device_IDW(deviceInfoData.DevInst, szDeviceID, MAX_PATH, 0))
+ {
+ // Add to vector
+ devices.push_back(CDevice(szDeviceID));
+ }
+ }
+
+ SetupDiDestroyDeviceInfoList(hDevInfo); // Cleanup
+ }
+}
+
+// This function build a device ID value from the dbcc_name field of a DEV_BROADCAST_DEVICEINTERFACE structure
+// In case of error, the device ID is set to an empty string
+// Algorithm taken from https://www.codeproject.com/Articles/14500/Detecting-Hardware-Insertion-and-or-Removal#premain174347
+void GetDeviceID(PDEV_BROADCAST_DEVICEINTERFACE pDevInf, WCHAR* szDevId)
+{
+ szDevId[0] = L'\0';
+ if (lstrlen(pDevInf->dbcc_name) < 4) return;
+ if (lstrlen(pDevInf->dbcc_name) - 4 >= MAX_PATH) return;
+
+ StringCchCopyW(szDevId, MAX_PATH, pDevInf->dbcc_name + 4);
+
+ // find last occurrence of '#'
+ wchar_t *idx = wcsrchr(szDevId, L'#');
+ if(!idx)
+ {
+ szDevId[0] = L'\0';
+ return;
+ }
+
+ // truncate string at last '#'
+ *idx = L'\0';
+
+ // replace '#' with '\\' and convert string to upper case
+ for (wchar_t *p = szDevId; *p; ++p)
+ {
+ if (*p == L'#')
+ {
+ *p = L'\\';
+ }
+ else
+ {
+ *p = towupper((unsigned)*p);
+ }
+ }
+}
+
static void SystemFavoritesServiceLogMessage (const wstring &errorMessage, WORD wType)
{
HANDLE eventSource = RegisterEventSource (NULL, TC_SYSTEM_FAVORITES_SERVICE_NAME);
@@ -9784,6 +9785,9 @@ static void SystemFavoritesServiceUpdateLoaderProcessing (BOOL bForce)
}
}
+// Global vector containing all devices previsouly knwon to the system
+std::vector<CDevice> g_Devices;
+
static DWORD WINAPI SystemFavoritesServiceCtrlHandler ( DWORD dwControl,
DWORD dwEventType,
LPVOID lpEventData,
@@ -9821,6 +9825,18 @@ static DWORD WINAPI SystemFavoritesServiceCtrlHandler ( DWORD dwControl,
}
}
break;
+ case VC_SERVICE_CONTROL_BUILD_DEVICE_LIST:
+ {
+ /* build a list of all devices currently connected to the system */
+ /* ignore if clear keys configuration is already set */
+ if (!(ReadDriverConfigurationFlags() & VC_DRIVER_CONFIG_CLEAR_KEYS_ON_NEW_DEVICE_INSERTION))
+ {
+ SystemFavoritesServiceLogInfo (L"VC_SERVICE_CONTROL_BUILD_DEVICE_LIST received");
+ g_Devices.clear ();
+ BuildDeviceList (g_Devices);
+ }
+ }
+ break;
case SERVICE_CONTROL_DEVICEEVENT:
if (DBT_DEVICEARRIVAL == dwEventType)
{
@@ -9842,13 +9858,44 @@ static DWORD WINAPI SystemFavoritesServiceCtrlHandler ( DWORD dwControl,
{
bClearKeys = FALSE;
}
+ else
+ {
+ WCHAR szDevId[MAX_PATH];
+ GetDeviceID(pInf, szDevId);
+ // device ID must contain "VID_" and "PID_" to be valid and it must not start with "SWD\" or "ROOT\"
+ if (wcsstr(szDevId, L"VID_") && wcsstr(szDevId, L"PID_") && wcsstr(szDevId, L"SWD\\") != szDevId && wcsstr(szDevId, L"ROOT\\") != szDevId)
+ {
+ CDevice dev(szDevId);
+ // look for the device in the list of devices already known to us and if it is there, then don't clear keys
+ if (std::find(g_Devices.begin(), g_Devices.end(), dev) != g_Devices.end())
+ {
+ bClearKeys = FALSE;
+ }
+ else
+ {
+ // trace the device ID of the new device in the log
+ WCHAR szMsg[2*MAX_PATH];
+ StringCbPrintfW(szMsg, sizeof(szMsg), L"SERVICE_CONTROL_DEVICEEVENT - New device ID: %s", szDevId);
+ SystemFavoritesServiceLogInfo (szMsg);
+ }
+ }
+ else
+ {
+ bClearKeys = FALSE;
+ }
+ }
}
if (bClearKeys)
{
DWORD cbBytesReturned = 0;
+
DeviceIoControl (hDriver, VC_IOCTL_EMERGENCY_CLEAR_ALL_KEYS, NULL, 0, NULL, 0, &cbBytesReturned, NULL);
}
+ else
+ {
+ SystemFavoritesServiceLogInfo (L"SERVICE_CONTROL_DEVICEEVENT - DBT_DEVICEARRIVAL ignored");
+ }
}
}
}
@@ -9887,8 +9934,7 @@ static VOID WINAPI SystemFavoritesServiceMain (DWORD argc, LPTSTR *argv)
memset (&SystemFavoritesServiceStatus, 0, sizeof (SystemFavoritesServiceStatus));
SystemFavoritesServiceStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
SystemFavoritesServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP;
- if (IsOSAtLeast (WIN_VISTA))
- SystemFavoritesServiceStatus.dwControlsAccepted |= SERVICE_ACCEPT_PRESHUTDOWN | SERVICE_ACCEPT_SESSIONCHANGE | SERVICE_ACCEPT_POWEREVENT;
+ SystemFavoritesServiceStatus.dwControlsAccepted |= SERVICE_ACCEPT_PRESHUTDOWN | SERVICE_ACCEPT_SESSIONCHANGE | SERVICE_ACCEPT_POWEREVENT;
for (i = 1; i < argc; i++)
{
@@ -10086,7 +10132,6 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpsz
DialogBoxParamW (hInstance, MAKEINTRESOURCEW (IDD_MOUNT_DLG), NULL, (DLGPROC) MainDialogProc,
(LPARAM) lpszCommandLine);
- FinalizeApp ();
/* Terminate */
return 0;
}
@@ -10239,7 +10284,7 @@ void DismountIdleVolumes ()
if (bWipeCacheOnAutoDismount)
{
DeviceIoControl (hDriver, TC_IOCTL_WIPE_PASSWORD_CACHE, NULL, 0, NULL, 0, &dwResult, NULL);
- SecurityToken::CloseAllSessions();
+ SecurityToken::CloseAllSessions(); // TODO Use Token
}
}
}
@@ -10347,7 +10392,7 @@ static BOOL MountFavoriteVolumeBase (HWND hwnd, const FavoriteVolume &favorite,
if (ServiceMode)
SystemFavoritesServiceLogInfo (wstring (L"Mounting system favorite \"") + effectiveVolumePath + L"\"");
- status = Mount (hwnd, drive, (wchar_t *) effectiveVolumePath.c_str(), favorite.Pim, favorite.Pkcs5, favorite.TrueCryptMode);
+ status = Mount (hwnd, drive, (wchar_t *) effectiveVolumePath.c_str(), favorite.Pim, favorite.Pkcs5);
if (ServiceMode)
{
@@ -10423,6 +10468,7 @@ BOOL MountFavoriteVolumes (HWND hwnd, BOOL systemFavorites, BOOL logOnMount, BOO
}
mountOptions = defaultMountOptions;
+ mountOptions.SkipCachedPasswords = FALSE;
VolumePassword.Length = 0;
MultipleMountOperationInProgress = (favoriteVolumeToMount.Path.empty() || FavoriteMountOnArrivalInProgress);
@@ -10564,10 +10610,9 @@ BOOL MountFavoriteVolumes (HWND hwnd, BOOL systemFavorites, BOOL logOnMount, BOO
burn (&VolumePassword, sizeof (VolumePassword));
burn (&VolumePkcs5, sizeof (VolumePkcs5));
burn (&VolumePim, sizeof (VolumePim));
- burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode));
if (bRet && CloseSecurityTokenSessionsAfterMount)
- SecurityToken::CloseAllSessions();
+ SecurityToken::CloseAllSessions(); // TODO Use Token
return bRet;
}
@@ -10745,7 +10790,7 @@ static void HandleHotKey (HWND hwndDlg, WPARAM wParam)
break;
case HK_CLOSE_SECURITY_TOKEN_SESSIONS:
- SecurityToken::CloseAllSessions();
+ SecurityToken::CloseAllSessions(); // TODO Use Token
InfoBalloon (NULL, "ALL_TOKEN_SESSIONS_CLOSED", hwndDlg);
@@ -10837,7 +10882,7 @@ int BackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, const wchar_t *
{
int GuiPkcs5 = ((EffectiveVolumePkcs5 > 0) && (*askPkcs5 == 0))? EffectiveVolumePkcs5 : *askPkcs5;
int GuiPim = ((EffectiveVolumePim > 0) && (*askPim <= 0))? EffectiveVolumePim : *askPim;
- if (!AskVolumePassword (hwndDlg, askPassword, &GuiPkcs5, &GuiPim, &VolumeTrueCryptMode, type == TC_VOLUME_TYPE_HIDDEN ? "ENTER_HIDDEN_VOL_PASSWORD" : "ENTER_NORMAL_VOL_PASSWORD", FALSE))
+ if (!AskVolumePassword (hwndDlg, askPassword, &GuiPkcs5, &GuiPim, type == TC_VOLUME_TYPE_HIDDEN ? "ENTER_HIDDEN_VOL_PASSWORD" : "ENTER_NORMAL_VOL_PASSWORD", FALSE))
{
nStatus = ERR_SUCCESS;
goto ret;
@@ -10855,7 +10900,7 @@ int BackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, const wchar_t *
if (KeyFilesEnable && FirstKeyFile)
KeyFilesApply (hwndDlg, askPassword, FirstKeyFile, lpszVolume);
- nStatus = OpenVolume (askVol, lpszVolume, askPassword, *askPkcs5, *askPim, VolumeTrueCryptMode, FALSE, bPreserveTimestamp, FALSE);
+ nStatus = OpenVolume (askVol, lpszVolume, askPassword, *askPkcs5, *askPim, FALSE, bPreserveTimestamp, FALSE);
NormalCursor();
@@ -10912,7 +10957,7 @@ noHidden:
goto ret;
/* Select backup file */
- if (!BrowseFiles (hwndDlg, "OPEN_TITLE", szFileName, bHistory, TRUE, NULL))
+ if (!BrowseFiles (hwndDlg, "OPEN_TITLE", szFileName, bHistory, TRUE))
goto ret;
/* Conceive the backup file */
@@ -11013,7 +11058,6 @@ error:
burn (&VolumePassword, sizeof (VolumePassword));
burn (&VolumePkcs5, sizeof (VolumePkcs5));
burn (&VolumePim, sizeof (VolumePim));
- burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode));
burn (&hiddenVolPassword, sizeof (hiddenVolPassword));
burn (temporaryKey, sizeof (temporaryKey));
burn (originalK2, sizeof (originalK2));
@@ -11125,7 +11169,7 @@ int RestoreVolumeHeader (HWND hwndDlg, const wchar_t *lpszVolume)
int GuiPkcs5 = ((EffectiveVolumePkcs5 > 0) && (VolumePkcs5 == 0))? EffectiveVolumePkcs5 : VolumePkcs5;
int GuiPim = ((EffectiveVolumePim > 0) && (VolumePim <= 0))? EffectiveVolumePim : VolumePim;
StringCbCopyW (PasswordDlgVolume, sizeof(PasswordDlgVolume), lpszVolume);
- if (!AskVolumePassword (hwndDlg, &VolumePassword, &GuiPkcs5, &GuiPim, &VolumeTrueCryptMode, NULL, FALSE))
+ if (!AskVolumePassword (hwndDlg, &VolumePassword, &GuiPkcs5, &GuiPim, NULL, FALSE))
{
nStatus = ERR_SUCCESS;
goto ret;
@@ -11143,7 +11187,7 @@ int RestoreVolumeHeader (HWND hwndDlg, const wchar_t *lpszVolume)
if (KeyFilesEnable && FirstKeyFile)
KeyFilesApply (hwndDlg, &VolumePassword, FirstKeyFile, lpszVolume);
- nStatus = OpenVolume (&volume, lpszVolume, &VolumePassword, VolumePkcs5, VolumePim, VolumeTrueCryptMode,TRUE, bPreserveTimestamp, TRUE);
+ nStatus = OpenVolume (&volume, lpszVolume, &VolumePassword, VolumePkcs5, VolumePim,TRUE, bPreserveTimestamp, TRUE);
NormalCursor();
@@ -11196,7 +11240,7 @@ int RestoreVolumeHeader (HWND hwndDlg, const wchar_t *lpszVolume)
}
/* Select backup file */
- if (!BrowseFiles (hwndDlg, "OPEN_TITLE", szFileName, bHistory, FALSE, NULL))
+ if (!BrowseFiles (hwndDlg, "OPEN_TITLE", szFileName, bHistory, FALSE))
{
nStatus = ERR_SUCCESS;
goto ret;
@@ -11366,7 +11410,7 @@ int RestoreVolumeHeader (HWND hwndDlg, const wchar_t *lpszVolume)
{
int GuiPkcs5 = ((EffectiveVolumePkcs5 > 0) && (VolumePkcs5 == 0))? EffectiveVolumePkcs5 : VolumePkcs5;
int GuiPim = ((EffectiveVolumePim > 0) && (VolumePim <= 0))? EffectiveVolumePim : VolumePim;
- if (!AskVolumePassword (hwndDlg, &VolumePassword, &GuiPkcs5, &GuiPim, &VolumeTrueCryptMode, "ENTER_HEADER_BACKUP_PASSWORD", FALSE))
+ if (!AskVolumePassword (hwndDlg, &VolumePassword, &GuiPkcs5, &GuiPim, "ENTER_HEADER_BACKUP_PASSWORD", FALSE))
{
nStatus = ERR_SUCCESS;
goto ret;
@@ -11389,7 +11433,7 @@ int RestoreVolumeHeader (HWND hwndDlg, const wchar_t *lpszVolume)
if (type == TC_VOLUME_TYPE_HIDDEN)
headerOffsetBackupFile += (legacyBackup ? TC_VOLUME_HEADER_SIZE_LEGACY : TC_VOLUME_HEADER_SIZE);
- nStatus = ReadVolumeHeader (FALSE, buffer + headerOffsetBackupFile, &VolumePassword, VolumePkcs5, VolumePim, VolumeTrueCryptMode, &restoredCryptoInfo, NULL);
+ nStatus = ReadVolumeHeader (FALSE, buffer + headerOffsetBackupFile, &VolumePassword, VolumePkcs5, VolumePim, &restoredCryptoInfo, NULL);
if (nStatus == ERR_SUCCESS)
break;
}
@@ -11495,7 +11539,6 @@ error:
burn (&VolumePassword, sizeof (VolumePassword));
burn (&VolumePkcs5, sizeof (VolumePkcs5));
burn (&VolumePim, sizeof (VolumePim));
- burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode));
RestoreDefaultKeyFilesParam();
RandStop (FALSE);
NormalCursor();
@@ -11516,8 +11559,22 @@ void SetServiceConfigurationFlag (uint32 flag, BOOL state)
BootEncObj->SetServiceConfigurationFlag (flag, state ? true : false);
}
+void SetMemoryProtectionConfig (BOOL bEnable)
+{
+ DWORD config = bEnable? 1: 0;
+ if (BootEncObj)
+ BootEncObj->WriteLocalMachineRegistryDwordValue (L"SYSTEM\\CurrentControlSet\\Services\\veracrypt", VC_ENABLE_MEMORY_PROTECTION, config);
+}
+
+void NotifyService (DWORD dwNotifyCmd)
+{
+ if (BootEncObj)
+ BootEncObj->NotifyService (dwNotifyCmd);
+}
+
static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
+ static HWND hDisableMemProtectionTooltipWnd = NULL;
WORD lw = LOWORD (wParam);
switch (msg)
@@ -11551,7 +11608,7 @@ static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM
EnableWindow (GetDlgItem (hwndDlg, IDC_ENABLE_CPU_RNG), FALSE);
}
- if (IsOSAtLeast (WIN_7) && IsRamEncryptionSupported())
+ if (IsRamEncryptionSupported())
{
CheckDlgButton (hwndDlg, IDC_ENABLE_RAM_ENCRYPTION, (driverConfig & VC_DRIVER_CONFIG_ENABLE_RAM_ENCRYPTION) ? BST_CHECKED : BST_UNCHECKED);
}
@@ -11561,6 +11618,8 @@ static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM
EnableWindow (GetDlgItem (hwndDlg, IDC_ENABLE_RAM_ENCRYPTION), FALSE);
}
+ CheckDlgButton (hwndDlg, IDC_DISABLE_MEMORY_PROTECTION, ReadMemoryProtectionConfig() ? BST_UNCHECKED : BST_CHECKED);
+
size_t cpuCount = GetCpuCount(NULL);
HWND freeCpuCombo = GetDlgItem (hwndDlg, IDC_ENCRYPTION_FREE_CPU_COUNT);
@@ -11594,9 +11653,24 @@ static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM
ToHyperlink (hwndDlg, IDC_MORE_INFO_ON_HW_ACCELERATION);
ToHyperlink (hwndDlg, IDC_MORE_INFO_ON_THREAD_BASED_PARALLELIZATION);
+
+ hDisableMemProtectionTooltipWnd = CreateToolTip (IDC_DISABLE_MEMORY_PROTECTION, hwndDlg, "DISABLE_MEMORY_PROTECTION_WARNING");
+ // make IDC_DISABLE_MEMORY_PROTECTION control fit the text so that the tooltip is shown only when mouse is over the text
+ AccommodateCheckBoxTextWidth(hwndDlg, IDC_DISABLE_MEMORY_PROTECTION);
+ // make the help button adjacent to the checkbox
+ MakeControlsContiguous(hwndDlg, IDC_DISABLE_MEMORY_PROTECTION, IDC_DISABLE_MEMORY_PROTECTION_HELP);
}
return 0;
+ // handle message to destroy hDisableMemProtectionTooltipWnd when the dialog is closed
+ case WM_DESTROY:
+ if (hDisableMemProtectionTooltipWnd)
+ {
+ DestroyWindow (hDisableMemProtectionTooltipWnd);
+ hDisableMemProtectionTooltipWnd = NULL;
+ }
+ break;
+
case WM_COMMAND:
switch (lw)
@@ -11620,6 +11694,7 @@ static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM
BOOL enableExtendedIOCTL = IsDlgButtonChecked (hwndDlg, IDC_ENABLE_EXTENDED_IOCTL_SUPPORT);
BOOL allowTrimCommand = IsDlgButtonChecked (hwndDlg, IDC_ALLOW_TRIM_NONSYS_SSD);
BOOL allowWindowsDefrag = IsDlgButtonChecked (hwndDlg, IDC_ALLOW_WINDOWS_DEFRAG);
+ BOOL bDisableMemoryProtection = IsDlgButtonChecked (hwndDlg, IDC_DISABLE_MEMORY_PROTECTION);
try
{
@@ -11663,32 +11738,35 @@ static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM
if (IsOSAtLeast (WIN_8_1))
SetDriverConfigurationFlag (VC_DRIVER_CONFIG_ALLOW_WINDOWS_DEFRAG, allowWindowsDefrag);
SetDriverConfigurationFlag (VC_DRIVER_CONFIG_ENABLE_CPU_RNG, enableCpuRng);
- if (IsOSAtLeast (WIN_7))
+
+ BOOL originalRamEncryptionEnabled = (driverConfig & VC_DRIVER_CONFIG_ENABLE_RAM_ENCRYPTION)? TRUE : FALSE;
+ if (originalRamEncryptionEnabled != enableRamEncryption)
{
- BOOL originalRamEncryptionEnabled = (driverConfig & VC_DRIVER_CONFIG_ENABLE_RAM_ENCRYPTION)? TRUE : FALSE;
- if (originalRamEncryptionEnabled != enableRamEncryption)
+ if (enableRamEncryption)
{
- if (enableRamEncryption)
+ // Disable Hibernate and Fast Startup if they are enabled
+ BOOL bHibernateEnabled, bHiberbootEnabled;
+ if (GetHibernateStatus (bHibernateEnabled, bHiberbootEnabled))
{
- // Disable Hibernate and Fast Startup if they are enabled
- BOOL bHibernateEnabled, bHiberbootEnabled;
- if (GetHibernateStatus (bHibernateEnabled, bHiberbootEnabled))
- {
- if (bHibernateEnabled)
- {
- BootEncObj->WriteLocalMachineRegistryDwordValue (L"SYSTEM\\CurrentControlSet\\Control\\Power", L"HibernateEnabled", 0);
- }
+ if (bHibernateEnabled)
+ {
+ BootEncObj->WriteLocalMachineRegistryDwordValue (L"SYSTEM\\CurrentControlSet\\Control\\Power", L"HibernateEnabled", 0);
+ }
- if (bHiberbootEnabled)
- {
- BootEncObj->WriteLocalMachineRegistryDwordValue (L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Power", L"HiberbootEnabled", 0);
- }
+ if (bHiberbootEnabled)
+ {
+ BootEncObj->WriteLocalMachineRegistryDwordValue (L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Power", L"HiberbootEnabled", 0);
}
}
- rebootRequired = true;
}
- SetDriverConfigurationFlag (VC_DRIVER_CONFIG_ENABLE_RAM_ENCRYPTION, enableRamEncryption);
+ rebootRequired = true;
}
+ SetDriverConfigurationFlag (VC_DRIVER_CONFIG_ENABLE_RAM_ENCRYPTION, enableRamEncryption);
+
+ BOOL originalDisableMemoryProtection = !ReadMemoryProtectionConfig();
+ if(originalDisableMemoryProtection != bDisableMemoryProtection)
+ rebootRequired = true;
+ SetMemoryProtectionConfig (!bDisableMemoryProtection);
DWORD bytesReturned;
if (!DeviceIoControl (hDriver, TC_IOCTL_REREAD_DRIVER_CONFIG, NULL, 0, NULL, 0, &bytesReturned, NULL))
@@ -11784,6 +11862,24 @@ static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM
}
return 1;
+ case IDC_DISABLE_MEMORY_PROTECTION:
+ {
+ BOOL disableMemoryProtection = IsDlgButtonChecked (hwndDlg, IDC_DISABLE_MEMORY_PROTECTION);
+ BOOL originalDisableMemoryProtection = !ReadMemoryProtectionConfig();
+ if (disableMemoryProtection != originalDisableMemoryProtection)
+ {
+ if (disableMemoryProtection)
+ {
+ Warning ("DISABLE_MEMORY_PROTECTION_WARNING", hwndDlg);
+ }
+
+ Warning ("SETTING_REQUIRES_REBOOT", hwndDlg);
+ }
+ }
+ return 1;
+ case IDC_DISABLE_MEMORY_PROTECTION_HELP:
+ Applink ("memoryprotection");
+ return 1;
case IDC_BENCHMARK:
Benchmark (hwndDlg);
return 1;
@@ -11814,6 +11910,7 @@ static BOOL CALLBACK SecurityTokenPreferencesDlgProc (HWND hwndDlg, UINT msg, WP
LocalizeDialog (hwndDlg, "IDD_TOKEN_PREFERENCES");
SetDlgItemText (hwndDlg, IDC_PKCS11_MODULE, SecurityTokenLibraryPath);
CheckDlgButton (hwndDlg, IDC_CLOSE_TOKEN_SESSION_AFTER_MOUNT, CloseSecurityTokenSessionsAfterMount ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton (hwndDlg, IDC_ENABLE_EMV_SUPPORT, EMVSupportEnabled ? BST_CHECKED : BST_UNCHECKED);
SetWindowTextW (GetDlgItem (hwndDlg, IDT_PKCS11_LIB_HELP), GetString("PKCS11_LIB_LOCATION_HELP"));
@@ -11836,7 +11933,7 @@ static BOOL CALLBACK SecurityTokenPreferencesDlgProc (HWND hwndDlg, UINT msg, WP
{
try
{
- SecurityToken::CloseLibrary();
+ SecurityToken::CloseLibrary(); // TODO Use Token
}
catch (...) { }
@@ -11856,7 +11953,7 @@ static BOOL CALLBACK SecurityTokenPreferencesDlgProc (HWND hwndDlg, UINT msg, WP
}
CloseSecurityTokenSessionsAfterMount = (IsDlgButtonChecked (hwndDlg, IDC_CLOSE_TOKEN_SESSION_AFTER_MOUNT) == BST_CHECKED);
-
+ EMVSupportEnabled = (IsDlgButtonChecked (hwndDlg, IDC_ENABLE_EMV_SUPPORT) == BST_CHECKED);
WaitCursor ();
SaveSettings (hwndDlg);
NormalCursor ();
@@ -11960,9 +12057,6 @@ static BOOL CALLBACK DefaultMountParametersDlgProc (HWND hwndDlg, UINT msg, WPAR
{
LocalizeDialog (hwndDlg, "IDD_DEFAULT_MOUNT_PARAMETERS");
- SendMessage (GetDlgItem (hwndDlg, IDC_TRUECRYPT_MODE), BM_SETCHECK,
- DefaultVolumeTrueCryptMode ? BST_CHECKED:BST_UNCHECKED, 0);
-
/* Populate the PRF algorithms list */
int i, nIndex, defaultPrfIndex = 0;
HWND hComboBox = GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID);
@@ -11996,25 +12090,14 @@ static BOOL CALLBACK DefaultMountParametersDlgProc (HWND hwndDlg, UINT msg, WPAR
case IDOK:
{
int pkcs5 = (int) SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETITEMDATA, SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETCURSEL, 0, 0), 0);
- BOOL truecryptMode = GetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE);
- /* check that PRF is supported in TrueCrypt Mode */
- if ( (truecryptMode)
- && (!is_pkcs5_prf_supported(pkcs5, TRUE, PRF_BOOT_NO))
- )
- {
- Error ("ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE", hwndDlg);
- }
- else
- {
- WaitCursor ();
- DefaultVolumeTrueCryptMode = truecryptMode;
- DefaultVolumePkcs5 = pkcs5;
- SaveSettings (hwndDlg);
+ WaitCursor ();
+ DefaultVolumePkcs5 = pkcs5;
- NormalCursor ();
- EndDialog (hwndDlg, lw);
- }
+ SaveSettings (hwndDlg);
+
+ NormalCursor ();
+ EndDialog (hwndDlg, lw);
return 1;
}
@@ -12293,6 +12376,8 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA
SetDriverConfigurationFlag (TC_DRIVER_CONFIG_CACHE_BOOT_PASSWORD, bPasswordCacheEnabled);
SetDriverConfigurationFlag (TC_DRIVER_CONFIG_CACHE_BOOT_PIM, (bPasswordCacheEnabled && bPimCacheEnabled)? TRUE : FALSE);
SetDriverConfigurationFlag (TC_DRIVER_CONFIG_DISABLE_EVIL_MAID_ATTACK_DETECTION, IsDlgButtonChecked (hwndDlg, IDC_DISABLE_EVIL_MAID_ATTACK_DETECTION));
+ if (bClearKeysEnabled)
+ NotifyService (VC_DRIVER_CONFIG_CLEAR_KEYS_ON_NEW_DEVICE_INSERTION);
SetDriverConfigurationFlag (VC_DRIVER_CONFIG_CLEAR_KEYS_ON_NEW_DEVICE_INSERTION, bClearKeysEnabled);
SetServiceConfigurationFlag (VC_SYSTEM_FAVORITES_SERVICE_CONFIG_DONT_UPDATE_LOADER, bAutoFixBootloader? FALSE : TRUE);
if (!IsHiddenOSRunning ())
@@ -12397,7 +12482,7 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA
}
-void MountSelectedVolume (HWND hwndDlg, BOOL mountWithOptions)
+void MountSelectedVolume (HWND hwndDlg, BOOL mountWithOptions, BOOL skipCachedPasswords)
{
if (!VolumeSelected(hwndDlg))
{
@@ -12406,6 +12491,7 @@ void MountSelectedVolume (HWND hwndDlg, BOOL mountWithOptions)
else if (LOWORD (GetSelectedLong (GetDlgItem (hwndDlg, IDC_DRIVELIST))) == TC_MLIST_ITEM_FREE)
{
mountOptions = defaultMountOptions;
+ mountOptions.SkipCachedPasswords = skipCachedPasswords;
bPrebootPasswordDlgMode = FALSE;
if (mountWithOptions || GetAsyncKeyState (VK_CONTROL) < 0)
diff --git a/src/Mount/Mount.h b/src/Mount/Mount.h
index bbe05c38..cd2636b1 100644
--- a/src/Mount/Mount.h
+++ b/src/Mount/Mount.h
@@ -55,7 +55,6 @@ typedef struct
Password *password;
int* pkcs5;
int* pim;
- BOOL* truecryptMode;
} PasswordDlgParam;
extern VOLUME_NOTIFICATIONS_LIST VolumeNotificationsList;
@@ -108,7 +107,7 @@ int RestoreVolumeHeader (HWND hwndDlg, const wchar_t *lpszVolume);
void SecurityTokenPreferencesDialog (HWND hwndDlg);
static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-void MountSelectedVolume (HWND hwndDlg, BOOL mountWithOptions);
+void MountSelectedVolume (HWND hwndDlg, BOOL mountWithOptions, BOOL skipCachedPasswords);
uint32 ReadDriverConfigurationFlags ();
void HookMouseWheel (HWND hwndDlg, UINT ctrlId);
static BOOL HandleDriveListMouseWheelEvent (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL bListMustBePointed);
@@ -129,4 +128,42 @@ void SetDriverConfigurationFlag (uint32 flag, BOOL state);
BOOL MountFavoriteVolumes (HWND hwnd, BOOL systemFavorites = FALSE, BOOL logOnMount = FALSE, BOOL hotKeyMount = FALSE, const VeraCrypt::FavoriteVolume &favoriteVolumeToMount = VeraCrypt::FavoriteVolume());
void __cdecl mountFavoriteVolumeThreadFunction (void *pArg);
+// A class that represents a device based on its device ID
+class CDevice
+{
+public:
+ WCHAR m_szDeviceID[MAX_PATH];
+
+ CDevice()
+ {
+ ZeroMemory(m_szDeviceID, sizeof(m_szDeviceID));
+ }
+
+ CDevice(WCHAR* szDevicePath)
+ {
+ StringCchCopyW(m_szDeviceID, MAX_PATH, szDevicePath);
+ }
+
+ CDevice(const CDevice& src)
+ {
+ StringCchCopyW(m_szDeviceID, MAX_PATH, src.m_szDeviceID);
+ }
+
+ CDevice& operator=(const CDevice& src)
+ {
+ StringCchCopyW(m_szDeviceID, MAX_PATH, src.m_szDeviceID);
+ return *this;
+ }
+
+ BOOL operator==(const CDevice& src)
+ {
+ return wcscmp(m_szDeviceID, src.m_szDeviceID) == 0;
+ }
+
+ ~CDevice()
+ {
+ }
+};
+
+
#endif
diff --git a/src/Mount/Mount.manifest b/src/Mount/Mount.manifest
index 5d4cb896..79d86799 100644
--- a/src/Mount/Mount.manifest
+++ b/src/Mount/Mount.manifest
@@ -14,7 +14,13 @@
</asmv3:application>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
- <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
+ <!-- Windows 10 and Windows 11 -->
+ <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
+ <!-- Windows 8.1 -->
+ <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
+ <!-- Windows 8 -->
+ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
+ <!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
</application>
</compatibility>
diff --git a/src/Mount/Mount.rc b/src/Mount/Mount.rc
index 8f474910..7827bab9 100644
--- a/src/Mount/Mount.rc
+++ b/src/Mount/Mount.rc
@@ -123,7 +123,6 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
EDITTEXT IDC_OLD_PASSWORD,89,14,181,13,ES_PASSWORD | ES_AUTOHSCROLL
COMBOBOX IDC_PKCS5_OLD_PRF_ID,89,33,97,90,CBS_DROPDOWNLIST | WS_TABSTOP
- CONTROL "TrueCrypt Mode",IDC_TRUECRYPT_MODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,193,35,83,10
EDITTEXT IDC_OLD_PIM,89,51,42,14,ES_RIGHT | ES_PASSWORD | ES_AUTOHSCROLL | ES_NUMBER | NOT WS_VISIBLE
CONTROL "Use P&IM",IDC_PIM_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,59,115,10
CONTROL "Use keyfiles",IDC_ENABLE_KEYFILES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,72,109,10
@@ -191,7 +190,6 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
EDITTEXT IDC_PASSWORD,69,8,179,14,ES_PASSWORD | ES_AUTOHSCROLL
COMBOBOX IDC_PKCS5_PRF_ID,69,26,96,90,CBS_DROPDOWNLIST | WS_TABSTOP
- CONTROL "&TrueCrypt Mode",IDC_TRUECRYPT_MODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,28,76,10
EDITTEXT IDC_PIM,69,43,42,14,ES_RIGHT | ES_PASSWORD | ES_AUTOHSCROLL | ES_NUMBER | NOT WS_VISIBLE
CONTROL "Use P&IM",IDC_PIM_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,48,97,10
CONTROL "Cache passwords and keyfil&es in memory",IDC_CACHE,
@@ -270,7 +268,7 @@ BEGIN
GROUPBOX "Shortcut",IDT_ASSIGN_HOTKEY,7,127,375,53
END
-IDD_TOKEN_PREFERENCES DIALOGEX 0, 0, 316, 199
+IDD_TOKEN_PREFERENCES DIALOGEX 0, 0, 316, 229
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "VeraCrypt - Security Token Preferences"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
@@ -280,10 +278,12 @@ BEGIN
PUSHBUTTON "Auto-&Detect Library",IDC_AUTO_DETECT_PKCS11_MODULE,16,41,112,14
CONTROL "&Close token session (log out) after a volume is successfully mounted",IDC_CLOSE_TOKEN_SESSION_AFTER_MOUNT,
"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,16,154,284,9
- DEFPUSHBUTTON "OK",IDOK,205,178,50,14
- PUSHBUTTON "Cancel",IDCANCEL,259,178,50,14
+ CONTROL "&Enable EMV Support",IDC_ENABLE_EMV_SUPPORT,"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,16,185,284,9
+ DEFPUSHBUTTON "OK",IDOK,205,208,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,259,208,50,14
GROUPBOX "PKCS #11 Library Path",IDT_PKCS11_LIB_PATH,7,7,302,129
GROUPBOX "Security Options",IDT_SECURITY_OPTIONS,7,140,302,30
+ GROUPBOX "EMV Options",IDT_EMV_OPTIONS,7,172,302,30
LTEXT "",IDT_PKCS11_LIB_HELP,16,63,286,65
END
@@ -321,7 +321,7 @@ BEGIN
DEFPUSHBUTTON "OK",IDOK,255,226,50,14
END
-IDD_PERFORMANCE_SETTINGS DIALOGEX 0, 0, 371, 293
+IDD_PERFORMANCE_SETTINGS DIALOGEX 0, 0, 371, 300
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "VeraCrypt - Performance Options"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
@@ -338,20 +338,23 @@ BEGIN
CONTROL "Enable extended disk control codes support",IDC_ENABLE_EXTENDED_IOCTL_SUPPORT,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,198,337,10
CONTROL "Allow TRIM command for non-system SSD partition/drive",IDC_ALLOW_TRIM_NONSYS_SSD,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,212,337,10
- PUSHBUTTON "&Benchmark",IDC_BENCHMARK,7,272,59,14
- DEFPUSHBUTTON "OK",IDOK,257,272,50,14
- PUSHBUTTON "Cancel",IDCANCEL,314,272,50,14
- LTEXT "Processor (CPU) in this computer supports hardware acceleration for AES:",IDT_HW_AES_SUPPORTED_BY_CPU,18,23,273,9
- GROUPBOX "Hardware Acceleration",IDT_ACCELERATION_OPTIONS,7,6,355,74
- GROUPBOX "Thread-Based Parallelization",IDT_PARALLELIZATION_OPTIONS,7,84,355,93
- GROUPBOX "Driver Configuration",IDT_DRIVER_OPTIONS,7,183,357,86
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,211,337,10
CONTROL "Allow Windows Disk Defragmenter to defragment non-system partition/drive",IDC_ALLOW_WINDOWS_DEFRAG,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,226,337,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,224,337,10
CONTROL "Use CPU hardware random generator as an additional source of entropy",IDC_ENABLE_CPU_RNG,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,240,335,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,237,335,10
CONTROL "Activate encryption of keys and passwords stored in RAM",IDC_ENABLE_RAM_ENCRYPTION,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,254,337,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,250,337,10
+ CONTROL "Disable memory protection for Accessibility tools compatibility",IDC_DISABLE_MEMORY_PROTECTION,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,263,339,10
+ PUSHBUTTON "?",IDC_DISABLE_MEMORY_PROTECTION_HELP,364,259,7,14
+ PUSHBUTTON "&Benchmark",IDC_BENCHMARK,7,279,59,14
+ DEFPUSHBUTTON "OK",IDOK,257,279,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,314,279,50,14
+ LTEXT "Processor (CPU) in this computer supports hardware acceleration for AES:",IDT_HW_AES_SUPPORTED_BY_CPU,18,23,273,9
+ GROUPBOX "Hardware Acceleration",IDT_ACCELERATION_OPTIONS,7,6,355,74
+ GROUPBOX "Thread-Based Parallelization",IDT_PARALLELIZATION_OPTIONS,7,84,355,93
+ GROUPBOX "Driver Configuration",IDT_DRIVER_OPTIONS,7,183,357,95
END
IDD_FAVORITE_VOLUMES DIALOGEX 0, 0, 380, 368
@@ -393,7 +396,6 @@ BEGIN
CONTROL "Use Volume ID to mount favorite",IDC_FAVORITE_USE_VOLUME_ID,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,148,337,10
COMBOBOX IDC_PKCS5_PRF_ID,87,166,96,90,CBS_DROPDOWNLIST | WS_TABSTOP
- CONTROL "TrueCrypt Mode",IDC_TRUECRYPT_MODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,189,168,76,10
LTEXT "PKCS-5 PRF:",IDT_PKCS5_PRF,19,168,63,10
END
@@ -406,7 +408,6 @@ BEGIN
PUSHBUTTON "Cancel",IDCANCEL,111,44,50,14
COMBOBOX IDC_PKCS5_PRF_ID,57,24,103,90,CBS_DROPDOWNLIST | WS_TABSTOP
LTEXT "PKCS-5 PRF:",IDT_PKCS5_PRF,8,26,44,11
- CONTROL "TrueCrypt Mode",IDC_TRUECRYPT_MODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,76,10
END
IDD_SYSENC_SETTINGS DIALOGEX 0, 0, 371, 344
@@ -523,7 +524,7 @@ BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 364
TOPMARGIN, 7
- BOTTOMMARGIN, 286
+ BOTTOMMARGIN, 293
END
IDD_FAVORITE_VOLUMES, DIALOG
@@ -559,8 +560,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,26,0,0
- PRODUCTVERSION 1,26,0,0
+ FILEVERSION 1,26,10,0
+ PRODUCTVERSION 1,26,10,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -577,11 +578,11 @@ BEGIN
BEGIN
VALUE "CompanyName", "IDRIX"
VALUE "FileDescription", "VeraCrypt"
- VALUE "FileVersion", "1.26"
+ VALUE "FileVersion", "1.26.10"
VALUE "LegalTrademarks", "VeraCrypt"
VALUE "OriginalFilename", "VeraCrypt.exe"
VALUE "ProductName", "VeraCrypt"
- VALUE "ProductVersion", "1.26"
+ VALUE "ProductVersion", "1.26.10"
END
END
BLOCK "VarFileInfo"
diff --git a/src/Mount/Mount.vcxproj b/src/Mount/Mount.vcxproj
index 1c55193a..01d013f7 100644
--- a/src/Mount/Mount.vcxproj
+++ b/src/Mount/Mount.vcxproj
@@ -190,7 +190,7 @@
<AdditionalDependencies>..\Crypto\Debug\crypto.lib;..\Common\Debug\Zip.lib;..\Common\Debug\lzma.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCrypt.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)Mount.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
@@ -239,7 +239,7 @@ copy Debug\VeraCrypt.exe "..\Debug\Setup Files" &gt;NUL:
<AdditionalDependencies>..\Crypto\x64\Debug\crypto.lib;..\Common\x64\Debug\Zip.lib;..\Common\x64\Debug\lzma.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCrypt.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)Mount.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
@@ -285,7 +285,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt-x64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\Release\crypto.lib;..\Common\Release\Zip.lib;..\Common\Release\lzma.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCrypt.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -328,7 +328,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt-x64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\Release\crypto.lib;..\Common\Release\Zip.lib;..\Common\Release\lzma.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCrypt.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -371,7 +371,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt-x64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\Release\crypto.lib;..\Common\Release\Zip.lib;..\Common\Release\lzma.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCrypt.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -418,7 +418,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt-x64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;..\Common\x64\Release\lzma.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCrypt.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -465,7 +465,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt-x64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;..\Common\x64\Release\lzma.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCrypt.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -512,7 +512,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt-x64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;..\Common\x64\Release\lzma.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCrypt.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -533,6 +533,17 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt-x64.exe" &gt;NUL:
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
+ <ClCompile Include="..\Common\CommandAPDU.cpp" />
+ <ClCompile Include="..\Common\EMVCard.cpp" />
+ <ClCompile Include="..\Common\EMVToken.cpp" />
+ <ClCompile Include="..\Common\PCSCException.cpp" />
+ <ClCompile Include="..\Common\ResponseAPDU.cpp" />
+ <ClCompile Include="..\Common\SCard.cpp" />
+ <ClCompile Include="..\Common\SCardLoader.cpp" />
+ <ClCompile Include="..\Common\SCardManager.cpp" />
+ <ClCompile Include="..\Common\SCardReader.cpp" />
+ <ClCompile Include="..\Common\TLVParser.cpp" />
+ <ClCompile Include="..\Common\Token.cpp" />
<ClCompile Include="..\Setup\SelfExtract.c" />
<ClCompile Include="Favorites.cpp" />
<ClCompile Include="Hotkeys.c" />
@@ -602,6 +613,17 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt-x64.exe" &gt;NUL:
<Midl Include="MainCom.idl" />
</ItemGroup>
<ItemGroup>
+ <ClInclude Include="..\Common\CommandAPDU.h" />
+ <ClInclude Include="..\Common\EMVCard.h" />
+ <ClInclude Include="..\Common\EMVToken.h" />
+ <ClInclude Include="..\Common\PCSCException.h" />
+ <ClInclude Include="..\Common\ResponseAPDU.h" />
+ <ClInclude Include="..\Common\SCard.h" />
+ <ClInclude Include="..\Common\SCardLoader.h" />
+ <ClInclude Include="..\Common\SCardManager.h" />
+ <ClInclude Include="..\Common\SCardReader.h" />
+ <ClInclude Include="..\Common\TLVParser.h" />
+ <ClInclude Include="..\Common\Token.h" />
<ClInclude Include="..\Common\Wipe.h" />
<ClInclude Include="..\Common\Apidrvr.h" />
<ClInclude Include="..\Common\BaseCom.h" />
diff --git a/src/Mount/Mount.vcxproj.filters b/src/Mount/Mount.vcxproj.filters
index e1dfd652..d5014051 100644
--- a/src/Mount/Mount.vcxproj.filters
+++ b/src/Mount/Mount.vcxproj.filters
@@ -108,6 +108,39 @@
<ClCompile Include="..\Setup\SelfExtract.c">
<Filter>Source Files\Setup</Filter>
</ClCompile>
+ <ClCompile Include="..\Common\EMVToken.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\Token.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\TLVParser.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\CommandAPDU.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\PCSCException.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\ResponseAPDU.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\SCardLoader.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\SCardManager.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\SCardReader.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\EMVCard.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\Common\SCard.cpp">
+ <Filter>Source Files\Common</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<Midl Include="MainCom.idl">
@@ -211,6 +244,39 @@
<ClInclude Include="..\Common\Xts.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="..\Common\EMVToken.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\Token.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\TLVParser.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\CommandAPDU.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\PCSCException.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\ResponseAPDU.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\SCardLoader.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\SCardManager.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\SCardReader.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\EMVCard.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\Common\SCard.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\Boot\Windows\Rescue_Serpent_SHA2\BootSector.bin">
diff --git a/src/Mount/Mount_vs2019.vcxproj b/src/Mount/Mount_vs2019.vcxproj
index 13aef3ca..4a944eec 100644
--- a/src/Mount/Mount_vs2019.vcxproj
+++ b/src/Mount/Mount_vs2019.vcxproj
@@ -210,7 +210,7 @@
<AdditionalDependencies>..\Crypto\Debug\crypto.lib;..\Common\Debug\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCrypt.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)Mount.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
@@ -259,7 +259,7 @@ copy Debug\VeraCrypt.exe "..\Debug\Setup Files" &gt;NUL:
<AdditionalDependencies>..\Crypto\x64\Debug\crypto.lib;..\Common\x64\Debug\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCrypt.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)Mount.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
@@ -310,7 +310,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt-x64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\ARM64\Debug\crypto.lib;..\Common\ARM64\Debug\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCrypt.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)Mount.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
@@ -354,7 +354,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt-arm64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\Release\crypto.lib;..\Common\Release\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCrypt.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -397,7 +397,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt-arm64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\Release\crypto.lib;..\Common\Release\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCrypt.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -444,7 +444,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt-arm64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCrypt.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -490,7 +490,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt-arm64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\ARM64\Release\crypto.lib;..\Common\ARM64\Release\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCrypt.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -536,7 +536,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt-arm64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCrypt.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -582,7 +582,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt-arm64.exe" &gt;NUL:
<AdditionalDependencies>..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCrypt.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -602,6 +602,17 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt-arm64.exe" &gt;NUL:
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
+ <ClCompile Include="..\Common\CommandAPDU.cpp" />
+ <ClCompile Include="..\Common\EMVCard.cpp" />
+ <ClCompile Include="..\Common\EMVToken.cpp" />
+ <ClCompile Include="..\Common\PCSCException.cpp" />
+ <ClCompile Include="..\Common\ResponseAPDU.cpp" />
+ <ClCompile Include="..\Common\SCard.cpp" />
+ <ClCompile Include="..\Common\SCardLoader.cpp" />
+ <ClCompile Include="..\Common\SCardManager.cpp" />
+ <ClCompile Include="..\Common\SCardReader.cpp" />
+ <ClCompile Include="..\Common\TLVParser.cpp" />
+ <ClCompile Include="..\Common\Token.cpp" />
<ClCompile Include="..\Setup\SelfExtract.c" />
<ClCompile Include="Favorites.cpp" />
<ClCompile Include="Hotkeys.c" />
@@ -675,6 +686,17 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt-arm64.exe" &gt;NUL:
<Midl Include="MainCom.idl" />
</ItemGroup>
<ItemGroup>
+ <ClInclude Include="..\Common\CommandAPDU.h" />
+ <ClInclude Include="..\Common\EMVCard.h" />
+ <ClInclude Include="..\Common\EMVToken.h" />
+ <ClInclude Include="..\Common\PCSCException.h" />
+ <ClInclude Include="..\Common\ResponseAPDU.h" />
+ <ClInclude Include="..\Common\SCard.h" />
+ <ClInclude Include="..\Common\SCardLoader.h" />
+ <ClInclude Include="..\Common\SCardManager.h" />
+ <ClInclude Include="..\Common\SCardReader.h" />
+ <ClInclude Include="..\Common\TLVParser.h" />
+ <ClInclude Include="..\Common\Token.h" />
<ClInclude Include="..\Common\Wipe.h" />
<ClInclude Include="..\Common\Apidrvr.h" />
<ClInclude Include="..\Common\BaseCom.h" />
diff --git a/src/Mount/Resource.h b/src/Mount/Resource.h
index dc73d180..fef9da49 100644
--- a/src/Mount/Resource.h
+++ b/src/Mount/Resource.h
@@ -160,7 +160,6 @@
#define IDC_PREF_DISMOUNT_SESSION_LOCKED 1137
#define IDT_NEW_PKCS5_PRF 1138
#define IDC_PKCS5_OLD_PRF_ID 1139
-#define IDC_TRUECRYPT_MODE 1140
#define IDC_PREF_TEMP_CACHE_ON_MULTIPLE_MOUNT 1141
#define IDT_OLD_PIM 1142
#define IDC_OLD_PIM 1143
@@ -199,6 +198,8 @@
#define IDC_FORCE_NEXT_BOOT_VERACRYPT 1176
#define IDC_FORCE_VERACRYPT_BOOT_ENTRY 1177
#define IDC_FORCE_VERACRYPT_FIRST_BOOT_ENTRY 1178
+#define IDC_ENABLE_EMV_SUPPORT 1179
+#define IDT_EMV_OPTIONS 1180
#define IDM_HELP 40001
#define IDM_ABOUT 40002
#define IDM_UNMOUNT_VOLUME 40003
@@ -267,6 +268,7 @@
#define IDM_DEFAULT_MOUNT_PARAMETERS 40066
#define IDM_DECRYPT_NONSYS_VOL 40067
#define IDM_VERIFY_RESCUE_DISK_ISO 40068
+#define IDM_MOUNIT_NO_CACHE 40069
// Next default values for new objects
//
@@ -274,8 +276,8 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 120
-#define _APS_NEXT_COMMAND_VALUE 40069
-#define _APS_NEXT_CONTROL_VALUE 1179
+#define _APS_NEXT_COMMAND_VALUE 40070
+#define _APS_NEXT_CONTROL_VALUE 1181
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/src/NOTICE b/src/NOTICE
index c013541e..6c038b74 100644
--- a/src/NOTICE
+++ b/src/NOTICE
@@ -1,4 +1,4 @@
-Copyright 2013-2018 IDRIX
+Copyright 2013-2023 IDRIX
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -111,7 +111,7 @@ warranties in respect of its properties, including, but not
limited to, correctness and/or fitness for purpose.
____________________________________________________________
-Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
+Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -132,7 +132,7 @@ Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
Jean-loup Gailly Mark Adler
jloup@gzip.org madler@alumni.caltech.edu
____________________________________________________________
-Copyright (C) 1999-2017 Dieter Baron and Thomas Klausner
+Copyright (C) 1999-2023 Dieter Baron and Thomas Klausner
The authors can be contacted at <libzip@nih.at>
@@ -202,7 +202,52 @@ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
____________________________________________________________
-LZMA SDK Copyright (C) 1999-2021 Igor Pavlov
+Copyright (c) 2013-2019 Stephan Mueller <smueller@chronox.de>
-Public domain
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, and the entire permission notice in its entirety,
+ including the disclaimer of warranties.
+
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+3. The name of the author may not be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ALTERNATIVELY, this product may be distributed under the terms of
+the GNU General Public License, in which case the provisions of the
+GPL2 are required INSTEAD OF the above restrictions. (This clause is
+necessary due to a potential bad interaction between the GPL and the
+restrictions contained in a BSD-style copyright.)
+
+THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF WHICH
+ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+____________________________________________________________
+Copyright (c) 1999-2023 Igor Pavlov
+
+LZMA SDK is written and placed in the public domain by Igor Pavlov.
+
+Some code in LZMA SDK is based on public domain code from another developers:
+ 1) PPMd var.H (2001): Dmitry Shkarin
+ 2) SHA-256: Wei Dai (Crypto++ library)
+
+Anyone is free to copy, modify, publish, use, compile, sell, or distribute the
+original LZMA SDK code, either in source code form or as a compiled binary, for
+any purpose, commercial or non-commercial, and by any means.
____________________________________________________________ \ No newline at end of file
diff --git a/src/Platform/Exception.h b/src/Platform/Exception.h
index b0f04bba..36981a74 100644
--- a/src/Platform/Exception.h
+++ b/src/Platform/Exception.h
@@ -92,11 +92,10 @@ namespace VeraCrypt
TC_EXCEPTION (ParameterTooLarge); \
TC_EXCEPTION (PartitionDeviceRequired); \
TC_EXCEPTION (StringConversionFailed); \
+ TC_EXCEPTION (TerminalNotFound); \
TC_EXCEPTION (TestFailed); \
TC_EXCEPTION (TimeOut); \
TC_EXCEPTION (UnknownException); \
- TC_EXCEPTION (UnsupportedAlgoInTrueCryptMode); \
- TC_EXCEPTION (UnsupportedTrueCryptFormat); \
TC_EXCEPTION (UserAbort)
TC_EXCEPTION_SET;
diff --git a/src/Platform/SharedPtr.h b/src/Platform/SharedPtr.h
index 29669714..f80b2167 100644
--- a/src/Platform/SharedPtr.h
+++ b/src/Platform/SharedPtr.h
@@ -21,7 +21,7 @@
namespace VeraCrypt
{
-#if (__cplusplus >= 201103L)
+#if (__cplusplus >= 201103L) || defined(__GXX_EXPERIMENTAL_CXX0X__)
#define VC_USE_NATIVE_PTR 1
#endif
diff --git a/src/Platform/Unix/File.cpp b/src/Platform/Unix/File.cpp
index d3413800..207efb4e 100644
--- a/src/Platform/Unix/File.cpp
+++ b/src/Platform/Unix/File.cpp
@@ -222,6 +222,17 @@ namespace VeraCrypt
# endif
}
#endif
+#ifdef TC_LINUX
+ // On Linux, try to use BLKGETSIZE64 for devices
+ if (Path.IsDevice())
+ {
+ uint64 mediaSize;
+ if (ioctl (FileHandle, BLKGETSIZE64, &mediaSize) != -1)
+ {
+ return mediaSize;
+ }
+ }
+#endif
off_t current = lseek (FileHandle, 0, SEEK_CUR);
throw_sys_sub_if (current == -1, wstring (Path));
SeekEnd (0);
diff --git a/src/Readme.txt b/src/Readme.txt
index 6875547d..be740b73 100644
--- a/src/Readme.txt
+++ b/src/Readme.txt
@@ -41,7 +41,9 @@ I. Windows
Requirements for Building VeraCrypt for Windows:
------------------------------------------------
-A detailed guide on how to compile VeraCrypt on Windows can be found at: https://www.veracrypt.fr/en/CompilingGuidelineWin.html
+A detailed guide on how to build VeraCrypt on Windows can be found in
+the file doc/html/CompilingGuidelineWin.html. it is also available online
+at https://www.veracrypt.fr/en/CompilingGuidelineWin.html
IMPORTANT:
@@ -90,7 +92,9 @@ For build instructions, please refer to the file src\Boot\EFI\Readme.txt.
II. Linux and Mac OS X
======================
-A detailed guide on how to build a dev environment and on how to compile VeraCrypt on Linux can be found at: https://www.veracrypt.fr/en/CompilingGuidelineLinux.html
+A detailed guide on how to build VeraCrypt on Linux can be found in
+the file doc/html/CompilingGuidelineLinux.html. it is also available online
+at https://www.veracrypt.fr/en/CompilingGuidelineLinux.html
Requirements for Building VeraCrypt for Linux and Mac OS X:
-----------------------------------------------------------
@@ -104,6 +108,7 @@ Requirements for Building VeraCrypt for Linux and Mac OS X:
wxWidgets 3.0 library source code (available at https://www.wxwidgets.org)
- FUSE library and header files (available at https://github.com/libfuse/libfuse
and https://osxfuse.github.io/)
+- PCSC-lite library and header files (available at https://github.com/LudovicRousseau/PCSC)
Instructions for Building VeraCrypt for Linux and Mac OS X:
@@ -210,20 +215,20 @@ Copyright Information
---------------------
This software as a whole:
-Copyright (c) 2013-2022 IDRIX. All rights reserved.
+Copyright (c) 2013-2023 IDRIX. All rights reserved.
Portions of this software:
-Copyright (c) 2013-2022 IDRIX. All rights reserved.
+Copyright (c) 2013-2023 IDRIX. All rights reserved.
Copyright (c) 2003-2012 TrueCrypt Developers Association. All rights reserved.
Copyright (c) 1998-2000 Paul Le Roux. All rights reserved.
Copyright (c) 1998-2008 Brian Gladman, Worcester, UK. All rights reserved.
-Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler.
+Copyright (c) 1995-2023 Jean-loup Gailly and Mark Adler.
Copyright (c) 2016 Disk Cryptography Services for EFI (DCS), Alex Kolotnikov
-Copyright (c) 1999-2017 Dieter Baron and Thomas Klausner.
+Copyright (c) 1999-2023 Dieter Baron and Thomas Klausner.
Copyright (c) 2013, Alexey Degtyarev. All rights reserved.
Copyright (c) 1999-2016 Jack Lloyd. All rights reserved.
-Copyright (c) 2013-2019 Stephan Mueller <smueller@chronox.de>
-Copyright (c) 1999-2021 Igor Pavlov
+Copyright (c) 2013-2019 Stephan Mueller <smueller@chronox.de>
+Copyright (c) 1999-2023 Igor Pavlov
For more information, please see the legal notices attached to parts of the
source code.
diff --git a/src/Release/Setup Files/Product64.wxs b/src/Release/Setup Files/Product64.wxs
index e20fd1dc..d2107447 100644
--- a/src/Release/Setup Files/Product64.wxs
+++ b/src/Release/Setup Files/Product64.wxs
@@ -4,7 +4,7 @@
<!-- FullProductVersion's first 3 parts MUST BE incremented at each release in order
for upgrades to work ; Windows Installer ignores the 4th part -->
- <?define var.FullProductVersion = 1.26?>
+ <?define var.FullProductVersion = 1.26.10?>
<?define var.ProductName = VeraCrypt $(var.FullProductVersion)?>
<!-- Unique GUID identifying this family of product (32-bit and 64-bit have the same) -->
@@ -12,7 +12,7 @@
<!-- Unique GUID identifying this product release (32-bit and 64-bit have different ones) -->
<!-- MUST BE regenerated for each new release -->
- <?define var.ProductGuid = {4089F6A9-1D6A-4235-AE08-4C2C2F98C7F5}?>
+ <?define var.ProductGuid = {03253FAE-94F8-46F8-ACE9-5458DA9EA621}?>
<!-- Unique GUID identifying a particular Windows Installer package -->
<!-- When compiling a product, it should not be set in order to allow it to be generated for each build -->
@@ -537,6 +537,9 @@
<Component Id="cmpB6AC414023A6BDBF855F4A807DAE138C" Guid="{557B4D3A-C503-4EAF-8DFC-5B9177A1F737}">
<File Id="filE1FF7E56D4D7BAE636B289521CD0C787" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Beginner's Tutorial_Image_034.png" DiskId="1" />
</Component>
+ <Component Id="cmpA80F47C0DB1649FE99DA7D449012D2D7" Guid="{E4AB233F-F5AE-4B26-83E5-524108F801B6}">
+ <File Id="filC92F8B3C25C841839FF268DAF13ADBCC" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\BLAKE2s-256.html" DiskId="1" />
+ </Component>
<Component Id="cmp053692809BD5B3F5682AFCC539A767A3" Guid="{C99F1ECB-6AAB-4D06-B4C7-134CD2502104}">
<File Id="fil9D6A859E5E76057E4E64E35D03BF1739" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Camellia.html" DiskId="1" />
</Component>
@@ -552,6 +555,87 @@
<Component Id="cmp3858A4BB7577362DE87F4485575DFC99" Guid="{94549BE1-9A7B-4DA7-A66F-17193865335E}">
<File Id="fil72F9481463D425378DDDD5FCDBCC909B" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Command Line Usage.html" DiskId="1" />
</Component>
+ <Component Id="cmpA06B9542AEB64F96BB784F47800158A8" Guid="{87929DDC-82A3-42CF-B610-D625A9EC404A}">
+ <File Id="filD596E938BA564F06A23DAAAA0909B229" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\CompilingGuidelineLinux.html" DiskId="1" />
+ </Component>
+ <Component Id="cmpACD4069DDF564A8DAB5D542BB8850131" Guid="{657E9938-9161-4C60-9112-944DD2BF2DE8}">
+ <File Id="fil0794C6C86BD24D62883FD840ADE90FC7" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\CompilingGuidelines.html" DiskId="1" />
+ </Component>
+ <Component Id="cmp735FE6B2F10C43019E11256864209EBC" Guid="{F87625DF-E610-4CCF-94E7-7293DDCD35DB}">
+ <File Id="filAB026A12CD59448B0346D8FB6BD594EB" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\CompilingGuidelineWin\AddNewSystemVar.jpg" DiskId="1" />
+ </Component>
+ <Component Id="cmp89BB363FF83EBA271361A4208E069DA9" Guid="{1E6E3A37-453A-4E81-AC23-45F3BB4800E2}">
+ <File Id="filE7535CB597FF0868DC51F9D3E8A1E45C" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\CompilingGuidelineWin\CertificateCannotBeVerified.jpg" DiskId="1" />
+ </Component>
+ <Component Id="cmp5115B3C02C1C0CF975E4B7C3152C163A" Guid="{D705F09B-8F81-48FE-A6D6-B46EE47425CE}">
+ <File Id="fil8DCBEED9F9CD2F449C888E90DBEC8A0F" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\CompilingGuidelineWin\CertVerifyFails.jpg" DiskId="1" />
+ </Component>
+ <Component Id="cmp3E70583F999D652B21E6E2D526666F61" Guid="{EA0DBD20-DFB7-4DF2-B29C-538C7FAE83C3}">
+ <File Id="fil8BA636EB3F15CDFBF9B1B07AF40CAF5C" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\CompilingGuidelineWin\DistributionPackageDamaged.jpg" DiskId="1" />
+ </Component>
+ <Component Id="cmpC2D0D30677874908C48FF8A921712958" Guid="{0CB7D629-B12B-4CCB-B65D-F92BC4099ED1}">
+ <File Id="filABD544E660E7612EF24A540F4DAC89DE" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\CompilingGuidelineWin\DownloadVS2010.jpg" DiskId="1" />
+ </Component>
+ <Component Id="cmp88EB50D9762FA92B2E52313A7C92F2DD" Guid="{BF41CBAB-594C-42FF-BC86-88869CD77445}">
+ <File Id="filD123B515FACC275A341B8C7A4DD19074" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\CompilingGuidelineWin\DownloadVS2019.jpg" DiskId="1" />
+ </Component>
+ <Component Id="cmp3DABA5B6F2E779D915E1B8D680AE7855" Guid="{203AC826-E013-40E8-A944-9D9622669066}">
+ <File Id="fil6BA9B558534B9399EA06F31375A6D8C5" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\CompilingGuidelineWin\DownloadVSBuildTools.jpg" DiskId="1" />
+ </Component>
+ <Component Id="cmp2EA15F417E5EE9D31E028263C137695F" Guid="{F4EDBAFC-4B84-4502-9AA4-4272281B26B9}">
+ <File Id="fil2DD203CD9997BD21FC45EFDF85BECE94" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\CompilingGuidelineWin\gzipCommandLine.jpg" DiskId="1" />
+ </Component>
+ <Component Id="cmp51D438A1152A65EAD414012A5EAEA2CA" Guid="{8B4B3B03-9D19-4D15-9060-1ABB4CF4A80E}">
+ <File Id="fil612E91212B4BE3447B34C59AD43D5FC2" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\CompilingGuidelineWin\NasmCommandLine.jpg" DiskId="1" />
+ </Component>
+ <Component Id="cmpD52CCEF7A4A330F26D3B3F7355D03646" Guid="{4C764331-E584-49C0-80FA-9251776108E3}">
+ <File Id="fil63F42635C3D23E1CC8D9541703F69B96" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\CompilingGuidelineWin\RegeditPermissions-1.jpg" DiskId="1" />
+ </Component>
+ <Component Id="cmp1A9BFDDFF15FF47166075F319B97BB6E" Guid="{F0EF5133-371D-4767-9265-266277E4D939}">
+ <File Id="fil609F8FC8F03A7AC92A7DDB6123F2771B" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\CompilingGuidelineWin\RegeditPermissions-2.jpg" DiskId="1" />
+ </Component>
+ <Component Id="cmp320762048B274197D27F739096C4A23A" Guid="{118CF290-CD2D-4515-A55D-48AD4DBEF8F0}">
+ <File Id="fil08D2CB8983DA4BA20DFFA5471E60CAD3" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\CompilingGuidelineWin\RegeditPermissions-3.jpg" DiskId="1" />
+ </Component>
+ <Component Id="cmp952051BDCF309CAEB1D62701560D8F78" Guid="{6BA07F89-BAA5-4E06-BE93-65AF8DF895EC}">
+ <File Id="fil335EB17B9D8DE11A9A8E0204C43BB2C7" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\CompilingGuidelineWin\RegeditPermissions-4.jpg" DiskId="1" />
+ </Component>
+ <Component Id="cmp6AB232B7503BC35E25CB33C789242482" Guid="{0B2B14B7-2D21-4904-999D-8DA37C7289BE}">
+ <File Id="fil9069630D9AA559C8EA243ADEB3DF0B69" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\CompilingGuidelineWin\SelectAdvancedSystemSettings.jpg" DiskId="1" />
+ </Component>
+ <Component Id="cmpE8ABDCD58C9636346FAE7E941A38CA6E" Guid="{2CF0B479-EFAF-499E-8630-AE4E41C8E424}">
+ <File Id="filA8C1D27C90C6647C16EB5EE8728DC943" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\CompilingGuidelineWin\SelectEnvironmentVariables.jpg" DiskId="1" />
+ </Component>
+ <Component Id="cmp9CD73EB218D7148E55F141E31AEC9D8C" Guid="{299F81CE-0140-4A97-93C2-C6B2CD3F8514}">
+ <File Id="fil8DB747C30552955A70B6FDAC1BC95198" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\CompilingGuidelineWin\SelectPathVariable.jpg" DiskId="1" />
+ </Component>
+ <Component Id="cmpE504F295E3ED5CEBDCF231608F6757B2" Guid="{0B23E02F-0D76-4F41-9081-CCC6A2634F05}">
+ <File Id="fil4E06FA5FE9FA09E4F71E22CFA0FC7BA9" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\CompilingGuidelineWin\SelectThisPC.jpg" DiskId="1" />
+ </Component>
+ <Component Id="cmp84A8D3A9BF75ED8047B7DEAB02F26003" Guid="{1EE2E63F-CE1F-4D90-97E9-AE186BC6DDA0}">
+ <File Id="fil0470CF25D1C5B0A85FD8091673E3E2E0" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\CompilingGuidelineWin\upxCommandLine.jpg" DiskId="1" />
+ </Component>
+ <Component Id="cmp63A4BE623C0E3F77B3BFA5B467C33A1A" Guid="{845FE6B7-11D1-4FEB-AFBE-A9EC8B7775DD}">
+ <File Id="filDC81CAAEC5DCB86937437877F26C046A" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\CompilingGuidelineWin\VS2010BuildSolution.jpg" DiskId="1" />
+ </Component>
+ <Component Id="cmp63CE6B664C7396B79B1B28591EEC72B9" Guid="{E0F7F066-1B4F-48B8-8C02-AB0661E0AFF5}">
+ <File Id="filC02619AFFB25501B6AA29599FAA01DEB" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\CompilingGuidelineWin\VS2010Win32Config.jpg" DiskId="1" />
+ </Component>
+ <Component Id="cmp4D6100E03DC3B05F17A7E2BA4AAF1EA1" Guid="{3AF8735B-D193-4F71-8C51-E8B1FE71CE5B}">
+ <File Id="filF697D096B67A6A8C84BB93AEB4199206" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\CompilingGuidelineWin\VS2010X64Config.jpg" DiskId="1" />
+ </Component>
+ <Component Id="cmpB7641BE40D4D1642AB3647B669008A94" Guid="{15A8F3D3-4364-4499-BBA9-2E29CD19D5C4}">
+ <File Id="filBD820E84E255A9B91DDC38D189515EE6" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\CompilingGuidelineWin\VS2019ARM64Config.jpg" DiskId="1" />
+ </Component>
+ <Component Id="cmp4DB96DA8172D79B63A7FBE08E016A280" Guid="{E6F2B68D-8CD9-42DE-AC2A-B5A2AB1F5DC1}">
+ <File Id="filEFA99F46C962110CBA6A0B14162F1764" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\CompilingGuidelineWin\VS2019BuildSolution.jpg" DiskId="1" />
+ </Component>
+ <Component Id="cmp615D3647A56F3ED6F0766CEEE9EFCF9F" Guid="{7A343344-91E3-4AEA-BD32-5E524AE8BEA4}">
+ <File Id="filD10154F2B3C2E7CB1EF84555EDA195C3" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\CompilingGuidelineWin\YasmCommandLine.jpg" DiskId="1" />
+ </Component>
+ <Component Id="cmp9FDD7E3C06564AF29700B82B19BC0501" Guid="{5DC9861F-1EB1-457D-9FAA-01DB499F6040}">
+ <File Id="filC4ADB6F8DFE44319BB70B7089B72BFBF" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\CompilingGuidelineWin.html" DiskId="1" />
+ </Component>
<Component Id="cmp90AB4CF273108F47223E3432838CDE37" Guid="{9510EAF5-F452-4991-9BA2-F1F641C1D697}">
<File Id="fil1DAD595818432F019735F37E86305500" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Contact.html" DiskId="1" />
</Component>
@@ -867,9 +951,6 @@
<Component Id="cmpFB2313AB16EF2467366ED136C0E61CE6" Guid="{CFEC9559-9F85-46C6-9E98-AEBB573B96FE}">
<File Id="filE496203C4727FDF47F8352CB9722A8C7" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Removing Encryption.html" DiskId="1" />
</Component>
- <Component Id="cmp960F36632D3FB602421D1195E4EB6FE1" Guid="{321F49A5-8A1B-4881-A32D-12EDA99D1B85}">
- <File Id="fil324009D5856BF4C5270D40F1EC4110EB" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\RIPEMD-160.html" DiskId="1" />
- </Component>
<Component Id="cmpB4C7B1A7A3EC0CB2DE805AC5CC5FC0D7" Guid="{4534E8B2-114E-4173-AE3E-75E0D96EB573}">
<File Id="fil8CFD1CFDCBE261B6F91D9E587F8720C0" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Security Model.html" DiskId="1" />
</Component>
@@ -1273,11 +1354,39 @@
<ComponentRef Id="cmpDC4FD19F507A5152351B9F71C8691486" />
<ComponentRef Id="cmp9E45BE754042F9DD742A0B7B9F27E786" />
<ComponentRef Id="cmpB6AC414023A6BDBF855F4A807DAE138C" />
+ <ComponentRef Id="cmpA80F47C0DB1649FE99DA7D449012D2D7" />
<ComponentRef Id="cmp053692809BD5B3F5682AFCC539A767A3" />
<ComponentRef Id="cmp9049A791E9E1AB7FF01BD7F08D1CB069" />
<ComponentRef Id="cmp4E6F9484484A40645D519F688ED9C21E" />
<ComponentRef Id="cmp3CF724F2A2347A2A30C85CB76490F687" />
<ComponentRef Id="cmp3858A4BB7577362DE87F4485575DFC99" />
+ <ComponentRef Id="cmpA06B9542AEB64F96BB784F47800158A8" />
+ <ComponentRef Id="cmpACD4069DDF564A8DAB5D542BB8850131" />
+ <ComponentRef Id="cmp735FE6B2F10C43019E11256864209EBC" />
+ <ComponentRef Id="cmp89BB363FF83EBA271361A4208E069DA9" />
+ <ComponentRef Id="cmp5115B3C02C1C0CF975E4B7C3152C163A" />
+ <ComponentRef Id="cmp3E70583F999D652B21E6E2D526666F61" />
+ <ComponentRef Id="cmpC2D0D30677874908C48FF8A921712958" />
+ <ComponentRef Id="cmp88EB50D9762FA92B2E52313A7C92F2DD" />
+ <ComponentRef Id="cmp3DABA5B6F2E779D915E1B8D680AE7855" />
+ <ComponentRef Id="cmp2EA15F417E5EE9D31E028263C137695F" />
+ <ComponentRef Id="cmp51D438A1152A65EAD414012A5EAEA2CA" />
+ <ComponentRef Id="cmpD52CCEF7A4A330F26D3B3F7355D03646" />
+ <ComponentRef Id="cmp1A9BFDDFF15FF47166075F319B97BB6E" />
+ <ComponentRef Id="cmp320762048B274197D27F739096C4A23A" />
+ <ComponentRef Id="cmp952051BDCF309CAEB1D62701560D8F78" />
+ <ComponentRef Id="cmp6AB232B7503BC35E25CB33C789242482" />
+ <ComponentRef Id="cmpE8ABDCD58C9636346FAE7E941A38CA6E" />
+ <ComponentRef Id="cmp9CD73EB218D7148E55F141E31AEC9D8C" />
+ <ComponentRef Id="cmpE504F295E3ED5CEBDCF231608F6757B2" />
+ <ComponentRef Id="cmp84A8D3A9BF75ED8047B7DEAB02F26003" />
+ <ComponentRef Id="cmp63A4BE623C0E3F77B3BFA5B467C33A1A" />
+ <ComponentRef Id="cmp63CE6B664C7396B79B1B28591EEC72B9" />
+ <ComponentRef Id="cmp4D6100E03DC3B05F17A7E2BA4AAF1EA1" />
+ <ComponentRef Id="cmpB7641BE40D4D1642AB3647B669008A94" />
+ <ComponentRef Id="cmp4DB96DA8172D79B63A7FBE08E016A280" />
+ <ComponentRef Id="cmp615D3647A56F3ED6F0766CEEE9EFCF9F" />
+ <ComponentRef Id="cmp9FDD7E3C06564AF29700B82B19BC0501" />
<ComponentRef Id="cmp90AB4CF273108F47223E3432838CDE37" />
<ComponentRef Id="cmpB9A0461BF7CF75538111B088C986A62F" />
<ComponentRef Id="cmpD8C7B52BC03709FAB2642B93BFE4FFE8" />
@@ -1383,7 +1492,6 @@
<ComponentRef Id="cmpB313B00E647A121B2CBE47F3048A18A7" />
<ComponentRef Id="cmp400428F6494DE58618E3B92539548C39" />
<ComponentRef Id="cmpFB2313AB16EF2467366ED136C0E61CE6" />
- <ComponentRef Id="cmp960F36632D3FB602421D1195E4EB6FE1" />
<ComponentRef Id="cmpB4C7B1A7A3EC0CB2DE805AC5CC5FC0D7" />
<ComponentRef Id="cmp00540BF93A805E0B9996945B61E1BC2F" />
<ComponentRef Id="cmp4C46C6668AD830D543AFE593D51676B3" />
diff --git a/src/Release/Setup Files/veracrypt-arm64.cat b/src/Release/Setup Files/veracrypt-arm64.cat
index a0a22f47..36ce6256 100644
--- a/src/Release/Setup Files/veracrypt-arm64.cat
+++ b/src/Release/Setup Files/veracrypt-arm64.cat
Binary files differ
diff --git a/src/Release/Setup Files/veracrypt-arm64.sys b/src/Release/Setup Files/veracrypt-arm64.sys
index 6e190198..55d8fe88 100644
--- a/src/Release/Setup Files/veracrypt-arm64.sys
+++ b/src/Release/Setup Files/veracrypt-arm64.sys
Binary files differ
diff --git a/src/Release/Setup Files/veracrypt-x64.cat b/src/Release/Setup Files/veracrypt-x64.cat
index 43c29654..71faf7a1 100644
--- a/src/Release/Setup Files/veracrypt-x64.cat
+++ b/src/Release/Setup Files/veracrypt-x64.cat
Binary files differ
diff --git a/src/Release/Setup Files/veracrypt-x64.sys b/src/Release/Setup Files/veracrypt-x64.sys
index 47025492..8808e1d7 100644
--- a/src/Release/Setup Files/veracrypt-x64.sys
+++ b/src/Release/Setup Files/veracrypt-x64.sys
Binary files differ
diff --git a/src/Release/Setup Files/veracrypt.Inf b/src/Release/Setup Files/veracrypt.Inf
index a7828dd4..533c5e63 100644
--- a/src/Release/Setup Files/veracrypt.Inf
+++ b/src/Release/Setup Files/veracrypt.Inf
@@ -2,7 +2,7 @@
;;; VeraCrypt
;;;
;;;
-;;; Copyright (c) 2022, IDRIX
+;;; Copyright (c) 2023, IDRIX
;;;
[Version]
@@ -10,7 +10,7 @@ signature = "$Windows NT$"
Class = "Encryption" ;This is determined by the work this filter driver does
ClassGuid = {a0a701c0-a511-42ff-aa6c-06dc0395576f} ;This value is determined by the Class
Provider = %ProviderString%
-DriverVer = 03/09/2022,1.26.0.0
+DriverVer = 08/11/2023,1.26.10.0
CatalogFile = veracrypt.cat
@@ -22,23 +22,29 @@ veracrypt.DriverFiles = 12 ;%windir%\system32\drivers
;; Default install sections
;;
-[DefaultInstall]
+[DefaultInstall.NTx86]
OptionDesc = %ServiceDescription%
CopyFiles = veracrypt.DriverFiles
AddReg = veracrypt.AddReg
-[DefaultInstall.Services]
-AddService = veracrypt,,veracrypt.Service
+[DefaultInstall.NTamd64]
+OptionDesc = %ServiceDescription%
+CopyFiles = veracrypt.DriverFiles
+AddReg = veracrypt.AddReg
-;;
-;; Default uninstall sections
-;;
+[DefaultInstall.NTarm64]
+OptionDesc = %ServiceDescription%
+CopyFiles = veracrypt.DriverFiles
+AddReg = veracrypt.AddReg
+
+[DefaultInstall.NTx86.Services]
+AddService = veracrypt,,veracrypt.Service
-[DefaultUninstall]
-DelFiles = veracrypt.DriverFiles
+[DefaultInstall.NTamd64.Services]
+AddService = veracrypt,,veracrypt.Service
-[DefaultUninstall.Services]
-DelService = veracrypt,0x200 ;Ensure service is stopped before deleting
+[DefaultInstall.NTarm64.Services]
+AddService = veracrypt,,veracrypt.Service
;
; Services Section
diff --git a/src/Release/Setup Files/veracrypt.cat b/src/Release/Setup Files/veracrypt.cat
index eb3930f1..4868f800 100644
--- a/src/Release/Setup Files/veracrypt.cat
+++ b/src/Release/Setup Files/veracrypt.cat
Binary files differ
diff --git a/src/Release/Setup Files/veracrypt.sys b/src/Release/Setup Files/veracrypt.sys
index 6b0cdd96..8b6e13b3 100644
--- a/src/Release/Setup Files/veracrypt.sys
+++ b/src/Release/Setup Files/veracrypt.sys
Binary files differ
diff --git a/src/Resources/Texts/License.rtf b/src/Resources/Texts/License.rtf
index 2f674c98..42364349 100644
--- a/src/Resources/Texts/License.rtf
+++ b/src/Resources/Texts/License.rtf
@@ -264,7 +264,7 @@ This software is provided 'as is' with no explicit or implied warranties in resp
\line }{\hich\af5\loch\scaps0\caps0\fs16\i0\b0\f5\loch
____________________________________________________________}{\loch
\line \line }{\hich\af5\loch\scaps0\caps0\fs16\i0\b0\f5\loch
-Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler}{\loch
+Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler}{\loch
\line \line }{\hich\af5\loch\scaps0\caps0\fs16\i0\b0\f5\loch
This software is provided 'as-is', without any express or implied warranty. In no event will the author be held liable for any damages arising from the use of this software.}{\loch
\line \line }{\hich\af5\loch\scaps0\caps0\fs16\i0\b0\f5\loch
@@ -278,7 +278,7 @@ Permission is granted to anyone to use this software for any purpose, including
\par \pard\plain \s0\rtlch\af8\afs24\alang1081 \ltrch\lang1033\langfe2052\hich\af3\loch\ql\nowidctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang1033\kerning1\dbch\af6\langfe2052\loch\ql\sb0\sa283{\hich\af5\loch\scaps0\caps0\fs16\i0\b0\f5\loch
____________________________________________________________}
\par \pard\plain \s0\rtlch\af8\afs24\alang1081 \ltrch\lang1033\langfe2052\hich\af3\loch\ql\nowidctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang1033\kerning1\dbch\af6\langfe2052\loch\ql\sb0\sa283{\hich\af5\loch\scaps0\caps0\fs16\i0\b0\f5\loch
-Copyright (C) 1999-2017 Dieter Baron and Thomas Klausner}
+Copyright (C) 1999-2023 Dieter Baron and Thomas Klausner}
\par \pard\plain \s0\rtlch\af8\afs24\alang1081 \ltrch\lang1033\langfe2052\hich\af3\loch\ql\nowidctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang1033\kerning1\dbch\af6\langfe2052\loch\ql\sb0\sa283{\hich\af5\loch\scaps0\caps0\fs16\i0\b0\f5\loch
The authors can be contacted at <libzip@nih.at>}
\par \pard\plain \s0\rtlch\af8\afs24\alang1081 \ltrch\lang1033\langfe2052\hich\af3\loch\ql\nowidctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang1033\kerning1\dbch\af6\langfe2052\loch\ql\sb0\sa283{\hich\af5\loch\scaps0\caps0\fs16\i0\b0\f5\loch
@@ -319,7 +319,7 @@ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WA
\par \pard\plain \s0\rtlch\af8\afs24\alang1081 \ltrch\lang1033\langfe2052\hich\af3\loch\ql\nowidctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang1033\kerning1\dbch\af6\langfe2052\loch\ql\sb0\sa283{\hich\af5\loch\scaps0\caps0\fs16\i0\b0\f5\loch
____________________________________________________________}
\par \pard\plain \s0\rtlch\af8\afs24\alang1081 \ltrch\lang1033\langfe2052\hich\af3\loch\ql\nowidctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang1033\kerning1\dbch\af6\langfe2052\loch\ql\sb0\sa283{\hich\af5\loch\scaps0\caps0\fs16\i0\b0\f5\loch
-Copyright (c) 2013-2018 Stephan Mueller <smueller@chronox.de>}
+Copyright (c) 2013-2019 Stephan Mueller <smueller@chronox.de>}
\par \pard\plain \s0\rtlch\af8\afs24\alang1081 \ltrch\lang1033\langfe2052\hich\af3\loch\ql\nowidctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang1033\kerning1\dbch\af6\langfe2052\loch\ql\sb0\sa283{\hich\af5\loch\scaps0\caps0\fs16\i0\b0\f5\loch
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:}
\par \pard\plain \s0\rtlch\af8\afs24\alang1081 \ltrch\lang1033\langfe2052\hich\af3\loch\ql\nowidctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang1033\kerning1\dbch\af6\langfe2052\loch\ql\sb0\sa283{\hich\af5\loch\scaps0\caps0\fs16\i0\b0\f5\loch
@@ -338,7 +338,7 @@ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLU
____________________________________________________________}
\par \pard\plain \s0\rtlch\af8\afs24\alang1081 \ltrch\lang1033\langfe2052\hich\af3\loch\ql\nowidctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang1033\kerning1\dbch\af6\langfe2052\loch\ql\sb0\sa283{\hich\af5\loch\scaps0\caps0\fs16\i0\b0\f5\loch
LZMA SDK Copyright (C) 1999-20}{\hich\af5\loch\scaps0\caps0\fs16\i0\b0\f5\loch
-21}{\hich\af5\loch\scaps0\caps0\fs16\i0\b0\f5\loch
+23}{\hich\af5\loch\scaps0\caps0\fs16\i0\b0\f5\loch
Igor Pavlov}{\loch
\line \line }{\hich\af5\loch\scaps0\caps0\fs16\i0\b0\f5\loch
Public domain}
diff --git a/src/Setup/ComSetup.cpp b/src/Setup/ComSetup.cpp
index 39ec0032..96734303 100644
--- a/src/Setup/ComSetup.cpp
+++ b/src/Setup/ComSetup.cpp
@@ -11,10 +11,10 @@
*/
#define TC_MAIN_COM_VERSION_MAJOR 2
-#define TC_MAIN_COM_VERSION_MINOR 11
+#define TC_MAIN_COM_VERSION_MINOR 13
#define TC_FORMAT_COM_VERSION_MAJOR 2
-#define TC_FORMAT_COM_VERSION_MINOR 9
+#define TC_FORMAT_COM_VERSION_MINOR 10
#include <atlbase.h>
#include <comdef.h>
@@ -39,9 +39,9 @@ extern "C" BOOL RegisterComServers (wchar_t *modulePath)
UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR, 0, SYS_WIN32);
UnRegisterTypeLib (LIBID_TrueCryptFormatCom, TC_FORMAT_COM_VERSION_MAJOR, TC_FORMAT_COM_VERSION_MINOR, 0, SYS_WIN32);
// unregister older versions that may still exist
- for (WORD i = 7; i >= 1; i--)
+ for (WORD i = 9; i >= 1; i--)
UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-i, 0, SYS_WIN32);
- for (WORD i = 5; i >= 1; i--)
+ for (WORD i = 6; i >= 1; i--)
UnRegisterTypeLib (LIBID_TrueCryptFormatCom, TC_FORMAT_COM_VERSION_MAJOR, TC_FORMAT_COM_VERSION_MINOR-i, 0, SYS_WIN32);
wchar_t setupModule[MAX_PATH];
@@ -78,9 +78,9 @@ extern "C" BOOL UnregisterComServers (wchar_t *modulePath)
return FALSE;
// unregister older versions that may still exist
- for (WORD i = 7; i >= 1; i--)
+ for (WORD i = 9; i >= 1; i--)
UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-i, 0, SYS_WIN32);
- for (WORD i = 5; i >= 1; i--)
+ for (WORD i = 6; i >= 1; i--)
UnRegisterTypeLib (LIBID_TrueCryptFormatCom, TC_FORMAT_COM_VERSION_MAJOR, TC_FORMAT_COM_VERSION_MINOR-i, 0, SYS_WIN32);
wchar_t module[1024];
diff --git a/src/Setup/FreeBSD/veracrypt_install_template.sh b/src/Setup/FreeBSD/veracrypt_install_template.sh
index c34f5858..1ebc7672 100644
--- a/src/Setup/FreeBSD/veracrypt_install_template.sh
+++ b/src/Setup/FreeBSD/veracrypt_install_template.sh
@@ -93,7 +93,7 @@ show_message()
else
if [ $KTERM -eq 1 ]
then
- konsole --title 'VeraCrypt Setup' --caption 'VeraCrypt Setup' -e sh -c "echo $*; read A"
+ konsole --qwindowtitle 'VeraCrypt Setup' --caption 'VeraCrypt Setup' -e sh -c "echo $*; read A"
fi
fi
fi
@@ -1031,14 +1031,15 @@ fi
if [ "$PACKAGE_TYPE" = "tar" ]
then
- if ! which fusermount >/dev/null 2>/dev/null || ! which dmsetup >/dev/null 2>/dev/null
+ if ! which fusermount >/dev/null 2>/dev/null || ! which dmsetup >/dev/null 2>/dev/null || ! service pcscd status >/dev/null 2>/dev/null
then
show_message "$(cat <<_INFO
Requirements for Running VeraCrypt:
-----------------------------------
- FUSE library and tools
- - device mapper tools
+ - device mapper tool
+ - PC/SC Lite (optional)
_INFO
)"
@@ -1073,7 +1074,7 @@ then
else
if [ $KTERM -eq 1 ]
then
- exec konsole --title 'VeraCrypt Setup' --caption 'VeraCrypt Setup' -e sh -c "echo Installing package...; $SUDO $PACKAGE_INSTALLER $PACKAGE_INSTALLER_OPTS $PACKAGE; rm -f $PACKAGE; echo; echo Press Enter to exit...; read A"
+ exec konsole --qwindowtitle 'VeraCrypt Setup' --caption 'VeraCrypt Setup' -e sh -c "echo Installing package...; $SUDO $PACKAGE_INSTALLER $PACKAGE_INSTALLER_OPTS $PACKAGE; rm -f $PACKAGE; echo; echo Press Enter to exit...; read A"
fi
fi
fi
diff --git a/src/Setup/Linux/mount.veracrypt b/src/Setup/Linux/mount.veracrypt
index 499ad9b9..a891c253 100644..100755
--- a/src/Setup/Linux/mount.veracrypt
+++ b/src/Setup/Linux/mount.veracrypt
@@ -13,11 +13,11 @@ for arg in $*; do
fs=*) VCOPTIONS=(${VCOPTIONS[*]} --filesystem=${arg#*=});;
keyfiles=*) VCOPTIONS=(${VCOPTIONS[*]} --keyfiles=${arg#*=});;
password=*) VCOPTIONS=(${VCOPTIONS[*]} --password=${arg#*=});;
- pim=*) VCOPTIONS=(${VCOPTIONS[*]} --pim==${arg#*=});;
+ pim=*) VCOPTIONS=(${VCOPTIONS[*]} --pim=${arg#*=});;
protect-hidden=*) VCOPTIONS=(${VCOPTIONS[*]} --protect-hidden=${arg#*=});;
slot=*) VCOPTIONS=(${VCOPTIONS[*]} --slot=${arg#*=});;
*) OPTIONS="${OPTIONS}${arg},";;
esac
done
-/usr/bin/veracrypt --non-interactive --text ${VCOPTIONS[*]} --fs-options="${OPTIONS%,*}" ${DEV} ${MNTPT}
+/usr/bin/veracrypt --text --non-interactive ${VCOPTIONS[*]} --fs-options="${OPTIONS%,*}" ${DEV} ${MNTPT}
diff --git a/src/Setup/Linux/veracrypt_install_template.sh b/src/Setup/Linux/veracrypt_install_template.sh
index 966e6f81..e4615966 100644
--- a/src/Setup/Linux/veracrypt_install_template.sh
+++ b/src/Setup/Linux/veracrypt_install_template.sh
@@ -32,7 +32,11 @@ KTERM=0
case $PACKAGE_TYPE in
tar)
PACKAGE_INSTALLER=tar
- PACKAGE_INSTALLER_OPTS='-C / --keep-directory-symlink --no-overwrite-dir -xpzvf'
+ if tar --help | grep -q -- '--keep-directory-symlink'; then
+ PACKAGE_INSTALLER_OPTS='-C / --keep-directory-symlink --no-overwrite-dir -xpzvf'
+ else
+ PACKAGE_INSTALLER_OPTS='-C / --no-overwrite-dir -xpzvf'
+ fi
;;
esac
@@ -93,7 +97,7 @@ show_message()
else
if [ $KTERM -eq 1 ]
then
- konsole --title 'VeraCrypt Setup' -e sh -c "echo $*; read A"
+ konsole --qwindowtitle 'VeraCrypt Setup' -e sh -c "echo $*; read A"
fi
fi
fi
@@ -1031,7 +1035,7 @@ fi
if [ "$PACKAGE_TYPE" = "tar" ]
then
- if ! which fusermount >/dev/null 2>/dev/null || ! which dmsetup >/dev/null 2>/dev/null
+ if ! which fusermount >/dev/null 2>/dev/null || ! which dmsetup >/dev/null 2>/dev/null || ! service pcscd status >/dev/null 2>/dev/null
then
show_message "$(cat <<_INFO
Requirements for Running VeraCrypt:
@@ -1039,6 +1043,7 @@ Requirements for Running VeraCrypt:
- FUSE library and tools
- device mapper tools
+ - PC/SC Lite (optional)
_INFO
)"
@@ -1073,7 +1078,7 @@ then
else
if [ $KTERM -eq 1 ]
then
- exec konsole --title 'VeraCrypt Setup' -e sh -c "echo Installing package...; $SUDO $PACKAGE_INSTALLER $PACKAGE_INSTALLER_OPTS $PACKAGE; rm -f $PACKAGE; echo; echo Press Enter to exit...; read A"
+ exec konsole --qwindowtitle 'VeraCrypt Setup' -e sh -c "echo Installing package...; $SUDO $PACKAGE_INSTALLER $PACKAGE_INSTALLER_OPTS $PACKAGE; rm -f $PACKAGE; echo; echo Press Enter to exit...; read A"
fi
fi
fi
diff --git a/src/Setup/MacOSX/veracrypt.pkgproj b/src/Setup/MacOSX/veracrypt.pkgproj
index 975b90a1..99c255ea 100755
--- a/src/Setup/MacOSX/veracrypt.pkgproj
+++ b/src/Setup/MacOSX/veracrypt.pkgproj
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
@@ -558,7 +557,7 @@
<key>USE_HFS+_COMPRESSION</key>
<false/>
<key>VERSION</key>
- <string>1.26.0</string>
+ <string>1.26.10</string>
</dict>
<key>TYPE</key>
<integer>0</integer>
@@ -756,7 +755,7 @@
<key>IC_REQUIREMENT_OS_DISTRIBUTION_TYPE</key>
<integer>0</integer>
<key>IC_REQUIREMENT_OS_MINIMUM_VERSION</key>
- <integer>100900</integer>
+ <integer>120001</integer>
</dict>
<key>IC_REQUIREMENT_CHECK_TYPE</key>
<integer>0</integer>
@@ -768,13 +767,13 @@
<key>LANGUAGE</key>
<string>English</string>
<key>VALUE</key>
- <string>VeraCrypt requires MacOSX 10.9 and above.</string>
+ <string>VeraCrypt requires MacOSX 12 and above.</string>
</dict>
<dict>
<key>LANGUAGE</key>
<string>French</string>
<key>VALUE</key>
- <string>VeraCrypt nécessite MacOSX 10.9 et supérieur.</string>
+ <string>VeraCrypt nécessite MacOSX 12 et supérieur.</string>
</dict>
</array>
<key>NAME</key>
@@ -1026,7 +1025,7 @@ https://osxfuse.github.io/
</dict>
</array>
<key>NAME</key>
- <string>VeraCrypt 1.26</string>
+ <string>VeraCrypt 1.26.10</string>
<key>PAYLOAD_ONLY</key>
<false/>
<key>TREAT_MISSING_PRESENTATION_DOCUMENTS_AS_WARNING</key>
diff --git a/src/Setup/MacOSX/veracrypt_Legacy.pkgproj b/src/Setup/MacOSX/veracrypt_Legacy.pkgproj
index 75a879a3..6819907a 100755
--- a/src/Setup/MacOSX/veracrypt_Legacy.pkgproj
+++ b/src/Setup/MacOSX/veracrypt_Legacy.pkgproj
@@ -557,7 +557,7 @@
<key>USE_HFS+_COMPRESSION</key>
<false/>
<key>VERSION</key>
- <string>1.26.0</string>
+ <string>1.26.10</string>
</dict>
<key>TYPE</key>
<integer>0</integer>
@@ -1062,7 +1062,7 @@ https://osxfuse.github.io/
</dict>
</array>
<key>NAME</key>
- <string>VeraCrypt Legacy 1.26</string>
+ <string>VeraCrypt Legacy 10</string>
<key>PAYLOAD_ONLY</key>
<false/>
<key>TREAT_MISSING_PRESENTATION_DOCUMENTS_AS_WARNING</key>
diff --git a/src/Setup/Portable.manifest b/src/Setup/Portable.manifest
index 5d4cb896..79d86799 100644
--- a/src/Setup/Portable.manifest
+++ b/src/Setup/Portable.manifest
@@ -14,7 +14,13 @@
</asmv3:application>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
- <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
+ <!-- Windows 10 and Windows 11 -->
+ <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
+ <!-- Windows 8.1 -->
+ <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
+ <!-- Windows 8 -->
+ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
+ <!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
</application>
</compatibility>
diff --git a/src/Setup/Portable.rc b/src/Setup/Portable.rc
index ae1bd068..eb198e9e 100644
--- a/src/Setup/Portable.rc
+++ b/src/Setup/Portable.rc
@@ -26,8 +26,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,26,0,0
- PRODUCTVERSION 1,26,0,0
+ FILEVERSION 1,26,10,0
+ PRODUCTVERSION 1,26,10,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -44,11 +44,11 @@ BEGIN
BEGIN
VALUE "CompanyName", "IDRIX"
VALUE "FileDescription", "VeraCrypt Portable"
- VALUE "FileVersion", "1.26"
+ VALUE "FileVersion", "1.26.10"
VALUE "LegalTrademarks", "VeraCrypt"
VALUE "OriginalFilename", "VeraCrypt Portable.exe"
VALUE "ProductName", "VeraCrypt"
- VALUE "ProductVersion", "1.26"
+ VALUE "ProductVersion", "1.26.10"
END
END
BLOCK "VarFileInfo"
@@ -86,6 +86,32 @@ IDR_LANG_RU LANGUAGES "..\\..\\Translations\\Language.
IDR_LANG_VI LANGUAGES "..\\..\\Translations\\Language.vi.xml"
IDR_LANG_ZHCN LANGUAGES "..\\..\\Translations\\Language.zh-cn.xml"
IDR_LANG_ZHHK LANGUAGES "..\\..\\Translations\\Language.zh-hk.xml"
+IDR_LANG_BE LANGUAGES "..\\..\\Translations\\Language.be.xml"
+IDR_LANG_BG LANGUAGES "..\\..\\Translations\\Language.bg.xml"
+IDR_LANG_CA LANGUAGES "..\\..\\Translations\\Language.ca.xml"
+IDR_LANG_CO LANGUAGES "..\\..\\Translations\\Language.co.xml"
+IDR_LANG_DA LANGUAGES "..\\..\\Translations\\Language.da.xml"
+IDR_LANG_EL LANGUAGES "..\\..\\Translations\\Language.el.xml"
+IDR_LANG_ET LANGUAGES "..\\..\\Translations\\Language.et.xml"
+IDR_LANG_EU LANGUAGES "..\\..\\Translations\\Language.eu.xml"
+IDR_LANG_FA LANGUAGES "..\\..\\Translations\\Language.fa.xml"
+IDR_LANG_FI LANGUAGES "..\\..\\Translations\\Language.fi.xml"
+IDR_LANG_HE LANGUAGES "..\\..\\Translations\\Language.he.xml"
+IDR_LANG_HU LANGUAGES "..\\..\\Translations\\Language.hu.xml"
+IDR_LANG_ID LANGUAGES "..\\..\\Translations\\Language.id.xml"
+IDR_LANG_KA LANGUAGES "..\\..\\Translations\\Language.ka.xml"
+IDR_LANG_KO LANGUAGES "..\\..\\Translations\\Language.ko.xml"
+IDR_LANG_LV LANGUAGES "..\\..\\Translations\\Language.lv.xml"
+IDR_LANG_NN LANGUAGES "..\\..\\Translations\\Language.nn.xml"
+IDR_LANG_PTBR LANGUAGES "..\\..\\Translations\\Language.pt-br.xml"
+IDR_LANG_SK LANGUAGES "..\\..\\Translations\\Language.sk.xml"
+IDR_LANG_SL LANGUAGES "..\\..\\Translations\\Language.sl.xml"
+IDR_LANG_SV LANGUAGES "..\\..\\Translations\\Language.sv.xml"
+IDR_LANG_TH LANGUAGES "..\\..\\Translations\\Language.th.xml"
+IDR_LANG_TR LANGUAGES "..\\..\\Translations\\Language.tr.xml"
+IDR_LANG_UK LANGUAGES "..\\..\\Translations\\Language.uk.xml"
+IDR_LANG_UZ LANGUAGES "..\\..\\Translations\\Language.uz.xml"
+IDR_LANG_ZHTW LANGUAGES "..\\..\\Translations\\Language.zh-tw.xml"
/////////////////////////////////////////////////////////////////////////////
//
diff --git a/src/Setup/Portable.vcxproj b/src/Setup/Portable.vcxproj
index 92d349bc..1c758b2b 100644
--- a/src/Setup/Portable.vcxproj
+++ b/src/Setup/Portable.vcxproj
@@ -108,7 +108,7 @@
<AdditionalDependencies>libcmtd.lib;atlsd.lib;mpr.lib;..\Common\Debug\Zip.lib;..\Crypto\Debug\crypto.lib;..\Common\Debug\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptPortable.exe</OutputFile>
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
- <DelayLoadDLLs>user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)Portable.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
@@ -146,7 +146,7 @@ copy PortableDebug\VeraCryptPortable.exe "..\Debug\Setup Files\VeraCrypt Portabl
<AdditionalDependencies>mpr.lib;..\Common\Release\Zip.lib;..\Crypto\Release\crypto.lib;..\Common\Release\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptPortable.exe</OutputFile>
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
- <DelayLoadDLLs>user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -184,7 +184,7 @@ copy PortableDebug\VeraCryptPortable.exe "..\Debug\Setup Files\VeraCrypt Portabl
<AdditionalDependencies>mpr.lib;..\Common\Release\Zip.lib;..\Crypto\Release\crypto.lib;..\Common\Release\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptPortable.exe</OutputFile>
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
- <DelayLoadDLLs>user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -222,7 +222,7 @@ copy PortableDebug\VeraCryptPortable.exe "..\Debug\Setup Files\VeraCrypt Portabl
<AdditionalDependencies>mpr.lib;..\Common\Release\Zip.lib;..\Crypto\Release\crypto.lib;..\Common\Release\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptPortable.exe</OutputFile>
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
- <DelayLoadDLLs>user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
diff --git a/src/Setup/Resource.h b/src/Setup/Resource.h
index 8882d67b..b5b7d466 100644
--- a/src/Setup/Resource.h
+++ b/src/Setup/Resource.h
@@ -17,6 +17,32 @@
#define IDR_LANG_VI 31
#define IDR_LANG_ZHCN 32
#define IDR_LANG_ZHHK 33
+#define IDR_LANG_BE 34
+#define IDR_LANG_BG 35
+#define IDR_LANG_CA 36
+#define IDR_LANG_CO 37
+#define IDR_LANG_DA 38
+#define IDR_LANG_EL 39
+#define IDR_LANG_ET 40
+#define IDR_LANG_EU 41
+#define IDR_LANG_FA 42
+#define IDR_LANG_FI 43
+#define IDR_LANG_HE 44
+#define IDR_LANG_HU 45
+#define IDR_LANG_ID 46
+#define IDR_LANG_KA 47
+#define IDR_LANG_KO 48
+#define IDR_LANG_LV 49
+#define IDR_LANG_NN 50
+#define IDR_LANG_PTBR 51
+#define IDR_LANG_SK 52
+#define IDR_LANG_SL 53
+#define IDR_LANG_SV 54
+#define IDR_LANG_TH 55
+#define IDR_LANG_TR 56
+#define IDR_LANG_UK 57
+#define IDR_LANG_UZ 58
+#define IDR_LANG_ZHTW 59
#define IDD_INSTALL 101
#define IDD_INSTALL_OPTIONS_PAGE_DLG 102
#define IDD_UNINSTALL 103
diff --git a/src/Setup/Setup.c b/src/Setup/Setup.c
index 43c951f5..6edc0ea9 100644
--- a/src/Setup/Setup.c
+++ b/src/Setup/Setup.c
@@ -74,6 +74,8 @@ BOOL UnloadDriver = TRUE;
BOOL bSystemRestore = TRUE;
BOOL bDisableSwapFiles = FALSE;
BOOL bForAllUsers = TRUE;
+BOOL bDisableMemoryProtection = FALSE;
+BOOL bOriginalDisableMemoryProtection = FALSE;
BOOL bRegisterFileExt = TRUE;
BOOL bAddToStartMenu = TRUE;
BOOL bDesktopIcon = TRUE;
@@ -570,26 +572,13 @@ BOOL IsSystemRestoreEnabled ()
GetRestorePointRegKeyName (szRegPath, sizeof (szRegPath));
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, szRegPath, 0, KEY_READ | KEY_WOW64_64KEY, &hKey) == ERROR_SUCCESS)
{
- if (IsOSAtLeast (WIN_VISTA))
- {
- if ( (ERROR_SUCCESS == RegQueryValueEx (hKey, L"RPSessionInterval", NULL, NULL, (LPBYTE) &dwValue, &cbValue))
- && (dwValue == 1)
- )
- {
- bEnabled = TRUE;
- }
- }
- else
+ if ( (ERROR_SUCCESS == RegQueryValueEx (hKey, L"RPSessionInterval", NULL, NULL, (LPBYTE) &dwValue, &cbValue))
+ && (dwValue == 1)
+ )
{
- if ( (ERROR_SUCCESS == RegQueryValueEx (hKey, L"DisableSR", NULL, NULL, (LPBYTE) &dwValue, &cbValue))
- && (dwValue == 0)
- )
- {
- bEnabled = TRUE;
- }
+ bEnabled = TRUE;
}
-
RegCloseKey (hKey);
}
@@ -720,10 +709,6 @@ void DetermineUpgradeDowngradeStatus (BOOL bCloseDriverHandle, LONG *driverVersi
DWORD dwResult;
BOOL bResult = DeviceIoControl (hDriver, TC_IOCTL_GET_DRIVER_VERSION, NULL, 0, &driverVersion, sizeof (driverVersion), &dwResult, NULL);
- if (!bResult)
- bResult = DeviceIoControl (hDriver, TC_IOCTL_LEGACY_GET_DRIVER_VERSION, NULL, 0, &driverVersion, sizeof (driverVersion), &dwResult, NULL);
-
-
bUpgrade = (bResult && driverVersion <= VERSION_NUM);
bDowngrade = (bResult && driverVersion > VERSION_NUM);
bReinstallMode = (bResult && driverVersion == VERSION_NUM);
@@ -1361,13 +1346,10 @@ error:
}
// Register COM servers for UAC
- if (IsOSAtLeast (WIN_VISTA))
+ if (!RegisterComServers (szDir))
{
- if (!RegisterComServers (szDir))
- {
- Error ("COM_REG_FAILED", hwndDlg);
- return FALSE;
- }
+ Error ("COM_REG_FAILED", hwndDlg);
+ return FALSE;
}
return bOK;
@@ -1440,16 +1422,9 @@ BOOL DoApplicationDataUninstall (HWND hwndDlg)
BOOL DoRegUninstall (HWND hwndDlg, BOOL bRemoveDeprecated)
{
wchar_t regk [64];
- typedef LSTATUS (WINAPI *RegDeleteKeyExWFn) (HKEY hKey,LPCWSTR lpSubKey,REGSAM samDesired,WORD Reserved);
- RegDeleteKeyExWFn RegDeleteKeyExWPtr = NULL;
- HMODULE hAdvapiDll = LoadLibrary (L"Advapi32.dll");
- if (hAdvapiDll)
- {
- RegDeleteKeyExWPtr = (RegDeleteKeyExWFn) GetProcAddress(hAdvapiDll, "RegDeleteKeyExW");
- }
// Unregister COM servers
- if (!bRemoveDeprecated && IsOSAtLeast (WIN_VISTA))
+ if (!bRemoveDeprecated)
{
if (!UnregisterComServers (InstallationPath))
StatusMessage (hwndDlg, "COM_DEREG_FAILED");
@@ -1458,16 +1433,9 @@ BOOL DoRegUninstall (HWND hwndDlg, BOOL bRemoveDeprecated)
if (!bRemoveDeprecated)
StatusMessage (hwndDlg, "REMOVING_REG");
- if (RegDeleteKeyExWPtr)
- {
- RegDeleteKeyExWPtr (HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\VeraCrypt", KEY_WOW64_32KEY, 0);
- RegDeleteKeyExWPtr (HKEY_CURRENT_USER, L"Software\\VeraCrypt", KEY_WOW64_32KEY, 0);
- }
- else
- {
- RegDeleteKey (HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\VeraCrypt");
- RegDeleteKey (HKEY_LOCAL_MACHINE, L"Software\\VeraCrypt");
- }
+ RegDeleteKeyExW (HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\VeraCrypt", KEY_WOW64_32KEY, 0);
+ RegDeleteKeyExW (HKEY_CURRENT_USER, L"Software\\VeraCrypt", KEY_WOW64_32KEY, 0);
+
RegDeleteKey (HKEY_LOCAL_MACHINE, L"Software\\Classes\\VeraCryptVolume\\Shell\\open\\command");
RegDeleteKey (HKEY_LOCAL_MACHINE, L"Software\\Classes\\VeraCryptVolume\\Shell\\open");
RegDeleteKey (HKEY_LOCAL_MACHINE, L"Software\\Classes\\VeraCryptVolume\\Shell");
@@ -1506,9 +1474,6 @@ BOOL DoRegUninstall (HWND hwndDlg, BOOL bRemoveDeprecated)
SHChangeNotify (SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);
}
- if (hAdvapiDll)
- FreeLibrary (hAdvapiDll);
-
return TRUE;
}
@@ -1755,13 +1720,6 @@ BOOL DoDriverUnload (HWND hwndDlg)
// Check mounted volumes
bResult = DeviceIoControl (hDriver, TC_IOCTL_IS_ANY_VOLUME_MOUNTED, NULL, 0, &volumesMounted, sizeof (volumesMounted), &dwResult, NULL);
- if (!bResult)
- {
- bResult = DeviceIoControl (hDriver, TC_IOCTL_LEGACY_GET_MOUNTED_VOLUMES, NULL, 0, &driver, sizeof (driver), &dwResult, NULL);
- if (bResult)
- volumesMounted = driver.ulMountedDrives;
- }
-
if (bResult)
{
if (volumesMounted != 0)
@@ -2379,6 +2337,12 @@ void DoInstall (void *arg)
if (bSystemRestore)
SetSystemRestorePoint (hwndDlg, TRUE);
+ if (bOK && (bDisableMemoryProtection != bOriginalDisableMemoryProtection))
+ {
+ WriteMemoryProtectionConfig(bDisableMemoryProtection? FALSE : TRUE);
+ bRestartRequired = TRUE; // Restart is required to apply the new memory protection settings
+ }
+
if (bOK)
{
UpdateProgressBarProc(100);
@@ -2591,20 +2555,46 @@ typedef struct
static tLanguageEntry g_languagesEntries[] = {
{L"العربية", IDR_LANG_AR, LANG_ARABIC, "ar", NULL},
+ {L"Беларуская", IDR_LANG_BE, LANG_BELARUSIAN, "be", NULL},
+ {L"Български", IDR_LANG_BG, LANG_BULGARIAN, "bg", NULL},
+ {L"Català", IDR_LANG_CA, LANG_CATALAN, "ca", NULL},
+ {L"Corsu", IDR_LANG_CO, LANG_CORSICAN, "co", NULL},
{L"Čeština", IDR_LANG_CS, LANG_CZECH, "cs", NULL},
+ {L"Dansk", IDR_LANG_DA, LANG_DANISH, "da", NULL},
{L"Deutsch", IDR_LANG_DE, LANG_GERMAN, "de", NULL},
+ {L"Ελληνικά", IDR_LANG_EL, LANG_GREEK, "el", NULL},
{L"English", IDR_LANGUAGE, LANG_ENGLISH, "en", NULL},
{L"Español", IDR_LANG_ES, LANG_SPANISH, "es", NULL},
+ {L"Eesti", IDR_LANG_ET, LANG_ESTONIAN, "et", NULL},
+ {L"Euskara", IDR_LANG_EU, LANG_BASQUE, "eu", NULL},
+ {L"فارسي", IDR_LANG_FA, LANG_PERSIAN, "fa", NULL},
+ {L"Suomi", IDR_LANG_FI, LANG_FINNISH, "fi", NULL},
{L"Français", IDR_LANG_FR, LANG_FRENCH, "fr", NULL},
+ {L"עברית", IDR_LANG_HE, LANG_HEBREW, "he", NULL},
+ {L"Magyar", IDR_LANG_HU, LANG_HUNGARIAN, "hu", NULL},
+ {L"Bahasa Indonesia", IDR_LANG_ID, LANG_INDONESIAN, "id", NULL},
{L"Italiano", IDR_LANG_IT, LANG_ITALIAN, "it", NULL},
{L"日本語", IDR_LANG_JA, LANG_JAPANESE, "ja", NULL},
+ {L"ქართული", IDR_LANG_KA, LANG_GEORGIAN, "ka", NULL},
+ {L"한국어", IDR_LANG_KO, LANG_KOREAN, "ko", NULL},
+ {L"Latviešu", IDR_LANG_LV, LANG_LATVIAN, "lv", NULL},
{L"Nederlands", IDR_LANG_NL, LANG_DUTCH, "nl", NULL},
+ {L"Norsk Nynorsk", IDR_LANG_NN, LANG_NORWEGIAN, "nn", NULL},
{L"Polski", IDR_LANG_PL, LANG_POLISH, "pl", NULL},
{L"Română", IDR_LANG_RO, LANG_ROMANIAN, "ro", NULL},
{L"Русский", IDR_LANG_RU, LANG_RUSSIAN, "ru", NULL},
+ {L"Português-Brasil", IDR_LANG_PTBR, LANG_PORTUGUESE, "pt-br", L"pt-BR"},
+ {L"Slovenčina", IDR_LANG_SK, LANG_SLOVAK, "sk", NULL},
+ {L"Slovenščina", IDR_LANG_SL, LANG_SLOVENIAN, "sl", NULL},
+ {L"Svenska", IDR_LANG_SV, LANG_SWEDISH, "sv", NULL},
+ {L"ภาษาไทย", IDR_LANG_TH, LANG_THAI, "th", NULL},
+ {L"Türkçe", IDR_LANG_TR, LANG_TURKISH, "tr", NULL},
+ {L"Українська", IDR_LANG_UK, LANG_UKRAINIAN, "uk", NULL},
+ {L"Ўзбекча", IDR_LANG_UZ, LANG_UZBEK, "uz", NULL},
{L"Tiếng Việt", IDR_LANG_VI, LANG_VIETNAMESE, "vi", NULL},
{L"简体中文", IDR_LANG_ZHCN, LANG_CHINESE, "zh-cn", L"zh-CN"},
- {L"繁體中文", IDR_LANG_ZHHK, LANG_CHINESE, "zh-hk", L"zh-HK"},
+ {L"繁體中文(香港)", IDR_LANG_ZHHK, LANG_CHINESE, "zh-hk", L"zh-HK"},
+ {L"繁體中文", IDR_LANG_ZHTW, LANG_CHINESE, "zh-tw", L"zh-TW"},
};
typedef int (WINAPI *LCIDToLocaleNameFn)(
@@ -2767,7 +2757,6 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpsz
if (IsAdmin () != TRUE)
if (MessageBoxW (NULL, GetString ("SETUP_ADMIN"), lpszTitle, MB_YESNO | MB_ICONQUESTION) != IDYES)
{
- FinalizeApp ();
exit (1);
}
#endif
@@ -2820,7 +2809,6 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpsz
#else
MessageBox (NULL, L"Error: This portable installer file does not contain any compressed files.\n\nTo create a self-extracting portable installation package (with embedded compressed files), run:\n\"VeraCrypt Portable.exe\" /p", L"VeraCrypt", MB_ICONERROR | MB_SETFOREGROUND | MB_TOPMOST);
#endif
- FinalizeApp ();
exit (1);
}
@@ -2841,7 +2829,6 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpsz
bUninstall = TRUE;
break;
default:
- FinalizeApp ();
exit (1);
}
}
@@ -2867,7 +2854,7 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpsz
if (!bUninstall)
{
- if (!bDevm && !LocalizationActive && (nCurrentOS >= WIN_VISTA))
+ if (!bDevm && !LocalizationActive)
{
BOOL bHasPreferredLanguage = (strlen (GetPreferredLangId ()) > 0)? TRUE : FALSE;
if ((IDCANCEL == DialogBoxParamW (hInstance, MAKEINTRESOURCEW (IDD_INSTALL_LANGUAGE), NULL, (DLGPROC) SelectLanguageDialogProc, (LPARAM) 0 ))
@@ -2875,7 +2862,6 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpsz
)
{
// Language dialog cancelled by user: exit the installer
- FinalizeApp ();
exit (1);
}
}
@@ -2912,6 +2898,5 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpsz
}
#endif
}
- FinalizeApp ();
return 0;
}
diff --git a/src/Setup/Setup.h b/src/Setup/Setup.h
index e38dd75a..70a04555 100644
--- a/src/Setup/Setup.h
+++ b/src/Setup/Setup.h
@@ -120,6 +120,8 @@ extern BOOL bReinstallMode;
extern BOOL bSystemRestore;
extern BOOL bDisableSwapFiles;
extern BOOL bForAllUsers;
+extern BOOL bDisableMemoryProtection;
+extern BOOL bOriginalDisableMemoryProtection;
extern BOOL bRegisterFileExt;
extern BOOL bAddToStartMenu;
extern BOOL bDesktopIcon;
diff --git a/src/Setup/Setup.manifest b/src/Setup/Setup.manifest
index afd4c1c0..abc1ef65 100644
--- a/src/Setup/Setup.manifest
+++ b/src/Setup/Setup.manifest
@@ -14,7 +14,13 @@
</asmv3:application>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
- <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
+ <!-- Windows 10 and Windows 11 -->
+ <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
+ <!-- Windows 8.1 -->
+ <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
+ <!-- Windows 8 -->
+ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
+ <!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
</application>
</compatibility>
diff --git a/src/Setup/Setup.rc b/src/Setup/Setup.rc
index fa119b19..89457692 100644
--- a/src/Setup/Setup.rc
+++ b/src/Setup/Setup.rc
@@ -28,8 +28,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,26,0,0
- PRODUCTVERSION 1,26,0,0
+ FILEVERSION 1,26,10,0
+ PRODUCTVERSION 1,26,10,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -46,11 +46,11 @@ BEGIN
BEGIN
VALUE "CompanyName", "IDRIX"
VALUE "FileDescription", "VeraCrypt Setup"
- VALUE "FileVersion", "1.26"
+ VALUE "FileVersion", "1.26.10"
VALUE "LegalTrademarks", "VeraCrypt"
VALUE "OriginalFilename", "VeraCrypt Setup.exe"
VALUE "ProductName", "VeraCrypt"
- VALUE "ProductVersion", "1.26"
+ VALUE "ProductVersion", "1.26.10"
END
END
BLOCK "VarFileInfo"
@@ -93,6 +93,32 @@ IDR_LANG_RU LANGUAGES "..\\..\\Translations\\Language.
IDR_LANG_VI LANGUAGES "..\\..\\Translations\\Language.vi.xml"
IDR_LANG_ZHCN LANGUAGES "..\\..\\Translations\\Language.zh-cn.xml"
IDR_LANG_ZHHK LANGUAGES "..\\..\\Translations\\Language.zh-hk.xml"
+IDR_LANG_BE LANGUAGES "..\\..\\Translations\\Language.be.xml"
+IDR_LANG_BG LANGUAGES "..\\..\\Translations\\Language.bg.xml"
+IDR_LANG_CA LANGUAGES "..\\..\\Translations\\Language.ca.xml"
+IDR_LANG_CO LANGUAGES "..\\..\\Translations\\Language.co.xml"
+IDR_LANG_DA LANGUAGES "..\\..\\Translations\\Language.da.xml"
+IDR_LANG_EL LANGUAGES "..\\..\\Translations\\Language.el.xml"
+IDR_LANG_ET LANGUAGES "..\\..\\Translations\\Language.et.xml"
+IDR_LANG_EU LANGUAGES "..\\..\\Translations\\Language.eu.xml"
+IDR_LANG_FA LANGUAGES "..\\..\\Translations\\Language.fa.xml"
+IDR_LANG_FI LANGUAGES "..\\..\\Translations\\Language.fi.xml"
+IDR_LANG_HE LANGUAGES "..\\..\\Translations\\Language.he.xml"
+IDR_LANG_HU LANGUAGES "..\\..\\Translations\\Language.hu.xml"
+IDR_LANG_ID LANGUAGES "..\\..\\Translations\\Language.id.xml"
+IDR_LANG_KA LANGUAGES "..\\..\\Translations\\Language.ka.xml"
+IDR_LANG_KO LANGUAGES "..\\..\\Translations\\Language.ko.xml"
+IDR_LANG_LV LANGUAGES "..\\..\\Translations\\Language.lv.xml"
+IDR_LANG_NN LANGUAGES "..\\..\\Translations\\Language.nn.xml"
+IDR_LANG_PTBR LANGUAGES "..\\..\\Translations\\Language.pt-br.xml"
+IDR_LANG_SK LANGUAGES "..\\..\\Translations\\Language.sk.xml"
+IDR_LANG_SL LANGUAGES "..\\..\\Translations\\Language.sl.xml"
+IDR_LANG_SV LANGUAGES "..\\..\\Translations\\Language.sv.xml"
+IDR_LANG_TH LANGUAGES "..\\..\\Translations\\Language.th.xml"
+IDR_LANG_TR LANGUAGES "..\\..\\Translations\\Language.tr.xml"
+IDR_LANG_UK LANGUAGES "..\\..\\Translations\\Language.uk.xml"
+IDR_LANG_UZ LANGUAGES "..\\..\\Translations\\Language.uz.xml"
+IDR_LANG_ZHTW LANGUAGES "..\\..\\Translations\\Language.zh-tw.xml"
/////////////////////////////////////////////////////////////////////////////
//
@@ -120,12 +146,15 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
EDITTEXT IDC_DESTINATION,11,41,260,13,ES_AUTOHSCROLL
PUSHBUTTON "Bro&wse...",IDC_BROWSE,278,40,59,14
- CONTROL "Install &for all users",IDC_ALL_USERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,77,168,11
+ CONTROL "Install &for all users",IDC_ALL_USERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,68,168,11
+ CONTROL "Add VeraCrypt to &Start menu",IDC_PROG_GROUP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,80,168,11
+ CONTROL "Add VeraCrypt icon to &desktop",IDC_DESKTOP_ICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,92,168,11
CONTROL "Associate the .hc file &extension with VeraCrypt",IDC_FILE_TYPE,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,113,232,11
- CONTROL "Add VeraCrypt to &Start menu",IDC_PROG_GROUP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,89,168,11
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,104,232,11
+ CONTROL "Disable memory protection for Accessibility tools compatibility",IDC_DISABLE_MEMORY_PROTECTION,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,115,315,10
+ PUSHBUTTON "?",IDC_DISABLE_MEMORY_PROTECTION_HELP,337,111,7,14
CONTROL "Create System &Restore point",IDC_SYSTEM_RESTORE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,125,194,11
- CONTROL "Add VeraCrypt icon to &desktop",IDC_DESKTOP_ICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,101,168,11
LTEXT "Please select or type the location where you want to install the VeraCrypt program files. If the specified folder does not exist, it will be automatically created.",IDT_INSTALL_DESTINATION,11,14,319,25
END
diff --git a/src/Setup/Setup.vcxproj b/src/Setup/Setup.vcxproj
index 59cec036..d1159c0b 100644
--- a/src/Setup/Setup.vcxproj
+++ b/src/Setup/Setup.vcxproj
@@ -108,7 +108,7 @@
<AdditionalDependencies>libcmtd.lib;atlsd.lib;mpr.lib;..\Common\Debug\Zip.lib;..\Crypto\Debug\crypto.lib;..\Common\Debug\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptSetup.exe</OutputFile>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
- <DelayLoadDLLs>user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)Setup.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
@@ -147,7 +147,7 @@ copy Debug\VeraCryptSetup.exe "..\Debug\Setup Files\VeraCrypt Setup.exe" &gt;NUL
<AdditionalDependencies>mpr.lib;..\Common\Release\Zip.lib;..\Crypto\Release\crypto.lib;..\Common\Release\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptSetup.exe</OutputFile>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
- <DelayLoadDLLs>user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -185,7 +185,7 @@ copy Debug\VeraCryptSetup.exe "..\Debug\Setup Files\VeraCrypt Setup.exe" &gt;NUL
<AdditionalDependencies>mpr.lib;..\Common\Release\Zip.lib;..\Crypto\Release\crypto.lib;..\Common\Release\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptSetup.exe</OutputFile>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
- <DelayLoadDLLs>user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -223,7 +223,7 @@ copy Debug\VeraCryptSetup.exe "..\Debug\Setup Files\VeraCrypt Setup.exe" &gt;NUL
<AdditionalDependencies>mpr.lib;..\Common\Release\Zip.lib;..\Crypto\Release\crypto.lib;..\Common\Release\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptSetup.exe</OutputFile>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
- <DelayLoadDLLs>user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
diff --git a/src/Setup/Wizard.c b/src/Setup/Wizard.c
index 7de3ef0c..abf76f69 100644
--- a/src/Setup/Wizard.c
+++ b/src/Setup/Wizard.c
@@ -45,8 +45,8 @@ enum wizard_pages
HWND hCurPage = NULL; /* Handle to current wizard page */
int nCurPageNo = -1; /* The current wizard page */
-wchar_t WizardDestInstallPath [TC_MAX_PATH];
-wchar_t WizardDestExtractPath [TC_MAX_PATH];
+wchar_t WizardDestInstallPath [TC_MAX_PATH] = { 0 };
+wchar_t WizardDestExtractPath [TC_MAX_PATH] = { 0 };
wchar_t SelfFile [TC_MAX_PATH];
HBITMAP hbmWizardBitmapRescaled = NULL;
@@ -212,6 +212,7 @@ static int GetDonVal (int minVal, int maxVal)
BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
static char PageDebugId[128];
+ static HWND hDisableMemProtectionTooltipWnd = NULL;
WORD lw = LOWORD (wParam);
WORD hw = HIWORD (wParam);
@@ -439,9 +440,16 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
EnableWindow (GetDlgItem (hwndDlg, IDC_SYSTEM_RESTORE), FALSE);
}
+ hDisableMemProtectionTooltipWnd = CreateToolTip (IDC_DISABLE_MEMORY_PROTECTION, hwndDlg, "DISABLE_MEMORY_PROTECTION_WARNING");
+ // make IDC_DISABLE_MEMORY_PROTECTION control fit the text so that the tooltip is shown only when mouse is over the text
+ AccommodateCheckBoxTextWidth(hwndDlg, IDC_DISABLE_MEMORY_PROTECTION);
+ // make the help button adjacent to the checkbox
+ MakeControlsContiguous(hwndDlg, IDC_DISABLE_MEMORY_PROTECTION, IDC_DISABLE_MEMORY_PROTECTION_HELP);
+
SetCheckBox (hwndDlg, IDC_ALL_USERS, bForAllUsers);
SetCheckBox (hwndDlg, IDC_FILE_TYPE, bRegisterFileExt);
SetCheckBox (hwndDlg, IDC_PROG_GROUP, bAddToStartMenu);
+ SetCheckBox (hwndDlg, IDC_DISABLE_MEMORY_PROTECTION, bDisableMemoryProtection);
SetCheckBox (hwndDlg, IDC_DESKTOP_ICON, bDesktopIcon);
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString (bUpgrade ? "UPGRADE" : "INSTALL"));
@@ -646,7 +654,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
switch (lw)
{
case IDC_BROWSE:
- if (BrowseDirectories (hwndDlg, "SELECT_DEST_DIR", WizardDestExtractPath))
+ if (BrowseDirectories (hwndDlg, "SELECT_DEST_DIR", WizardDestExtractPath, WizardDestExtractPath))
{
if (WizardDestExtractPath [wcslen(WizardDestExtractPath)-1] != L'\\')
{
@@ -667,7 +675,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
switch (lw)
{
case IDC_BROWSE:
- if (BrowseDirectories (hwndDlg, "SELECT_DEST_DIR", WizardDestInstallPath))
+ if (BrowseDirectories (hwndDlg, "SELECT_DEST_DIR", WizardDestInstallPath, WizardDestInstallPath))
{
if (WizardDestInstallPath [wcslen(WizardDestInstallPath)-1] != L'\\')
{
@@ -685,6 +693,18 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
bForAllUsers = IsButtonChecked (GetDlgItem (hCurPage, IDC_ALL_USERS));
return 1;
+ case IDC_DISABLE_MEMORY_PROTECTION:
+ bDisableMemoryProtection = IsButtonChecked (GetDlgItem (hCurPage, IDC_DISABLE_MEMORY_PROTECTION));
+ if (bDisableMemoryProtection)
+ {
+ Warning ("DISABLE_MEMORY_PROTECTION_WARNING", hwndDlg);
+ }
+ return 1;
+
+ case IDC_DISABLE_MEMORY_PROTECTION_HELP:
+ Applink("memoryprotection");
+ return 1;
+
case IDC_FILE_TYPE:
bRegisterFileExt = IsButtonChecked (GetDlgItem (hCurPage, IDC_FILE_TYPE));
return 1;
@@ -760,6 +780,16 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
}
return 0;
+ case WM_DESTROY:
+
+ if (hDisableMemProtectionTooltipWnd != NULL)
+ {
+ DestroyWindow (hDisableMemProtectionTooltipWnd);
+ hDisableMemProtectionTooltipWnd = NULL;
+ }
+
+ break;
+
}
return 0;
@@ -853,6 +883,9 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
DonColorSchemeId = GetDonVal (2, 9);
+ // get the initial value of bDisableMemoryProtection by reading the registry
+ bDisableMemoryProtection = bOriginalDisableMemoryProtection = ReadMemoryProtectionConfig()? FALSE : TRUE;
+
if (bDevm)
{
InitWizardDestInstallPath ();
diff --git a/src/SetupDLL/Resource.h b/src/SetupDLL/Resource.h
index 8882d67b..b5b7d466 100644
--- a/src/SetupDLL/Resource.h
+++ b/src/SetupDLL/Resource.h
@@ -17,6 +17,32 @@
#define IDR_LANG_VI 31
#define IDR_LANG_ZHCN 32
#define IDR_LANG_ZHHK 33
+#define IDR_LANG_BE 34
+#define IDR_LANG_BG 35
+#define IDR_LANG_CA 36
+#define IDR_LANG_CO 37
+#define IDR_LANG_DA 38
+#define IDR_LANG_EL 39
+#define IDR_LANG_ET 40
+#define IDR_LANG_EU 41
+#define IDR_LANG_FA 42
+#define IDR_LANG_FI 43
+#define IDR_LANG_HE 44
+#define IDR_LANG_HU 45
+#define IDR_LANG_ID 46
+#define IDR_LANG_KA 47
+#define IDR_LANG_KO 48
+#define IDR_LANG_LV 49
+#define IDR_LANG_NN 50
+#define IDR_LANG_PTBR 51
+#define IDR_LANG_SK 52
+#define IDR_LANG_SL 53
+#define IDR_LANG_SV 54
+#define IDR_LANG_TH 55
+#define IDR_LANG_TR 56
+#define IDR_LANG_UK 57
+#define IDR_LANG_UZ 58
+#define IDR_LANG_ZHTW 59
#define IDD_INSTALL 101
#define IDD_INSTALL_OPTIONS_PAGE_DLG 102
#define IDD_UNINSTALL 103
diff --git a/src/SetupDLL/Setup.c b/src/SetupDLL/Setup.c
index 2afc7312..1c3782dd 100644
--- a/src/SetupDLL/Setup.c
+++ b/src/SetupDLL/Setup.c
@@ -68,108 +68,6 @@ typedef enum
#define WAIT_PERIOD 3
-extern HMODULE hRichEditDll;
-extern HMODULE hComctl32Dll;
-extern HMODULE hSetupDll;
-extern HMODULE hShlwapiDll;
-extern HMODULE hProfApiDll;
-extern HMODULE hUsp10Dll;
-extern HMODULE hCryptSpDll;
-extern HMODULE hUXThemeDll;
-extern HMODULE hUserenvDll;
-extern HMODULE hRsaenhDll;
-extern HMODULE himm32dll;
-extern HMODULE hMSCTFdll;
-extern HMODULE hfltlibdll;
-extern HMODULE hframedyndll;
-extern HMODULE hpsapidll;
-extern HMODULE hsecur32dll;
-extern HMODULE hnetapi32dll;
-extern HMODULE hauthzdll;
-extern HMODULE hxmllitedll;
-extern HMODULE hmprdll;
-extern HMODULE hsppdll;
-extern HMODULE vssapidll;
-extern HMODULE hvsstracedll;
-extern HMODULE hcfgmgr32dll;
-extern HMODULE hdevobjdll;
-extern HMODULE hpowrprofdll;
-extern HMODULE hsspiclidll;
-extern HMODULE hcryptbasedll;
-extern HMODULE hdwmapidll;
-extern HMODULE hmsasn1dll;
-extern HMODULE hcrypt32dll;
-extern HMODULE hbcryptdll;
-extern HMODULE hbcryptprimitivesdll;
-extern HMODULE hMsls31;
-extern HMODULE hntmartadll;
-extern HMODULE hwinscarddll;
-extern HMODULE hmsvcrtdll;
-extern HMODULE hWinTrustLib;
-extern HMODULE hAdvapi32Dll;
-
-#define FREE_DLL(h) if (h) { FreeLibrary (h); h = NULL;}
-
-#ifndef BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE
-#define BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE 0x00000001
-#endif
-
-#ifndef BASE_SEARCH_PATH_PERMANENT
-#define BASE_SEARCH_PATH_PERMANENT 0x00008000
-#endif
-
-#ifndef LOAD_LIBRARY_SEARCH_SYSTEM32
-#define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800
-#endif
-
-typedef BOOL (WINAPI *SetDllDirectoryPtr)(LPCWSTR lpPathName);
-typedef BOOL (WINAPI *SetSearchPathModePtr)(DWORD Flags);
-typedef BOOL (WINAPI *SetDefaultDllDirectoriesPtr)(DWORD DirectoryFlags);
-
-typedef void (WINAPI *InitCommonControlsPtr)(void);
-typedef HIMAGELIST (WINAPI *ImageList_CreatePtr)(int cx, int cy, UINT flags, int cInitial, int cGrow);
-typedef int (WINAPI *ImageList_AddPtr)(HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask);
-
-typedef VOID (WINAPI *SetupCloseInfFilePtr)(HINF InfHandle);
-typedef HKEY (WINAPI *SetupDiOpenClassRegKeyPtr)(CONST GUID *ClassGuid,REGSAM samDesired);
-typedef BOOL (WINAPI *SetupInstallFromInfSectionWPtr)(HWND,HINF,PCWSTR,UINT,HKEY,PCWSTR,UINT,PSP_FILE_CALLBACK_W,PVOID,HDEVINFO,PSP_DEVINFO_DATA);
-typedef HINF (WINAPI *SetupOpenInfFileWPtr)(PCWSTR FileName,PCWSTR InfClass,DWORD InfStyle,PUINT ErrorLine);
-
-typedef LSTATUS (STDAPICALLTYPE *SHDeleteKeyWPtr)(HKEY hkey, LPCWSTR pszSubKey);
-
-typedef HRESULT (STDAPICALLTYPE *SHStrDupWPtr)(LPCWSTR psz, LPWSTR *ppwsz);
-
-// ChangeWindowMessageFilter
-typedef BOOL (WINAPI *ChangeWindowMessageFilterPtr) (UINT, DWORD);
-
-typedef BOOL (WINAPI *CreateProcessWithTokenWFn)(
- __in HANDLE hToken,
- __in DWORD dwLogonFlags,
- __in_opt LPCWSTR lpApplicationName,
- __inout_opt LPWSTR lpCommandLine,
- __in DWORD dwCreationFlags,
- __in_opt LPVOID lpEnvironment,
- __in_opt LPCWSTR lpCurrentDirectory,
- __in LPSTARTUPINFOW lpStartupInfo,
- __out LPPROCESS_INFORMATION lpProcessInformation
- );
-
-extern SetDllDirectoryPtr SetDllDirectoryFn;
-extern SetSearchPathModePtr SetSearchPathModeFn;
-extern SetDefaultDllDirectoriesPtr SetDefaultDllDirectoriesFn;
-
-extern ImageList_CreatePtr ImageList_CreateFn;
-extern ImageList_AddPtr ImageList_AddFn;
-
-extern SetupCloseInfFilePtr SetupCloseInfFileFn;
-extern SetupDiOpenClassRegKeyPtr SetupDiOpenClassRegKeyFn;
-extern SetupInstallFromInfSectionWPtr SetupInstallFromInfSectionWFn;
-extern SetupOpenInfFileWPtr SetupOpenInfFileWFn;
-extern SHDeleteKeyWPtr SHDeleteKeyWFn;
-extern SHStrDupWPtr SHStrDupWFn;
-extern ChangeWindowMessageFilterPtr ChangeWindowMessageFilterFn;
-extern CreateProcessWithTokenWFn CreateProcessWithTokenWPtr;
-
wchar_t InstallationPath[TC_MAX_PATH];
BOOL bUninstall = FALSE;
@@ -328,10 +226,6 @@ void DetermineUpgradeDowngradeStatus (BOOL bCloseDriverHandle, LONG *driverVersi
DWORD dwResult;
BOOL bResult = DeviceIoControl (hDriver, TC_IOCTL_GET_DRIVER_VERSION, NULL, 0, &driverVersion, sizeof (driverVersion), &dwResult, NULL);
- if (!bResult)
- bResult = DeviceIoControl (hDriver, TC_IOCTL_LEGACY_GET_DRIVER_VERSION, NULL, 0, &driverVersion, sizeof (driverVersion), &dwResult, NULL);
-
-
bUpgrade = (bResult && driverVersion <= VERSION_NUM);
bDowngrade = (bResult && driverVersion > VERSION_NUM);
bReinstallMode = (bResult && driverVersion == VERSION_NUM);
@@ -360,26 +254,13 @@ BOOL IsSystemRestoreEnabled ()
GetRestorePointRegKeyName (szRegPath, sizeof (szRegPath));
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, szRegPath, 0, KEY_READ | KEY_WOW64_64KEY, &hKey) == ERROR_SUCCESS)
{
- if (IsOSAtLeast (WIN_VISTA))
- {
- if ( (ERROR_SUCCESS == RegQueryValueEx (hKey, L"RPSessionInterval", NULL, NULL, (LPBYTE) &dwValue, &cbValue))
- && (dwValue == 1)
- )
- {
- bEnabled = TRUE;
- }
- }
- else
+ if ( (ERROR_SUCCESS == RegQueryValueEx (hKey, L"RPSessionInterval", NULL, NULL, (LPBYTE) &dwValue, &cbValue))
+ && (dwValue == 1)
+ )
{
- if ( (ERROR_SUCCESS == RegQueryValueEx (hKey, L"DisableSR", NULL, NULL, (LPBYTE) &dwValue, &cbValue))
- && (dwValue == 0)
- )
- {
- bEnabled = TRUE;
- }
+ bEnabled = TRUE;
}
-
RegCloseKey (hKey);
}
@@ -988,8 +869,6 @@ void HandleDriveNotReadyError_Dll (MSIHANDLE hInstaller)
{
MSILogAndShow (hInstaller, MSI_WARNING_LEVEL, GetString("SYS_AUTOMOUNT_DISABLED"));
}
- else if (nCurrentOS == WIN_VISTA && CurrentOSServicePack < 1)
- MSILogAndShow (hInstaller, MSI_WARNING_LEVEL, GetString("SYS_ASSIGN_DRIVE_LETTER"));
else
MSILogAndShow (hInstaller, MSI_WARNING_LEVEL, GetString("DEVICE_NOT_READY_ERROR"));
@@ -1155,11 +1034,6 @@ void handleError_Dll (MSIHANDLE hInstaller, int code, const char* srcPos)
// A non-error
break;
- case ERR_UNSUPPORTED_TRUECRYPT_FORMAT:
- StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("UNSUPPORTED_TRUECRYPT_FORMAT"), (code >> 24), (code >> 16) & 0x000000FF);
- MSILogAndShow (hInstaller, MSI_ERROR_LEVEL, AppendSrcPos (szTmp, srcPos).c_str());
- break;
-
default:
StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("ERR_UNKNOWN"), code);
MSILogAndShow (hInstaller, MSI_ERROR_LEVEL, AppendSrcPos (szTmp, srcPos).c_str());
@@ -1505,7 +1379,6 @@ BOOL DoDriverUnload_Dll (MSIHANDLE hInstaller, HWND hwnd)
if (hDriver != INVALID_HANDLE_VALUE)
{
- MOUNT_LIST_STRUCT driver;
LONG driverVersion = VERSION_NUM;
int refCount;
DWORD dwResult;
@@ -1592,13 +1465,6 @@ BOOL DoDriverUnload_Dll (MSIHANDLE hInstaller, HWND hwnd)
// Check mounted volumes
bResult = DeviceIoControl (hDriver, TC_IOCTL_IS_ANY_VOLUME_MOUNTED, NULL, 0, &volumesMounted, sizeof (volumesMounted), &dwResult, NULL);
- if (!bResult)
- {
- bResult = DeviceIoControl (hDriver, TC_IOCTL_LEGACY_GET_MOUNTED_VOLUMES, NULL, 0, &driver, sizeof (driver), &dwResult, NULL);
- if (bResult)
- volumesMounted = driver.ulMountedDrives;
- }
-
if (bResult)
{
if (volumesMounted != 0)
@@ -1836,7 +1702,7 @@ BOOL DoRegUninstall_Dll (MSIHANDLE hInstaller, BOOL bRemoveDeprecated)
}
// Unregister COM servers
- if (!bRemoveDeprecated && IsOSAtLeast (WIN_VISTA))
+ if (!bRemoveDeprecated)
{
if (!UnregisterComServers (InstallationPath))
MSILog (hInstaller, MSI_ERROR_LEVEL, GetString("COM_DEREG_FAILED"));
@@ -2123,141 +1989,12 @@ BOOL InitDll (MSIHANDLE hInstaller)
MSILog(hInstaller, MSI_INFO_LEVEL, L"Begin InitDll");
BOOL bOK = TRUE;
- InitCommonControlsPtr InitCommonControlsFn = NULL;
-
- /* remove current directory from dll search path */
- SetDllDirectoryFn = (SetDllDirectoryPtr) GetProcAddress (GetModuleHandle(L"kernel32.dll"), "SetDllDirectoryW");
- SetSearchPathModeFn = (SetSearchPathModePtr) GetProcAddress (GetModuleHandle(L"kernel32.dll"), "SetSearchPathMode");
- SetDefaultDllDirectoriesFn = (SetDefaultDllDirectoriesPtr) GetProcAddress (GetModuleHandle(L"kernel32.dll"), "SetDefaultDllDirectories");
- if (SetDllDirectoryFn)
- SetDllDirectoryFn (L"");
- if (SetSearchPathModeFn)
- SetSearchPathModeFn (BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE | BASE_SEARCH_PATH_PERMANENT);
- if (SetDefaultDllDirectoriesFn)
- SetDefaultDllDirectoriesFn (LOAD_LIBRARY_SEARCH_SYSTEM32);
InitOSVersionInfo();
InitGlobalLocks ();
- LoadSystemDll_Dll (hInstaller, L"msvcrt.dll", &hmsvcrtdll, TRUE, SRC_POS);
- LoadSystemDll_Dll (hInstaller, L"ntmarta.dll", &hntmartadll, TRUE, SRC_POS);
- LoadSystemDll_Dll (hInstaller, L"MPR.DLL", &hmprdll, TRUE, SRC_POS);
- if (IsOSAtLeast (WIN_7))
- {
- LoadSystemDll_Dll (hInstaller, L"ProfApi.DLL", &hProfApiDll, TRUE, SRC_POS);
- LoadSystemDll_Dll (hInstaller, L"cryptbase.dll", &hcryptbasedll, TRUE, SRC_POS);
- LoadSystemDll_Dll (hInstaller, L"sspicli.dll", &hsspiclidll, TRUE, SRC_POS);
- }
- LoadSystemDll_Dll (hInstaller, L"psapi.dll", &hpsapidll, TRUE, SRC_POS);
- LoadSystemDll_Dll (hInstaller, L"secur32.dll", &hsecur32dll, TRUE, SRC_POS);
- LoadSystemDll_Dll (hInstaller, L"msasn1.dll", &hmsasn1dll, TRUE, SRC_POS);
- LoadSystemDll_Dll (hInstaller, L"Usp10.DLL", &hUsp10Dll, TRUE, SRC_POS);
- if (IsOSAtLeast (WIN_7))
- LoadSystemDll_Dll (hInstaller, L"dwmapi.dll", &hdwmapidll, TRUE, SRC_POS);
- LoadSystemDll_Dll (hInstaller, L"UXTheme.dll", &hUXThemeDll, TRUE, SRC_POS);
-
- LoadSystemDll_Dll (hInstaller, L"msls31.dll", &hMsls31, TRUE, SRC_POS);
- LoadSystemDll_Dll (hInstaller, L"SETUPAPI.DLL", &hSetupDll, FALSE, SRC_POS);
- LoadSystemDll_Dll (hInstaller, L"SHLWAPI.DLL", &hShlwapiDll, FALSE, SRC_POS);
-
- LoadSystemDll_Dll (hInstaller, L"userenv.dll", &hUserenvDll, TRUE, SRC_POS);
- LoadSystemDll_Dll (hInstaller, L"rsaenh.dll", &hRsaenhDll, TRUE, SRC_POS);
-
- if (nCurrentOS < WIN_7)
- {
- if (nCurrentOS == WIN_XP)
- {
- LoadSystemDll_Dll (hInstaller, L"imm32.dll", &himm32dll, TRUE, SRC_POS);
- LoadSystemDll_Dll (hInstaller, L"MSCTF.dll", &hMSCTFdll, TRUE, SRC_POS);
- LoadSystemDll_Dll (hInstaller, L"fltlib.dll", &hfltlibdll, TRUE, SRC_POS);
- LoadSystemDll_Dll (hInstaller, L"wbem\\framedyn.dll", &hframedyndll, TRUE, SRC_POS);
- }
-
- if (IsOSAtLeast (WIN_VISTA))
- {
- LoadSystemDll_Dll (hInstaller, L"netapi32.dll", &hnetapi32dll, TRUE, SRC_POS);
- LoadSystemDll_Dll (hInstaller, L"authz.dll", &hauthzdll, TRUE, SRC_POS);
- LoadSystemDll_Dll (hInstaller, L"xmllite.dll", &hxmllitedll, TRUE, SRC_POS);
- }
- }
-
- if (IsOSAtLeast (WIN_VISTA))
- {
- LoadSystemDll_Dll (hInstaller, L"atl.dll", &hsppdll, TRUE, SRC_POS);
- LoadSystemDll_Dll (hInstaller, L"vsstrace.dll", &hvsstracedll, TRUE, SRC_POS);
- LoadSystemDll_Dll (hInstaller, L"vssapi.dll", &vssapidll, TRUE, SRC_POS);
- LoadSystemDll_Dll (hInstaller, L"spp.dll", &hsppdll, TRUE, SRC_POS);
- }
-
- LoadSystemDll_Dll (hInstaller, L"crypt32.dll", &hcrypt32dll, TRUE, SRC_POS);
-
- if (IsOSAtLeast (WIN_7))
- {
- LoadSystemDll_Dll (hInstaller, L"CryptSP.dll", &hCryptSpDll, TRUE, SRC_POS);
-
- LoadSystemDll_Dll (hInstaller, L"cfgmgr32.dll", &hcfgmgr32dll, TRUE, SRC_POS);
- LoadSystemDll_Dll (hInstaller, L"devobj.dll", &hdevobjdll, TRUE, SRC_POS);
- LoadSystemDll_Dll (hInstaller, L"powrprof.dll", &hpowrprofdll, TRUE, SRC_POS);
-
- LoadSystemDll_Dll (hInstaller, L"bcrypt.dll", &hbcryptdll, TRUE, SRC_POS);
- LoadSystemDll_Dll (hInstaller, L"bcryptprimitives.dll", &hbcryptprimitivesdll, TRUE, SRC_POS);
- }
-
- LoadSystemDll_Dll (hInstaller, L"COMCTL32.DLL", &hComctl32Dll, FALSE, SRC_POS);
-
- // call InitCommonControls function
- InitCommonControlsFn = (InitCommonControlsPtr) GetProcAddress (hComctl32Dll, "InitCommonControls");
- ImageList_AddFn = (ImageList_AddPtr) GetProcAddress (hComctl32Dll, "ImageList_Add");
- ImageList_CreateFn = (ImageList_CreatePtr) GetProcAddress (hComctl32Dll, "ImageList_Create");
-
- if (InitCommonControlsFn && ImageList_AddFn && ImageList_CreateFn)
- {
- InitCommonControlsFn();
- }
- else
- {
- MSILog(hInstaller, MSI_ERROR_LEVEL, GetString("INIT_DLL"));
- bOK = FALSE;
- goto end;
- }
-
- LoadSystemDll_Dll (hInstaller, L"Riched20.dll", &hRichEditDll, FALSE, SRC_POS);
- LoadSystemDll_Dll (hInstaller, L"Advapi32.dll", &hAdvapi32Dll, FALSE, SRC_POS);
-
- // Get SetupAPI functions pointers
- SetupCloseInfFileFn = (SetupCloseInfFilePtr) GetProcAddress (hSetupDll, "SetupCloseInfFile");
- SetupDiOpenClassRegKeyFn = (SetupDiOpenClassRegKeyPtr) GetProcAddress (hSetupDll, "SetupDiOpenClassRegKey");
- SetupInstallFromInfSectionWFn = (SetupInstallFromInfSectionWPtr) GetProcAddress (hSetupDll, "SetupInstallFromInfSectionW");
- SetupOpenInfFileWFn = (SetupOpenInfFileWPtr) GetProcAddress (hSetupDll, "SetupOpenInfFileW");
-
- if (!SetupCloseInfFileFn || !SetupDiOpenClassRegKeyFn || !SetupInstallFromInfSectionWFn || !SetupOpenInfFileWFn)
- {
- MSILog(hInstaller, MSI_ERROR_LEVEL, GetString("INIT_DLL"));
- bOK = FALSE;
- goto end;
- }
-
- // Get SHDeleteKeyW function pointer
- SHDeleteKeyWFn = (SHDeleteKeyWPtr) GetProcAddress (hShlwapiDll, "SHDeleteKeyW");
- SHStrDupWFn = (SHStrDupWPtr) GetProcAddress (hShlwapiDll, "SHStrDupW");
- if (!SHDeleteKeyWFn || !SHStrDupWFn)
- {
- MSILog(hInstaller, MSI_ERROR_LEVEL, GetString("INIT_DLL"));
- bOK = FALSE;
- goto end;
- }
-
- if (IsOSAtLeast (WIN_VISTA))
- {
- /* Get ChangeWindowMessageFilter used to enable some messages bypasss UIPI (User Interface Privilege Isolation) */
- ChangeWindowMessageFilterFn = (ChangeWindowMessageFilterPtr) GetProcAddress (GetModuleHandle (L"user32.dll"), "ChangeWindowMessageFilter");
- }
-
- // Get CreateProcessWithTokenW function pointer
- CreateProcessWithTokenWPtr = (CreateProcessWithTokenWFn) GetProcAddress(hAdvapi32Dll, "CreateProcessWithTokenW");
-
SetErrorMode (SetErrorMode (0) | SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
- CoInitialize (NULL);
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
// Force language to english to read strings from the default Language.xml embedded in the DLL.
SetPreferredLangId ("en");
@@ -2268,7 +2005,6 @@ BOOL InitDll (MSIHANDLE hInstaller)
_set_invalid_parameter_handler (InvalidParameterHandler);
RemoteSession = GetSystemMetrics (SM_REMOTESESSION) != 0;
-end:
MSILog(hInstaller, MSI_INFO_LEVEL, L"End InitDll");
return bOK;
}
@@ -2382,46 +2118,6 @@ void VC_CustomAction_Cleanup ()
FinalizeGlobalLocks ();
- FREE_DLL (hRichEditDll);
- FREE_DLL (hComctl32Dll);
- FREE_DLL (hSetupDll);
- FREE_DLL (hShlwapiDll);
- FREE_DLL (hProfApiDll);
- FREE_DLL (hUsp10Dll);
- FREE_DLL (hCryptSpDll);
- FREE_DLL (hUXThemeDll);
- FREE_DLL (hUserenvDll);
- FREE_DLL (hRsaenhDll);
- FREE_DLL (himm32dll);
- FREE_DLL (hMSCTFdll);
- FREE_DLL (hfltlibdll);
- FREE_DLL (hframedyndll);
- FREE_DLL (hpsapidll);
- FREE_DLL (hsecur32dll);
- FREE_DLL (hnetapi32dll);
- FREE_DLL (hauthzdll);
- FREE_DLL (hxmllitedll);
- FREE_DLL (hmprdll);
- FREE_DLL (hsppdll);
- FREE_DLL (vssapidll);
- FREE_DLL (hvsstracedll);
- FREE_DLL (hCryptSpDll);
- FREE_DLL (hcfgmgr32dll);
- FREE_DLL (hdevobjdll);
- FREE_DLL (hpowrprofdll);
- FREE_DLL (hsspiclidll);
- FREE_DLL (hcryptbasedll);
- FREE_DLL (hdwmapidll);
- FREE_DLL (hmsasn1dll);
- FREE_DLL (hcrypt32dll);
- FREE_DLL (hbcryptdll);
- FREE_DLL (hbcryptprimitivesdll);
- FREE_DLL (hMsls31);
- FREE_DLL (hntmartadll);
- FREE_DLL (hwinscarddll);
- FREE_DLL (hmsvcrtdll);
- FREE_DLL (hAdvapi32Dll);
-
//MSILog(hInstaller, MSI_INFO_LEVEL, L"End VC_CustomAction_Cleanup");
}
@@ -2927,13 +2623,10 @@ EXTERN_C UINT STDAPICALLTYPE VC_CustomAction_PostInstall(MSIHANDLE hInstaller)
// Last part of DoRegInstall()
{
// Register COM servers for UAC
- if (IsOSAtLeast (WIN_VISTA))
+ if (!RegisterComServers ((wchar_t*)szInstallDir.c_str()))
{
- if (!RegisterComServers ((wchar_t*)szInstallDir.c_str()))
- {
- MSILogAndShow (hInstaller, MSI_ERROR_LEVEL, GetString("COM_REG_FAILED"));
- goto end;
- }
+ MSILogAndShow (hInstaller, MSI_ERROR_LEVEL, GetString("COM_REG_FAILED"));
+ goto end;
}
}
diff --git a/src/SetupDLL/Setup.rc b/src/SetupDLL/Setup.rc
index 501f820f..aab2f5c5 100644
--- a/src/SetupDLL/Setup.rc
+++ b/src/SetupDLL/Setup.rc
@@ -28,8 +28,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,26,0,0
- PRODUCTVERSION 1,26,0,0
+ FILEVERSION 1,26,10,0
+ PRODUCTVERSION 1,26,10,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -46,11 +46,11 @@ BEGIN
BEGIN
VALUE "CompanyName", "IDRIX"
VALUE "FileDescription", "VeraCryptSetup"
- VALUE "FileVersion", "1.26"
+ VALUE "FileVersion", "1.26.10"
VALUE "LegalTrademarks", "VeraCrypt"
VALUE "OriginalFilename", "VeraCryptSetup.dll"
VALUE "ProductName", "VeraCrypt"
- VALUE "ProductVersion", "1.26"
+ VALUE "ProductVersion", "1.26.10"
END
END
BLOCK "VarFileInfo"
@@ -93,6 +93,32 @@ IDR_LANG_RU LANGUAGES "..\\..\\Translations\\Language.
IDR_LANG_VI LANGUAGES "..\\..\\Translations\\Language.vi.xml"
IDR_LANG_ZHCN LANGUAGES "..\\..\\Translations\\Language.zh-cn.xml"
IDR_LANG_ZHHK LANGUAGES "..\\..\\Translations\\Language.zh-hk.xml"
+IDR_LANG_BE LANGUAGES "..\\..\\Translations\\Language.be.xml"
+IDR_LANG_BG LANGUAGES "..\\..\\Translations\\Language.bg.xml"
+IDR_LANG_CA LANGUAGES "..\\..\\Translations\\Language.ca.xml"
+IDR_LANG_CO LANGUAGES "..\\..\\Translations\\Language.co.xml"
+IDR_LANG_DA LANGUAGES "..\\..\\Translations\\Language.da.xml"
+IDR_LANG_EL LANGUAGES "..\\..\\Translations\\Language.el.xml"
+IDR_LANG_ET LANGUAGES "..\\..\\Translations\\Language.et.xml"
+IDR_LANG_EU LANGUAGES "..\\..\\Translations\\Language.eu.xml"
+IDR_LANG_FA LANGUAGES "..\\..\\Translations\\Language.fa.xml"
+IDR_LANG_FI LANGUAGES "..\\..\\Translations\\Language.fi.xml"
+IDR_LANG_HE LANGUAGES "..\\..\\Translations\\Language.he.xml"
+IDR_LANG_HU LANGUAGES "..\\..\\Translations\\Language.hu.xml"
+IDR_LANG_ID LANGUAGES "..\\..\\Translations\\Language.id.xml"
+IDR_LANG_KA LANGUAGES "..\\..\\Translations\\Language.ka.xml"
+IDR_LANG_KO LANGUAGES "..\\..\\Translations\\Language.ko.xml"
+IDR_LANG_LV LANGUAGES "..\\..\\Translations\\Language.lv.xml"
+IDR_LANG_NN LANGUAGES "..\\..\\Translations\\Language.nn.xml"
+IDR_LANG_PTBR LANGUAGES "..\\..\\Translations\\Language.pt-br.xml"
+IDR_LANG_SK LANGUAGES "..\\..\\Translations\\Language.sk.xml"
+IDR_LANG_SL LANGUAGES "..\\..\\Translations\\Language.sl.xml"
+IDR_LANG_SV LANGUAGES "..\\..\\Translations\\Language.sv.xml"
+IDR_LANG_TH LANGUAGES "..\\..\\Translations\\Language.th.xml"
+IDR_LANG_TR LANGUAGES "..\\..\\Translations\\Language.tr.xml"
+IDR_LANG_UK LANGUAGES "..\\..\\Translations\\Language.uk.xml"
+IDR_LANG_UZ LANGUAGES "..\\..\\Translations\\Language.uz.xml"
+IDR_LANG_ZHTW LANGUAGES "..\\..\\Translations\\Language.zh-tw.xml"
/////////////////////////////////////////////////////////////////////////////
//
diff --git a/src/SetupDLL/SetupDLL.vcxproj b/src/SetupDLL/SetupDLL.vcxproj
index 74f86276..7eb24a66 100644
--- a/src/SetupDLL/SetupDLL.vcxproj
+++ b/src/SetupDLL/SetupDLL.vcxproj
@@ -91,7 +91,7 @@
<AdditionalDependencies>version.lib;msi.lib;libcmtd.lib;atlsd.lib;mpr.lib;..\Common\Debug\Zip.lib;..\Crypto\Debug\crypto.lib;..\Common\Debug\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptSetup.dll</OutputFile>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
- <DelayLoadDLLs>user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)Setup.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
@@ -130,7 +130,7 @@ copy Debug\VeraCryptSetup.dll "..\Debug\Setup Files\VeraCryptSetup.dll" &gt;NUL:
<AdditionalDependencies>version.lib;msi.lib;mpr.lib;..\Common\Release\Zip.lib;..\Crypto\Release\crypto.lib;..\Common\Release\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptSetup.dll</OutputFile>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
- <DelayLoadDLLs>user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
@@ -169,7 +169,7 @@ copy Debug\VeraCryptSetup.dll "..\Debug\Setup Files\VeraCryptSetup.dll" &gt;NUL:
<AdditionalDependencies>version.lib;msi.lib;mpr.lib;..\Common\Release\Zip.lib;..\Crypto\Release\crypto.lib;..\Common\Release\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptSetup.exe</OutputFile>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
- <DelayLoadDLLs>user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
diff --git a/src/Signing/sign.bat b/src/Signing/sign.bat
index addece12..f1df920a 100644
--- a/src/Signing/sign.bat
+++ b/src/Signing/sign.bat
@@ -1,7 +1,7 @@
PATH=%PATH%;%WSDK81%\bin\x86;C:\Program Files\7-Zip;C:\Program Files (x86)\7-Zip
-set VC_VERSION=1.26
-set VC_VERSION_NBRE=1.26.0
+set VC_VERSION=1.26.10
+set VC_VERSION_NBRE=1.26.10
set SIGNINGPATH=%~dp0
cd %SIGNINGPATH%
@@ -10,7 +10,7 @@ call "..\..\doc\chm\create_chm.bat"
cd %SIGNINGPATH%
rem sign using SHA-256
-signtool sign /v /sha1 88c1ff4b7469ea3915bd8e7635a7567d34f43202 /ac GlobalSign_SHA256_EV_CodeSigning_CA.cer /fd sha256 /tr http://timestamp.digicert.com /td SHA256 "..\Release\Setup Files\VeraCrypt.exe" "..\Release\Setup Files\VeraCrypt Format.exe" "..\Release\Setup Files\VeraCryptExpander.exe" "..\Release\Setup Files\VeraCrypt-x64.exe" "..\Release\Setup Files\VeraCrypt Format-x64.exe" "..\Release\Setup Files\VeraCryptExpander-x64.exe" "..\Release\Setup Files\VeraCrypt-arm64.exe" "..\Release\Setup Files\VeraCrypt Format-arm64.exe" "..\Release\Setup Files\VeraCryptExpander-arm64.exe" "..\Release\Setup Files\VeraCryptSetup.dll"
+signtool sign /v /sha1 88c1ff4b7469ea3915bd8e7635a7567d34f43202 /ac GlobalSign_SHA256_EV_CodeSigning_CA.cer /fd sha256 /tr http://timestamp.digicert.com /td SHA256 "..\Release\Setup Files\VeraCrypt.exe" "..\Release\Setup Files\VeraCrypt Format.exe" "..\Release\Setup Files\VeraCryptExpander.exe" "..\Release\Setup Files\VeraCrypt-x64.exe" "..\Release\Setup Files\VeraCrypt Format-x64.exe" "..\Release\Setup Files\VeraCryptExpander-x64.exe" "..\Release\Setup Files\VeraCrypt-arm64.exe" "..\Release\Setup Files\VeraCrypt Format-arm64.exe" "..\Release\Setup Files\VeraCryptExpander-arm64.exe" "..\Release\Setup Files\VeraCryptSetup.dll"
rem create setup and MSI
cd "..\Release\Setup Files\"
@@ -31,7 +31,7 @@ del Languages.zip
rmdir /S /Q docs
mkdir docs\html\en
mkdir docs\EFI-DCS
-copy /V /Y ..\..\..\doc\html\* docs\html\en\.
+xcopy /E /V /Y ..\..\..\doc\html\* docs\html\en\.
copy "..\..\..\doc\chm\VeraCrypt User Guide.chm" docs\.
copy "..\..\..\doc\EFI-DCS\*.pdf" docs\EFI-DCS\.
del docs.zip
diff --git a/src/Signing/sign_TESTSIGNING.bat b/src/Signing/sign_TESTSIGNING.bat
index 858fa442..bc75ff08 100644
--- a/src/Signing/sign_TESTSIGNING.bat
+++ b/src/Signing/sign_TESTSIGNING.bat
@@ -1,7 +1,7 @@
PATH=%PATH%;%WSDK81%\bin\x86;C:\Program Files\7-Zip;C:\Program Files (x86)\7-Zip
-set VC_VERSION=1.26-TESTSIGNING
-set VC_VERSION_NBRE=1.26.0
+set VC_VERSION=1.26.10
+set VC_VERSION_NBRE=1.26.10
set SIGNINGPATH=%~dp0
cd %SIGNINGPATH%
diff --git a/src/Signing/sign_test.bat b/src/Signing/sign_test.bat
index f471cff6..1dd2e4e2 100644
--- a/src/Signing/sign_test.bat
+++ b/src/Signing/sign_test.bat
@@ -1,6 +1,6 @@
PATH=%PATH%;%WSDK81%\bin\x86;C:\Program Files\7-Zip;C:\Program Files (x86)\7-Zip
-set VC_VERSION=1.26
-set VC_VERSION_NBRE=1.26.0
+set VC_VERSION=1.26.10
+set VC_VERSION_NBRE=1.26.10
set PFXNAME=TestCertificate\idrix_codeSign.pfx
set PFXPASSWORD=idrix
set PFXCA=TestCertificate\idrix_TestRootCA.crt
@@ -42,7 +42,7 @@ del Languages.zip
rmdir /S /Q docs
mkdir docs\html\en
mkdir docs\EFI-DCS
-copy /V /Y ..\..\..\doc\html\* docs\html\en\.
+xcopy /E /V /Y ..\..\..\doc\html\* docs\html\en\.
copy "..\..\..\doc\chm\VeraCrypt User Guide.chm" docs\.
copy "..\..\..\doc\EFI-DCS\*.pdf" docs\EFI-DCS\.
del docs.zip
diff --git a/src/Signing/sign_test_debug.bat b/src/Signing/sign_test_debug.bat
index 6fe07866..8e8d2d39 100644
--- a/src/Signing/sign_test_debug.bat
+++ b/src/Signing/sign_test_debug.bat
@@ -1,6 +1,6 @@
PATH=%PATH%;%WSDK81%\bin\x86;C:\Program Files\7-Zip;C:\Program Files (x86)\7-Zip
-set VC_VERSION=1.26
-set VC_VERSION_NBRE=1.26.0
+set VC_VERSION=1.26.10
+set VC_VERSION_NBRE=1.26.10
set PFXNAME=TestCertificate\idrix_codeSign.pfx
set PFXPASSWORD=idrix
set PFXCA=TestCertificate\idrix_TestRootCA.crt
diff --git a/src/VeraCrypt_vs2019.sln b/src/VeraCrypt_vs2019.sln
index 43b2f41e..5c440480 100644
--- a/src/VeraCrypt_vs2019.sln
+++ b/src/VeraCrypt_vs2019.sln
@@ -684,11 +684,11 @@ Global
{4B41C7B5-75C6-40A2-AF4D-55BC1E012BCD}.All CustomEFI|x64.ActiveCfg = Debug|ARM64
{4B41C7B5-75C6-40A2-AF4D-55BC1E012BCD}.All Debug|ARM64.ActiveCfg = Debug|ARM64
{4B41C7B5-75C6-40A2-AF4D-55BC1E012BCD}.All Debug|ARM64.Build.0 = Debug|ARM64
- {4B41C7B5-75C6-40A2-AF4D-55BC1E012BCD}.All Debug|Win32.ActiveCfg = Debug|ARM64
- {4B41C7B5-75C6-40A2-AF4D-55BC1E012BCD}.All Debug|x64.ActiveCfg = Debug|ARM64
+ {4B41C7B5-75C6-40A2-AF4D-55BC1E012BCD}.All Debug|Win32.ActiveCfg = Debug|Win32
+ {4B41C7B5-75C6-40A2-AF4D-55BC1E012BCD}.All Debug|x64.ActiveCfg = Debug|x64
{4B41C7B5-75C6-40A2-AF4D-55BC1E012BCD}.All|ARM64.ActiveCfg = Release|ARM64
- {4B41C7B5-75C6-40A2-AF4D-55BC1E012BCD}.All|Win32.ActiveCfg = Debug|ARM64
- {4B41C7B5-75C6-40A2-AF4D-55BC1E012BCD}.All|x64.ActiveCfg = Debug|ARM64
+ {4B41C7B5-75C6-40A2-AF4D-55BC1E012BCD}.All|Win32.ActiveCfg = Release|Win32
+ {4B41C7B5-75C6-40A2-AF4D-55BC1E012BCD}.All|x64.ActiveCfg = Release|x64
{4B41C7B5-75C6-40A2-AF4D-55BC1E012BCD}.Boot Loader|ARM64.ActiveCfg = Debug|ARM64
{4B41C7B5-75C6-40A2-AF4D-55BC1E012BCD}.Boot Loader|ARM64.Build.0 = Debug|ARM64
{4B41C7B5-75C6-40A2-AF4D-55BC1E012BCD}.Boot Loader|ARM64.Deploy.0 = Debug|ARM64
diff --git a/src/Volume/Cipher.cpp b/src/Volume/Cipher.cpp
index 8c6ce390..d0fb7bd5 100644
--- a/src/Volume/Cipher.cpp
+++ b/src/Volume/Cipher.cpp
@@ -94,11 +94,12 @@ namespace VeraCrypt
CipherList l;
l.push_back (shared_ptr <Cipher> (new CipherAES ()));
+ #ifndef WOLFCRYPT_BACKEND
l.push_back (shared_ptr <Cipher> (new CipherSerpent ()));
l.push_back (shared_ptr <Cipher> (new CipherTwofish ()));
l.push_back (shared_ptr <Cipher> (new CipherCamellia ()));
l.push_back (shared_ptr <Cipher> (new CipherKuznyechik ()));
-
+ #endif
return l;
}
@@ -115,6 +116,37 @@ namespace VeraCrypt
Initialized = true;
}
+ #ifdef WOLFCRYPT_BACKEND
+ void Cipher::SetKeyXTS (const ConstBufferPtr &key)
+ {
+ if (key.Size() != GetKeySize ())
+ throw ParameterIncorrect (SRC_POS);
+
+ if (!Initialized)
+ ScheduledKey.Allocate (GetScheduledKeySize ());
+
+ SetCipherKeyXTS (key);
+ Key.CopyFrom (key);
+ Initialized = true;
+ }
+
+ void Cipher::EncryptBlockXTS (byte *data, uint64 length, uint64 startDataUnitNo) const
+ {
+ if (!Initialized)
+ throw NotInitialized (SRC_POS);
+
+ EncryptXTS (data, length, startDataUnitNo);
+ }
+
+ void Cipher::DecryptBlockXTS (byte *data, uint64 length, uint64 startDataUnitNo) const
+ {
+ if (!Initialized)
+ throw NotInitialized (SRC_POS);
+
+ DecryptXTS (data, length, startDataUnitNo);
+ }
+ #endif
+
#define TC_EXCEPTION(TYPE) TC_SERIALIZER_FACTORY_ADD(TYPE)
#undef TC_EXCEPTION_NODECL
#define TC_EXCEPTION_NODECL(TYPE) TC_SERIALIZER_FACTORY_ADD(TYPE)
@@ -186,6 +218,26 @@ namespace VeraCrypt
#endif
Cipher::EncryptBlocks (data, blockCount);
}
+ #ifdef WOLFCRYPT_BACKEND
+ void CipherAES::EncryptXTS (byte *data, uint64 length, uint64 startDataUnitNo) const
+ {
+ xts_encrypt (data, data, length, startDataUnitNo, (aes_encrypt_ctx *) ScheduledKey.Ptr());
+ }
+
+ void CipherAES::DecryptXTS (byte *data, uint64 length, uint64 startDataUnitNo) const
+ {
+ xts_decrypt (data, data, length, startDataUnitNo, (aes_decrypt_ctx *) (ScheduledKey.Ptr() + sizeof (aes_encrypt_ctx)));
+ }
+
+ void CipherAES::SetCipherKeyXTS (const byte *key)
+ {
+ if (xts_encrypt_key256 (key, (aes_encrypt_ctx *) ScheduledKey.Ptr()) != EXIT_SUCCESS)
+ throw CipherInitError (SRC_POS);
+
+ if (xts_decrypt_key256 (key, (aes_decrypt_ctx *) (ScheduledKey.Ptr() + sizeof (aes_encrypt_ctx))) != EXIT_SUCCESS)
+ throw CipherInitError (SRC_POS);
+ }
+ #endif
size_t CipherAES::GetScheduledKeySize () const
{
@@ -218,6 +270,7 @@ namespace VeraCrypt
throw CipherInitError (SRC_POS);
}
+ #ifndef WOLFCRYPT_BACKEND
// Serpent
void CipherSerpent::Decrypt (byte *data) const
{
@@ -465,5 +518,6 @@ namespace VeraCrypt
return false;
#endif
}
- bool Cipher::HwSupportEnabled = true;
+ #endif
+ bool Cipher::HwSupportEnabled = true;
}
diff --git a/src/Volume/Cipher.h b/src/Volume/Cipher.h
index 31a519a5..1b7fd233 100644
--- a/src/Volume/Cipher.h
+++ b/src/Volume/Cipher.h
@@ -28,8 +28,15 @@ namespace VeraCrypt
virtual void DecryptBlock (byte *data) const;
virtual void DecryptBlocks (byte *data, size_t blockCount) const;
- static void EnableHwSupport (bool enable) { HwSupportEnabled = enable; }
- virtual void EncryptBlock (byte *data) const;
+ #ifndef WOLFCRYPT_BACKEND
+ static void EnableHwSupport (bool enable) { HwSupportEnabled = enable; }
+ #else
+ static void EnableHwSupport (bool enable) { HwSupportEnabled = false; }
+ virtual void EncryptBlockXTS (byte *data, uint64 length, uint64 startDataUnitNo) const;
+ virtual void DecryptBlockXTS (byte *data, uint64 length, uint64 startDataUnitNo) const;
+ virtual void SetKeyXTS (const ConstBufferPtr &key);
+ #endif
+ virtual void EncryptBlock (byte *data) const;
virtual void EncryptBlocks (byte *data, size_t blockCount) const;
static CipherList GetAvailableCiphers ();
virtual size_t GetBlockSize () const = 0;
@@ -50,6 +57,11 @@ namespace VeraCrypt
virtual void Encrypt (byte *data) const = 0;
virtual size_t GetScheduledKeySize () const = 0;
virtual void SetCipherKey (const byte *key) = 0;
+ #ifdef WOLFCRYPT_BACKEND
+ virtual void DecryptXTS (byte *data, uint64 length, uint64 startDataUnitNo) const = 0;
+ virtual void EncryptXTS (byte *data, uint64 length, uint64 startDataUnitNo) const = 0;
+ virtual void SetCipherKeyXTS (const byte *key) = 0;
+ #endif
static bool HwSupportEnabled;
bool Initialized;
@@ -69,6 +81,7 @@ namespace VeraCrypt
CipherException (const string &message, const wstring &subject) : Exception (message, subject) { }
};
+#ifdef WOLFCRYPT_BACKEND
#define TC_CIPHER(NAME, BLOCK_SIZE, KEY_SIZE) \
class TC_JOIN (Cipher,NAME) : public Cipher \
@@ -88,12 +101,43 @@ namespace VeraCrypt
virtual void Encrypt (byte *data) const; \
virtual size_t GetScheduledKeySize () const; \
virtual void SetCipherKey (const byte *key); \
+ virtual void DecryptXTS (byte *data, uint64 length, uint64 startDataUnitNo) const; \
+ virtual void SetCipherKeyXTS (const byte *key); \
+ virtual void EncryptXTS (byte *data, uint64 length, uint64 startDataUnitNo) const; \
\
private: \
TC_JOIN (Cipher,NAME) (const TC_JOIN (Cipher,NAME) &); \
TC_JOIN (Cipher,NAME) &operator= (const TC_JOIN (Cipher,NAME) &); \
}
+#else
+
+#define TC_CIPHER(NAME, BLOCK_SIZE, KEY_SIZE) \
+ class TC_JOIN (Cipher,NAME) : public Cipher \
+ { \
+ public: \
+ TC_JOIN (Cipher,NAME) () { } \
+ virtual ~TC_JOIN (Cipher,NAME) () { } \
+\
+ virtual size_t GetBlockSize () const { return BLOCK_SIZE; }; \
+ virtual size_t GetKeySize () const { return KEY_SIZE; }; \
+ virtual wstring GetName () const { return L###NAME; }; \
+ virtual shared_ptr <Cipher> GetNew () const { return shared_ptr <Cipher> (new TC_JOIN (Cipher,NAME)()); } \
+ TC_CIPHER_ADD_METHODS \
+\
+ protected: \
+ virtual void Decrypt (byte *data) const; \
+ virtual void Encrypt (byte *data) const; \
+ virtual size_t GetScheduledKeySize () const; \
+ virtual void SetCipherKey (const byte *key); \
+\
+ private: \
+ TC_JOIN (Cipher,NAME) (const TC_JOIN (Cipher,NAME) &); \
+ TC_JOIN (Cipher,NAME) &operator= (const TC_JOIN (Cipher,NAME) &); \
+ }
+
+#endif
+
#define TC_CIPHER_ADD_METHODS \
virtual void DecryptBlocks (byte *data, size_t blockCount) const; \
virtual void EncryptBlocks (byte *data, size_t blockCount) const; \
diff --git a/src/Volume/EncryptionAlgorithm.cpp b/src/Volume/EncryptionAlgorithm.cpp
index 85d9be1c..0178da00 100644
--- a/src/Volume/EncryptionAlgorithm.cpp
+++ b/src/Volume/EncryptionAlgorithm.cpp
@@ -12,6 +12,9 @@
#include "EncryptionAlgorithm.h"
#include "EncryptionModeXTS.h"
+#ifdef WOLFCRYPT_BACKEND
+#include "EncryptionModeWolfCryptXTS.h"
+#endif
namespace VeraCrypt
{
@@ -62,6 +65,7 @@ namespace VeraCrypt
EncryptionAlgorithmList l;
l.push_back (shared_ptr <EncryptionAlgorithm> (new AES ()));
+ #ifndef WOLFCRYPT_BACKEND
l.push_back (shared_ptr <EncryptionAlgorithm> (new Serpent ()));
l.push_back (shared_ptr <EncryptionAlgorithm> (new Twofish ()));
l.push_back (shared_ptr <EncryptionAlgorithm> (new Camellia ()));
@@ -76,7 +80,7 @@ namespace VeraCrypt
l.push_back (shared_ptr <EncryptionAlgorithm> (new SerpentAES ()));
l.push_back (shared_ptr <EncryptionAlgorithm> (new SerpentTwofishAES ()));
l.push_back (shared_ptr <EncryptionAlgorithm> (new TwofishSerpent ()));
-
+ #endif
return l;
}
@@ -215,7 +219,25 @@ namespace VeraCrypt
}
}
- void EncryptionAlgorithm::ValidateState () const
+ #ifdef WOLFCRYPT_BACKEND
+ void EncryptionAlgorithm::SetKeyXTS (const ConstBufferPtr &key)
+ {
+ if (Ciphers.size() < 1)
+ throw NotInitialized (SRC_POS);
+
+ if (GetKeySize() != key.Size())
+ throw ParameterIncorrect (SRC_POS);
+
+ size_t keyOffset = 0;
+ foreach_ref (Cipher &c, Ciphers)
+ {
+ c.SetKeyXTS (key.GetRange (keyOffset, c.GetKeySize()));
+ keyOffset += c.GetKeySize();
+ }
+ }
+ #endif
+
+ void EncryptionAlgorithm::ValidateState () const
{
if (Ciphers.size() < 1 || Mode.get() == nullptr)
throw NotInitialized (SRC_POS);
@@ -226,9 +248,14 @@ namespace VeraCrypt
{
Ciphers.push_back (shared_ptr <Cipher> (new CipherAES()));
+ #ifdef WOLFCRYPT_BACKEND
+ SupportedModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeWolfCryptXTS ()));
+ #else
SupportedModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeXTS ()));
- }
+ #endif
+ }
+#ifndef WOLFCRYPT_BACKEND
// AES-Twofish
AESTwofish::AESTwofish ()
{
@@ -353,4 +380,5 @@ namespace VeraCrypt
SupportedModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeXTS ()));
}
+#endif
}
diff --git a/src/Volume/EncryptionAlgorithm.h b/src/Volume/EncryptionAlgorithm.h
index 56642146..d60082fa 100644
--- a/src/Volume/EncryptionAlgorithm.h
+++ b/src/Volume/EncryptionAlgorithm.h
@@ -46,7 +46,10 @@ namespace VeraCrypt
virtual bool IsModeSupported (const EncryptionMode &mode) const;
virtual bool IsModeSupported (const shared_ptr <EncryptionMode> mode) const;
virtual void SetKey (const ConstBufferPtr &key);
- virtual void SetMode (shared_ptr <EncryptionMode> mode);
+ #ifdef WOLFCRYPT_BACKEND
+ virtual void SetKeyXTS (const ConstBufferPtr &key);
+ #endif
+ virtual void SetMode (shared_ptr <EncryptionMode> mode);
protected:
EncryptionAlgorithm ();
diff --git a/src/Volume/EncryptionMode.cpp b/src/Volume/EncryptionMode.cpp
index b7e5cc02..81d275b6 100644
--- a/src/Volume/EncryptionMode.cpp
+++ b/src/Volume/EncryptionMode.cpp
@@ -12,6 +12,9 @@
#include "EncryptionMode.h"
#include "EncryptionModeXTS.h"
+#ifdef WOLFCRYPT_BACKEND
+#include "EncryptionModeWolfCryptXTS.h"
+#endif
#include "EncryptionThreadPool.h"
namespace VeraCrypt
@@ -38,7 +41,11 @@ namespace VeraCrypt
{
EncryptionModeList l;
+ #ifdef WOLFCRYPT_BACKEND
+ l.push_back (shared_ptr <EncryptionMode> (new EncryptionModeWolfCryptXTS ()));
+ #else
l.push_back (shared_ptr <EncryptionMode> (new EncryptionModeXTS ()));
+ #endif
return l;
}
diff --git a/src/Volume/EncryptionModeWolfCryptXTS.cpp b/src/Volume/EncryptionModeWolfCryptXTS.cpp
new file mode 100644
index 00000000..891f6007
--- /dev/null
+++ b/src/Volume/EncryptionModeWolfCryptXTS.cpp
@@ -0,0 +1,119 @@
+
+#include "Crypto/cpu.h"
+#include "Crypto/misc.h"
+#include "EncryptionModeWolfCryptXTS.h"
+#include "Common/Crypto.h"
+
+namespace VeraCrypt
+{
+ void EncryptionModeWolfCryptXTS::Encrypt (byte *data, uint64 length) const
+ {
+ EncryptBuffer (data, length, 0);
+ }
+
+ void EncryptionModeWolfCryptXTS::EncryptBuffer (byte *data, uint64 length, uint64 startDataUnitNo) const
+ {
+ if_debug (ValidateState());
+
+ CipherList::const_iterator iSecondaryCipher = SecondaryCiphers.begin();
+
+ for (CipherList::const_iterator iCipher = Ciphers.begin(); iCipher != Ciphers.end(); ++iCipher)
+ {
+ EncryptBufferXTS (**iCipher, **iSecondaryCipher, data, length, startDataUnitNo, 0);
+ ++iSecondaryCipher;
+ }
+
+ assert (iSecondaryCipher == SecondaryCiphers.end());
+ }
+
+ void EncryptionModeWolfCryptXTS::EncryptBufferXTS (Cipher &cipher, const Cipher &secondaryCipher, byte *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const
+ {
+ cipher.EncryptBlockXTS(buffer, length, startDataUnitNo);
+ }
+
+ void EncryptionModeWolfCryptXTS::EncryptSectorsCurrentThread (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
+ {
+ EncryptBuffer (data, sectorCount * sectorSize, sectorIndex * sectorSize / ENCRYPTION_DATA_UNIT_SIZE);
+ }
+
+ size_t EncryptionModeWolfCryptXTS::GetKeySize () const
+ {
+ if (Ciphers.empty())
+ throw NotInitialized (SRC_POS);
+
+ size_t keySize = 0;
+ foreach_ref (const Cipher &cipher, SecondaryCiphers)
+ {
+ keySize += cipher.GetKeySize();
+ }
+
+ return keySize;
+ }
+
+ void EncryptionModeWolfCryptXTS::Decrypt (byte *data, uint64 length) const
+ {
+ DecryptBuffer (data, length, 0);
+ }
+
+ void EncryptionModeWolfCryptXTS::DecryptBuffer (byte *data, uint64 length, uint64 startDataUnitNo) const
+ {
+ if_debug (ValidateState());
+
+ CipherList::const_iterator iSecondaryCipher = SecondaryCiphers.end();
+
+ for (CipherList::const_reverse_iterator iCipher = Ciphers.rbegin(); iCipher != Ciphers.rend(); ++iCipher)
+ {
+ --iSecondaryCipher;
+ DecryptBufferXTS (**iCipher, **iSecondaryCipher, data, length, startDataUnitNo, 0);
+ }
+
+ assert (iSecondaryCipher == SecondaryCiphers.begin());
+ }
+
+ void EncryptionModeWolfCryptXTS::DecryptBufferXTS (Cipher &cipher, const Cipher &secondaryCipher, byte *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const
+ {
+ cipher.DecryptBlockXTS(buffer, length, startDataUnitNo);
+ }
+
+ void EncryptionModeWolfCryptXTS::DecryptSectorsCurrentThread (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
+ {
+ DecryptBuffer (data, sectorCount * sectorSize, sectorIndex * sectorSize / ENCRYPTION_DATA_UNIT_SIZE);
+ }
+
+ void EncryptionModeWolfCryptXTS::SetCiphers (const CipherList &ciphers)
+ {
+ EncryptionMode::SetCiphers (ciphers);
+
+ SecondaryCiphers.clear();
+
+ foreach_ref (const Cipher &cipher, ciphers)
+ {
+ SecondaryCiphers.push_back (cipher.GetNew());
+ }
+
+ if (SecondaryKey.Size() > 0)
+ SetSecondaryCipherKeys();
+ }
+
+ void EncryptionModeWolfCryptXTS::SetKey (const ConstBufferPtr &key)
+ {
+ SecondaryKey.Allocate (key.Size());
+ SecondaryKey.CopyFrom (key);
+
+ if (!SecondaryCiphers.empty())
+ SetSecondaryCipherKeys();
+
+ }
+
+ void EncryptionModeWolfCryptXTS::SetSecondaryCipherKeys ()
+ {
+ size_t keyOffset = 0;
+ foreach_ref (Cipher &cipher, SecondaryCiphers)
+ {
+ cipher.SetKeyXTS (SecondaryKey.GetRange (keyOffset, cipher.GetKeySize()));
+ keyOffset += cipher.GetKeySize();
+ }
+
+ KeySet = true;
+ }
+}
diff --git a/src/Volume/EncryptionModeWolfCryptXTS.h b/src/Volume/EncryptionModeWolfCryptXTS.h
new file mode 100644
index 00000000..e432f768
--- /dev/null
+++ b/src/Volume/EncryptionModeWolfCryptXTS.h
@@ -0,0 +1,54 @@
+/*
+ Derived from source code of TrueCrypt 7.1a, which is
+ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
+ by the TrueCrypt License 3.0.
+
+ Modifications and additions to the original source code (contained in this file)
+ and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and are governed by the Apache License 2.0 the full text of which is
+ contained in the file License.txt included in VeraCrypt binary and source
+ code distribution packages.
+*/
+
+#ifndef TC_HEADER_Volume_EncryptionModeWolfCryptXTS
+#define TC_HEADER_Volume_EncryptionModeWolfCryptXTS
+
+#include "Platform/Platform.h"
+#include "EncryptionMode.h"
+
+namespace VeraCrypt
+{
+ class EncryptionModeWolfCryptXTS : public EncryptionMode
+ {
+ public:
+ EncryptionModeWolfCryptXTS () { }
+ virtual ~EncryptionModeWolfCryptXTS () { }
+
+ virtual void Decrypt (byte *data, uint64 length) const;
+ virtual void DecryptSectorsCurrentThread (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
+ virtual void Encrypt (byte *data, uint64 length) const;
+ virtual void EncryptSectorsCurrentThread (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
+ virtual const SecureBuffer &GetKey () const { return SecondaryKey; }
+ virtual size_t GetKeySize () const;
+ virtual wstring GetName () const { return L"XTS"; };
+ virtual shared_ptr <EncryptionMode> GetNew () const { return shared_ptr <EncryptionMode> (new EncryptionModeWolfCryptXTS); }
+ virtual void SetCiphers (const CipherList &ciphers);
+ virtual void SetKey (const ConstBufferPtr &key);
+
+ protected:
+ void DecryptBuffer (byte *data, uint64 length, uint64 startDataUnitNo) const;
+ void DecryptBufferXTS (Cipher &cipher, const Cipher &secondaryCipher, byte *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const;
+ void EncryptBuffer (byte *data, uint64 length, uint64 startDataUnitNo) const;
+ void EncryptBufferXTS (Cipher &cipher, const Cipher &secondaryCipher, byte *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const;
+ void SetSecondaryCipherKeys ();
+
+ SecureBuffer SecondaryKey;
+ CipherList SecondaryCiphers;
+
+ private:
+ EncryptionModeWolfCryptXTS (const EncryptionModeWolfCryptXTS &);
+ EncryptionModeWolfCryptXTS &operator= (const EncryptionModeWolfCryptXTS &);
+ };
+}
+
+#endif // TC_HEADER_Volume_EncryptionModeWolfCryptXTS
diff --git a/src/Volume/EncryptionModeXTS.cpp b/src/Volume/EncryptionModeXTS.cpp
index 66f0ff62..56ee895c 100644
--- a/src/Volume/EncryptionModeXTS.cpp
+++ b/src/Volume/EncryptionModeXTS.cpp
@@ -69,7 +69,7 @@ namespace VeraCrypt
void EncryptionModeXTS::EncryptBufferXTS (const Cipher &cipher, const Cipher &secondaryCipher, byte *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const
{
- byte finalCarry;
+ byte finalCarry;
byte whiteningValues [ENCRYPTION_DATA_UNIT_SIZE];
byte whiteningValue [BYTES_PER_XTS_BLOCK];
byte byteBufUnitNo [BYTES_PER_XTS_BLOCK];
@@ -374,7 +374,7 @@ namespace VeraCrypt
FAST_ERASE64 (whiteningValue, sizeof (whiteningValue));
FAST_ERASE64 (whiteningValues, sizeof (whiteningValues));
- }
+ }
void EncryptionModeXTS::DecryptSectorsCurrentThread (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
{
@@ -411,7 +411,7 @@ namespace VeraCrypt
foreach_ref (Cipher &cipher, SecondaryCiphers)
{
cipher.SetKey (SecondaryKey.GetRange (keyOffset, cipher.GetKeySize()));
- keyOffset += cipher.GetKeySize();
+ keyOffset += cipher.GetKeySize();
}
KeySet = true;
diff --git a/src/Volume/EncryptionTest.cpp b/src/Volume/EncryptionTest.cpp
index 5c251bd5..c900885e 100644
--- a/src/Volume/EncryptionTest.cpp
+++ b/src/Volume/EncryptionTest.cpp
@@ -16,6 +16,9 @@
#include "EncryptionAlgorithm.h"
#include "EncryptionMode.h"
#include "EncryptionModeXTS.h"
+#ifdef WOLFCRYPT_BACKEND
+#include "EncryptionModeWolfCryptXTS.h"
+#endif
#include "EncryptionTest.h"
#include "Pkcs5Kdf.h"
@@ -64,6 +67,7 @@ namespace VeraCrypt
}
};
+ #ifndef WOLFCRYPT_BACKEND
static const CipherTestVector SerpentTestVectors[] =
{
{
@@ -151,6 +155,7 @@ namespace VeraCrypt
}
}
};
+ #endif
static void TestCipher (Cipher &cipher, const CipherTestVector *testVector, size_t testVectorCount)
{
@@ -190,6 +195,7 @@ namespace VeraCrypt
if (origCrc != Crc32::ProcessBuffer (testData))
throw TestFailed (SRC_POS);
+ #ifndef WOLFCRYPT_BACKEND
CipherSerpent serpent;
TestCipher (serpent, SerpentTestVectors, array_capacity (SerpentTestVectors));
@@ -201,6 +207,7 @@ namespace VeraCrypt
CipherKuznyechik kuznyechik;
TestCipher (kuznyechik, KuznyechikTestVectors, array_capacity (KuznyechikTestVectors));
+ #endif
}
const EncryptionTest::XtsTestVector EncryptionTest::XtsTestVectors[] =
@@ -437,9 +444,16 @@ namespace VeraCrypt
for (i = 0; i < array_capacity (XtsTestVectors); i++)
{
AES aes;
- shared_ptr <EncryptionMode> xts (new EncryptionModeXTS);
-
- aes.SetKey (ConstBufferPtr (XtsTestVectors[i].key1, sizeof (XtsTestVectors[i].key1)));
+ #ifdef WOLFCRYPT_BACKEND
+ shared_ptr <EncryptionMode> xts (new EncryptionModeWolfCryptXTS);
+ #else
+ shared_ptr <EncryptionMode> xts (new EncryptionModeXTS);
+ #endif
+
+ aes.SetKey (ConstBufferPtr (XtsTestVectors[i].key1, sizeof (XtsTestVectors[i].key1)));
+ #ifdef WOLFCRYPT_BACKEND
+ aes.SetKeyXTS (ConstBufferPtr (XtsTestVectors[i].key2, sizeof (XtsTestVectors[i].key2)));
+ #endif
xts->SetKey (ConstBufferPtr (XtsTestVectors[i].key2, sizeof (XtsTestVectors[i].key2)));
aes.SetMode (xts);
@@ -494,7 +508,11 @@ namespace VeraCrypt
// Test all EAs that support this mode of operation
foreach_ref (EncryptionAlgorithm &ea, EncryptionAlgorithm::GetAvailableAlgorithms())
{
- shared_ptr <EncryptionMode> mode (new EncryptionModeXTS);
+ #ifdef WOLFCRYPT_BACKEND
+ shared_ptr <EncryptionMode> mode (new EncryptionModeWolfCryptXTS);
+ #else
+ shared_ptr <EncryptionMode> mode (new EncryptionModeXTS);
+ #endif
if (!ea.IsModeSupported (mode))
continue;
@@ -508,8 +526,11 @@ namespace VeraCrypt
mode->SetKey (modeKey);
ea.SetMode (mode);
+ #ifdef WOLFCRYPT_BACKEND
+ ea.SetKeyXTS (modeKey);
+ #endif
- // Each data unit will contain the same plaintext
+ // Each data unit will contain the same plaintext
for (i = 0; i < nbrUnits; i++)
{
memcpy ((unsigned char *) buf + i * ENCRYPTION_DATA_UNIT_SIZE,
@@ -556,6 +577,7 @@ namespace VeraCrypt
break;
}
}
+ #ifndef WOLFCRYPT_BACKEND
else if (typeid (ea) == typeid (Serpent))
{
switch (testCase)
@@ -920,7 +942,7 @@ namespace VeraCrypt
break;
}
}
-
+ #endif
if (crc == 0x9f5edd58)
throw TestFailed (SRC_POS);
@@ -941,7 +963,11 @@ namespace VeraCrypt
// Test all EAs that support this mode of operation
foreach_ref (EncryptionAlgorithm &ea, EncryptionAlgorithm::GetAvailableAlgorithms())
{
+ #ifdef WOLFCRYPT_BACKEND
+ shared_ptr <EncryptionMode> mode (new EncryptionModeWolfCryptXTS);
+ #else
shared_ptr <EncryptionMode> mode (new EncryptionModeXTS);
+ #endif
if (!ea.IsModeSupported (mode))
continue;
@@ -955,6 +981,9 @@ namespace VeraCrypt
mode->SetKey (modeKey);
ea.SetMode (mode);
+ #ifdef WOLFCRYPT_BACKEND
+ ea.SetKeyXTS (modeKey);
+ #endif
// Each data unit will contain the same plaintext
for (i = 0; i < nbrUnits; i++)
@@ -974,6 +1003,7 @@ namespace VeraCrypt
throw TestFailed (SRC_POS);
nTestsPerformed++;
}
+ #ifndef WOLFCRYPT_BACKEND
else if (typeid (ea) == typeid (Serpent))
{
if (crc != 0x3494d480)
@@ -1058,6 +1088,7 @@ namespace VeraCrypt
throw TestFailed (SRC_POS);
nTestsPerformed++;
}
+ #endif
if (crc == 0x9f5edd58)
throw TestFailed (SRC_POS);
@@ -1069,8 +1100,11 @@ namespace VeraCrypt
nTestsPerformed++;
}
-
+ #ifndef WOLFCRYPT_BACKEND
if (nTestsPerformed != 150)
+ #else
+ if (nTestsPerformed != 10)
+ #endif
throw TestFailed (SRC_POS);
}
@@ -1081,17 +1115,18 @@ namespace VeraCrypt
ConstBufferPtr salt (saltData, sizeof (saltData));
Buffer derivedKey (4);
+ #ifndef WOLFCRYPT_BACKEND
Pkcs5HmacBlake2s pkcs5HmacBlake2s;
pkcs5HmacBlake2s.DeriveKey (derivedKey, password, salt, 5);
if (memcmp (derivedKey.Ptr(), "\x8d\x51\xfa\x31", 4) != 0)
throw TestFailed (SRC_POS);
- Pkcs5HmacSha512 pkcs5HmacSha512(false);
+ Pkcs5HmacSha512 pkcs5HmacSha512;
pkcs5HmacSha512.DeriveKey (derivedKey, password, salt, 5);
if (memcmp (derivedKey.Ptr(), "\x13\x64\xae\xf8", 4) != 0)
throw TestFailed (SRC_POS);
- Pkcs5HmacWhirlpool pkcs5HmacWhirlpool(false);
+ Pkcs5HmacWhirlpool pkcs5HmacWhirlpool;
pkcs5HmacWhirlpool.DeriveKey (derivedKey, password, salt, 5);
if (memcmp (derivedKey.Ptr(), "\x50\x7c\x36\x6f", 4) != 0)
throw TestFailed (SRC_POS);
@@ -1105,5 +1140,16 @@ namespace VeraCrypt
pkcs5HmacStreebog.DeriveKey (derivedKey, password, salt, 5);
if (memcmp (derivedKey.Ptr(), "\xd0\x53\xa2\x30", 4) != 0)
throw TestFailed (SRC_POS);
- }
+ #else
+ Pkcs5HmacSha256 pkcs5HmacSha256;
+ pkcs5HmacSha256.DeriveKey (derivedKey, password, salt, 5);
+ if (memcmp (derivedKey.Ptr(), "\x64\xf3\xa5\xa3", 4) != 0)
+ throw TestFailed (SRC_POS);
+
+ Pkcs5HmacSha512 pkcs5HmacSha512;
+ pkcs5HmacSha512.DeriveKey (derivedKey, password, salt, 5);
+ if (memcmp (derivedKey.Ptr(), "\x55\xa1\x76\xbb", 4) != 0)
+ throw TestFailed (SRC_POS);
+ #endif
+ }
}
diff --git a/src/Volume/Hash.cpp b/src/Volume/Hash.cpp
index aad900c1..d2e3e649 100644
--- a/src/Volume/Hash.cpp
+++ b/src/Volume/Hash.cpp
@@ -24,11 +24,12 @@ namespace VeraCrypt
HashList l;
l.push_back (shared_ptr <Hash> (new Sha512 ()));
- l.push_back (shared_ptr <Hash> (new Whirlpool ()));
- l.push_back (shared_ptr <Hash> (new Blake2s ()));
l.push_back (shared_ptr <Hash> (new Sha256 ()));
+ #ifndef WOLFCRYPT_BACKEND
+ l.push_back (shared_ptr <Hash> (new Blake2s ()));
+ l.push_back (shared_ptr <Hash> (new Whirlpool ()));
l.push_back (shared_ptr <Hash> (new Streebog ()));
-
+ #endif
return l;
}
@@ -44,6 +45,7 @@ namespace VeraCrypt
throw ParameterIncorrect (SRC_POS);
}
+ #ifndef WOLFCRYPT_BACKEND
// RIPEMD-160
Blake2s::Blake2s ()
{
@@ -67,6 +69,7 @@ namespace VeraCrypt
if_debug (ValidateDataParameters (data));
blake2s_update ((blake2s_state *) Context.Ptr(), data.Get(), data.Size());
}
+ #endif
// SHA-256
Sha256::Sha256 ()
@@ -116,6 +119,7 @@ namespace VeraCrypt
sha512_hash (data.Get(), (int) data.Size(), (sha512_ctx *) Context.Ptr());
}
+ #ifndef WOLFCRYPT_BACKEND
// Whirlpool
Whirlpool::Whirlpool ()
{
@@ -163,4 +167,5 @@ namespace VeraCrypt
if_debug (ValidateDataParameters (data));
STREEBOG_add ((STREEBOG_CTX *) Context.Ptr(), data.Get(), (int) data.Size());
}
+ #endif
}
diff --git a/src/Volume/Hash.h b/src/Volume/Hash.h
index 0e464b37..5720eb50 100644
--- a/src/Volume/Hash.h
+++ b/src/Volume/Hash.h
@@ -48,6 +48,7 @@ namespace VeraCrypt
Hash &operator= (const Hash &);
};
+ #ifndef WOLFCRYPT_BACKEND
// Blake2s
class Blake2s : public Hash
{
@@ -70,6 +71,7 @@ namespace VeraCrypt
Blake2s (const Blake2s &);
Blake2s &operator= (const Blake2s &);
};
+ #endif
// SHA-256
class Sha256 : public Hash
@@ -117,6 +119,7 @@ namespace VeraCrypt
Sha512 &operator= (const Sha512 &);
};
+ #ifndef WOLFCRYPT_BACKEND
// Whirlpool
class Whirlpool : public Hash
{
@@ -162,6 +165,7 @@ namespace VeraCrypt
Streebog (const Streebog &);
Streebog &operator= (const Streebog &);
};
+ #endif
}
#endif // TC_HEADER_Encryption_Hash
diff --git a/src/Volume/Keyfile.cpp b/src/Volume/Keyfile.cpp
index d171458c..24b40709 100644
--- a/src/Volume/Keyfile.cpp
+++ b/src/Volume/Keyfile.cpp
@@ -12,13 +12,13 @@
#include "Platform/Serializer.h"
#include "Common/SecurityToken.h"
+#include "Common/EMVToken.h"
#include "Crc32.h"
#include "Keyfile.h"
#include "VolumeException.h"
-
namespace VeraCrypt
{
- void Keyfile::Apply (const BufferPtr &pool) const
+ void Keyfile::Apply (const BufferPtr &pool, bool emvSupportEnabled) const
{
if (Path.IsDirectory())
throw ParameterIncorrect (SRC_POS);
@@ -32,22 +32,22 @@ namespace VeraCrypt
SecureBuffer keyfileBuf (File::GetOptimalReadSize());
- if (SecurityToken::IsKeyfilePathValid (Path))
+ if (Token::IsKeyfilePathValid (Path, emvSupportEnabled))
{
// Apply keyfile generated by a security token
vector <byte> keyfileData;
- SecurityToken::GetKeyfileData (SecurityTokenKeyfile (wstring (Path)), keyfileData);
+ Token::getTokenKeyfile(wstring(Path))->GetKeyfileData(keyfileData);
if (keyfileData.size() < MinProcessedLength)
- throw InsufficientData (SRC_POS, Path);
+ throw InsufficientData(SRC_POS, Path);
for (size_t i = 0; i < keyfileData.size(); i++)
{
- uint32 crc = crc32.Process (keyfileData[i]);
+ uint32 crc = crc32.Process(keyfileData[i]);
- pool[poolPos++] += (byte) (crc >> 24);
- pool[poolPos++] += (byte) (crc >> 16);
- pool[poolPos++] += (byte) (crc >> 8);
+ pool[poolPos++] += (byte)(crc >> 24);
+ pool[poolPos++] += (byte)(crc >> 16);
+ pool[poolPos++] += (byte)(crc >> 8);
pool[poolPos++] += (byte) crc;
if (poolPos >= pool.Size())
@@ -57,8 +57,9 @@ namespace VeraCrypt
break;
}
- burn (&keyfileData.front(), keyfileData.size());
- goto done;
+
+ burn(&keyfileData.front(), keyfileData.size());
+ goto done;
}
file.Open (Path, File::OpenRead, File::ShareRead);
@@ -67,26 +68,24 @@ namespace VeraCrypt
{
for (size_t i = 0; i < readLength; i++)
{
- uint32 crc = crc32.Process (keyfileBuf[i]);
-
- pool[poolPos++] += (byte) (crc >> 24);
- pool[poolPos++] += (byte) (crc >> 16);
- pool[poolPos++] += (byte) (crc >> 8);
+ uint32 crc = crc32.Process(keyfileBuf[i]);
+ pool[poolPos++] += (byte)(crc >> 24);
+ pool[poolPos++] += (byte)(crc >> 16);
+ pool[poolPos++] += (byte)(crc >> 8);
pool[poolPos++] += (byte) crc;
-
if (poolPos >= pool.Size())
poolPos = 0;
-
if (++totalLength >= MaxProcessedLength)
goto done;
}
}
-done:
+ done:
+
if (totalLength < MinProcessedLength)
throw InsufficientData (SRC_POS, Path);
}
- shared_ptr <VolumePassword> Keyfile::ApplyListToPassword (shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> password)
+ shared_ptr <VolumePassword> Keyfile::ApplyListToPassword (shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> password, bool emvSupportEnabled)
{
if (!password)
password.reset (new VolumePassword);
@@ -143,7 +142,7 @@ done:
// Apply all keyfiles
foreach_ref (const Keyfile &k, keyfilesExp)
{
- k.Apply (keyfilePool);
+ k.Apply (keyfilePool, emvSupportEnabled);
}
newPassword->Set (keyfilePool);
diff --git a/src/Volume/Keyfile.h b/src/Volume/Keyfile.h
index 04674178..1d87a983 100644
--- a/src/Volume/Keyfile.h
+++ b/src/Volume/Keyfile.h
@@ -29,7 +29,7 @@ namespace VeraCrypt
virtual ~Keyfile () { };
operator FilesystemPath () const { return Path; }
- static shared_ptr <VolumePassword> ApplyListToPassword (shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> password);
+ static shared_ptr <VolumePassword> ApplyListToPassword (shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> password, bool emvSupportEnabled = false);
static shared_ptr <KeyfileList> DeserializeList (shared_ptr <Stream> stream, const string &name);
static void SerializeList (shared_ptr <Stream> stream, const string &name, shared_ptr <KeyfileList> keyfiles);
static bool WasHiddenFilePresentInKeyfilePath() { bool r = HiddenFileWasPresentInKeyfilePath; HiddenFileWasPresentInKeyfilePath = false; return r; }
@@ -38,7 +38,7 @@ namespace VeraCrypt
static const size_t MaxProcessedLength = 1024 * 1024;
protected:
- void Apply (const BufferPtr &pool) const;
+ void Apply (const BufferPtr &pool, bool emvSupportEnabled) const;
static bool HiddenFileWasPresentInKeyfilePath;
diff --git a/src/Volume/Pkcs5Kdf.cpp b/src/Volume/Pkcs5Kdf.cpp
index fee057a8..820f1121 100644
--- a/src/Volume/Pkcs5Kdf.cpp
+++ b/src/Volume/Pkcs5Kdf.cpp
@@ -16,7 +16,7 @@
namespace VeraCrypt
{
- Pkcs5Kdf::Pkcs5Kdf (bool truecryptMode) : m_truecryptMode(truecryptMode)
+ Pkcs5Kdf::Pkcs5Kdf ()
{
}
@@ -29,9 +29,9 @@ namespace VeraCrypt
DeriveKey (key, password, salt, GetIterationCount(pim));
}
- shared_ptr <Pkcs5Kdf> Pkcs5Kdf::GetAlgorithm (const wstring &name, bool truecryptMode)
+ shared_ptr <Pkcs5Kdf> Pkcs5Kdf::GetAlgorithm (const wstring &name)
{
- foreach (shared_ptr <Pkcs5Kdf> kdf, GetAvailableAlgorithms(truecryptMode))
+ foreach (shared_ptr <Pkcs5Kdf> kdf, GetAvailableAlgorithms())
{
if (kdf->GetName() == name)
return kdf;
@@ -39,9 +39,9 @@ namespace VeraCrypt
throw ParameterIncorrect (SRC_POS);
}
- shared_ptr <Pkcs5Kdf> Pkcs5Kdf::GetAlgorithm (const Hash &hash, bool truecryptMode)
+ shared_ptr <Pkcs5Kdf> Pkcs5Kdf::GetAlgorithm (const Hash &hash)
{
- foreach (shared_ptr <Pkcs5Kdf> kdf, GetAvailableAlgorithms(truecryptMode))
+ foreach (shared_ptr <Pkcs5Kdf> kdf, GetAvailableAlgorithms())
{
if (typeid (*kdf->GetHash()) == typeid (hash))
return kdf;
@@ -50,24 +50,17 @@ namespace VeraCrypt
throw ParameterIncorrect (SRC_POS);
}
- Pkcs5KdfList Pkcs5Kdf::GetAvailableAlgorithms (bool truecryptMode)
+ Pkcs5KdfList Pkcs5Kdf::GetAvailableAlgorithms ()
{
Pkcs5KdfList l;
- if (truecryptMode)
- {
- l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacSha512 (true)));
- l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacWhirlpool (true)));
- }
- else
- {
- l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacSha512 (false)));
- l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacSha256 ()));
- l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacBlake2s ()));
- l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacWhirlpool (false)));
- l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacStreebog ()));
- }
-
+ l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacSha512 ()));
+ l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacSha256 ()));
+ #ifndef WOLFCRYPT_BACKEND
+ l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacBlake2s ()));
+ l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacWhirlpool ()));
+ l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacStreebog ()));
+ #endif
return l;
}
@@ -77,6 +70,7 @@ namespace VeraCrypt
throw ParameterIncorrect (SRC_POS);
}
+ #ifndef WOLFCRYPT_BACKEND
void Pkcs5HmacBlake2s_Boot::DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const
{
ValidateParameters (key, password, salt, iterationCount);
@@ -88,6 +82,7 @@ namespace VeraCrypt
ValidateParameters (key, password, salt, iterationCount);
derive_key_blake2s ((char *) password.DataPtr(), (int) password.Size(), (char *) salt.Get(), (int) salt.Size(), iterationCount, (char *) key.Get(), (int) key.Size());
}
+ #endif
void Pkcs5HmacSha256_Boot::DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const
{
@@ -107,6 +102,7 @@ namespace VeraCrypt
derive_key_sha512 ((char *) password.DataPtr(), (int) password.Size(), (char *) salt.Get(), (int) salt.Size(), iterationCount, (char *) key.Get(), (int) key.Size());
}
+ #ifndef WOLFCRYPT_BACKEND
void Pkcs5HmacWhirlpool::DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const
{
ValidateParameters (key, password, salt, iterationCount);
@@ -124,4 +120,5 @@ namespace VeraCrypt
ValidateParameters (key, password, salt, iterationCount);
derive_key_streebog ((char *) password.DataPtr(), (int) password.Size(), (char *) salt.Get(), (int) salt.Size(), iterationCount, (char *) key.Get(), (int) key.Size());
}
+ #endif
}
diff --git a/src/Volume/Pkcs5Kdf.h b/src/Volume/Pkcs5Kdf.h
index 25ad76e8..fc83eb06 100644
--- a/src/Volume/Pkcs5Kdf.h
+++ b/src/Volume/Pkcs5Kdf.h
@@ -29,20 +29,17 @@ namespace VeraCrypt
virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, int pim, const ConstBufferPtr &salt) const;
virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const = 0;
- static shared_ptr <Pkcs5Kdf> GetAlgorithm (const wstring &name, bool truecryptMode);
- static shared_ptr <Pkcs5Kdf> GetAlgorithm (const Hash &hash, bool truecryptMode);
- static Pkcs5KdfList GetAvailableAlgorithms (bool truecryptMode);
+ static shared_ptr <Pkcs5Kdf> GetAlgorithm (const wstring &name);
+ static shared_ptr <Pkcs5Kdf> GetAlgorithm (const Hash &hash);
+ static Pkcs5KdfList GetAvailableAlgorithms ();
virtual shared_ptr <Hash> GetHash () const = 0;
virtual int GetIterationCount (int pim) const = 0;
virtual wstring GetName () const = 0;
virtual Pkcs5Kdf* Clone () const = 0;
virtual bool IsDeprecated () const { return GetHash()->IsDeprecated(); }
- bool GetTrueCryptMode () const { return m_truecryptMode;}
- void SetTrueCryptMode (bool truecryptMode) { m_truecryptMode = truecryptMode;}
protected:
- bool m_truecryptMode;
- Pkcs5Kdf (bool truecryptMode);
+ Pkcs5Kdf ();
void ValidateParameters (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const;
@@ -51,10 +48,11 @@ namespace VeraCrypt
Pkcs5Kdf &operator= (const Pkcs5Kdf &);
};
+ #ifndef WOLFCRYPT_BACKEND
class Pkcs5HmacBlake2s_Boot : public Pkcs5Kdf
{
public:
- Pkcs5HmacBlake2s_Boot () : Pkcs5Kdf(false) { }
+ Pkcs5HmacBlake2s_Boot () : Pkcs5Kdf() { }
virtual ~Pkcs5HmacBlake2s_Boot () { }
virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const;
@@ -71,7 +69,7 @@ namespace VeraCrypt
class Pkcs5HmacBlake2s : public Pkcs5Kdf
{
public:
- Pkcs5HmacBlake2s () : Pkcs5Kdf(false) { }
+ Pkcs5HmacBlake2s () : Pkcs5Kdf() { }
virtual ~Pkcs5HmacBlake2s () { }
virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const;
@@ -84,11 +82,12 @@ namespace VeraCrypt
Pkcs5HmacBlake2s (const Pkcs5HmacBlake2s &);
Pkcs5HmacBlake2s &operator= (const Pkcs5HmacBlake2s &);
};
+ #endif
class Pkcs5HmacSha256_Boot : public Pkcs5Kdf
{
public:
- Pkcs5HmacSha256_Boot () : Pkcs5Kdf(false) { }
+ Pkcs5HmacSha256_Boot () : Pkcs5Kdf() { }
virtual ~Pkcs5HmacSha256_Boot () { }
virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const;
@@ -105,7 +104,7 @@ namespace VeraCrypt
class Pkcs5HmacSha256 : public Pkcs5Kdf
{
public:
- Pkcs5HmacSha256 () : Pkcs5Kdf(false) { }
+ Pkcs5HmacSha256 () : Pkcs5Kdf() { }
virtual ~Pkcs5HmacSha256 () { }
virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const;
@@ -122,31 +121,31 @@ namespace VeraCrypt
class Pkcs5HmacSha512 : public Pkcs5Kdf
{
public:
- Pkcs5HmacSha512 (bool truecryptMode) : Pkcs5Kdf(truecryptMode) { }
+ Pkcs5HmacSha512 () : Pkcs5Kdf() { }
virtual ~Pkcs5HmacSha512 () { }
virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const;
virtual shared_ptr <Hash> GetHash () const { return shared_ptr <Hash> (new Sha512); }
- virtual int GetIterationCount (int pim) const { return m_truecryptMode? 1000 : (pim <= 0 ? 500000 : (15000 + (pim * 1000))); }
+ virtual int GetIterationCount (int pim) const { return (pim <= 0 ? 500000 : (15000 + (pim * 1000))); }
virtual wstring GetName () const { return L"HMAC-SHA-512"; }
- virtual Pkcs5Kdf* Clone () const { return new Pkcs5HmacSha512(m_truecryptMode); }
+ virtual Pkcs5Kdf* Clone () const { return new Pkcs5HmacSha512(); }
private:
Pkcs5HmacSha512 (const Pkcs5HmacSha512 &);
Pkcs5HmacSha512 &operator= (const Pkcs5HmacSha512 &);
};
-
+ #ifndef WOLFCRYPT_BACKEND
class Pkcs5HmacWhirlpool : public Pkcs5Kdf
{
public:
- Pkcs5HmacWhirlpool (bool truecryptMode) : Pkcs5Kdf(truecryptMode) { }
+ Pkcs5HmacWhirlpool () : Pkcs5Kdf() { }
virtual ~Pkcs5HmacWhirlpool () { }
virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const;
virtual shared_ptr <Hash> GetHash () const { return shared_ptr <Hash> (new Whirlpool); }
- virtual int GetIterationCount (int pim) const { return m_truecryptMode? 1000 : (pim <= 0 ? 500000 : (15000 + (pim * 1000))); }
+ virtual int GetIterationCount (int pim) const { return (pim <= 0 ? 500000 : (15000 + (pim * 1000))); }
virtual wstring GetName () const { return L"HMAC-Whirlpool"; }
- virtual Pkcs5Kdf* Clone () const { return new Pkcs5HmacWhirlpool(m_truecryptMode); }
+ virtual Pkcs5Kdf* Clone () const { return new Pkcs5HmacWhirlpool(); }
private:
Pkcs5HmacWhirlpool (const Pkcs5HmacWhirlpool &);
@@ -156,7 +155,7 @@ namespace VeraCrypt
class Pkcs5HmacStreebog : public Pkcs5Kdf
{
public:
- Pkcs5HmacStreebog () : Pkcs5Kdf(false) { }
+ Pkcs5HmacStreebog () : Pkcs5Kdf() { }
virtual ~Pkcs5HmacStreebog () { }
virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const;
@@ -173,7 +172,7 @@ namespace VeraCrypt
class Pkcs5HmacStreebog_Boot : public Pkcs5Kdf
{
public:
- Pkcs5HmacStreebog_Boot () : Pkcs5Kdf(false) { }
+ Pkcs5HmacStreebog_Boot () : Pkcs5Kdf() { }
virtual ~Pkcs5HmacStreebog_Boot () { }
virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const;
@@ -186,6 +185,7 @@ namespace VeraCrypt
Pkcs5HmacStreebog_Boot (const Pkcs5HmacStreebog_Boot &);
Pkcs5HmacStreebog_Boot &operator= (const Pkcs5HmacStreebog_Boot &);
};
+ #endif
}
#endif // TC_HEADER_Encryption_Pkcs5
diff --git a/src/Volume/Volume.cpp b/src/Volume/Volume.cpp
index c4a21b3e..524f2395 100644
--- a/src/Volume/Volume.cpp
+++ b/src/Volume/Volume.cpp
@@ -30,7 +30,6 @@ namespace VeraCrypt
TopWriteOffset (0),
TotalDataRead (0),
TotalDataWritten (0),
- TrueCryptMode (false),
Pim (0),
EncryptionNotCompleted (false)
{
@@ -71,7 +70,7 @@ namespace VeraCrypt
return EA->GetMode();
}
- void Volume::Open (const VolumePath &volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, VolumeProtection::Enum protection, shared_ptr <VolumePassword> protectionPassword, int protectionPim, shared_ptr <Pkcs5Kdf> protectionKdf, shared_ptr <KeyfileList> protectionKeyfiles, bool sharedAccessAllowed, VolumeType::Enum volumeType, bool useBackupHeaders, bool partitionInSystemEncryptionScope)
+ void Volume::Open (const VolumePath &volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection, shared_ptr <VolumePassword> protectionPassword, int protectionPim, shared_ptr <Pkcs5Kdf> protectionKdf, shared_ptr <KeyfileList> protectionKeyfiles, bool sharedAccessAllowed, VolumeType::Enum volumeType, bool useBackupHeaders, bool partitionInSystemEncryptionScope)
{
make_shared_auto (File, file);
@@ -102,18 +101,14 @@ namespace VeraCrypt
throw;
}
- return Open (file, password, pim, kdf, truecryptMode, keyfiles, protection, protectionPassword, protectionPim, protectionKdf,protectionKeyfiles, volumeType, useBackupHeaders, partitionInSystemEncryptionScope);
+ return Open (file, password, pim, kdf, keyfiles, emvSupportEnabled, protection, protectionPassword, protectionPim, protectionKdf,protectionKeyfiles, volumeType, useBackupHeaders, partitionInSystemEncryptionScope);
}
- void Volume::Open (shared_ptr <File> volumeFile, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, VolumeProtection::Enum protection, shared_ptr <VolumePassword> protectionPassword, int protectionPim, shared_ptr <Pkcs5Kdf> protectionKdf,shared_ptr <KeyfileList> protectionKeyfiles, VolumeType::Enum volumeType, bool useBackupHeaders, bool partitionInSystemEncryptionScope)
+ void Volume::Open (shared_ptr <File> volumeFile, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection, shared_ptr <VolumePassword> protectionPassword, int protectionPim, shared_ptr <Pkcs5Kdf> protectionKdf,shared_ptr <KeyfileList> protectionKeyfiles, VolumeType::Enum volumeType, bool useBackupHeaders, bool partitionInSystemEncryptionScope)
{
if (!volumeFile)
throw ParameterIncorrect (SRC_POS);
- // TrueCrypt doesn't support SHA-256 and Streebog
- if (kdf && truecryptMode && (kdf->GetName() == L"HMAC-SHA-256" || kdf->GetName() == L"HMAC-Streebog"))
- throw UnsupportedAlgoInTrueCryptMode (SRC_POS);
-
Protection = protection;
VolumeFile = volumeFile;
SystemEncryption = partitionInSystemEncryptionScope;
@@ -121,7 +116,7 @@ namespace VeraCrypt
try
{
VolumeHostSize = VolumeFile->Length();
- shared_ptr <VolumePassword> passwordKey = Keyfile::ApplyListToPassword (keyfiles, password);
+ shared_ptr <VolumePassword> passwordKey = Keyfile::ApplyListToPassword (keyfiles, password, emvSupportEnabled);
bool skipLayoutV1Normal = false;
@@ -190,11 +185,11 @@ namespace VeraCrypt
shared_ptr <VolumeHeader> header = layout->GetHeader();
- if (header->Decrypt (headerBuffer, *passwordKey, pim, kdf, truecryptMode, layout->GetSupportedKeyDerivationFunctions(truecryptMode), layoutEncryptionAlgorithms, layoutEncryptionModes))
+ if (header->Decrypt (headerBuffer, *passwordKey, pim, kdf, layout->GetSupportedKeyDerivationFunctions(), layoutEncryptionAlgorithms, layoutEncryptionModes))
{
// Header decrypted
- if (!truecryptMode && typeid (*layout) == typeid (VolumeLayoutV2Normal) && header->GetRequiredMinProgramVersion() < 0x10b)
+ if (typeid (*layout) == typeid (VolumeLayoutV2Normal) && header->GetRequiredMinProgramVersion() < 0x10b)
{
// VolumeLayoutV1Normal has been opened as VolumeLayoutV2Normal
layout.reset (new VolumeLayoutV1Normal);
@@ -202,7 +197,6 @@ namespace VeraCrypt
layout->SetHeader (header);
}
- TrueCryptMode = truecryptMode;
Pim = pim;
Type = layout->GetType();
SectorSize = header->GetSectorSize();
@@ -248,7 +242,8 @@ namespace VeraCrypt
Volume protectedVolume;
protectedVolume.Open (VolumeFile,
- protectionPassword, protectionPim, protectionKdf, truecryptMode, protectionKeyfiles,
+ protectionPassword, protectionPim, protectionKdf, protectionKeyfiles,
+ emvSupportEnabled,
VolumeProtection::ReadOnly,
shared_ptr <VolumePassword> (), 0, shared_ptr <Pkcs5Kdf> (),shared_ptr <KeyfileList> (),
VolumeType::Hidden,
@@ -286,8 +281,8 @@ namespace VeraCrypt
Buffer mbr (VolumeFile->GetDeviceSectorSize());
driveDevice.ReadAt (mbr, 0);
- // Search for the string "VeraCrypt" or "TrueCrypt"
- const char* bootSignature = truecryptMode? "TrueCrypt" : TC_APP_NAME;
+ // Search for the string "VeraCrypt"
+ const char* bootSignature = TC_APP_NAME;
size_t nameLen = strlen (bootSignature);
for (size_t i = 0; i < mbr.Size() - nameLen; ++i)
{
diff --git a/src/Volume/Volume.h b/src/Volume/Volume.h
index a743a161..c816da58 100644
--- a/src/Volume/Volume.h
+++ b/src/Volume/Volume.h
@@ -52,20 +52,6 @@ namespace VeraCrypt
return Data.substr (pos + 1);
}
}
-
- bool HasTrueCryptExtension () const
- {
- wstring sExt = GetExtension ();
- if ((sExt.size () == 2)
- && (sExt[0] == L't' || sExt[0] == L'T')
- && (sExt[1] == L'c' || sExt[1] == L'C')
- )
- {
- return true;
- }
- else
- return false;
- }
protected:
wstring Data;
@@ -118,13 +104,12 @@ namespace VeraCrypt
uint64 GetTotalDataRead () const { return TotalDataRead; }
uint64 GetTotalDataWritten () const { return TotalDataWritten; }
VolumeType::Enum GetType () const { return Type; }
- bool GetTrueCryptMode() const { return TrueCryptMode; }
int GetPim() const { return Pim;}
uint64 GetVolumeCreationTime () const { return Header->GetVolumeCreationTime(); }
bool IsHiddenVolumeProtectionTriggered () const { return HiddenVolumeProtectionTriggered; }
bool IsInSystemEncryptionScope () const { return SystemEncryption; }
- void Open (const VolumePath &volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, VolumeProtection::Enum protection = VolumeProtection::None, shared_ptr <VolumePassword> protectionPassword = shared_ptr <VolumePassword> (), int protectionPim = 0, shared_ptr <Pkcs5Kdf> protectionKdf = shared_ptr <Pkcs5Kdf> (),shared_ptr <KeyfileList> protectionKeyfiles = shared_ptr <KeyfileList> (), bool sharedAccessAllowed = false, VolumeType::Enum volumeType = VolumeType::Unknown, bool useBackupHeaders = false, bool partitionInSystemEncryptionScope = false);
- void Open (shared_ptr <File> volumeFile, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, VolumeProtection::Enum protection = VolumeProtection::None, shared_ptr <VolumePassword> protectionPassword = shared_ptr <VolumePassword> (), int protectionPim = 0, shared_ptr <Pkcs5Kdf> protectionKdf = shared_ptr <Pkcs5Kdf> (), shared_ptr <KeyfileList> protectionKeyfiles = shared_ptr <KeyfileList> (), VolumeType::Enum volumeType = VolumeType::Unknown, bool useBackupHeaders = false, bool partitionInSystemEncryptionScope = false);
+ void Open (const VolumePath &volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection = VolumeProtection::None, shared_ptr <VolumePassword> protectionPassword = shared_ptr <VolumePassword> (), int protectionPim = 0, shared_ptr <Pkcs5Kdf> protectionKdf = shared_ptr <Pkcs5Kdf> (),shared_ptr <KeyfileList> protectionKeyfiles = shared_ptr <KeyfileList> (), bool sharedAccessAllowed = false, VolumeType::Enum volumeType = VolumeType::Unknown, bool useBackupHeaders = false, bool partitionInSystemEncryptionScope = false);
+ void Open (shared_ptr <File> volumeFile, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection = VolumeProtection::None, shared_ptr <VolumePassword> protectionPassword = shared_ptr <VolumePassword> (), int protectionPim = 0, shared_ptr <Pkcs5Kdf> protectionKdf = shared_ptr <Pkcs5Kdf> (), shared_ptr <KeyfileList> protectionKeyfiles = shared_ptr <KeyfileList> (), VolumeType::Enum volumeType = VolumeType::Unknown, bool useBackupHeaders = false, bool partitionInSystemEncryptionScope = false);
void ReadSectors (const BufferPtr &buffer, uint64 byteOffset);
void ReEncryptHeader (bool backupHeader, const ConstBufferPtr &newSalt, const ConstBufferPtr &newHeaderKey, shared_ptr <Pkcs5Kdf> newPkcs5Kdf);
void WriteSectors (const ConstBufferPtr &buffer, uint64 byteOffset);
@@ -152,7 +137,6 @@ namespace VeraCrypt
uint64 TopWriteOffset;
uint64 TotalDataRead;
uint64 TotalDataWritten;
- bool TrueCryptMode;
int Pim;
bool EncryptionNotCompleted;
diff --git a/src/Volume/Volume.make b/src/Volume/Volume.make
index 91f40fb7..b6d9e99e 100644
--- a/src/Volume/Volume.make
+++ b/src/Volume/Volume.make
@@ -16,7 +16,6 @@ OBJSNOOPT :=
OBJS += Cipher.o
OBJS += EncryptionAlgorithm.o
OBJS += EncryptionMode.o
-OBJS += EncryptionModeXTS.o
OBJS += EncryptionTest.o
OBJS += EncryptionThreadPool.o
OBJS += Hash.o
@@ -30,12 +29,19 @@ OBJS += VolumeLayout.o
OBJS += VolumePassword.o
OBJS += VolumePasswordCache.o
+ifeq "$(ENABLE_WOLFCRYPT)" "0"
+OBJS += EncryptionModeXTS.o
+else
+OBJS += EncryptionModeWolfCryptXTS.o
+endif
+
+ifeq "$(ENABLE_WOLFCRYPT)" "0"
ifeq "$(PLATFORM)" "MacOSX"
- OBJSEX += ../Crypto/Aes_asm.oo
- OBJS += ../Crypto/Aes_hw_cpu.o
- OBJS += ../Crypto/Aescrypt.o
- OBJSEX += ../Crypto/Twofish_asm.oo
- OBJSEX += ../Crypto/Camellia_asm.oo
+ OBJSEX += ../Crypto/Aes_asm.oo
+ OBJS += ../Crypto/Aes_hw_cpu.o
+ OBJS += ../Crypto/Aescrypt.o
+ OBJSEX += ../Crypto/Twofish_asm.oo
+ OBJSEX += ../Crypto/Camellia_asm.oo
OBJSEX += ../Crypto/Camellia_aesni_asm.oo
OBJSEX += ../Crypto/sha256-nayuki.oo
OBJSEX += ../Crypto/sha512-nayuki.oo
@@ -47,16 +53,16 @@ ifeq "$(PLATFORM)" "MacOSX"
OBJSEX += ../Crypto/sha512_sse4.oo
else ifeq "$(CPU_ARCH)" "x86"
OBJS += ../Crypto/Aes_x86.o
-ifeq "$(DISABLE_AESNI)" "0"
- OBJS += ../Crypto/Aes_hw_cpu.o
-endif
+ ifeq "$(DISABLE_AESNI)" "0"
+ OBJS += ../Crypto/Aes_hw_cpu.o
+ endif
OBJS += ../Crypto/sha256-x86-nayuki.o
OBJS += ../Crypto/sha512-x86-nayuki.o
else ifeq "$(CPU_ARCH)" "x64"
OBJS += ../Crypto/Aes_x64.o
-ifeq "$(DISABLE_AESNI)" "0"
- OBJS += ../Crypto/Aes_hw_cpu.o
-endif
+ ifeq "$(DISABLE_AESNI)" "0"
+ OBJS += ../Crypto/Aes_hw_cpu.o
+ endif
OBJS += ../Crypto/Twofish_x64.o
OBJS += ../Crypto/Camellia_x64.o
OBJS += ../Crypto/Camellia_aesni_x64.o
@@ -72,16 +78,19 @@ else
endif
ifeq "$(GCC_GTEQ_430)" "1"
-OBJSSSE41 += ../Crypto/blake2s_SSE41.osse41
-OBJSSSSE3 += ../Crypto/blake2s_SSSE3.ossse3
+ OBJSSSE41 += ../Crypto/blake2s_SSE41.osse41
+ OBJSSSSE3 += ../Crypto/blake2s_SSSE3.ossse3
+else
+ OBJS += ../Crypto/blake2s_SSE41.o
+ OBJS += ../Crypto/blake2s_SSSE3.o
+endif
else
-OBJS += ../Crypto/blake2s_SSE41.o
-OBJS += ../Crypto/blake2s_SSSE3.o
+OBJS += ../Crypto/wolfCrypt.o
endif
+ifeq "$(ENABLE_WOLFCRYPT)" "0"
OBJS += ../Crypto/Aeskey.o
OBJS += ../Crypto/Aestab.o
-OBJS += ../Crypto/cpu.o
OBJS += ../Crypto/blake2s.o
OBJS += ../Crypto/blake2s_SSE2.o
OBJS += ../Crypto/SerpentFast.o
@@ -93,17 +102,32 @@ OBJS += ../Crypto/Camellia.o
OBJS += ../Crypto/Streebog.o
OBJS += ../Crypto/kuznyechik.o
OBJS += ../Crypto/kuznyechik_simd.o
+OBJS += ../Common/Pkcs5.o
+endif
+
+OBJS += ../Crypto/cpu.o
OBJSNOOPT += ../Crypto/jitterentropy-base.o0
+OBJS += ../Common/CommandAPDU.o
+OBJS += ../Common/PCSCException.o
+OBJS += ../Common/ResponseAPDU.o
+OBJS += ../Common/SCard.o
+OBJS += ../Common/SCardLoader.o
+OBJS += ../Common/SCardManager.o
+OBJS += ../Common/SCardReader.o
+OBJS += ../Common/Token.o
OBJS += ../Common/Crc.o
+OBJS += ../Common/TLVParser.o
+OBJS += ../Common/EMVCard.o
+OBJS += ../Common/EMVToken.o
OBJS += ../Common/Endian.o
OBJS += ../Common/GfMul.o
-OBJS += ../Common/Pkcs5.o
OBJS += ../Common/SecurityToken.o
VolumeLibrary: Volume.a
+ifeq "$(ENABLE_WOLFCRYPT)" "0"
ifeq "$(PLATFORM)" "MacOSX"
../Crypto/Aes_asm.oo: ../Crypto/Aes_x86.asm ../Crypto/Aes_x64.asm
@echo Assembling $(<F)
@@ -148,5 +172,6 @@ ifeq "$(PLATFORM)" "MacOSX"
@echo Assembling $(<F)
$(AS) $(ASFLAGS64) -o ../Crypto/sha512_sse4.oo ../Crypto/sha512_sse4_x64.asm
endif
+endif
include $(BUILD_INC)/Makefile.inc
diff --git a/src/Volume/VolumeHeader.cpp b/src/Volume/VolumeHeader.cpp
index faed1fcb..57b63394 100644
--- a/src/Volume/VolumeHeader.cpp
+++ b/src/Volume/VolumeHeader.cpp
@@ -12,6 +12,9 @@
#include "Crc32.h"
#include "EncryptionModeXTS.h"
+#ifdef WOLFCRYPT_BACKEND
+#include "EncryptionModeWolfCryptXTS.h"
+#endif
#include "Pkcs5Kdf.h"
#include "Pkcs5Kdf.h"
#include "VolumeHeader.h"
@@ -76,13 +79,17 @@ namespace VeraCrypt
}
EA = options.EA;
- shared_ptr <EncryptionMode> mode (new EncryptionModeXTS ());
- EA->SetMode (mode);
+ #ifdef WOLFCRYPT_BACKEND
+ shared_ptr <EncryptionMode> mode (new EncryptionModeWolfCryptXTS ());
+ #else
+ shared_ptr <EncryptionMode> mode (new EncryptionModeXTS ());
+ #endif
+ EA->SetMode (mode);
EncryptNew (headerBuffer, options.Salt, options.HeaderKey, options.Kdf);
}
- bool VolumeHeader::Decrypt (const ConstBufferPtr &encryptedData, const VolumePassword &password, int pim, shared_ptr <Pkcs5Kdf> kdf, bool truecryptMode, const Pkcs5KdfList &keyDerivationFunctions, const EncryptionAlgorithmList &encryptionAlgorithms, const EncryptionModeList &encryptionModes)
+ bool VolumeHeader::Decrypt (const ConstBufferPtr &encryptedData, const VolumePassword &password, int pim, shared_ptr <Pkcs5Kdf> kdf, const Pkcs5KdfList &keyDerivationFunctions, const EncryptionAlgorithmList &encryptionAlgorithms, const EncryptionModeList &encryptionModes)
{
if (password.Size() < 1)
throw PasswordEmpty (SRC_POS);
@@ -100,17 +107,28 @@ namespace VeraCrypt
foreach (shared_ptr <EncryptionMode> mode, encryptionModes)
{
- if (typeid (*mode) != typeid (EncryptionModeXTS))
- mode->SetKey (headerKey.GetRange (0, mode->GetKeySize()));
+ #ifdef WOLFCRYPT_BACKEND
+ if (typeid (*mode) != typeid (EncryptionModeWolfCryptXTS))
+ #else
+ if (typeid (*mode) != typeid (EncryptionModeXTS))
+ #endif
+ mode->SetKey (headerKey.GetRange (0, mode->GetKeySize()));
foreach (shared_ptr <EncryptionAlgorithm> ea, encryptionAlgorithms)
{
if (!ea->IsModeSupported (mode))
continue;
+ #ifndef WOLFCRYPT_BACKEND
if (typeid (*mode) == typeid (EncryptionModeXTS))
{
- ea->SetKey (headerKey.GetRange (0, ea->GetKeySize()));
+ ea->SetKey (headerKey.GetRange (0, ea->GetKeySize()));
+ #else
+ if (typeid (*mode) == typeid (EncryptionModeWolfCryptXTS))
+ {
+ ea->SetKey (headerKey.GetRange (0, ea->GetKeySize()));
+ ea->SetKeyXTS (headerKey.GetRange (ea->GetKeySize(), ea->GetKeySize()));
+ #endif
mode = mode->GetNew();
mode->SetKey (headerKey.GetRange (ea->GetKeySize(), ea->GetKeySize()));
@@ -125,7 +143,7 @@ namespace VeraCrypt
header.CopyFrom (encryptedData.GetRange (EncryptedHeaderDataOffset, EncryptedHeaderDataSize));
ea->Decrypt (header);
- if (Deserialize (header, ea, mode, truecryptMode))
+ if (Deserialize (header, ea, mode))
{
EA = ea;
Pkcs5 = pkcs5;
@@ -138,18 +156,12 @@ namespace VeraCrypt
return false;
}
- bool VolumeHeader::Deserialize (const ConstBufferPtr &header, shared_ptr <EncryptionAlgorithm> &ea, shared_ptr <EncryptionMode> &mode, bool truecryptMode)
+ bool VolumeHeader::Deserialize (const ConstBufferPtr &header, shared_ptr <EncryptionAlgorithm> &ea, shared_ptr <EncryptionMode> &mode)
{
if (header.Size() != EncryptedHeaderDataSize)
throw ParameterIncorrect (SRC_POS);
- if (truecryptMode && (header[0] != 'T' ||
- header[1] != 'R' ||
- header[2] != 'U' ||
- header[3] != 'E'))
- return false;
-
- if (!truecryptMode && (header[0] != 'V' ||
+ if ((header[0] != 'V' ||
header[1] != 'E' ||
header[2] != 'R' ||
header[3] != 'A'))
@@ -173,16 +185,9 @@ namespace VeraCrypt
RequiredMinProgramVersion = DeserializeEntry <uint16> (header, offset);
- if (!truecryptMode && (RequiredMinProgramVersion > Version::Number()))
+ if ((RequiredMinProgramVersion > Version::Number()))
throw HigherVersionRequired (SRC_POS);
- if (truecryptMode)
- {
- if (RequiredMinProgramVersion < 0x600 || RequiredMinProgramVersion > 0x71a)
- throw UnsupportedTrueCryptFormat (SRC_POS);
- RequiredMinProgramVersion = CurrentRequiredMinProgramVersion;
- }
-
VolumeKeyAreaCrc32 = DeserializeEntry <uint32> (header, offset);
VolumeCreationTime = DeserializeEntry <uint64> (header, offset);
HeaderCreationTime = DeserializeEntry <uint64> (header, offset);
@@ -219,9 +224,16 @@ namespace VeraCrypt
ea = ea->GetNew();
mode = mode->GetNew();
+ #ifndef WOLFCRYPT_BACKEND
if (typeid (*mode) == typeid (EncryptionModeXTS))
{
- ea->SetKey (header.GetRange (offset, ea->GetKeySize()));
+ ea->SetKey (header.GetRange (offset, ea->GetKeySize()));
+ #else
+ if (typeid (*mode) == typeid (EncryptionModeWolfCryptXTS))
+ {
+ ea->SetKey (header.GetRange (offset, ea->GetKeySize()));
+ ea->SetKeyXTS (header.GetRange (offset + ea->GetKeySize(), ea->GetKeySize()));
+ #endif
mode->SetKey (header.GetRange (offset + ea->GetKeySize(), ea->GetKeySize()));
}
else
@@ -263,10 +275,17 @@ namespace VeraCrypt
shared_ptr <EncryptionMode> mode = EA->GetMode()->GetNew();
shared_ptr <EncryptionAlgorithm> ea = EA->GetNew();
+ #ifndef WOLFCRYPT_BACKEND
if (typeid (*mode) == typeid (EncryptionModeXTS))
{
- mode->SetKey (newHeaderKey.GetRange (EA->GetKeySize(), EA->GetKeySize()));
- ea->SetKey (newHeaderKey.GetRange (0, ea->GetKeySize()));
+ ea->SetKey (newHeaderKey.GetRange (0, ea->GetKeySize()));
+ #else
+ if (typeid (*mode) == typeid (EncryptionModeWolfCryptXTS))
+ {
+ ea->SetKey (newHeaderKey.GetRange (0, ea->GetKeySize()));
+ ea->SetKeyXTS (newHeaderKey.GetRange (EA->GetKeySize(), EA->GetKeySize()));
+ #endif
+ mode->SetKey (newHeaderKey.GetRange (EA->GetKeySize(), EA->GetKeySize()));
}
else
{
diff --git a/src/Volume/VolumeHeader.h b/src/Volume/VolumeHeader.h
index 191547e3..85908711 100644
--- a/src/Volume/VolumeHeader.h
+++ b/src/Volume/VolumeHeader.h
@@ -60,7 +60,7 @@ namespace VeraCrypt
virtual ~VolumeHeader ();
void Create (const BufferPtr &headerBuffer, VolumeHeaderCreationOptions &options);
- bool Decrypt (const ConstBufferPtr &encryptedData, const VolumePassword &password, int pim, shared_ptr <Pkcs5Kdf> kdf, bool truecryptMode, const Pkcs5KdfList &keyDerivationFunctions, const EncryptionAlgorithmList &encryptionAlgorithms, const EncryptionModeList &encryptionModes);
+ bool Decrypt (const ConstBufferPtr &encryptedData, const VolumePassword &password, int pim, shared_ptr <Pkcs5Kdf> kdf, const Pkcs5KdfList &keyDerivationFunctions, const EncryptionAlgorithmList &encryptionAlgorithms, const EncryptionModeList &encryptionModes);
void EncryptNew (const BufferPtr &newHeaderBuffer, const ConstBufferPtr &newSalt, const ConstBufferPtr &newHeaderKey, shared_ptr <Pkcs5Kdf> newPkcs5Kdf);
uint64 GetEncryptedAreaStart () const { return EncryptedAreaStart; }
uint64 GetEncryptedAreaLength () const { return EncryptedAreaLength; }
@@ -78,7 +78,7 @@ namespace VeraCrypt
void SetSize (uint32 headerSize);
protected:
- bool Deserialize (const ConstBufferPtr &header, shared_ptr <EncryptionAlgorithm> &ea, shared_ptr <EncryptionMode> &mode, bool truecryptMode);
+ bool Deserialize (const ConstBufferPtr &header, shared_ptr <EncryptionAlgorithm> &ea, shared_ptr <EncryptionMode> &mode);
template <typename T> T DeserializeEntry (const ConstBufferPtr &header, size_t &offset) const;
template <typename T> T DeserializeEntryAt (const ConstBufferPtr &header, const size_t &offset) const;
void Init ();
diff --git a/src/Volume/VolumeInfo.cpp b/src/Volume/VolumeInfo.cpp
index b30dafa2..699e203f 100644
--- a/src/Volume/VolumeInfo.cpp
+++ b/src/Volume/VolumeInfo.cpp
@@ -54,7 +54,6 @@ namespace VeraCrypt
Type = static_cast <VolumeType::Enum> (sr.DeserializeInt32 ("Type"));
VirtualDevice = sr.DeserializeWString ("VirtualDevice");
sr.Deserialize ("VolumeCreationTime", VolumeCreationTime);
- sr.Deserialize ("TrueCryptMode", TrueCryptMode);
sr.Deserialize ("Pim", Pim);
}
@@ -95,7 +94,6 @@ namespace VeraCrypt
sr.Serialize ("Type", static_cast <uint32> (Type));
sr.Serialize ("VirtualDevice", wstring (VirtualDevice));
sr.Serialize ("VolumeCreationTime", VolumeCreationTime);
- sr.Serialize ("TrueCryptMode", TrueCryptMode);
sr.Serialize ("Pim", Pim);
}
@@ -120,7 +118,6 @@ namespace VeraCrypt
TopWriteOffset = volume.GetTopWriteOffset();
TotalDataRead = volume.GetTotalDataRead();
TotalDataWritten = volume.GetTotalDataWritten();
- TrueCryptMode = volume.GetTrueCryptMode();
Pim = volume.GetPim ();
}
diff --git a/src/Volume/VolumeInfo.h b/src/Volume/VolumeInfo.h
index f9e07a2e..1adc87e3 100644
--- a/src/Volume/VolumeInfo.h
+++ b/src/Volume/VolumeInfo.h
@@ -60,7 +60,6 @@ namespace VeraCrypt
VolumeType::Enum Type;
DevicePath VirtualDevice;
VolumeTime VolumeCreationTime;
- bool TrueCryptMode;
int Pim;
private:
diff --git a/src/Volume/VolumeLayout.cpp b/src/Volume/VolumeLayout.cpp
index 3045ba83..3600d76f 100644
--- a/src/Volume/VolumeLayout.cpp
+++ b/src/Volume/VolumeLayout.cpp
@@ -12,6 +12,9 @@
#include "Volume/EncryptionMode.h"
#include "Volume/EncryptionModeXTS.h"
+#ifdef WOLFCRYPT_BACKEND
+#include "Volume/EncryptionModeWolfCryptXTS.h"
+#endif
#include "VolumeLayout.h"
#include "Boot/Windows/BootCommon.h"
@@ -66,6 +69,7 @@ namespace VeraCrypt
HeaderSize = TC_VOLUME_HEADER_SIZE_LEGACY;
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new AES ()));
+ #ifndef WOLFCRYPT_BACKEND
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Serpent ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Twofish ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Camellia ()));
@@ -75,7 +79,10 @@ namespace VeraCrypt
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new SerpentTwofishAES ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new TwofishSerpent ()));
- SupportedEncryptionModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeXTS ()));
+ SupportedEncryptionModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeXTS ()));
+ #else
+ SupportedEncryptionModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeWolfCryptXTS ()));
+ #endif
}
uint64 VolumeLayoutV1Normal::GetDataOffset (uint64 volumeHostSize) const
@@ -97,6 +104,7 @@ namespace VeraCrypt
BackupHeaderOffset = -TC_VOLUME_HEADER_GROUP_SIZE;
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new AES ()));
+ #ifndef WOLFCRYPT_BACKEND
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Serpent ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Twofish ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Camellia ()));
@@ -111,9 +119,12 @@ namespace VeraCrypt
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new SerpentAES ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new SerpentTwofishAES ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new TwofishSerpent ()));
-
SupportedEncryptionModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeXTS ()));
- }
+ #else
+ SupportedEncryptionModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeWolfCryptXTS ()));
+ #endif
+
+ }
uint64 VolumeLayoutV2Normal::GetDataOffset (uint64 volumeHostSize) const
{
@@ -142,6 +153,7 @@ namespace VeraCrypt
BackupHeaderOffset = -TC_HIDDEN_VOLUME_HEADER_OFFSET;
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new AES ()));
+ #ifndef WOLFCRYPT_BACKEND
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Serpent ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Twofish ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Camellia ()));
@@ -158,6 +170,9 @@ namespace VeraCrypt
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new TwofishSerpent ()));
SupportedEncryptionModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeXTS ()));
+ #else
+ SupportedEncryptionModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeWolfCryptXTS ()));
+ #endif
}
uint64 VolumeLayoutV2Hidden::GetDataOffset (uint64 volumeHostSize) const
@@ -194,6 +209,7 @@ namespace VeraCrypt
HeaderSize = TC_BOOT_ENCRYPTION_VOLUME_HEADER_SIZE;
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new AES ()));
+ #ifndef WOLFCRYPT_BACKEND
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Serpent ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Twofish ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Camellia ()));
@@ -208,9 +224,13 @@ namespace VeraCrypt
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new SerpentAES ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new SerpentTwofishAES ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new TwofishSerpent ()));
-
- SupportedEncryptionModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeXTS ()));
- }
+
+ SupportedEncryptionModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeXTS ()));
+ #else
+ SupportedEncryptionModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeWolfCryptXTS ()));
+ #endif
+
+ }
uint64 VolumeLayoutSystemEncryption::GetDataOffset (uint64 volumeHostSize) const
{
@@ -222,17 +242,16 @@ namespace VeraCrypt
return volumeHostSize;
}
- Pkcs5KdfList VolumeLayoutSystemEncryption::GetSupportedKeyDerivationFunctions (bool truecryptMode) const
+ Pkcs5KdfList VolumeLayoutSystemEncryption::GetSupportedKeyDerivationFunctions () const
{
Pkcs5KdfList l;
- if (!truecryptMode)
- {
- l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacSha256_Boot ()));
- l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacBlake2s_Boot ()));
- l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacSha512 (false)));
- l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacWhirlpool (false)));
- l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacStreebog ()));
- }
- return l;
+ l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacSha256_Boot ()));
+ l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacSha512 ()));
+ #ifndef WOLFCRYPT_BACKEND
+ l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacBlake2s_Boot ()));
+ l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacWhirlpool ()));
+ l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacStreebog ()));
+ #endif
+ return l;
}
}
diff --git a/src/Volume/VolumeLayout.h b/src/Volume/VolumeLayout.h
index 40a8643d..32b646ad 100644
--- a/src/Volume/VolumeLayout.h
+++ b/src/Volume/VolumeLayout.h
@@ -38,7 +38,7 @@ namespace VeraCrypt
virtual uint32 GetHeaderSize () const { return HeaderSize; }
virtual uint64 GetMaxDataSize (uint64 volumeSize) const = 0;
virtual EncryptionAlgorithmList GetSupportedEncryptionAlgorithms () const { return SupportedEncryptionAlgorithms; }
- virtual Pkcs5KdfList GetSupportedKeyDerivationFunctions (bool truecryptMode) const { return Pkcs5Kdf::GetAvailableAlgorithms(truecryptMode); }
+ virtual Pkcs5KdfList GetSupportedKeyDerivationFunctions () const { return Pkcs5Kdf::GetAvailableAlgorithms(); }
virtual EncryptionModeList GetSupportedEncryptionModes () const { return SupportedEncryptionModes; }
virtual VolumeType::Enum GetType () const { return Type; }
virtual bool HasBackupHeader () const = 0;
@@ -126,7 +126,7 @@ namespace VeraCrypt
virtual uint64 GetDataOffset (uint64 volumeHostSize) const;
virtual uint64 GetDataSize (uint64 volumeHostSize) const;
virtual uint64 GetMaxDataSize (uint64 volumeSize) const { throw NotApplicable (SRC_POS); }
- virtual Pkcs5KdfList GetSupportedKeyDerivationFunctions (bool truecryptMode) const;
+ virtual Pkcs5KdfList GetSupportedKeyDerivationFunctions () const;
virtual bool HasBackupHeader () const { return false; }
virtual bool HasDriveHeader () const { return true; }