Отмена Установить для &всех пользователей О&бзор... &Значок VeraCrypt на рабочем столе Помочь... Ассоциировать рас&ширение .hc с VeraCrypt По окончании откр&ыть целевую папку &Добавить VeraCrypt в меню 'Пуск' Создать то&чку восстановления системы Уда&ление &Извлечь &Установить Мастер установки VeraCrypt Удаление VeraCrypt &Справка Укажите целевую папку для извлечения файлов: Выберите место, куда вы хотите установить программные файлы VeraCrypt.\nЕсли указанной папки не существует, она будет создана автоматически. Нажмите 'Удаление', чтобы удалить VeraCrypt из этой системы. Стоп &Тест &Проверить Создать и отформатировать зашифрованный том Зашифровать раздел на месте Показ созданных ключей (их частей) Показывать пул Загрузить ПО для записи CD/DVD Создать зашифрованный файловый контейнер &ГБ &ТБ Подробнее &Скрытый том VeraCrypt Что такое 'скрытый том'? Прямой режим Обычный режим &КБ Кл&юч. файлы Сначала пытаться смонтировать без пароля Случайный размер (64 <-> 1 048 576) Клю&ч. файлы... О хеш-алгоритмах Подробнее Сведения о PIM &МБ Подробнее Подробнее о шифровании системы Подробнее Мультизагрузка Зашифровать несистемный раздел/диск &Не сохранять историю Открыть внешний том &Пауза Использовать P&IM Использовать PIM Быстрое форматир. &Показ пароля &Показ пароля По&каз PIM Одиночная загрузка Обычный том VeraCrypt Скр&ытый Обычный Зашифровать раздел или весь диск с системой Зашифровать системный раздел Windows Зашифровать весь диск Мастер создания томов VeraCrypt Кластер ВАЖНО: Хаотично перемещайте мышь внутри этого окна (чем дольше, тем лучше) - это значительно увеличит криптостойкость ключей шифрования. Затем нажмите 'Далее'. &Подтвердите: Уже Буква диска: Алгоритм шифрования Файл.сист. Создать виртуальный зашифрованный диск внутри файла. Рекомендуется неопытным пользователям. Опции Алгоритм хеширования Ключ заг-ка: Ещё Мастер-ключ: Выберите эту опцию, если в ПК установлено две или более ОС.\n\nНапример:\n- Windows XP и Windows XP\n- Windows XP и Windows Vista\n- Windows и macOS\n- Windows и Linux\n- Windows, Linux и macOS Зашифровать раздел без ОС на внутреннем/внешнем диске (на флэшке и др.). Дополнительно - создать скрытый том. Текущее содержимое пула (часть) Пароль Пароль: PIM тома: PIM тома: Ход операции: Случайн. пул: Выберите эту опцию, если в ПК установлена только одна ОС (даже если она с несколькими пользователями). Скорость Статус Ключи, соль и другие данные успешно созданы. Если вы хотите создать новые ключи, нажмите 'Назад', а затем 'Далее'. Если же нет, то нажмите 'Далее' для продолжения. Зашифровать раздел/диск, где установлена Windows. Перед каждой загрузкой Windows нужно будет вводить пароль для доступа к ОС, считывания и записи файлов и т.д. Дополнительно - создать скрытую ОС. Выберите эту опцию, чтобы зашифровать раздел, где установлена работающая сейчас Windows. Метка тома в Windows: Режим очистки: Закрыть Об&ход дозагрузочной аутентификации по Esc (разрешает диспетчер загрузки) Нет действий &Автомонтирование тома VeraCrypt (указанного) &Запуск VeraCrypt Автоопределение &библиотеки К&эшировать пароль дозагрузочной аутентификации (для монтирования несистемных томов) Обзор... Обзор... К&эшировать пароли и ключевые файлы Выход, если нет смонтированных томов Закр&ыть токен-сессию (выйти) после успешного монтирования тома С расширителем томов VeraCrypt С мастером создания томов VeraCrypt Создать С&оздать том Пусто&й экран аутентификации (только указанный ниже текст) Не обнаруживать атаку 'Evil Maid' Ускорять (де)шифрование AES с помощью AES-инструкций процессора (если возможно) Ключ. файлы Ключ. файлы В&ыход Об избранных томах Н&е монтировать выбранный том, если нажата клавиша монтирования избранных томов Монт&ировать выбранный том при подключении устройства, на котором он расположен Монтировать выбранный том при в&ходе в систему Монтировать выбранный том как предназначенный &только для чтения Монтировать выбранный том как &сменный носитель &Ниже &Выше Открыть том в Пр&оводнике при успешном монтировании &Убрать Метка избранного как метка диска в Проводнике Глобальные установки Оповещение после успешного размонтирования по горячей клавише Звук после успешного размонтирования по горячей клавише Alt Ctrl Shift Win Назначить Убрать Ключ.файлы... Не использовать это число процессоров при (де)шифровании: Подробнее Подробнее Ещё настройки... &Автомонтирование Параметр&ы... Монтировать как том только для &чтения Ключ.файлы... (пусто или 0 для итераций по умолчанию) (пусто или 0 для итераций по умолчанию) Включено Кэшировать пароли в памяти драйвера Автоматически размонтировать тома при неактивности в течение завершении сеансов блокировке сеанса пользователя входе в энергосбережение старте экранной заставки Автоматически размонтировать тома даже при открытых файлах/папках Монтировать все тома на устройствах Запуск VeraCrypt в фоне Монтировать как тома\nтолько для чтения Монтировать тома как сменные носители Открывать Проводник для успешно смонтированного тома Временно кэшировать пароль при монтировании избранных томов Другой значок в области уведомлений при смонтированных томах Очищать кэш паролей при авторазмонтировании Очищать кэш паролей при выходе Сохранять дату изменения у файл-контейнеров Сброс &Устройство... &Файл... &Библиотека... Показ пароля Показ пароля &Открыть смонтированный том в Проводнике &Кэшировать пароль в памяти драйвера Режим TrueCrypt &Размонтировать все Сво&йства тома... О&перации с томами О&чистить кэш Параметры монтирования Избранные тома VeraCrypt Общесистемные горячие клавиши VeraCrypt VeraCrypt Изменение пароля или ключевых файлов Введите пароль тома VeraCrypt Настройки производительности VeraCrypt Параметры VeraCrypt Настройки шифрования системы Настройки токена безопасности Настройка переносного диска VeraCrypt Свойства тома VeraCrypt О программе... Добавить/удалить ключевые файлы в/из том(а)... Добавить смонтированный том в список избранных томов... Добавить смонтированный том в список избранных системных томов... Проанализировать сбой системы... Создать резервную копию заголовка тома... Тест скорости... Установить алгоритм формирования ключа заголовка... Изменить пароль тома... Установить алгоритм формирования ключа заголовка... Изменить пароль... Очистить историю томов Закрыть все токен-сессии Связь с авторами... Создать скрытую ОС... Создать диск восстановления... Создать новый том... Перманентно расшифровать... Ключевые файлы по умолчанию... Параметры монтирования по умолчанию... Помочь... Зашифровать системный раздел/диск... Часто задаваемые вопросы Руководство пользователя &Домашняя страница Горячие клавиши... Генератор ключевых файлов Язык (language)... Юридическая информация Ключевые файлы токена безопасности... Автомонтирование всех томов на основе устройств Смонтировать избранные тома Смонтировать &без дозагрузочной аутентификации... Смонтировать том Смонтировать том с параметрами Новости Справка в Интернете Руководство для начинающих Упорядочить избранные тома... Упорядочить системные избранные тома... Быстродействие... Перманентно расшифровать системный раздел/диск Параметры... Обновить буквы дисков Удалить из тома все ключевые файлы... Восстановить заголовок тома... Продолжить прерванный процесс Выбрать устройство... Выбрать файл... Возобновить прерванный процесс Шифрование системы... Свойства... Установки... Системные избранные тома... Загрузка ПО Тест алгоритмов генерирования векторов... Токены безопасности... Настройка переносного диска... Размонтировать все смонтированные тома Размонтировать том Проверить диск восстановления Проверить образ диска восстановления История версий Расширитель томов Свойства тома Мастер создания томов Сайт VeraCrypt Очистить кэш паролей OK Аппаратное ускорение Клавиша быстрого вызова Настройка автозапуска (файл autorun.inf) Автоматическое размонтирование Размонтировать\nвсе тома при: Параметры экрана загрузчика Подтвердите: Текущий Показывать этот текст на экране дозагрузочной аутентификации (до 24 символов): Параметры монтирования томов по умолчанию Дополнительные параметры Конфигурация драйвера Поддержка расширенного управления дисками Метка выбранного избранного тома: Файловые параметры Клавиша: Процессор в этом ПК поддерживает аппаратное ускорение AES-операций: Действия при входе в Windows мин Буква диска: Параметры монтирования тома VeraCrypt Новый Пароль: Потоковое распараллеливание Путь к библиотеке PKCS #11 PKCS-5 PRF: PKCS-5 PRF: Кэширование (запоминание) паролей Параметры безопасности Работа VeraCrypt в фоновом режиме Том для монтирования (относительно корня переносного диска): При вставке переносного диска: Создать файлы переносного диска (корневая папка переносного диска) в: Том Окна &Путь... &Автотест всех Да&лее &Дешифрация &Удалить &Шифрация &Экспорт... Создать и сохранить файл... Случа&йный ключевой файл... Загрузить языковые модули с сайта Аппаратное ускорение AES: &Импорт кл.файла в токен... &Файлы... Клю&чевые файлы К&люч.файлы... &Удалить Удалить &все О защите скрытых томов О ключевых файлах Монтировать том как &сменный носитель Монтировать раздел с шифрованием ОС &без дозагр. аутентификации Потоки: Тест Пе&чать З&ащитить скрытый том от повреждения при записи во внешний том &Сброс Пока&з пароля &Токен-файлы... По возможности применять копию заголовка, встроенну&ю в том XTS-режим О программе VeraCrypt Тест скорости алгоритмов шифрования Тест генерирования векторов Справка по командной строке Ключевые файлы Генератор ключевых файлов Язык интерфейса VeraCrypt Параметры монтирования Свойства ключевого файла нового токена безопасности Обогащение случайного пула Выберите раздел или устройство VeraCrypt Ключевые файлы токена безопасности Токен безопасности: требуется пароль/PIN Сведения о выбранном языковом модуле На скорость влияют загрузка ЦП и характеристики устройств хранения данных.\n\nЭти тесты выполняются в ОЗУ. Буфер: Шифр: Пароль с&крытого тома:\n(если пусто, то из кэша) Защита скрытого тома Длина ключа: ВАЖНО: Хаотично перемещайте мышь внутри этого окна (чем дольше, тем лучше) - это значительно увеличит криптостойкость ключевого файла. !!! При утере ключевого файла или повреждении его первых 1024 килобайт монтирование использующих этот файл томов невозможно! бит Число ключевых файлов: Размер файлов (в байтах): Базовое имя ключевых файлов: Автор перевода: Размер: бит Текущее содержимое пула Микшер повтора: ВАЖНО: Хаотично перемещайте мышь внутри этого окна (чем дольше, тем лучше) - это значительно увеличит криптостойкость. Затем нажмите 'Далее'. Вторичный ключ (16-ричное) Токен: Сортировка: Этот процесс может быть долгим, подождите... Подождите...\nПроцесс может быть долгим,\nа VeraCrypt перестанет реагировать на запросы. Число блоков: Зашифрованный текст (16-ричное) Число единиц с данными (64-бит 16-ричное, размер единицы с данными - 512 байт) Ключ (16-ричное) Незашифрованный текст (16-ричное) Ключевой файл: XTS-режим &Система &Тома И&збранное Серв&ис Настрой&ки Спра&вка Ве&б-страница &О программе... Невозможно снять атрибут 'только чтение' со старого тома. Проверьте, разрешён ли доступ к файлу. ОШИБКА: Нет доступа.\n\nРаздел, к которому вы пытаетесь получить доступ, имеет длину 0 секторов, либо это загрузочное устройство. Администратор Для загрузки драйвера VeraCrypt нужно войти в систему с правами администратора. Для шифрования/дешифрования/форматирования раздела/устройства нужно войти в систему с правами администратора.\n\nК томам на основе файлов это не относится. Чтобы создать скрытый том, нужно войти в систему с правами администратора.\n\nПродолжить? Чтобы форматировать тома как NTFS/exFAT, нужно войти в систему с правами администратора.\n\nБез привилегий администратора можно форматировать тома только как FAT. Утверждённый FIPS (США) алгоритм шифрования (Rijndael, опубликован в 1998 г.), разрешён к применению в федеральных структурах США для защиты важнейшей информации. Ключ: 256 бит, блок: 128 бит, раундов: 14 (AES-256). Режим работы: XTS. Том уже смонтирован. ВНИМАНИЕ: По крайней мере один алгоритм шифрования или хеширования не прошёл автоматическое самотестирование.\n\nВозможно, повреждена установка VeraCrypt. ВНИМАНИЕ: В пуле генератора случайных чисел недостаточно данных для предоставления нужного объёма случайной информации.\n\nПродолжать дальше не следует. Известите об ошибке авторов, выбрав соответствующий пункт в меню 'Справка'. Повреждён диск (на нём физический дефект) или кабель, либо сбоит память компьютера.\n\nЭто проблема аппаратной части вашего ПК, а не VeraCrypt. Пожалуйста, НЕ сообщайте нам о ней как об ошибке/проблеме в работе VeraCrypt и НЕ просите о помощи в форумах VeraCrypt. Свяжитесь с изготовителем своего ПК. Спасибо.\n\nПримечание: если ошибка происходит регулярно в одном и том же месте, наиболее вероятная причина - в повреждённом блоке на диске, который можно попытаться исправить с помощью стороннего ПО (учтите, что команда 'chkdsk /r' зачастую бесполезна, так как работает лишь на уровне файловой системы; иногда chkdsk не может даже обнаружить наличие ошибки). Если вы обращаетесь к накопителю на сменных носителях, удостоверьтесь, что в накопителе есть носитель. Также возможно повреждение накопителя/носителя (физический дефект) или повреждение/отключение кабеля. Драйверы аппаратуры в вашей системе содержат ошибку, препятствующую шифрованию всего системного диска.\n\nПопробуйте обновить или удалить сторонние (не Microsoft) драйверы чипсета. Если это не поможет, попробуйте зашифровать только системный раздел. Неверная буква диска. Неверный путь. Отмена Нет доступа к устройству. Проверьте, существует ли выбранное устройство и не занято ли оно. Внимание! Нажата клавиша Caps Lock. Это может привести к неправильному вводу пароля. Тип тома Может так случиться, что кто-то вынудит вас сообщить пароль от зашифрованного тома. В ряде ситуаций вы просто не сможете отказаться выдать пароль (например при вымогательстве). В подобных случаях поможет так называемый 'скрытый том', позволяющий не выдавать пароль к действительно ценным данным. Выберите эту опцию, чтобы создать обычный том VeraCrypt. Внимание! Если вы хотите, чтобы операционная система была установлена на скрытом томе на основе раздела, то весь системный диск нельзя зашифровать с помощью лишь одного ключа. Шифрование внешнего тома Шифрование скрытого тома Настройки шифрования ВНИМАНИЕ: Ошибка очистки пути к последнему выбранному тому/ключевому файлу (запомненному селектором файлов). ОШИБКА: Контейнер был сжат на уровне файловой системы. VeraCrypt не поддерживает сжатые контейнеры (сжатие зашифрованных данных неэффективно и избыточно).\n\nОтключите сжатие контейнера, выполнив следующее: 1) Щёлкните правой кнопкой мыши в Проводнике Windows (не в VeraCrypt). 2) Выберите пункт 'Свойства'. 3) В окне 'Свойства' нажмите кнопку 'Дополнительно'. 4) В окне 'Дополнительные атрибуты' выключите параметр 'Сжимать содержимое для экономии места на диске' и нажмите OK. 5) Нажмите OK в окне 'Свойства'. Ошибка создания тома %s Размер %s - %.2f байт Размер %s - %.2f КБ Размер %s - %.2f МБ Размер %s - %.2f ГБ Размер %s - %.2f ТБ Размер %s - %.2f ПБ ВНИМАНИЕ: Устройство/раздел используется операционной системой или приложениями. Форматирование устройства/раздела может привести к потере данных или нестабильности системы.\n\nПродолжить? ВНИМАНИЕ: Устройство/раздел используется операционной системой или приложениями. Следует закрыть все программы, которые могут использовать раздел (включая антивирусное ПО).\n\nПродолжить? ОШИБКА: Устройство/раздел содержит файловую систему, которая не может быть размонтирована. Эта файловая система может использоваться операционной системой. Форматирование устройства/раздела вероятнее всего приведёт к повреждению данных и нестабильности системы.\n\nДля решения этой проблемы мы рекомендуем сначала удалить этот раздел, после чего вновь создать его без форматирования. Вот как это сделать: 1) Щёлкните правой кнопкой мыши по значку 'Компьютер' (или 'Мой компьютер') в меню 'Пуск' и выберите пункт 'Управление'. Должно появиться окно 'Управление компьютером'. 2) В окне 'Управление компьютером' выберите 'Запоминающие устройства' > 'Управление дисками'. 3) Щёлкните правой кнопкой мыши по разделу, который вы хотите зашифровать, и выберите либо 'Удалить раздел', либо 'Удалить том', либо 'Удалить логический диск'. 4) Нажмите 'Да'. Если Windows попросит перезагрузить компьютер, сделайте это. Затем повторите шаги 1 и 2 и перейдите к шагу 5. 5) Щёлкните правой кнопкой на участке с пустым местом (оно должно содержать надпись 'Не распределено') и выберите 'Основной раздел', 'Дополнительный раздел' или 'Логический диск'. 6) Должно появиться окно мастера создания разделов или томов; следуйте его инструкциям. В окне мастера на странице 'Форматирование раздела' выберите либо 'Не форматировать этот раздел', либо 'Не форматировать этот том'. В том же окне мастера нажмите кнопку 'Далее' и затем 'Готово'. 7) Учтите, что выбранный вами в VeraCrypt путь к устройству может быть теперь неверным. Поэтому завершите работу мастера создания томов VeraCrypt (если он всё ещё выполняется) и запустите его снова. 8) Попробуйте снова зашифровать устройство/раздел в VeraCrypt.\n\nЕсли VeraCrypt по-прежнему откажется шифровать устройство/раздел, скорректируйте свои планы и создайте вместо этого файловый контейнер. ОШИБКА: Не удалось заблокировать и/или размонтировать файловую систему. Вероятно, она используется ОС или приложениями (например антивирусным ПО). Шифрование этого раздела может повлечь повреждение данных и нестабильность системы.\n\nЗакройте все приложения, которые могут обращаться к файловой системе (включая антивирусное ПО) и повторите попытку. Если это не поможет, следуйте указанным ниже инструкциям. ВНИМАНИЕ: Некоторые смонтированные устройства/разделы уже используются.\n\nИгнорирование этого может привести к нежелательным последствиям, включая нестабильность системы.\n\nНастоятельно рекомендуется закрыть все программы, использующие эти устройства/разделы. Выбранное устройство содержит разделы.\n\nФорматирование этого устройства может привести к нестабильности системы и/или повреждению данных. Либо выберите раздел на этом устройстве, либо удалите все разделы на нём, чтобы дать возможность VeraCrypt безопасно его отформатировать. Выбранное несистемное устройство содержит разделы.\n\nЗашифрованные тома VeraCrypt на основе устройств можно создавать только на дисках, не содержащих разделов (включая жёсткие и твердотельные диски). Устройство с разделами можно зашифровать целиком на месте (с помощью одного мастер-ключа), только если это диск, где установлена Windows и с которого она загружается.\n\nЕсли вы хотите зашифровать выбранное несистемное устройство с помощью одного мастер-ключа, сначала потребуется удалить все разделы на этом устройстве, чтобы VeraCrypt смог его безопасно отформатировать (форматирование устройства с разделами может повлечь нестабильность системы и/или повреждение данных). Другой вариант - зашифровать отдельно каждый раздел на диске (используя индивидуальные мастер-ключи).\n\nПримечание: чтобы удалить все разделы с диска GPT, его нужно преобразовать в диск MBR (например с помощью инструмента 'Управление дисками') для удаления скрытых разделов. ВНИМАНИЕ: При шифровании всего устройства (а не только одного раздела на нём) ОС будет считать его новым, пустым и неформатированным (не содержащим таблицы разделов) и может самопроизвольно инициализировать это устройство (или спрашивать у вас на то разрешение), что способно повредить том. Более того, будет невозможно ни монтировать этот том как избранный (например при изменениях числа дисков), ни присваивать ему метку избранного тома.\n\nЧтобы этого избежать, вы можете создать раздел на устройстве и зашифровать только этот раздел.\n\nВы действительно хотите зашифровать всё устройство? ВАЖНО: Учтите, что этот том НЕЛЬЗЯ смонтировать и получить к нему доступ по букве диска %c:, которая сейчас ему назначена!\n\nЧтобы смонтировать этот том, нажмите 'Автомонтирование' в главном окне VeraCrypt (или нажмите кнопку 'Устройство', выберите этот раздел/диск и нажмите 'Смонтировать'). Том будет смонтирован на другую букву диска, выбираемую из списка в главном окне VeraCrypt.\n\nИсходную букву диска %c: следует применять только когда нужно удалить шифрование с раздела/устройства (например если шифрование больше не требуется). В этом случае щёлкните правой кнопкой мыши по диску %c: в окне 'Компьютер' (или 'Мой компьютер') и выберите пункт 'Форматировать'. Во всех иных ситуациях букву диска %c: использовать не следует (если только вы не удалили её, как это описано, например, в FAQ VeraCrypt, и не присвоили затем другому разделу/устройству). В используемой вами ОС шифрование несистемных томов 'на месте' не поддерживается (для этого требуется Windows Vista или более новая версия Windows).\n\nПричина: эта версия Windows не допускает сжатие файловой системы (что требуется для высвобождения места под заголовок тома и его резервную копию). Выбранный раздел не содержит файловой системы NTFS. Для шифрования 'на месте' подходят только разделы с NTFS.\n\nПричина: Windows не поддерживает сжатие файловых систем других типов (что требуется для высвобождения места под заголовок тома и его резервную копию). Выбранный раздел не содержит файловой системы NTFS. Для шифрования 'на месте' подходят только разделы с NTFS.\n\nЕсли вы хотите создать зашифрованный том VeraCrypt внутри этого раздела, выберите 'Создать и отформатировать зашифрованный том' (а не "Зашифровать раздел на месте"). ОШИБКА: Раздел слишком мал. VeraCrypt не может зашифровать его 'на месте'. Чтобы зашифровать данные на этом разделе, сделайте следующее:\n\n1) Создайте том VeraCrypt на пустом разделе/устройстве и смонтируйте его.\n\n2) Скопируйте все файлы с раздела, который вы хотите зашифровать, на смонтированный том VeraCrypt (созданный на этапе 1). Так вы создадите зашифрованную резервную копию данных.\n\n3) Создайте том VeraCrypt на разделе, который хотите зашифровать, и убедитесь (в мастере VeraCrypt), что выбрали опцию 'Создать зашифрованный том и отформатировать его' (а не опцию 'Зашифровать раздел на месте'). Учтите, что все данные на этом разделе будут удалены. Создав том, смонтируйте его.\n\n4) Скопируйте все файлы со смонтированного тома VeraCrypt с копией данных (созданного на этапе 1) на смонтированный том VeraCrypt, созданный на этапе 3.\n\nПо окончании этих операций данные будут зашифрованы, плюс с них будет сделана зашифрованная резервная копия. Шифрование 'на месте' возможно только для раздела, динамического тома или всего системного диска.\n\nЕсли вы хотите создать зашифрованный том VeraCrypt на выбранном несистемном устройстве, выберите опцию 'Создать зашифрованный том и отформатировать его' (а не опцию 'Зашифровать раздел на месте'). ОШИБКА: Шифрование 'на месте' возможно только для раздела, динамического тома или всего системного диска. Убедитесь в правильности указанного пути. ОШИБКА: Невозможно уменьшить файловую систему (это необходимо для высвобождения места под заголовок тома и резервную копию заголовка).\n\nВозможные причины и решения:\n\n- Недостаточно свободного места на томе. Проверьте, чтобы никакие другие программы не выполняли запись в файловую систему.\n\n- Повреждена файловая система. Попробуйте исправить её (щёлкните ПКМ на букве соответствующего диска в окне '(Мой) Компьютер', выберите 'Свойства' > 'Сервис' > 'Выполнить проверку', включите опцию 'Автоматически исправлять системные ошибки' и нажмите 'Запуск').\n\nЕсли ничего не помогает, следуйте рекомендациям ниже. ОШИБКА: Недостаточно свободного места на томе, невозможно уменьшить файловую систему (это необходимо для высвобождения места под заголовок тома и резервную копию заголовка).\n\nУдалите ненужные файлы и очистите Корзину, высвободив хотя бы 256 КБ, после чего повторите попытку. Из-за особенностей Windows, объём сообщаемого Проводником свободного места может быть неверным до перезагрузки ОС. Если перезагрузка не помогает, возможно, повреждена файловая система. Попробуйте исправить её (щёлкните ПКМ на букве соответствующего диска в окне '(Мой) Компьютер', выберите 'Свойства' > 'Сервис' > 'Выполнить проверку', включите опцию 'Автоматически исправлять системные ошибки' и нажмите 'Запуск').\n\nЕсли ничего не помогает, следуйте рекомендациям ниже. На диске %s свободно %.2f байт На диске %s свободно %.2f КБ На диске %s свободно %.2f МБ На диске %s свободно %.2f ГБ На диске %s свободно %.2f ТБ На диске %s свободно %.2f ПБ Не удалось получить доступные буквы дисков. ОШИБКА: Не найден драйвер VeraCrypt.\n\nСкопируйте файлы veracrypt.sys и veracrypt-x64.sys в папку с программой VeraCrypt (файлом VeraCrypt.exe). ОШИБКА: Используется драйвер VeraCrypt несовместимой версии.\n\nЕсли вы пытаетесь запустить VeraCrypt в переносном режиме (т.е. без установки в систему), и в это время работает другая версия VeraCrypt, то сначала удалите её (или обновите с помощью установщика VeraCrypt). Чтобы удалить VeraCrypt, проделайте следующее: в Windows Vista и новее выберите меню 'Пуск' > 'Компьютер' > 'Удалить или изменить программу' > VeraCrypt > Удалить; в Windows XP выберите меню 'Пуск' > 'Настройка' > 'Панель управления' > 'Установка и удаление программ' > VeraCrypt > Удалить.\n\nАналогично, если вы пытаетесь запустить VeraCrypt в переносном режиме (т.е. без установки в систему), и в это время в переносном режиме уже выполняется другая версия VeraCrypt, то сначала перезагрузите систему, а затем запустите эту новую версию. Ошибка инициализации шифра. Ошибка: слабый или потенциально слабый ключ! Этот ключ не принят. Повторите попытку. Критическая ошибка, работа VeraCrypt прервана. Если это следствие ошибки в VeraCrypt, мы бы хотели её исправить. Чтобы помочь нам в этом, отправьте автоматически созданный отчёт об ошибках со следующими данными:\n\n- Версия программы\n- Версия операционной системы\n- Тип ЦП\n- Имя компонента VeraCrypt\n- Контрольная сумма исполняемого файла VeraCrypt\n- Символическое имя диалогового окна\n- Категория ошибки\n- Адрес ошибки\n- Стековый вызов VeraCrypt\n\nПри выборе 'Да' в вашем браузере будет открыт следующий URL-адрес с полным отчётом об ошибке.\n\n%hs\n\nОтправить отчёт об ошибке? Критическая ошибка в системе, работа VeraCrypt будет прервана.\n\nЭта ошибка произошла не по вине VeraCrypt (поэтому разработчики VeraCrypt не могут её исправить). Проверьте свою систему на предмет возможных проблем (например системную конфигурацию, подключение к сети, сбои аппаратуры). Критическая ошибка в системе, работа VeraCrypt будет прервана.\n\nЕсли эта проблема возникает регулярно, попробуйте отключить или удалить приложения, которые могут быть как-то с ней связаны, например антивирусное ПО, системные 'улучшатели', 'оптимизаторы', 'твикеры' и т.п. Если это не поможет, попробуйте переустановить ОС (проблема также может быть вызвана вредительским ПО). Критическая ошибка VeraCrypt По сведениям VeraCrypt, в операционной системе недавно произошёл сбой. Потенциальных причин этому множество (например отказ аппаратуры, ошибка в драйвере устройства и т.д.)\n\nХотите проверить, был ли вызван системный сбой ошибкой в VeraCrypt? Следует ли VeraCrypt и дальше отслеживать системные сбои? VeraCrypt не удалось обнаружить файл с мини-дампом системных сбоев. Удалить дамп-файл Windows с данными о сбое, чтобы высвободить место на диске? Чтобы проанализировать системный сбой, VeraCrypt сначала нужно\nустановить Microsoft Debugging Tools для Windows.\n\nПосле нажатия OK начнётся загрузка и установка\nэтого пакета (16 МБ) с сервера Microsoft\n(программа установки Windows перенаправит вас на сервер\nMicrosoft с сервера veracrypt.org, тем самым гарантируя успех операции,\nдаже если Microsoft изменит местоположение пакета установки). После нажатия OK начнётся анализ системного сбоя. Эта операция может занять несколько минут. Убедитесь, что в переменной окружения PATH указан путь к файлу отладчика ядра kd.exe (Kernel Debugger). Судя по всему, причина системного сбоя - НЕ в VeraCrypt. Потенциальных причин сбоя системы множество (например отказ аппаратуры, ошибка в драйвере устройства и т.д.) Как показал анализ, проблему может решить обновление следующего драйвера: Чтобы помочь определить, имеется ли ошибка в VeraCrypt, отправьте нам автоматически созданный отчёт об ошибках со следующими данными:\n- Версия программы\n- Версия операционной системы\n- Тип ЦП\n- Категория ошибки\n- Имя и версия драйвера\n- Стек системных вызовов\n\nПри выборе 'Да' в вашем интернет-браузере будет открыт следующий URL-адрес (с полным отчётом об ошибках). Хотите отправить нам этот отчёт об ошибках? &Шифрация &Дешифрация Расшифровать п&ерманентно Выход Создайте логический диск для этого расширенного раздела и повторите попытку. Том VeraCrypt может находиться в файле (в контейнере VeraCrypt) на жёстком диске, флэш-накопителе USB и т.п. Контейнер VeraCrypt ничем не отличается от любого другого обычного файла (например, его можно перемещать или удалять как и прочие файлы). Нажмите кнопку 'Файл', чтобы указать имя и путь к создаваемому файлу-контейнеру для хранения нового тома.\n\nВНИМАНИЕ: Если вы выберете уже имеющийся файл, VeraCrypt НЕ зашифрует его; этот файл будет удалён и заменён вновь созданным контейнером VeraCrypt. Вы сможете зашифровать имеющиеся файлы (впоследствии), переместив их в создаваемый сейчас контейнер VeraCrypt. Выберите размещение для создаваемого внешнего тома (внутри этого тома затем будет создан скрытый том).\n\nТом VeraCrypt может находиться в файле (в контейнере VeraCrypt) на жёстком диске, флэш-накопителе USB и т.п. Контейнер VeraCrypt можно перемещать или удалять как любой обычный файл. Нажмите кнопку 'Файл', чтобы указать имя и путь к создаваемому файлу-контейнеру для хранения нового тома. Если вы выберете уже имеющийся файл, VeraCrypt НЕ зашифрует его; этот файл будет удалён и заменён вновь созданным контейнером VeraCrypt. Вы сможете зашифровать имеющиеся файлы (впоследствии), переместив их в создаваемый сейчас контейнер VeraCrypt. Зашифрованный том VeraCrypt на основе устройства можно создавать внутри раздела жёсткого диска, на твердотельном накопителе, флэш-накопителе USB и других устройствах хранения данных. Разделы также можно шифровать на месте.\n\nКроме того, зашифрованные тома VeraCrypt на основе устройств можно создавать внутри устройств, не содержащих разделов (включая жёсткие диски и твердотельные накопители).\n\nПримечание: устройство, содержащее разделы, можно зашифровать целиком на месте (используя один ключ), только если с него загружается Windows. Том VeraCrypt на основе устройства можно создавать внутри раздела жёсткого диска, на твердотельном накопителе, флэш-накопителе USB и других устройствах хранения данных.\n\nВНИМАНИЕ: Раздел/диск будет отформатирован, а все имеющиеся на нём данные - уничтожены. \nВыберите размещение для создаваемого внешнего тома (внутри этого тома затем будет создан скрытый том).\n\nВнешние тома можно создавать внутри разделов жёстких дисков, на твердотельных накопителях, флэш-накопителях USB и других устройствах хранения данных. Внешние тома также можно создавать внутри устройств, не содержащих разделов (включая жёсткие диски и твердотельные накопители).\n\nВНИМАНИЕ: Раздел/диск будет отформатирован, а все имеющиеся на нём данные - уничтожены. Выберите размещение тома VeraCrypt, внутри которого вы хотите создать скрытый том. ВНИМАНИЕ: Хост-файл/устройство уже используется.\n\nИгнорирование этого может привести к нежелательным последствиям, включая нестабильность системы. Перед монтированием тома следует закрыть все программы, обращающиеся к этому хост-файлу/устройству (например антивирусы или ПО для резервного копирования).\n\nПродолжить монтирование? ОШИБКА: Невозможно смонтировать том. Хост-файл/устройство уже используется. Также не удалось выполнить монтирование без исключительного доступа. Невозможно открыть файл. Размещение тома Большие файлы Собираетесь ли вы хранить в этом томе VeraCrypt файлы размером более 4 ГБ? В зависимости от вашего ответа VeraCrypt выберет для тома подходящую файловую систему (её выбор будет предложен на следующем этапе). Так как вы создаёте внешний том, следует ответить 'Нет'. Иначе ФС по умолчанию будет NTFS, что для внешних томов хуже, чем FAT/exFAT (так, максимально возможный размер скрытого тома будет существенно больше, если внешний том - FAT/exFAT). Обычно FAT это ФС по умолчанию как для скрытых, так и для обычных томов (тома FAT не вызывают подозрений). Однако если нужно хранить файлы размером более 4 ГБ (что в FAT недопустимо), то FAT не будет ФС по умолчанию. Вы действительно хотите ответить 'Да'? Режим создания тома Это самый быстрый способ создания тома VeraCrypt на основе раздела или устройства (шифрование на месте медленнее, так как содержимое каждого сектора сначала считывается, шифруется и затем записывается). Все данные на выбранном разделе/устройстве будут уничтожены (эти данные НЕ шифруются; они перезаписываются случайными данными). Если вам нужно зашифровать данные, имеющиеся в разделе, выберите другой вариант. Весь выбранный раздел со всеми имеющимися в нём данными будет зашифрован на месте. Если раздел пуст, то следует выбрать другой вариант (том будет создан гораздо быстрее). Примечание: Возо&бновить О&тложить &Старт Продол&жить &Разметить &Затереть Прервать форматирование? Подробнее Больше не показывать Содержимое раздела/устройства успешно удалено (затёрто). Содержимое раздела с исходной системой (клоном которой является скрытая система) успешно удалено (затёрто). Удостоверьтесь, что Windows, которую вы хотите установить (на очищенный раздел), имеет ту же версию, что и работающая сейчас Windows. Это необходимо потому, что обе ОС будут использовать общий загрузочный раздел. Системный раздел/диск успешно зашифрован.\n\nПримечание: если имеются несистемные тома VeraCrypt, которые должны автоматически монтироваться при каждой загрузке Windows, монтирование каждого из них можно настроить, выбрав 'Избранное' > 'Добавить смонтированный том в список избранных системных томов'). Системный раздел/диск успешно расшифрован. \n\nТом VeraCrypt создан и готов к использованию.\n\nЕсли вы хотите создать ещё один том, нажмите 'Далее'. Иначе нажмите 'Выход'. \n\nСкрытый том VeraCrypt успешно создан (внутри него будет находиться скрытая операционная система).\n\nНажмите 'Далее' для продолжения. Том полностью зашифрован Том полностью расшифрован ВАЖНО: ДЛЯ МОНТИРОВАНИЯ ЭТОГО ТОМА И ДОСТУПА К СОДЕРЖАЩИМСЯ В НЁМ ДАННЫМ НАЖМИТЕ 'Автомонтирование' В ГЛАВНОМ ОКНЕ VERACRYPT. После ввода правильного пароля (и/или ключевых файлов) том будет смонтирован на букву диска, выбранную вами в главном окне VeraCrypt (доступ к зашифрованным данным будет по этой букве диска).\n\nЗАПОМНИТЕ ИЛИ ЗАПИШИТЕ ЭТАПЫ ВЫШЕ. ВЫ ДОЛЖНЫ ИМ СЛЕДОВАТЬ ДЛЯ МОНТИРОВАНИЯ ТОМА И ДОСТУПА К ЕГО ДАННЫМ. Другой способ: нажмите кнопку 'Устройство' в главном окне VeraCrypt, выберите этот раздел/том и нажмите 'Смонтировать'.\n\nРаздел/том успешно зашифрован (сейчас он содержит полностью зашифрованный том VeraCrypt) и готов к использованию. Том VeraCrypt успешно расшифрован. Том VeraCrypt успешно расшифрован.\n\nВыберите букву диска, которая будет присвоена расшифрованному тому, и нажмите 'Готово'.\n\nВАЖНО: Пока тому не присвоена буква, нет доступа к хранящимся в нём данным. ВНИМАНИЕ: Чтобы получить доступ к данным, расшифрованному тому нужно присвоить букву диска. Однако сейчас незанятых букв нет.\n\nОсвободите какую-либо букву диска (например, отсоедините USB-накопитель или внешний жёсткий диск и т.п.) и нажмите OK. Том VeraCrypt успешно создан. Том создан ВАЖНО: Хаотично перемещайте мышь внутри этого окна (чем дольше, тем лучше) - это значительно увеличит криптостойкость ключей шифрования.\nЗатем нажмите 'Разметить', чтобы создать том. Нажмите 'Разметить', чтобы создать внешний том. Подробности см. в документации. Форматирование внешнего тома Форматирование скрытого тома Форматирование тома Для просмотра или печати Руководства пользователя требуется программа Adobe Reader (или совместимая с ней). Её можно загрузить (бесплатно) с сайта www.adobe.com\n\nХотите вместо этого ознакомиться с онлайн-документацией? Если выбрать эту опцию, мастер сначала поможет вам создать обычный том VeraCrypt, а затем внутри него - скрытый том. Этот вариант предназначен для пользователей-новичков. Выберите эту опцию, чтобы создать скрытый том внутри уже имеющегося тома VeraCrypt (т.е. у вас должен быть ранее созданный том VeraCrypt, пригодный для хранения скрытого тома). Режим создания тома Скрытый том создан Скрытый том VeraCrypt создан и готов к использованию. Если были соблюдены все инструкции и меры предосторожности из главы 'Требования и меры предосторожности, касающиеся скрытых томов' в Руководстве пользователя VeraCrypt, узнать наверняка, имеется ли скрытый том, станет вряд ли возможно даже при смонтированном внешнем томе.\n\nВНИМАНИЕ: ЕСЛИ ВЫ НЕ ЗАЩИТИЛИ СКРЫТЫЙ ТОМ (О ТОМ, КАК ЭТО СДЕЛАТЬ, СМ. РАЗДЕЛ 'PROTECTION OF HIDDEN VOLUMES AGAINST DAMAGE' ('ЗАЩИТА СКРЫТЫХ ТОМОВ ОТ ПОВРЕЖДЕНИЙ') В РУКОВОДСТВЕ ПОЛЬЗОВАТЕЛЯ VERACRYPT), НИЧЕГО НЕ ЗАПИСЫВАЙТЕ ВО ВНЕШНИЙ ТОМ, ИНАЧЕ ВЫ МОЖЕТЕ ПЕРЕЗАПИСАТЬ И ПОВРЕДИТЬ СКРЫТЫЙ ТОМ! Вы запустили скрытую операционную систему. Скрытая ОС выглядит так, как будто она установлена на том же разделе, что и исходная ОС. Но на самом деле эта ОС установлена в разделе, следующем за ним (в скрытом томе). Все операции чтения и записи прозрачно перенаправляются из системного раздела в скрытый том.\n\nНи ОС, ни приложения не будут знать, что данные, записываемые и считываемые в системном разделе, в действительности записываются и считываются в разделе позади него (в скрытом томе). Любые такие данные шифруются и расшифровываются на лету как обычно (с ключом шифрования, отличным от ключа для обманной ОС).\n\n\nНажмите 'Далее' для продолжения. Внешний том создан и смонтирован как диск %hc:. Скопируйте в этот том какие-нибудь осмысленно выглядящие файлы, которые на самом деле вам прятать НЕ нужно. Они понадобятся для демонстрации, если вас вынудят сообщить пароль от раздела, следующего за системным, где будут расположены внешний том и скрытый том (со скрытой ОС). Вы сможете сообщить пароль от этого внешнего тома, а существование скрытого тома (и скрытой ОС) останется в тайне.\n\nВАЖНО: Копируемые во внешний том файлы не должны занимать больше, чем %s. В противном случае на внешнем томе может не хватить места для скрытого тома (и вы не сможете продолжить). Когда закончите копирование, нажмите 'Далее' (не размонтируйте том). Внешний том успешно создан и смонтирован как диск %hc:. В этот том сейчас следует скопировать какие-нибудь осмысленно выглядящие файлы, которые на самом деле вам прятать НЕ нужно, чтобы ввести в заблуждение неприятеля, если он вынудит вас сообщить пароль. В этом случае вы скажете только пароль для этого внешнего тома, но не для скрытого. Действительно ценные для вас файлы будут храниться в скрытом томе, создаваемом позже. Когда закончите копировать файлы, нажмите 'Далее'. Не размонтируйте этот том. ПРИМЕЧАНИЕ: Нажатие 'Далее' запустит сканирование карты кластеров внешнего тома для выяснения размера непрерывной свободной области, конец которой станет концом тома. Этот участок будет приспособлен под скрытый том, т.е. именно им определяется его максимально возможный размер. Сканирование карты кластеров гарантирует, что никакие данные во внешнем томе не будут перезаписаны скрытым томом. Содержимое внешнего тома \n\nНа следующих этапах установите параметры для внешнего тома (внутри которого затем будет создан скрытый том). \n\nНа следующих этапах вы создадите так называемый внешний том VeraCrypt внутри первого раздела за системным разделом (как это было объяснено на одном из предыдущих этапов). Внешний том На следующих этапах потребуется установить параметры и пароль для скрытого тома, который будет содержать скрытую ОС. Примечание: для определения размера непрерывной незанятой области, окончание которой будет выровнено по концу внешнего тома, выполняется сканирование его карты кластеров. Эта область будет подогнана для скрытого тома, чтобы его границы не превышали максимально возможный размер. Максимально возможный размер скрытого тома определён и он гарантированно больше, чем у системного раздела (это необходимо, поскольку всё содержимое системного раздела должно быть скопировано в скрытый том). Т.е. никакие данные, находящиеся в данный момент во внешнем томе, не будут перезаписаны данными, записанными в область скрытого тома. ВАЖНО: Запомните алгоритмы, которые вы сейчас выбираете - для обманной ОС потребуется выбрать те же алгоритмы. В противном случае скрытая система будет недоступна! (Обманная система должна быть зашифрована тем же алгоритмом, что и скрытая.)\n\nПримечание: причина в том, что обманная и скрытая системы используют один и тот же загрузчик, поддерживающий лишь алгоритм, выбранный пользователем (для каждого алгоритма имеется своя версия загрузчика VeraCrypt). \n\nКарта кластеров тома просмотрена, максимально возможный размер скрытого тома определён. На следующих экранах мастера вам нужно будет выбрать параметры, размер и пароль для скрытого тома. Скрытый том Теперь скрытый том защищён от повреждений до размонтирования внешнего тома.\n\nВНИМАНИЕ: При попытке записи данных в область скрытого тома, VeraCrypt запретит запись на весь том (внешний и скрытый) до его размонтирования, так как это может повредить файловую систему внешнего тома, что, в свою очередь, негативно отразится на правдоподобности отрицания наличия скрытого тома. Поэтому следует всячески препятствовать записи в область, где находится скрытый том. Любые данные, записываемые в область, занимаемую скрытым томом, будут ПОТЕРЯНЫ. Windows может сообщать об этом как об ошибке отложенной записи или неверном параметре. Все скрытые тома в заново смонтированных томах защищены от повреждений до размонтирования.\n\nВНИМАНИЕ: При попытке записи данных в область скрытого тома, VeraCrypt запретит запись на весь том (внешний и скрытый) до его размонтирования, так как это может повредить файловую систему внешнего тома, что, в свою очередь, негативно отразится на правдоподобности отрицания наличия скрытого тома. Поэтому следует всячески препятствовать записи в область, где находится скрытый том. Любые данные, записываемые в область, занимаемую скрытым томом, будут ПОТЕРЯНЫ. Windows может сообщать об этом как об ошибке отложенной записи или неверном параметре. ВНИМАНИЕ: Попытка записи данных в область скрытого тома в томе, смонтированном как %c:! Чтобы защитить скрытый том, запись этих данных была запрещена. Это могло бы повредить файловую систему внешнего тома, а Windows сообщала бы об ошибке отложенной записи или неверном параметре. Весь том (внешняя и скрытая части) недоступен для записи до его размонтирования. Если VeraCrypt не в первый раз препятствует записи в область скрытого тома в данном томе, это может неблагоприятно сказаться на правдоподобности отрицания наличия скрытого тома (из-за возможных странных несоответствий в файловой системе внешнего тома). Поэтому имеет смысл создать новый том VeraCrypt (с выключенным быстрым форматированием) и перенести файлы из этого тома во вновь созданный; этот том следует затем надёжно затереть (и внешнюю, и внутреннюю части). Сейчас настоятельно рекомендуется перезагрузить операционную систему. Вы намерены хранить в томе файлы размером более 4 ГБ. Такой том должен быть отформатирован в NTFS/exFAT, но это невозможно. Примите к сведению, что когда работает скрытая ОС, не скрытые тома VeraCrypt невозможно форматировать в NTFS/exFAT. Это объясняется тем, что том требуется временно смонтировать без защиты от записи, чтобы позволить ОС отформатировать его в NTFS (тогда как форматирование в FAT выполняется средствами VeraCrypt, а не операционной системы, и без монтирования тома). Технические подробности приведены ниже. Не скрытый том NTFS/exFAT можно создать изнутри обманной ОС. В целях безопасности, когда запущена скрытая ОС, скрытые тома можно создавать только в 'прямом' режиме (поскольку внешние тома должны всегда монтироваться как 'только для чтения'). Чтобы безопасно создать скрытый том, выполните следующее:\n\n1) Загрузите обманную систему.\n\n2) Создайте обычный том VeraCrypt и скопируйте в этот том какие-нибудь осмысленно выглядящие файлы, которые на самом деле вам прятать НЕ нужно (этот том станет внешним).\n\n3) Загрузите скрытую систему и запустите мастер создания томов VeraCrypt. Если том - на основе файла, переместите его в системный раздел или в другой скрытый том (иначе вновь созданный скрытый том был бы смонтирован как 'только для чтения' без возможности форматирования). Следуйте инструкциям мастера так, как при выборе 'прямого' режима создания скрытого тома.\n\n4) На экране мастера выберите том, созданный на этапе 2, и следуйте инструкциям для создания скрытого тома внутри него. В целях безопасности, когда запущена скрытая ОС, локальные незашифрованные файловые системы и не скрытые тома VeraCrypt монтируются как 'только для чтения' (т.е. в такие файловые системы или тома VeraCrypt не может быть записано никаких данных).\n\nРазрешена запись лишь в файловые системы внутри скрытого тома VeraCrypt (при условии, что скрытый том расположен не в контейнере, находящемся на незашифрованной файловой системе или на любой другой файловой системе только для чтения). Эти меры противодействия были реализованы по трём основным причинам:\n\n- Возможность создания безопасной платформы для монтирования скрытых томов VeraCrypt. Обратите внимание, что мы официально рекомендуем монтировать скрытые тома, только когда запущена скрытая ОС. (Подробности см. в документации, глава 'Требования безопасности и меры предосторожности касательно скрытых томов'.)\n\n- В ряде случаев имеется возможность определить, что в определённое время конкретная файловая система не была смонтирована (или конкретный файл в файловой системе не был сохранён, либо к нему не было обращения из неё) под конкретной копией ОС (например, путём анализа и сравнения журналов файловых систем, времён файлов, отчётов приложений и/или ошибок и т.д.). Всё это может навести на мысль о существовании в компьютере скрытой ОС. Данные меры противодействия этому препятствуют.\n\n- Предотвращение повреждения данных и безопасная гибернация. При выходе из гибернации Windows подразумевает, что все смонтированные файловые системы находятся в том же состоянии, что и до гибернации. VeraCrypt обеспечивает это запретом записи любой файловой системы, доступной как из обманной, так и из скрытой системы. Без такой защиты файловая система может повредиться при монтировании одной системой, когда другая система находится в состоянии гибернации. Примечание: если нужно безопасно перенести файлы из обманной системы в скрытую, выполните следующее: 1) Загрузите обманную систему. 2) Сохраните нужные вам файлы на незашифрованном томе или на внешнем/обычном томе VeraCrypt. 3) Загрузите скрытую систему. 4) Если вы сохранили файлы на томе VeraCrypt, смонтируйте его (он будет автоматически смонтирован как 'только для чтения'). 5) Скопируйте файлы в скрытый системный раздел или в другой скрытый том. Требуется перезагрузка компьютера.\n\nВыполнить её сейчас? Ошибка получения состояния системного шифрования. Не указан пароль в командной строке. Создать том невозможно. Не указан размер тома в командной строке. Создать том невозможно. Указанный в командной строке размер файла тома не совместим с выбранной файловой системой NTFS. Указанный в командной строке размер файла тома не совместим с выбранной файловой системой FAT32. Файловая система на целевом диске не поддерживает создание разрежённых файлов, что необходимо для динамических томов. Из командной строки можно создавать только файлы-контейнеры. Указанный в командной строке размер файла-контейнера больше, чем объём свободного места на диске. Создать том невозможно. Указанный в командной строке размер тома слишком мал. Создать том невозможно. Указанный в командной строке размер тома слишком велик. Создать том невозможно. Невозможно инициализировать компоненты приложения для системного шифрования. Ошибка инициализации генератора случайных чисел.\n\n\n(Если вы хотите сообщить о связанной с этим ошибке, включите в отчёт следующую техническую информацию:\n%hs, Последняя ошибка = 0x%.8X) Сбой интерфейса CryptoAPI Windows!\n\n\n(Если вы хотите сообщить о связанной с этим ошибке, включите в отчёт следующую техническую информацию:\nh%s, Последняя ошибка = 0x%.8X) Ошибка инициализации приложения. Невозможно зарегистрировать класс Dialog. Ошибка загрузки системной библиотеки Rich Edit. Мастер создания томов VeraCrypt Максимальный размер скрытого тома для этого тома: %.2f байт Максимальный размер скрытого тома для этого тома: %.2f КБ Максимальный размер скрытого тома для этого тома: %.2f МБ Максимальный размер скрытого тома для этого тома: %.2f ГБ. Максимальный размер скрытого тома для этого тома: %.2f ТБ. Пока том смонтирован, изменять пароль/ключевые файлы этого тома невозможно. Сначала размонтируйте том. Пока том смонтирован, изменять алгоритм формирования ключа заголовка этого тома невозможно. Сначала размонтируйте том. С&монтировать Для монтирования этого тома требуется более новая версия VeraCrypt. ОШИБКА: Не найден мастер создания томов.\n\nУбедитесь в наличии файла 'VeraCrypt Format.exe' в папке, откуда был запущен 'VeraCrypt.exe'. Если его там нет, переустановите VeraCrypt или найдите 'VeraCrypt Format.exe' у себя на диске и запустите его. ОШИБКА: Не найден расширитель томов.\n\nУбедитесь в наличии файла 'VeraCryptExpander.exe' в папке, откуда был запущен 'VeraCrypt.exe'. Если его там нет, переустановите VeraCrypt или найдите 'VeraCryptExpander.exe' у себя на диске и запустите его. &Далее > &Готово &Установить &Извлечь Не удалось подключиться к драйверу VeraCrypt. Если драйвер не запущен, работа VeraCrypt невозможна.\n\nИз-за особенностей Windows, для загрузки драйвера сначала может потребоваться завершение сеанса или перезагрузка системы. Ошибка загрузки/подготовки шрифтов. Буква диска не найдена, либо она не была указана. ОШИБКА: Невозможно присвоить букву диска.\n\nПока зашифрованному тому не присвоена буква диска, хранящиеся в нём данные будут недоступны.\n\nПовторить? Буква диска недоступна. Не выбран файл. Нет доступных букв дисков. Нет незанятой буквы диска для внешнего тома. Продолжение создания тома невозможно. Не удалось определить версию операционной системы, либо вы используете неподдерживаемую ОС. Не указан путь. Недостаточно свободного места для скрытого тома. Продолжение создания тома невозможно. ОШИБКА: Скопированные во внешний том файлы занимают слишком много места, из-за чего в нём недостаточно места под скрытый том.\n\nОбратите внимание, что скрытый том должен быть не меньше системного раздела (т.е. раздела, где установлена работающая сейчас операционная система). Причина в том, что при создании скрытой ОС выполняется копирование в скрытый том содержимого системного раздела.\n\n\nПродолжение создания скрытой операционной системы невозможно. Драйвер не может размонтировать том. Вероятно, на этом томе имеются открытые файлы. Невозможно заблокировать том. На этом томе имеются открытые файлы, поэтому его нельзя размонтировать. VeraCrypt не может заблокировать том, так как он используется системой или приложениями (возможно, открыты находящиеся на этом томе файлы).\n\nРазмонтировать этот том принудительно? Выберите том VeraCrypt Укажите путь и имя файла Выберите библиотеку PKCS #11 Мало памяти ВАЖНО: Неопытным пользователям настоятельно рекомендуется вместо шифрования\nвсего раздела/устройства создать на выбранном разделе/устройстве файловый контейнер VeraCrypt.\n\nПри создании файлового контейнера VeraCrypt (в отличие от шифрования устройства или раздела),\nнапример, нет риска уничтожения большого числа файлов.\nОбратите внимание: файловый контейнер VeraCrypt (хотя он и содержит виртуальный зашифрованный диск)\nв действительности представляет собой обычный файл.\nСм. подробности в Руководстве пользователя VeraCrypt (глава 'Руководство для новичков').\n\nВы действительно хотите зашифровать целиком устройство/раздел? ВНИМАНИЕ: Файл '%s' уже существует!\n\nВАЖНО: ЭТОТ ФАЙЛ БУДЕТ НЕ ЗАШИФРОВАН, А УДАЛЁН.\n\nВы действительно хотите удалить этот файл, заменив его новым контейнером VeraCrypt? ОСТОРОЖНО: ВСЕ ДАННЫЕ, КОТОРЫЕ СОДЕРЖИТ %s '%s'%s, БУДУТ УНИЧТОЖЕНЫ (А НЕ ЗАШИФРОВАНЫ)!\n\nВы настаиваете на форматировании? ВНИМАНИЕ: Монтирование тома и доступ к хранящимся в нём файлам невозможны, пока том не будет полностью зашифрован.\n\nВы действительно хотите приступить к шифрованию %s '%s'%s? ВНИМАНИЕ: Монтирование тома и доступ к хранящимся в нём файлам невозможны, пока том не будет полностью расшифрован.\n\nВы действительно хотите приступить к дешифрованию %s '%s'%s? ВНИМАНИЕ: Если во время шифрования имеющихся данных 'на месте' неожиданно пропадёт электропитание или произойдёт сбой ОС из-за программной/аппаратной ошибки, это может привести к частичному повреждению или потере данных. Поэтому прежде чем приступить к шифрованию, сделайте резервную копию файлов, которые хотите зашифровать.\n\nВы сделали такую резервную копию? ОСТОРОЖНО: ВСЕ ФАЙЛЫ НА РАЗДЕЛЕ '%s'%s (Т.Е. НА РАЗДЕЛЕ, ИДУЩИМ ПЕРВЫМ ЗА СИСТЕМНЫМ) БУДУТ УНИЧТОЖЕНЫ (А НЕ ЗАШИФРОВАНЫ)!\n\nВы действительно настаиваете на форматировании? ВНИМАНИЕ: ВЫБРАННЫЙ РАЗДЕЛ СОДЕРЖИТ МНОГО ДАННЫХ! Все файлы на этом разделе будут удалены (они НЕ будут зашифрованы)! Стереть файлы в разделе при создании внутри него тома VeraCrypt Пароль PIM Алгоритм формирования ключа заголовка Добавление/удаление ключевых файлов в/из том(а) Удаление всех ключевых файлов из тома Пароль, PIM и/или ключевые файлы успешно изменен(ы).\n\nВАЖНО: Обязательно прочтите параграф 'Изменение паролей и ключевых файлов'\nв главе 'Требования безопасности и меры предосторожности'\nв Руководстве пользователя VeraCrypt. Этот том зарегистрирован как системный избранный, и его PIM изменился.\nХотите автоматически обновить конфигурацию системных избранных томов (требуются права администратора)?\n\nПри ответе 'Нет' вам будет нужно обновить системные избранные тома самостоятельно. ВАЖНО: Если вы не уничтожили свой диск восстановления VeraCrypt (Rescue Disk), ваш системный раздел/диск по-прежнему можно расшифровать с помощью старого пароля (загрузившись с диска восстановления VeraCrypt и введя старый пароль). Вам следует создать новый диск восстановления VeraCrypt, после чего уничтожить старый.\n\nХотите создать новый диск восстановления? Обратите внимание, что ваш диск восстановления VeraCrypt (Rescue Disk) всё ещё использует прежний алгоритм. Если вы считаете этот алгоритм недостаточно надёжным, создайте новый диск восстановления VeraCrypt, после чего уничтожьте старый.\n\nХотите создать новый диск восстановления? В качестве ключевого можно использовать файл любого типа (например .mp3, .jpg, .zip, .avi). Содержимое ключевого файла при этом не изменяется. Можно выбирать несколько ключевых файлов (порядок неважен). Если добавить папку, то ключевыми будут все не скрытые файлы внутри неё. Нажмите 'Токен-файлы', чтобы выбрать ключевые файлы на токенах безопасности или смарт-картах (или для импорта ключевых файлов с токена/смарт-карты). Ключевые файлы успешно добавлены/удалены. Ключевой файл экспортирован. Алгоритм формирования ключа заголовка успешно задан. Введите пароль и/или ключевые файлы для несистемного тома, где вы хотите возобновить шифрование 'на месте'.\n\n\nПримечание: после нажатия 'Далее' VeraCrypt попытается найти все несистемные тома, на которых был прерван процесс шифрования, и где можно расшифровать заголовок тома VeraCrypt с помощью указанного пароля и/или ключевых файлов. Если таких томов окажется несколько, на следующем этапе вам будет нужно выбрать один из них. Выберите один из перечисленных томов. Это несистемные тома с прерванным процессом шифрования/дешифрования, заголовок которых удалось расшифровать с помощью указанного пароля и/или ключевых файлов. Введите пароль и/или ключевые файлы для несистемного тома VeraCrypt, который вы хотите расшифровать. Хороший пароль - это очень важно. Избегайте паролей из одного или нескольких слов, которые можно найти в словаре (или комбинаций из 2, 3 или 4 таких слов). Пароль не должен содержать имён или дат рождения. Он должен быть труден для угадывания. Хороший пароль - случайная комбинация прописных и строчных букв, цифр и особых символов (@ ^ = $ * + и т.д.).\n\nРекомендуем выбирать пароли длиннее 20 символов (чем больше, тем лучше). Максимальная длина: 128 символа. Выберите пароль для скрытого тома. Выберите пароль для скрытой операционной системы (т.е. для скрытого тома). ВАЖНО: Выбираемый на этом этапе пароль для скрытой операционной системы должен существенно отличаться от двух других паролей (т.е. от паролей для внешнего тома и для обманной операционной системы). Введите пароль для тома, внутри которого вы хотите создать скрытый том.\n\nПосле нажатия 'Далее' VeraCrypt попытается смонтировать том, после чего просмотреть карту кластеров смонтированного тома в поиске непрерывной свободной области, в конце которой окажется конец тома. В этой области размещается скрытый том, т.е. она определяет его предельный размер. Просмотр карты нужен для гарантии того, что данные во внешнем томе не будут перезаписаны внутренним томом. \nВыберите пароль для внешнего тома. Это пароль, который вы сможете выдать противнику, если он вынудит вас это сделать.\n\nВАЖНО: Пароль должен существенно отличаться от того, который вы выберете для скрытого тома.\n\nПримечание: максимальная длина пароля - 128 символа. Выберите пароль для внешнего тома. Это пароль, который вы сможете выдать каждому, кто вынудит вас сообщить пароль для раздела, идущего первым за системным, где будут располагаться внешний том и скрытый том (содержащий скрытую операционную систему). Существование скрытого тома (и скрытой ОС) останется в тайне. Учтите, что это пароль НЕ для обманной операционной системы.\n\nВАЖНО: Пароль должен существенно отличаться от того, который вы выберете для скрытого тома (т.е. для скрытой операционной системы). Пароль для внешнего тома Пароль для скрытого тома Пароль для скрытой ОС ВНИМАНИЕ: Короткие пароли легко взломать с помощью техник перебора.\n\nРекомендуется применять пароли из более чем 20 символов.\n\nВы действительно хотите использовать короткий пароль? Пароль для тома Операция не выполнена. Возможные причины:\n - неверный пароль,\n - неверное число PIM,\n - неверный PRF (хеш),\n - это не том VeraCrypt. Операция не выполнена. Возможные причины:\n - неверные ключевые файлы,\n - неверный пароль,\n - неверное число PIM тома,\n - неверный PRF (хеш),\n - это не том. Операция не выполнена. Возможные причины:\n - неверный режим монтирования,\n - неверный пароль,\n - неверное число PIM тома,\n - неверный PRF (хеш),\n - это не том. Операция не выполнена. Возможные причины:\n - неверный режим монтирования,\n - неверные ключевые файлы,\n - неверный пароль,\n - неверное число PIM тома,\n - неверный PRF (хеш),\n - это не том. Автомонтирование не выполнено. Возможные причины:\n - неверный пароль,\n - неверное число PIM тома,\n - неверный PRF (хеш),\n - не найден подходящий том. Автомонтирование не выполнено. Возможные причины:\n - неверные ключевые файлы,\n - неверный пароль,\n - неверное число PIM тома,\n - неверный PRF (хеш),\n - не найден подходящий том. \n\nВнимание! Нажата клавиша Caps Lock. Это может привести к неправильному вводу пароля. Запомните число для монтирования тома PIM внешнего тома PIM скрытого тома PIM скрытой ОС PIM (персональный умножитель итераций) - это значение, управляющее количеством итераций для формирования ключа заголовка.\n Итерации = 15000 + (PIM x 1000).\n\nЕсли пусто или равно нулю, будет использоваться стандартное значение (485), обеспечивающее высокую надёжность.\n\nЕсли пароль короче 20 символов, PIM не может быть меньше 485, чтобы гарантировать минимальный уровень защиты.\nЕсли пароль состоит из 20 и более символов, PIM может быть любым.\n\nPIM более 485 ведёт к замедлению монтирования. При меньшем значении PIM (до 485) монтирование ускоряется, но снижается надёжность, если пароль недостаточно сложный. PIM (персональный умножитель итераций) - это значение, управляющее количеством итераций для формирования ключа заголовка.\n Итерации = PIM x 2048.\n\nЕсли пусто или равно нулю, будет использоваться стандартное значение, обеспечивающее высокую надёжность.\n\nЕсли пароль короче 20 символов, PIM не может быть меньше 98, чтобы гарантировать минимальный уровень защиты.\nЕсли пароль состоит из 20 и более символов, PIM может быть любым.\n\nPIM более 98 ведёт к замедлению загрузки. При меньшем значении PIM (до 98) загрузка ускоряется, но снижается надёжность, если пароль недостаточно сложный. Запомните число для загрузки системы Выбранное значение PIM больше, чем стандартное в VeraCrypt.\nЭто приведёт к значительному замедлению монтирования/загрузки. Выбранное значение PIM меньше, чем стандартное в VeraCrypt. Учтите, что если ваш пароль недостаточно надёжен, это может привести к ослаблению защиты.\n\nПодтверждаете, что вы используете надёжный пароль? Максимальное значение PIM для шифрования системы - 65535. PIM тома \n\nВнимание! В пути поиска ключевых файлов обнаружены скрытые файлы. Скрытые файлы не могут быть ключевыми. Если вы хотите использовать их как ключевые, снимите у них атрибут 'Скрытый' (на каждом из них щёлкните правой кнопкой мыши, выберите 'Свойства', снимите флажок 'Скрытый' и нажмите OK). Учтите, что скрытые файлы видны только при соответствующей системной настройке (Компьютер > Сервис > Параметры папок (Свойства папки) > Вид). Если вы пытаетесь защитить скрытый том, содержащий скрытую систему, проверьте, чтобы при вводе пароля для скрытого тома была включена стандартная американская раскладка клавиатуры. Это необходимо, так как данный пароль запрашивается на этапе дозагрузочной аутентификации (до запуска Windows), когда иные раскладки клавиатуры недоступны. Не найдено ни одного несистемного тома с прерванной операцией шифрования/дешифрования и заголовком, для которого подходит указанный пароль и/или ключевые файлы.\n\nПроверьте, правильно ли указан пароль и/или ключевые файлы, и не используется ли раздел/том системой или приложениями (включая антивирусное ПО). Раздел/устройство уже полностью зашифрован(о).\nФлаги заголовка = 0x%.8X Раздел/устройство не использует шифрование 'на месте'.\nФлаги заголовка = 0x%.8X \n\nПримечание: если вы пытаетесь смонтировать раздел, расположенный на зашифрованном системном диске без дозагрузочной аутентификации, или смонтировать зашифрованный системный раздел операционной системы, не выполняемой в данный момент, выберите 'Система' > 'Смонтировать без дозагрузочной аутентификации'. В этом режиме нельзя монтировать раздел, расположенный на диске, часть которого находится в области шифрования активной системы.\n\nПрежде чем можно будет смонтировать этот раздел в данном режиме, нужно либо загрузить операционную систему, установленную на другом диске (зашифрованном или нет), либо загрузить незашифрованную ОС. VeraCrypt не может расшифровать отдельный раздел на полностью зашифрованном системном диске (можно расшифровать только весь системный диск). Внимание! Так как диск содержит загрузчик VeraCrypt, он может быть полностью зашифрованным системным диском. Если это так, учтите, что VeraCrypt не может расшифровывать отдельный раздел на полностью зашифрованном системном диске (можно расшифровать только весь системный диск). Вы можете сейчас продолжить, но потом получите сообщение 'Неверный пароль'. < &Назад Невозможно показать список установленных в системе raw-устройств. Том '%s' существует и предназначен только для чтения. Вы действительно хотите его заменить? Выберите целевую папку Выберите ключевой файл Выберите путь поиска ключевых файлов.\n(Запоминается только путь, но не имена файлов.) Выбрать папку хранения ключевых файлов. В качестве ключевого файла выбран текущий файл-контейнер. Он будет пропущен. Авторы: Ross Anderson, Eli Biham и Lars Knudsen. Опубликован в 1998 г. Ключ: 256 бит, блок: 128 бит. Режим работы: XTS. Алгоритм Serpent - один из финалистов конкурса AES. Укажите размер создаваемого контейнера.\n\nПри создании динамического (увеличивающегося по мере заполнения) контейнера, этот параметр определяет его максимальный размер.\n\nМинимальные размеры тома: FAT - 292 КБ, exFAT - 424 КБ, NTFS - 3792 КБ. Укажите размер нового внешнего тома (сначала создаётся внешний том, а затем внутри него - скрытый). Минимально возможный размер тома, предназначенного для создания скрытого тома, составляет 340 КБ. Укажите размер создаваемого скрытого тома. Минимальный объём скрытого тома - 40 КБ (или 3664 КБ, если он отформатирован как NTFS). Максимально возможный для выбора размер скрытого тома показан выше. Размер внешнего тома Размер скрытого тома Проверьте правильность размера выбранного устройства или раздела и нажмите 'Далее'. Внутри этого раздела будут находиться внешний том и скрытый том (со скрытой ОС). Это должен быть первый раздел за системным.\n\nПроверьте правильность показанных выше размера и номера раздела, и если всё верно, то нажмите 'Далее'. \n\nТом, внутри которого будет создаваться скрытый том, не может быть меньше 340 КБ. Размер тома Динами- ческий Внимание! ОШИБКА теста. Тест всех алгоритмов пройден Неверный размер единиц данных. Неверная длина вторичного ключа. Неверная длина тестового зашифрованного текста. Неверная длина тестового ключа. Неверная длина тестового незашифрованного текста. Каскадное (последовательное) шифрование двумя алгоритмами в режиме XTS. Каждый блок сначала шифруется %s (%d-бит ключ), а затем %s (%d-бит ключ). Каждый шифр применяет свой собственный ключ. Все ключи взаимонезависимы. Каскадное (последовательное) шифрование тремя алгоритмами в режиме XTS. Каждый блок сначала шифруется %s (%d-бит ключ), затем %s (%d-бит ключ), и наконец %s (%d-бит ключ). Каждый шифр применяет свой собственный ключ. Все ключи взаимонезависимы. Обратите внимание, что в зависимости от конфигурации ОС, функции автозапуска и автомонтирования могут работать, только если файлы переносного диска находятся на недоступном для записи носителе (CD/DVD и т.п.). Это не ошибка VeraCrypt, а ограничение Windows. Переносной диск VeraCrypt успешно создан.\n\nПомните, что для запуска VeraCrypt в переносном режиме необходимы права администратора ПК. Также учтите, что исследуя реестр, можно узнать, что в Windows запускали VeraCrypt, даже если только в переносном режиме. Переносной диск VeraCrypt Авторы: Bruce Schneier, John Kelsey, Doug Whiting, David Wagner, Chris Hall и Niels Ferguson. Опубликован в 1998 г. Ключ: 256 бит, блок: 128 бит. Режим работы: XTS. Алгоритм Twofish - один из финалистов конкурса AES. Подробнее о %s Неизвестно Неопределённая или неизвестная ошибка (%d). Некоторые тома содержат файлы или папки, используемые приложениями или системой.\n\nНастаиваете на размонтировании? Раз&монтировать Ошибка размонтирования! Том содержит файлы или папки, используемые приложениями или системой.\n\nНастаиваете на размонтировании? На указанную букву диска том не смонтирован. Этот том уже смонтирован. Ошибка при попытке монтирования тома. Ошибка поиска местоположения внутри тома. Ошибка! Неверный размер тома. Внимание! Быстрое форматирование следует использовать, только если:\n\n1) на устройстве нет конфиденциальных данных и вам не требуется правдоподобное отрицание\n2) устройство уже полностью и надёжно зашифровано\n\nВы действительно хотите использовать быстрое форматирование? Динамический контейнер - это предраспределённый разрежённый файл NTFS, физический размер которого (место на диске) увеличивается по мере добавления в него данных.\n\nВНИМАНИЕ: У томов на основе разрежённых файлов значительно ниже быстродействие, чем у обычных томов. Такие тома менее надёжны, поскольку можно определить, какие из секторов тома не используются. Такие тома не позволяют правдоподобно отрицать наличие скрытого тома. Если данные записываются в контейнер на основе разрежённого файла при недостатке свободного места на файловой хост-системе, то зашифрованная файловая система может оказаться повреждённой.\n\nВы действительно хотите создать том на основе разрежённого файла? Учтите, что размер динамического контейнера, сообщаемый Windows и VeraCrypt, будет всегда равен его максимальному размеру. Чтобы выяснить текущий физический размер контейнера (действительно занимаемое им место на диске), щёлкните правой кнопкой мыши на файле-контейнере (в окне Проводника, не в VeraCrypt!), выберите пункт 'Свойства' и см. значение 'На диске'.\n\nТакже учтите, что при перемещении динамического контейнера на другой том или диск, физический размер контейнера будет увеличен до максимума. (Этого можно избежать, создав новый динамический контейнер в целевом месте, смонтировав его и затем перенеся в него файлы из старого контейнера.) Кэш паролей очищен Пароли (и/или обработанные данные ключевых файлов), хранящиеся в кэше драйвера VeraCrypt, удалены. VeraCrypt не может изменить пароль для чуждого ему тома. Выберите из списка незанятую букву диска. Выберите в списке букв дисков смонтированный том. Выбраны два разных тома/устройства (один в списке букв дисков, другой в поле ввода ниже списка).\n\nУкажите том, который вы хотели выбрать: Ошибка! Невозможно создать autorun.inf Ошибка обработки ключевого файла! Ошибка обработки пути ключевого файла! В пути к ключевым файлам нет файлов.\n\nОбратите внимание, что папки (и содержащиеся в них файлы), найденные в путях поиска ключевых файлов, игнорируются. VeraCrypt не работает в этой операционной системе. Ошибка! VeraCrypt поддерживает только стабильные (не бета) версии этой операционной системы (версии beta/RC не поддерживаются). Ошибка! Невозможно распределить память. Ошибка! Невозможно восстановить значение счётчика производительности. Ошибка! Некорректный формат тома. Ошибка! Вы указали пароль для скрытого тома (а не для обычного). В целях безопасности, скрытый том нельзя создать внутри тома VeraCrypt, содержащего файловую систему, зашифрованную 'на месте' (поскольку свободное место такого тома не было заполнено случайными данными). VeraCrypt: юридические примечания Все файлы Тома VeraCrypt Библиотечные модули Продолжение NTFS/exFAT-форматирования невозможно. Невозможно смонтировать том. Невозможно размонтировать том. Windows не может отформатировать этот том как NTFS/exFAT.\n\nВыберите другой тип файловой системы (если возможно) и повторите попытку. Либо вы можете оставить этот том неформатированным (в поле выбора файловой системы укажите 'Нет'), закрыть окно мастера, смонтировать том, а затем с помощью системной или сторонней утилиты отформатировать смонтированный том (том при этом останется зашифрованным). Windows не может отформатировать этот том как NTFS/exFAT.\n\nХотите вместо этого отформатировать том как FAT? По умолчанию раздел РАЗДЕЛ Устройство устройство УСТРОЙСТВО Том том ТОМ Метка Для этого тома выбран слишком маленький размер кластеров. Будут использованы кластеры большего размера. Ошибка! Невозможно получить размер тома.\n\nПроверьте, не используется ли выбранный том системой или какой-либо программой. Скрытые тома нельзя создавать внутри динамических контейнеров (разрежённых файлов). Чтобы можно было правдоподобно отрицать наличие секретной информации, скрытый том нужно создавать внутри не-динамического контейнера. Мастер создания томов VeraCrypt способен создавать скрытый том только внутри тома FAT/exFAT или NTFS. В среде Windows 2000 мастер создания томов VeraCrypt способен создавать скрытый том только внутри тома FAT. Примечание: для внешних томов больше подходит система FAT/exFAT, нежели NTFS (например, максимальный размер скрытого тома почти наверняка будет существенно больше, если внешний том отформатирован как FAT/exFAT). Обратите внимание, что для внешних томов больше подходит система FAT/exFAT, нежели NTFS. Например, максимальный размер скрытого тома почти наверняка будет существенно больше, если внешний том отформатирован как FAT/exFAT (поскольку NTFS всегда хранит внутренние данные точно в центре тома и потому скрытый том может располагаться только во второй половине внешнего тома).\n\nВы действительно хотите отформатировать внешний том как NTFS? Хотите вместо этого отформатировать том как FAT? Примечание: этот том нельзя отформатировать в FAT, так как его размер больше, чем допускает файловая система FAT32 для соответствующего размера секторов (2 ТБ для секторов по 512 байт, и 16 ТБ для секторов по 4096 байт). Ошибка! Раздел для скрытой операционной системы (т.е. для первого идущего за системным раздела) должен быть по крайней мере на 5% больше системного раздела (системный раздел - тот, где установлена работающая сейчас ОС). Ошибка! Раздел для скрытой операционной системы (т.е. для первого идущего за системным раздела) должен быть по крайней мере на 110% (в 2,1 раза) больше системного раздела (системный раздел - тот, где установлена работающая сейчас ОС). Причина в том, что файловая система NTFS всегда хранит внутренние данные точно в центре тома, и потому скрытый том (в котором должен содержаться клон системного раздела) может располагаться только во второй половине внешнего тома. Ошибка! Если внешний том отформатирован как NTFS, он должен быть по крайней мере на 110% (в 2,1 раза) больше системного раздела. Причина в том, что файловая система NTFS всегда хранит внутренние данные точно в центре тома, и потому скрытый том (в котором должен содержаться клон системного раздела) может располагаться только во второй половине внешнего тома.\n\nПримечание: внешний том должен находиться в том же разделе, что и скрытая операционная система (т.е. в первом разделе, идущим за системным). Ошибка! Нет раздела, расположенного за системным разделом.\n\nПрежде чем можно будет создать скрытую операционную систему, нужно создать для неё раздел на системном диске. Этот раздел должен быть первым за системным, и он должен быть по крайней мере на 5% больше системного раздела (т.е. того, где установлена работающая сейчас ОС). Однако если внешний том (не путайте с системным разделом) отформатирован как NTFS, раздел для скрытой операционной системы должен быть не менее чем на 110% (в 2,1 раза) больше системного (причина в том, что файловая система NTFS всегда хранит внутренние данные точно в центре тома, поэтому скрытый том, который должен содержать клон системного раздела, может располагаться только во второй половине раздела). Замечание: непрактично (и потому это не поддерживается) устанавливать операционные системы в два тома VeraCrypt, встроенных в один раздел, поскольку при использовании внешней ОС часто требуется записывать данные в область внутренней ОС (а если такие операции записи предотвращать с помощью функции защиты скрытых томов, то это может привести к краху системы - к 'синему экрану смерти'). Информацию о создании и управлении разделами см. в документации к вашей операционной системе, либо проконсультируйтесь в службе техподдержки поставщика своего компьютера. Ошибка! Работающая сейчас операционная система установлена не в загрузочном разделе (первом разделе с пометкой 'Активный'). Это не поддерживается. Вы указали, что собираетесь хранить в этом томе VeraCrypt файлы размером более 4 ГБ, но выбрали файловую систему FAT, в которой нельзя сохранять файлы объёмом свыше 4 ГБ.\n\nВы действительно хотите отформатировать том как FAT? Ошибка! VeraCrypt не поддерживает дешифрование 'на месте' несистемных томов, созданных VeraCrypt устаревших версий (1.0b и ранее).\n\nЧтобы расшифровать файлы, хранящиеся в этом томе, просто скопируйте или переместите их на любой незашифрованный том. Ошибка! VeraCrypt не может 'на месте' расшифровать скрытый том VeraCrypt.\n\nЧтобы расшифровать файлы, хранящиеся в этом томе, просто скопируйте или переместите их на любой незашифрованный том. Внимание! VeraCrypt не может 'на месте' расшифровать том, в котором содержится скрытый том VeraCrypt (скрытый том перезапишется псевдослучайными данными).\n\nПодтвердите, что в томе, который вы собираетесь расшифровать, нет скрытого тома.\n\nЕсли в томе есть скрытый том, но вы не против его потери, то можете продолжить (внешний том будет безопасно расшифрован). В этом томе нет скрытого тома. Продолжаем. В этом томе есть скрытый том. Отмена. ОШИБКА: Нет доступа к тому.\n\nПроверьте, существует ли этот том, не смонтирован ли он, не используется ли системой или какой-либо программой, которой вы дали права чтения/записи этого тома, и не защищён ли он от записи. ОШИБКА: Невозможно получить свойства тома. ОШИБКА: Нет доступа к тому и/или невозможно получить сведения о томе.\n\nПроверьте, существует ли выбранный том, не используется ли он системой или приложениями, есть ли у вас права для чтения/записи этого тома, и не защищён ли он от записи. ОШИБКА: Нет доступа к тому и/или невозможно получить сведения о томе. Проверьте, существует ли выбранный том, не используется ли он системой или приложениями, есть ли у вас права для чтения/записи этого тома, и не защищён ли он от записи.\n\nЕсли проблема не решается, попробуйте предпринять шаги, указанные ниже. Зашифровать раздел не удалось из-за ошибки. Попробуйте устранить все ранее указанные проблемы и повторить попытку. Если проблемы не решаются, попробуйте предпринять шаги, указанные ниже. Продолжить шифрование/дешифрование раздела не удалось из-за ошибки.\n\nПопробуйте устранить все ранее указанные проблемы и снова возобновить процесс. Учтите, что том нельзя смонтировать до тех пор, пока он не будет полностью зашифрован/расшифрован. Не удалось расшифровать том из-за ошибки. Попробуйте устранить все возникшие ранее проблемы и затем по возможности повторите. ОШИБКА: Невозможно размонтировать внешний том.\n\nТом нельзя размонтировать, если он содержит файлы или папки, используемые какой-либо программой или системой.\n\nЗакройте все программы, которые могут использовать файлы и папки на этом томе, и нажмите 'Повтор'. ОШИБКА: Невозможно получить информацию о внешнем томе. Создание тома не может быть продолжено. ОШИБКА: Нет доступа к внешнему тому. Создание тома не может быть продолжено. ОШИБКА: Невозможно смонтировать внешний том. Создание тома не может быть продолжено. ОШИБКА: Невозможно получить карту кластеров тома. Создание тома не может быть продолжено. По алфавиту/категориям Средняя скорость (убывание) Алгоритм Шифрование Дешифрование Среднее Диск Размер Алгоритм шифрования Алгоритм шифрования Тип Значение Свойство Размещение байт Скрытый Внешний Обычный Системный Скрытый (системный) Только для чтения Системный диск Системный диск (шифрование - %.2f%% готово) Системный диск (дешифрование - %.2f%% готово) Системный диск (%.2f%% зашифровано) Системный раздел Скрытый системный раздел Системный раздел (шифрование - %.2f%% готово) Системный раздел (дешифрование - %.2f%% готово) Системный раздел (%.2f%% зашифровано) Да (защита от повреждений!) Нет Длина первичного ключа Длина вторичного ключа (режим XTS) Длина Tweak-ключа (режим LRW) бит Размер блока PKCS-5 PRF Число итераций PKCS-5 Том создан Последнее изменение заголовка (прошло дней: %I64d) Версия формата тома Встроенная копия заголовка Загрузчик VeraCrypt - версия 1-ая доступная Сменный диск Жёсткий диск Не изменять Автоопределение Режим мастера Выберите режим. Если не уверены, используйте предложенный. Выберите эту опцию, чтобы установить VeraCrypt в данной системе. Обновление можно выполнить без расшифровки данных, даже если зашифрован системный раздел/диск или используется скрытая операционная система. При выборе этой опции все файлы будут извлечены из дистрибутива, но не установлены в систему. Не выбирайте этот вариант, если вы намерены шифровать системный раздел/диск. Этот вариант - для запуска VeraCrypt в так называемом 'переносном' (portable) режиме. VeraCrypt не обязательно устанавливать в ОС. После извлечения всех файлов просто запустите файл VeraCrypt.exe (программа будет работать в 'переносном' режиме). Параметры установки Параметры, влияющие на установку программы. Установка Подождите, идёт установка VeraCrypt. Установка VeraCrypt успешно выполнена Обновление VeraCrypt успешно выполнено Помогите материально развитию программы. Кнопка 'Готово' - закрыть установщик. Параметры извлечения Параметры, влияющие на извлечение файлов. Подождите, идёт извлечение файлов. Файлы успешно извлечены Все файлы успешно извлечены в указанное целевое место. Если указанной папки не существует, она будет создана автоматически. Программные файлы VeraCrypt будут обновлены в папке установки VeraCrypt. Если вы хотите выбрать другое местоположение, сначала нужно удалить VeraCrypt. Показать примечания к текущей (последней стабильной) версии VeraCrypt? Если вы никогда ранее не работали с VeraCrypt, рекомендуется ознакомиться с разделом для новичков в Руководстве пользователя VeraCrypt. Хотите прочитать документацию? Выберите желаемое действие: Восстановить/переустановить Обновить Удалить Для установки/удаления VeraCrypt необходимо иметь права администратора. Продолжить? В системе сейчас запущен установщик VeraCrypt. Он выполняет/готовит установку или обновление VeraCrypt. Дождитесь завершения работы или закройте его. Если закрыть установщик не получается, перезагрузите компьютер и лишь потом продолжайте. Установка не выполнена. Удаление не выполнено. Этот дистрибутивный пакет повреждён. Загрузите его снова (желательно с официального сайта VeraCrypt - https://www.veracrypt.fr). Невозможно записать файл %s Извлечение Невозможно прочитать данные из дистрибутива. Невозможно проверить целостность дистрибутивного пакета. Извлечение не выполнено. Установка возвращена назад. Программа VeraCrypt успешно установлена. Программа VeraCrypt успешно обновлена. Версия VeraCrypt успешно обновлена, но прежде чем её использовать, нужно перезагрузить компьютер.\n\nВыполнить перезагрузку сейчас? Ошибка обновления VeraCrypt!\n\nВАЖНО: Настоятельно рекомендуется до завершения работы или перезагрузки ОС воспользоваться восстановлением системы ('Пуск > Программы > Стандартные > Служебные > Восстановление системы') и вернуть систему в точку 'VeraCrypt installation'. Если функция 'Восстановление системы' недоступна, попробуйте снова установить исходную или новую версию версию VeraCrypt до завершения или перезагрузки системы. Программа VeraCrypt успешно удалена.\n\nНажмите 'Готово', чтобы удалить установщик VeraCrypt и папку %s. Папка не будет удалена, если в ней содержатся какие-либо файлы, созданные не установщиком и не самой программой VeraCrypt. Удаление записей VeraCrypt в реестре Добавление элемента в реестр Удаление относящихся к программе данных Установка Остановка Удаление Добавление значка Создание точки восстановления системы Ошибка создания точки восстановления системы. Обновление загрузчика Установка '%s' не выполнена. %s Продолжить установку? Удаление '%s' не выполнено. %s Продолжить удаление? Установка завершена. Не удалось создать папку '%s' Невозможно выгрузить драйвер VeraCrypt.\n\nСначала закройте все открытые окна VeraCrypt. Если это не поможет, перезагрузите Windows и попробуйте ещё раз. Прежде чем продолжить установку или удаление программы, нужно размонтировать все тома VeraCrypt. В этой системе уже установлена устаревшая версия VeraCrypt. Её необходимо удалить, прежде чем можно будет установить новую версию.\n\nПри закрытии этого окна будет запущена программа удаления старой версии. Никакие тома при удалении VeraCrypt не расшифровываются. После удаления старой версии запустите установщик новой версии VeraCrypt снова. Ошибка установки элементов в реестре Ошибка установки драйвера. Перезагрузите Windows и попробуйте установить VeraCrypt ещё раз. Запуск драйвера VeraCrypt Ошибка удаления драйвера. Обратите внимание, что из-за особенностей Windows для удаления (или переустановки) драйвера может потребоваться завершить сеанс работы или перезагрузить систему. Установка драйвера VeraCrypt Остановка драйвера VeraCrypt Удаление драйвера VeraCrypt Ошибка регистрации библиотеки поддержки управления учётными записями пользователей (User Account Control). Ошибка отмены регистрации библиотеки поддержки управления учётными записями пользователей (User Account Control). О переносном режиме\n\nПрежде чем драйверы могут быть запущены, они должны быть зарегистрированы в операционной системе. Поэтому драйвер VeraCrypt - не полностью переносной (и не может таковым быть, тогда как приложения VeraCrypt - полностью переносные, т.е. не требуют установки или регистрации в ОС). Обратите внимание, что для шифрования/дешифрования 'на лету' VeraCrypt требуется драйвер. !!! Если вы решили запустить VeraCrypt в переносном режиме (а не как установленную в ПК программу), система будет запрашивать разрешение на выполнение (контроль учётных записей, UAC) при каждом запуске.\n\nПричина в том, что в переносном режиме требуется загружать и запускать драйвер VeraCrypt, необходимый для прозрачного, выполняемого 'на лету' шифрования/дешифрования, а пользователи без прав администратора не могут запускать драйверы в Windows. Поэтому система будет запрашивать разрешение на запуск VeraCrypt с привилегиями администратора (UAC).\n\nОбратите внимание, что при установке (инсталляции) VeraCrypt в систему (в отличие от запуска в переносном режиме), система НЕ будет запрашивать разрешение при каждом запуске программы.\n\nВы действительно хотите только извлечь файлы? ВНИМАНИЕ: Эта копия мастера создания томов имеет административные привилегии.\n\nНовый том может быть создан с правами, которые не позволят записывать в него данные, когда он будет смонтирован. Чтобы этого избежать, закройте данную копию мастера создания томов и запустите другую, без административных привилегий.\n\nЗакрыть эту копию мастера создания томов? Ошибка вывода лицензии. Внешний(!) дн. час мин c Открыть Размонтировать Показать VeraCrypt Скрыть VeraCrypt Считано данных после монтирования Записано данных после монтирования Зашифрованная часть 100% (полностью зашифровано) 0% (не зашифровано) %.3f%% 100% Ожидание Подготовка Изменение размера Шифрация Дешифрация Завершение Пауза Завершено Ошибка Устройство отключено Системные избранные тома сохранены.\n\nЧтобы разрешить монтирование этих томов при загрузке системы, выберите 'Настройки' > 'Системные избранные тома' > 'Монтировать системные избранные тома при старте Windows'. Добавляемый в избранное том - не раздел и не динамический том. Поэтому VeraCrypt не сможет смонтировать этот избранный том, если изменится число устройств. Добавляемый в избранное том - это раздел, не распознанный Windows.\n\nVeraCrypt не сможет смонтировать этот избранный том, если изменится число устройств. Задайте тип раздела, распознаваемый Windows (используйте команду SETID в Windows-утилите DiskPart), и затем снова добавьте раздел в список избранного. Фоновая работа VeraCrypt отключена или настроена на прекращение при отсутствии смонтированных томов (либо программа запущена в переносном режиме). Это может помешать автомонтированию избранных томов при подключении устройств, на которых они расположены.\n\n!!! Чтобы включить фоновое выполнение VeraCrypt, вызовите окно настроек программы и отметьте параметр 'Включено' в поле 'Работа VeraCrypt в фоновом режиме'. Автомонтирование контейнера, расположенного в сетевой файловой системе, при подключении его хост-устройства невозможно. Указанное ниже устройство - не раздел и не динамический том. Поэтому при подключении этого устройства автомонтирование расположенного на нём тома невозможно. Присвойте показанному ниже разделу тип, распознаваемый Windows (используйте команду SETID в Windows-утилите DiskPart). Затем удалите раздел из списка избранного и добавьте его снова. Этим вы разрешите тому на основе устройства автоматически монтироваться при подключении устройства. Указанное ниже устройство - не раздел и не динамический том, поэтому ему нельзя присвоить метку. Присвойте показанному ниже разделу тип, распознаваемый Windows (используйте команду SETID в Windows-утилите DiskPart). Затем удалите раздел из списка избранного и добавьте его снова. Это позволит VeraCrypt присвоить разделу метку. Из-за системных ограничений Windows контейнер, находящийся в удалённой сетевой файловой системе, нельзя монтировать как избранный системный том (но его можно смонтировать как несистемный избранный том при входе пользователя в свою учётную запись). Введите пароль для %s Введите пароль для '%s' Введите пароль для обычного/внешнего тома Введите пароль для скрытого тома Введите пароль для заголовка в файле резервной копии Ключевой файл успешно создан. Недопустимое количество ключевых файлов. Размер ключевого файла должен быть между 64 и 1 048 576 байтами. Введите имя создаваемого ключевого файла Недопустимое базовое имя ключевых файлов Ключевой файл '%s' уже существует.\nПерезаписать его? При ответе 'Нет' процесс генерирования будет остановлен. ВНИМАНИЕ: Повреждён заголовок этого тома! Была автоматически использована резервная копия заголовка, встроенная в том.\n\nСледует исправить заголовок, выбрав 'Сервис' > 'Восстановить заголовок тома'. Резервная копия заголовка тома успешно создана.\n\nВАЖНО: При восстановлении заголовка из этой резервной копии также будет восстановлен и текущий пароль тома. Более того, если для монтирования тома требуются ключевые файлы, после восстановления заголовка из копии для монтирования тома понадобятся те же ключевые файлы.\n\nВНИМАНИЕ: Эту копию заголовка тома можно использовать для восстановления заголовка ТОЛЬКО этого конкретного тома. Если применить эту копию для восстановления заголовка другого тома, смонтировать том вы сможете, но НЕ удастся расшифровать никакие данные в этом томе (так как это изменит его мастер-ключ). Заголовок тома успешно восстановлен.\n\nВАЖНО: Имейте в виду, что вместе с заголовком мог быть восстановлен и прежний пароль.\nБолее того, если на момент создания резервной копии для монтирования тома\nтребовались ключевые файлы, эти же ключевые файлы понадобятся\nдля монтирования данного тома сейчас. В целях безопасности, для этого тома потребуется ввести правильный пароль\n(и/или предоставить корректные ключевые файлы).\n\nПримечание: если в этом томе есть скрытый том, сначала нужно ввести правильный пароль\n(и/или предоставить корректные ключевые файлы) для внешнего тома.\nЗатем, если выбрано резервное копирование заголовка скрытого тома, нужно будет\nуказать правильный пароль (и/или предоставить корректные ключевые файлы) для скрытого тома. Вы действительно хотите создать резервную копию заголовка тома для %s?\n\nПри выборе 'Да' потребуется указать имя файла для резервной копии заголовка.\n\nПримечание: оба заголовка - для обычного и скрытого томов - будут повторно зашифрованы с новой солью и сохранены в резервной копии. Если внутри этого тома нет скрытого тома, область, зарезервированная в резервной копии под заголовок скрытого тома, будет заполнена случайными данными (чтобы можно было правдоподобно отрицать причастность). При восстановлении заголовка тома из резервной копии потребуется ввести правильный пароль и/или предоставить корректные ключевые файлы, действительные на момент создания резервной копии заголовка тома. По паролю (и/или ключевым файлам) также будет автоматически определяться тип заголовка тома для восстановления - обычный или скрытый (VeraCrypt определяет тип методом проб и ошибок). Вы действительно хотите восстановить заголовок тома %s?\n\nВНИМАНИЕ: При восстановлении заголовка будет восстановлен пароль тома, который действовал при создании резервной копии. Более того, если на момент создания резервной копии для монтирования тома также требовались ключевые файлы, после восстановления заголовка для монтирования тома понадобятся те же ключевые файлы.\n\nНажмите 'Да', чтобы выбрать файл с резервной копией заголовка. Имеется ли в томе скрытый том? В томе есть скрытый том В томе нет скрытого тома Выберите тип резервной копии заголовка тома: Восстановить заголовок из копии, встроенной в том Восстановить заголовок из внешнего файла с резервной копией Неверный размер файла с резервной копией заголовка тома. В этом томе нет встроенной копии заголовка (встроенные копии заголовков есть только в томах, созданных VeraCrypt 6.0 или новее). Вы пытаетесь создать резервную копию заголовка системного раздела/диска. Это не разрешено. Операции резервного копирования/восстановления, относящиеся к системному разделу/диску, можно выполнять только с помощью диска восстановления VeraCrypt (Rescue Disk).\n\nСоздать диск восстановления VeraCrypt? Вы пытаетесь восстановить из резервной копии заголовок виртуального тома VeraCrypt, но выбрали системный раздел/диск. Это не разрешено. Операции резервного копирования/восстановления, относящиеся к системному разделу/диску, можно выполнять только с помощью диска восстановления VeraCrypt (Rescue Disk).\n\nСоздать диск восстановления VeraCrypt? После нажатия OK выберите имя файла для образа нового диска восстановления VeraCrypt (Rescue Disk) и место, где его нужно сохранить. Образ диска восстановления создан и сохранён в файле\n%s\n\nСейчас нужно записать этот образ на CD или DVD.\n\nВАЖНО: Этот файл должен быть записан на CD/DVD как ISO-образ диска (а не как отдельный файл). Сведения об этом см. в документации к своему ПО для записи CD/DVD.\n\nЗаписав диск восстановления на CD/DVD, выберите 'Система' > 'Проверить диск восстановления', чтобы убедиться в корректности записи созданного диска. Образ диска восстановления создан и сохранён в файле\n%s\n\nСейчас нужно записать этот образ на CD или DVD.\n\nЗапустить программу записи оптических дисков Windows?\n\nЗаписав диск восстановления на CD/DVD, выберите 'Система' > 'Проверить диск восстановления', чтобы убедиться в корректности записи созданного диска. Чтобы проверить диск восстановления VeraCrypt, вставьте его в накопитель и нажмите OK. Диск восстановления VeraCrypt проверен. Всё в порядке. Невозможно проверить правильность записи диска восстановления.\n\nЕсли запись завершена, выньте CD/DVD и вставьте снова, а затем повторите попытку. Не помогло? Воспользуйтесь другим ПО для записи дисков и/или другим CD/DVD.\n\nЕсли вы пытались проверить диск восстановления, созданный с другим мастер-ключом, паролем, солью и т.д., то учтите, что проверка такого диска будет всегда давать ошибку. Чтобы создать новый диск, полностью совместимый с текущей конфигурацией, выберите меню 'Система' > 'Создать диск восстановления'. Проверка образа диска восстановления VeraCrypt успешно пройдена. Проверка образа диска восстановления VeraCrypt не пройдена.\n\nЕсли вы пытались проверить образ, созданный с другим мастер-ключом, паролем, солью и т.д., то учтите, что проверка такого образа будет всегда давать ошибку. Чтобы создать новый образ диска восстановления, полностью совместимый с текущей конфигурацией, выберите 'Система' > 'Создать диск восстановления'. Ошибка создания диска восстановления VeraCrypt. Диск восстановления VeraCrypt нельзя создавать, когда работает скрытая операционная система.\n\nЧтобы создать диск восстановления, загрузите обманную ОС и выберите 'Система' > 'Создать диск восстановления'. Невозможно проверить правильность записи диска восстановления.\n\nЕсли запись завершена, выньте CD/DVD и вставьте снова; затем нажмите 'Далее', чтобы повторить попытку. Если это не поможет, попробуйте воспользоваться другим носителем%s.\n\nЕсли вы пока ещё не записали диск восстановления, сделайте это и нажмите 'Далее'.\n\nЕсли вы пытались проверить диск восстановления VeraCrypt, созданный ДО запуска этого мастера, знайте, что такой диск использовать нельзя, поскольку он был создан с другим мастер-ключом. Нужно записать на CD/DVD заново созданный диск восстановления. и/или другим ПО для записи CD/DVD Системные избранные тома VeraCrypt Что такое 'системные избранные тома'? Системный раздел/диск не зашифрован.\n\nСистемные избранные тома можно монтировать только с помощью пароля дозагрузочной аутентификации.\nПоэтому если вы хотите использовать системные избранные тома, сначала зашифруйте системный раздел/диск. Прежде чем продолжить, размонтируйте том. ОШИБКА: Невозможно установить таймер. Проверить файловую систему Исправить файловую систему Добавить в избранные... Добавить в системные избранные... Сво&йства... Скрытый том защищён Н/П Да Нет Отключено 1 2 и более Режим операции Метка: Размер: Путь: Буква диска: Ошибка! Пароль должен содержать только символы стандартного набора ASCII.\n\nСимволы не из набора ASCII могут привести к невозможности монтирования тома при смене настроек в конфигурации системы.\n\nРазрешается использовать следующие символы:\n\n ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \\ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~ ВНИМАНИЕ: Пароль содержит символы не из набора ASCII. Это может привести к невозможности монтирования тома при смене конфигурации системы.\n\nВам следует заменить все не относящиеся к ASCII символы в пароле на символы ASCII. Для этого в меню 'Тома' выберите 'Изменить пароль тома'.\n\nК символам ASCII относятся:\n\n ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \\ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~ ВНИМАНИЕ: Настоятельно не рекомендуется использовать расширения как у исполняемых файлов (.exe, .sys, .dll) или других, которые могут быть источником потенциальных проблем. Такие расширения часто приводят к влиянию на контейнер со стороны Windows и антивирусных программ, что снижает производительность тома и может привести к другим серьёзным проблемам.\n\nНастоятельно советуем удалить это расширение или изменить его (например на '.hc').\n\nВы настаиваете на использовании этого проблематичного расширения файла? ВНИМАНИЕ: У этого контейнера расширение как у исполняемых файлов (.exe, .sys, .dll) или других, которые могут быть источником потенциальных проблем. Вероятнее всего это приведёт к влиянию на данный контейнер со стороны Windows и антивирусного ПО, что снизит производительность тома и может вызвать другие серьёзные проблемы.\n\nНастоятельно рекомендуем удалить это расширение у файла-контейнера или изменить его (например на '.hc') после размонтирования тома. Домашняя страница ВНИМАНИЕ: В системе не установлено ни одного пакета обновлений (Service Pack) Windows. Если в Windows XP не установлен Service Pack 1 (или новее), не следует выполнять запись на диски IDE объёмом более 128 ГБ, иначе возможно повреждение данных (неважно, относятся они к тому VeraCrypt или нет). Это ограничение Windows, а не ошибка в VeraCrypt. ВНИМАНИЕ: В системе не установлен пакет обновлений Windows Service Pack 3 (или новее). Если в Windows 2000 не установлен Service Pack 3 (или новее), не следует выполнять запись на диски IDE объёмом более 128 ГБ, иначе возможно повреждение данных (неважно, относятся они к тому VeraCrypt или нет). Это ограничение Windows, а не ошибка в VeraCrypt. Кроме того, может потребоваться включить в реестре поддержку 48-бит адресации LBA; подробности см. на http://support.microsoft.com/kb/305098/EN-US ВНИМАНИЕ: В системе отключена поддержка 48-бит LBA ATAPI. Поэтому не следует выполнять запись на IDE-диски объёмом более 128 ГБ! В противном случае это может привести к повреждению данных на диске (будь это том VeraCrypt или обычный раздел). Это ограничение Windows, а не VeraCrypt.\n\nЧтобы включить поддержку 48-бит режима LBA, добавьте в реестр в ключ HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\atapi\\Parameters значение 'EnableBigLba' и установите его значение в 1.\n\nСм. подробности тут: http://support.microsoft.com/kb/305098 ОШИБКА: В файловой системе FAT32 нельзя сохранять файлы размером более 4 ГБ. Поэтому тома VeraCrypt на основе файлов (контейнеры), хранящиеся в файловой системе FAT32, не могут быть больше 4 ГБ.\n\nЕсли нужен том большего объёма, создайте его в системе NTFS (или, при использовании Windows Vista SP1 или новее, в файловой системе exFAT), либо вместо создания тома на основе файла зашифруйте весь раздел диска. ВНИМАНИЕ: Windows XP не поддерживает файлы больше 2048 ГБ (сообщая о недостатке свободного места). Поэтому в Windows XP нельзя создавать тома VeraCrypt на основе файлов (контейнеры) объёмом свыше 2048 ГБ.\n\nТем не менее в Windows XP можно зашифровать диск целиком или создать том VeraCrypt на основе раздела размером более 2048 ГБ. ВНИМАНИЕ: Если вам нужно впоследствии добавлять во внешний том ещё данные/файлы, имеет смысл уменьшить размер скрытого тома.\n\nХотите продолжить и использовать указанный вами размер? Не выбран том.\n\nНажмите кнопку 'Устройство' или 'Файл' и выберите том VeraCrypt. Не выбран раздел.\n\nНажмите кнопку 'Устройство' и выберите несмонтированный раздел, который требует дозагрузочной аутентификации (например раздел на зашифрованном системном диске с другой, не выполняемой сейчас ОС, или зашифрованный системный раздел другой ОС).\n\nПримечание: выбранный раздел будет смонтирован как обычный том VeraCrypt без дозагрузочной аутентификации. Это может понадобиться, например, для резервного копирования или починки. ВНИМАНИЕ: Если установлены и активированы ключевые файлы по умолчанию, монтировать НЕ использующие их тома будет невозможно. При монтировании таких томов не забывайте выключать опцию 'Ключевые файлы' (ниже поля ввода пароля).\n\nВы действительно хотите сохранить выбранные ключевые файлы/пути как используемые по умолчанию? Автомонтирование устройств Размонтировать все Очистка кэша Размонтировать все и очистить кэш Сразу размонтировать все и очистить кэш Сразу размонтировать все, очистить кэш и выйти Смонтировать избранные тома Показать/скрыть главное окно VeraCrypt (щёлкните здесь и нажмите клавишу) Действие Быстрый вызов ОШИБКА: Эта клавиша зарезервирована. Выберите другую. ОШИБКА: Эта клавиша уже используется. ВНИМАНИЕ: Некоторые общесистемные горячие клавиши VeraCrypt не будут работать!\n\nПроверьте, не используются ли те же клавиши другими приложениями или операционной системой. Создание файла подкачки предотвращено.\n\nОбратите внимание, что из-за особенностей Windows файлы подкачки не могут располагаться на несистемных томах VeraCrypt (включая избранные системные тома). VeraCrypt поддерживает создание файлов подкачки только на зашифрованном системном разделе/диске. Из-за ошибки или несовместимости VeraCrypt не может зашифровать файл гибернации. Поэтому режим гибернации отключён.\n\nПримечание: когда компьютер переходит в режим гибернации (или в энергосберегающий режим сна), содержимое системной памяти записывается на жёсткий диск в файл с данными гибернации. VeraCrypt не может предотвратить сохранение открытых в ОЗУ ключей шифрования и содержимого важных файлов в незашифрованном виде в файле гибернации. Гибернация отменена.\n\nVeraCrypt не поддерживает гибернацию скрытых операционных систем, использующих дополнительный загрузочный раздел. Учтите, что загрузочный раздел используется как обманной, так и скрытой системами. Поэтому для предотвращения утечки данных и проблем при выходе из гибернации программа VeraCrypt запретила скрытой системе запись в общий загрузочный раздел и гибернацию. Том VeraCrypt, смонтированный как %c:, размонтирован. Тома VeraCrypt размонтированы. Смонтированные тома VeraCrypt размонтированы, кэш паролей очищен. Успешно размонтировано ВНИМАНИЕ: Если запретить работу VeraCrypt в фоновом режиме, то будут отключены следующие функции:\n\n1) Горячие клавиши\n2) Авторазмонтирование (например при завершении сеанса, случайном удалении хост-устройства, истечении времени ожидания и т.д.)\n3) Автомонтирование избранных томов\n4) Оповещения (например о предотвращении повреждения скрытого тома)\n5) Значок в области уведомлений\n\nПримечание: фоновый процесс можно завершить в любой момент, щёлкнув ПКМ по значку VeraCrypt в области уведомлений и выбрав 'Выход'.\n\nВы действительно хотите перманентно запретить фоновый режим? ВНИМАНИЕ: Если выключить этот параметр, станет невозможно автоматически размонтировать тома, содержащие открытые файлы/папки.\n\nВы действительно хотите выключить этот параметр? ВНИМАНИЕ: Тома с открытыми файлами/папками НЕ будут автоматически размонтироваться.\n\nЧтобы избежать этого, включите в данном окне параметр 'Авторазмонтировать тома даже при открытых файлах/папках' ВНИМАНИЕ: Если в ноутбуке низкий уровень заряда батареи, Windows может не отправлять соответствующие сообщения в выполняющиеся приложения при входе в энергосберегающий режим. Поэтому в таких случаях авторазмонтирование томов в VeraCrypt может не сработать. Вы запланировали (де)шифрование раздела/тома. Этот процесс пока не завершён.\n\nВозобновить его сейчас? Вы запланировали шифрование или дешифрование системного раздела/диска. Этот процесс пока не завершён.\n\nНачать (продолжить) процесс сейчас? Спрашивать о продолжении запланированного на данный момент (де)шифрования несистемных разделов/томов? Да, спрашивать Нет, не спрашивать ВАЖНО: Не забывайте, что вы можете продолжить (де)шифрование любого несистемного раздела/тома, выбрав в меню главного окна VeraCrypt пункт 'Тома' > 'Продолжить прерванный процесс'. Вы запланировали шифрование или дешифрование системного раздела/диска, но не пройдена (или была пропущена) дозагрузочная аутентификация.\n\nПримечание: при дешифровании системного раздела/диска в дозагрузочном окружении может потребоваться финализация процесса командой 'Система' > 'Перманентно расшифровать системный раздел/диск' в меню главного окна VeraCrypt. ВНИМАНИЕ: Если закрыть VeraCrypt сейчас, будут отключены следующие функции:\n\n1) Горячие клавиши\n2) Авторазмонтирование (при завершении сеанса, нечаянном удалении хост-устройства, истечении времени ожидания и т.д.)\n3) Автомонтирование избранных томов\n4) Оповещения (например о предотвращении повреждения скрытого тома)\n\nПримечание: если вы не хотите, чтобы после закрытия окна VeraCrypt программа продолжала работать в фоновом режиме, выключите соответствующий параметр в её настройках (а также, при необходимости, автозапуск VeraCrypt).\n\nВы действительно хотите закрыть VeraCrypt? Выход? Недостаточно информации, чтобы определить, какую операцию выполнить - шифрование или дешифрование. Недостаточно информации, чтобы определить, какую операцию выполнить - шифрование или дешифрование.\n\nПримечание: при дешифровании системного раздела/диска в дозагрузочном окружении может потребоваться финализировать процесс, нажав Decrypt. Примечание: если при шифровании несистемного раздела/диска 'на месте' не удаётся завершить процесс из-за какой-либо постоянно повторяющейся ошибки, вы не сможете смонтировать этот том (и получить доступ к хранящимся в нём данным), пока полностью не РАСШИФРУЕТЕ этот том (т.е. выполните обратный процесс).\n\nЭто можно сделать так:\n1) Выйдите из этого мастера.\n2) В главном окне VeraCrypt выберите 'Тома' > 'Продолжить прерванный процесс'.\n3) Выберите 'Дешифрация'. Хотите прервать (де)шифрование раздела/тома, отложив его на будущее?\n\nУчтите, что том нельзя смонтировать, пока он не будет полностью зашифрован или расшифрован. Позже (де)шифрование можно будет возобновить с той точки, где оно было остановлено, выбрав команду 'Тома' > 'Продолжить прерванный процесс' в меню главного окна VeraCrypt. Хотите прервать и отложить шифрование системного раздела/диска?\n\nПозже процесс можно будет возобновить с той точки, где он был остановлен, выбрав в главном окне VeraCrypt меню 'Система' > 'Продолжить прерванный процесс'. Если вы хотите окончательно прервать процесс или вовсе отказаться от шифрования, выберите 'Система' > 'Перманентно расшифровать системный раздел/диск'. Хотите прервать и отложить дешифрование системного раздела/диска?\n\nПозже процесс можно будет возобновить с той точки, где он был остановлен, выбрав в главном окне VeraCrypt меню 'Система' > 'Продолжить прерванный процесс'. Чтобы отказаться от дешифрования (и начать шифрование), выберите 'Система' > 'Зашифровать системный раздел/диск'. ОШИБКА: Не удалось прервать (де)шифрование системного раздела/диска. ОШИБКА: Не удалось прервать удаление (затирание) данных. ОШИБКА: Не удалось возобновить прерванное (де)шифрование системного раздела/диска. ОШИБКА: Не удалось начать удаление (затирание) данных. Несоответствие устранено.\n\n\n(Если вы сообщаете нам о связанной с этим ошибке, включите в отчёт следующую информацию: %hs) ОШИБКА: Неизвестное состояние.\n\n\n(Если вы сообщаете нам о связанной с этим ошибке, включите в отчёт следующую информацию: %hs) Нет прерванных процессов (де)шифрования системного раздела/диска, которые можно продолжить.\n\nЧтобы возобновить прерванное (де)шифрование НЕсистемного раздела/диска, выберите 'Тома' > 'Продолжить прерванный процесс'. ВНИМАНИЕ: Отключён фоновый процесс VeraCrypt. При выходе из VeraCrypt не будет оповещения о предотвращении повреждения скрытого тома.\n\nПримечание: фоновый процесс можно закрыть в любой момент, щёлкнув ПКМ по значку VeraCrypt в области уведомлений и выбрав 'Выход'.\n\nВключить фоновый процесс VeraCrypt? Версия языкового модуля: %s Проверка файловой системы тома VeraCrypt, смонтированного как %s... Попытка исправить файловую систему тома VeraCrypt, смонтированного как %s... ВНИМАНИЕ: Этот том зашифрован с помощью устаревшего алгоритма.\n\nВсе алгоритмы шифрования с 64-бит блоками (например Blowfish, CAST-128, Triple DES) вышли из употребления. В последующих версиях VeraCrypt монтирование этого тома будет возможно, но никаких улучшений в реализации этих устаревших алгоритмов не предвидится. Рекомендуем создать новый том VeraCrypt с шифрованием по алгоритму со 128-бит блоками (например AES, Serpent, Twofish и др.) и перенести все файлы из этого тома в новый. Ваша система не настроена на автомонтирование новых томов. Монтирование томов VeraCrypt на основе устройств может оказаться невозможным. Чтобы включить автомонтирование, выполните следующую команду и перезагрузите систему:\n\nmountvol.exe /E Прежде чем продолжить, присвойте разделу/устройству букву диска ('Панель управления' > 'Администрирование' > 'Управление компьютером' - 'Управление дисками').\n\n(Это требование операционной системы.) Смонтировать том VeraCrypt Размонтировать все тома VeraCrypt VeraCrypt не может получить права администратора. Доступ запрещён операционной системой.\n\nВозможная причина: для чтения/записи данных в некоторых папках, файлах и устройствах операционная система требует наличия прав чтения/записи (привилегий администратора). По умолчанию пользователю без прав администратора разрешается создавать читать и изменять файлы лишь в папке с его документами ('Мои документы'). ОШИБКА: Выбранное устройство использует сектора неподдерживаемого размера.\n\nВ настоящее время невозможно создавать разделы/тома на основе устройств на дисках с секторами более 4096 байт. Однако на таких дисках можно создавать тома (контейнеры) на основе файлов. В настоящее время не поддерживается шифрование системы, установленной на диске с секторами не по 512 байт. Для загрузчика VeraCrypt необходимо не менее 32 КБ свободного места в начале системного диска (загрузчик должен располагаться в этой области). Ваш диск этому условию не удовлетворяет.\n\nПожалуйста, НЕ сообщайте нам об этом как об ошибке/проблеме в работе VeraCrypt. Чтобы решить данную проблему, нужно переразметить диск, оставив свободными первые 32 КБ (в большинстве случаев достаточно удалить и вновь создать первый раздел). Рекомендуем использовать для этого диспетчер разделов Microsoft, устанавливаемый вместе с Windows. Эта функция не поддерживается операционной системой той версии, которую вы сейчас используете. В этой версии операционной системы VeraCrypt не поддерживает шифрование системного раздела/диска. Чтобы зашифровать системный раздел/диск в Windows Vista, сначала нужно установить пакет обновления Service Pack 1 для Windows Vista или более новый (в вашей системе он пока не установлен).\n\nПримечание: Service Pack 1 для Windows Vista устраняет проблему с нехваткой основной памяти при загрузке системы. VeraCrypt больше не поддерживает шифрование системного раздела/диска в Windows Vista без установленного пакета обновления (Service Pack). Прежде чем обновить VeraCrypt, установите Service Pack 1 (или новее) для Windows Vista. ОШИБКА: Для этой функции нужно, чтобы программа VeraCrypt была УСТАНОВЛЕНА в компьютере (сейчас она работает в 'переносном' режиме).\n\nУстановите (инсталлируйте) VeraCrypt и повторите попытку. ВНИМАНИЕ: Похоже, Windows не установлена на диске, с которого она загружается. Такая конфигурация не поддерживается.\n\nПродолжать следует лишь в случае, если вы уверены, что Windows установлена на том же диске, с которого она загружается.\n\nПродолжить? ОСТОРОЖНО: На системном диске уже установлен загрузчик VeraCrypt!\n\nВозможно, в компьютере имеется другая уже зашифрованная система.\n\nВНИМАНИЕ: ЕСЛИ ПРИСТУПИТЬ К ШИФРОВАНИЮ ТЕКУЩЕЙ СИСТЕМЫ, ЕСТЬ ВЕРОЯТНОСТЬ, ЧТО ДРУГИЕ СИСТЕМЫ НЕ СМОГУТ ЗАГРУЖАТЬСЯ, А ОТНОСЯЩИЕСЯ К НИМ ДАННЫЕ СТАНУТ НЕДОСТУПНЫМИ.\n\nВы действительно хотите продолжить? Ошибка восстановления исходного загрузчика системы.\n\nИспользуйте диск восстановления VeraCrypt ('Repair Options' > 'Restore original system loader') или установочный диск Windows, чтобы заменить загрузчик VeraCrypt системным загрузчиком Windows. Исходный системный загрузчик не будет сохранён на диске восстановления (возможно, нет файла с резервной копией). Ошибка записи сектора MBR.\n\nВозможно, в BIOS компьютера включена защита сектора MBR. Проверьте в настройках BIOS (нажмите клавишу F2, Delete или Esc сразу после включения компьютера), не активирована ли антивирусная/MBR защита. ВНИМАНИЕ: Ошибка контрольной суммы загрузчика VeraCrypt!\nВозможно, была попытка подделки информации на диске (атака 'Evil Maid').\n\nЭто предупреждение также может появиться, если вы восстановили загрузчик VeraCrypt с помощью диска восстановления, созданного другой версией VeraCrypt.\n\nРекомендуем немедленно изменить пароль - это восстановит нормальный загрузчик VeraCrypt. Также стоит переустановить VeraCrypt и ограничить нежелательным лицам доступ к этому ПК. Не установлен загрузчик VeraCrypt (Boot Loader) нужной версии. Это может препятствовать сохранению ряда параметров. Примечание: иногда нужно, чтобы посторонний (неприятель), наблюдающий за включением ПК, не знал, что вы пользуетесь VeraCrypt. Эти параметры позволяют изменить экран загрузки VeraCrypt. Если включить первую опцию, экран загрузчика будет пустым (даже при вводе неправильного пароля). При вводе пароля ПК будет выглядеть 'зависшим'. Кроме того, чтобы ввести неприятеля в заблуждение, можно включить показ своего сообщения. Например, отображать ложные сообщения об ошибках вроде 'Missing operating system' (обычно это показывает загрузчик Windows, когда не может найти загрузочный раздел Windows). Учитите, однако, что если у неприятеля будет возможность проанализировать содержимое жёсткого диска, то он сумеет найти на нём загрузчик VeraCrypt. ВНИМАНИЕ: Если включить эту опцию, загрузчик VeraCrypt не будет выводить на экран никаких сообщений (даже при неправильном пароле). При вводе пароля компьютер будет выглядеть 'зависшим' (не реагирующим), курсор НЕ будет перемещаться, а нажатия клавиш НЕ будут сопровождаться показом звёздочек.\n\nВы действительно хотите включить эту опцию? Судя по всему, системный раздел/диск полностью зашифрован. VeraCrypt не поддерживает шифрование системного диска, который был преобразован в динамический диск. Системный диск содержит расширенные (логические) разделы.\n\nШифрование всего системного диска, содержащего расширенные (логические) разделы, доступно только в Windows Vista и более новых версиях Windows. В Windows XP зашифровать весь системный диск можно при условии, что он содержит только первичные разделы.\n\nТем не менее вместо всего системного диска можно зашифровать системный раздел (а также создать тома VeraCrypt на основе разделов внутри любых несистемных разделов на диске). ВНИМАНИЕ: Так как вы работаете в Windows XP/2003, после запуска шифрования диска на нём НЕЛЬЗЯ создавать расширенные (логические) разделы (разрешается создавать только первичные разделы). Любой расширенный (логический) раздел на диске после начала шифрования станет недоступным (сейчас на диске нет таких разделов).\n\nПримечание: если это ограничение неприемлемо, вернитесь и выберите шифрование только системного раздела, а не всего диска (также можно создать тома VeraCrypt на основе разделов внутри любых несистемных разделов на диске).\n\nЕсли данное ограничение неприемлемо, перейдите на Vista или более новую версию Windows (шифрование всего системного диска, содержащего расширенные/логические разделы, доступно только в Vista и более новых версиях Windows). Системный диск содержит нестандартный раздел.\n\nЕсли вы используете ноутбук, вероятно, на системном диске находится особый раздел для восстановления. После шифрования всего системного диска (включая любой раздел для восстановления) компьютер может перестать загружаться, если в нём не вполне корректная BIOS. Также, пока не будет расшифрован системный диск, нельзя использовать раздел для восстановления. Поэтому рекомендуем шифровать только системный раздел. Хотите зашифровать только системный раздел, а не весь диск?\n\nОбратите внимание, что можно создавать тома VeraCrypt на основе разделов внутри любых несистемных разделов на диске (вдобавок к шифрованию системного раздела). Поскольку системный диск содержит только один раздел, занимающий его целиком, предпочтительнее (безопаснее) зашифровать весь диск, включая свободное 'резервное' место, которое обычно окружает такой раздел.\n\nХотите зашифровать весь системный диск? Ваша система настроена на хранение временных файлов в несистемном разделе.\n\nЭти файлы должны храниться только на системном разделе. Файлы вашего профиля пользователя не хранятся на системном разделе.\n\nЭти файлы должны храниться только на системном разделе. На несистемных разделах имеются файлы подкачки.\n\nЭти файлы должны находиться только на системном разделе. Настроить систему так, чтобы файлы подкачки создавались только на разделе с Windows?\n\nПри нажатии 'Да' компьютер будет перезагружен. После этого запустите VeraCrypt и снова попробуйте создать скрытую ОС. В противном случае это неблагоприятно скажется на правдоподобности отрицания скрытой ОС.\n\nУчтите, что если неприятель проанализирует содержимое таких файлов (на несистемном разделе), то сможет узнать, что вы пользовались этим мастером в режиме создания скрытой системы (что натолкнёт на мысль о наличии в ПК скрытой ОС). Также имейте в виду, что такие файлы на системном разделе будут надёжно удалены VeraCrypt при создании скрытой ОС. ВНИМАНИЕ: Во время создания скрытой ОС потребуется полностью переустановить текущую ОС (чтобы безопасно создать обманную систему).\n\nПримечание: работающая сейчас ОС и всё содержимое системного раздела будут скопированы в скрытый том (чтобы создать скрытую систему).\n\n\nВы уверены, что сможете установить Windows с носителя с дистрибутивом (или со служебного раздела)? В целях безопасности, если работающая сейчас ОС требует активации, то перед продолжением её нужно активировать. Скрытая ОС будет создана копированием содержимого системного раздела в скрытый том (поэтому если эта ОС не активирована, то не будет активирована и скрытая).\n\nВАЖНО: Прежде чем продолжить, обязательно ознакомьтесь с главой 'Требования безопасности и меры предосторожности касательно скрытых томов' в Руководстве пользователя VeraCrypt.\n\n\nУдовлетворяет ли работающая сейчас ОС указанному выше условию? Ваша система использует дополнительный загрузочный раздел. VeraCrypt не поддерживает гибернацию скрытых операционных систем с дополнительным загрузочным разделом (гибернация обманных систем никаких проблем не вызывает).\n\nУчтите, что загрузочный раздел используется как обманной, так и скрытой системами. Поэтому чтобы предотвратить утечки данных и проблемы с выходом из гибернации, скрытой системе запрещены запись в общий загрузочный раздел и гибернация.\n\n\nПродолжить? При ответе 'Нет' будут даны инструкции, как удалить дополнительный загрузочный раздел. \nДополнительный загрузочный раздел можно удалить до установки Windows. Для этого выполните следующее:\n\n1) Загрузите Windows с установочного носителя.\n\n2) На экране установки Windows нажмите 'Install now' > 'Custom (advanced)'.\n\n3) Нажмите 'Drive Options'.\n\n4) Выберите основной системный раздел и удалите его, нажав 'Delete' и OK.\n\n5) Выберите раздел 'System Reserved', нажмите 'Extend' и увеличьте его размер в соответствии с устанавливаемой ОС.\n\n6) Нажмите 'Apply' и OK.\n\n7) Установите Windows в раздел 'System Reserved'.\n\n\nЕсли неприятель спросит вас, зачем вы удалили дополнительный загрузочный раздел, вы можете ответить, что хотели предотвратить возможность утечки данных в незашифрованный загрузочный раздел.\n\nЧтобы распечатать этот текст, нажмите кнопку 'Печать'. Если вы сохраните или распечатаете этот текст (настоятельно рекомендуем это сделать, если только ваш принтер не хранит копии заданий на своём внутреннем накопителе), то после удаления дополнительного загрузочного раздела все копии текста следует уничтожить (иначе если такую копию обнаружат, это может навести на мысль о наличии в ПК скрытой ОС). ВНИМАНИЕ: Между системным разделом и первым идущим за ним разделом имеется нераспределённое место. После создания скрытой ОС вы не должны создавать в этой нераспределённой области никаких новых разделов. В противном случае скрытая ОС не сможет загрузиться (пока не будут удалены такие вновь созданные разделы). Сейчас этот алгоритм для шифрования системы не поддерживается. Этот алгоритм не поддерживается в режиме TrueCrypt. PIM (персональный умножитель итераций) не поддерживается в режиме TrueCrypt. Для использования указанного PIM пароль должен быть не короче 20 символов.\nБолее короткие пароли можно применять только с PIM не менее 485. Для использования указанного PIM пароль дозагрузочной аутентификации должен быть не короче 20 символов.\nБолее короткие пароли можно использовать только с PIM не менее 98. Сейчас ключевые файлы для шифрования системы не поддерживаются. ВНИМАНИЕ: VeraCrypt не удалось восстановить первоначальную раскладку клавиатуры. Это может привести к неправильному вводу пароля. ОШИБКА: Невозможно установить раскладку клавиатуры для VeraCrypt в стандартную американскую (US).\n\nПоскольку пароль требуется указывать ДО загрузки Windows, когда любые раскладки клавиатуры, отличные от американской, ещё недоступны, его нужно всегда вводить в стандартной американской раскладке. Поскольку раскладка клавиатуры временно изменена на стандартную американскую, ввод символов при нажатой правой клавише Alt невозможен. Тем не менее большинство таких символов можно ввести соответствующими клавишами при нажатой клавише Shift. Изменение раскладки клавиатуры заблокировано VeraCrypt. Примечание: поскольку пароль требуется указывать ДО загрузки Windows, когда любые раскладки клавиатуры, отличные от американской, ещё недоступны, его нужно всегда вводить в стандартной американской раскладке. Важно учесть, что настоящая американская клавиатура НЕ нужна. VeraCrypt автоматически обеспечивает безопасный ввод пароля (прямо сейчас и на стадии перед загрузкой ОС), даже если у вас НЕ настоящая американская клавиатура. Прежде чем приступить к шифрованию раздела/диска, нужно создать диск восстановления VeraCrypt Rescue Disk (VRD), обеспечивающий следующее:\n\n- При повреждении загрузчика VeraCrypt, мастер-ключа или других критических данных, VRD позволяет их восстановить (при этом всё равно надо будет ввести правильный пароль).\n- При повреждении и невозможности загрузки Windows, VRD позволяет перманентно расшифровать раздел/диск перед запуском Windows.\n- VRD содержит резервную копию текущего содержимого первого цилиндра диска (в котором обычно находится системный загрузчик или менеджер загрузки) и позволяет восстановить его.\n\nISO-образ диска восстановления VeraCrypt будет создан тут: После нажатия OK будет запущено средство записи образов дисков Windows. Запишите с его помощью ISO-образ диска восстановления на CD/DVD.\n\nЗатем вернитесь в окно мастера создания томов VeraCrypt и следуйте инструкциям. Образ диска восстановления создан и сохранён в файле\n%s\n\nСейчас нужно записать (прожечь) этот образ на CD/DVD.\n\n%lsПосле записи диска нажмите 'Далее', чтобы проверить, корректно ли он был записан. Образ диска восстановления создан и сохранён в файле\n%s\n\nСейчас следует либо записать (прожечь) этот образ на CD/DVD, либо переместить его в безопасное место для использования в дальнейшем.\n\n%lsНажмите 'Далее' для продолжения. ВАЖНО: Файл-образ должен быть записан на CD/DVD как ISO-образ диска (а не как отдельный файл). О том, как это сделать, см. документацию на ПО для записи CD/DVD. Если у вас нет программы записи ISO-образов на CD/DVD, щёлкните по ссылке ниже, чтобы загрузить такое бесплатное ПО.\n\n Запустить средство записи образов дисков Windows ВНИМАНИЕ: Если ранее вы уже создавали диск восстановления VeraCrypt, то не сможете им воспользоваться снова для этого системного раздела/диска, так как он был создан для другого мастер-ключа! При каждом шифровании системного раздела/диска нужно создавать новый диск восстановления VeraCrypt, даже если используется тот же пароль. ОШИБКА: Невозможно сохранить параметры системного шифрования. Невозможно инициировать пре-тест системного шифрования. Невозможно начать создание скрытой операционной системы. Режим очистки На ряде перезаписываемых носителей перезаписанные данные можно восстановить с помощью спецтехник (магнитно-силовой микроскопии). Это относится и к данным, перезаписанным в зашифрованном виде (когда VeraCrypt шифрует незашифрованный системный раздел/диск). Восстановление перезаписанных данных можно предотвратить (или сильно осложнить) многократной перезаписью псевдослучайными или определёнными неслучайными данными. Если неприятель способен применить подобные методы для восстановления данных, которые вы собираетесь зашифровать, выберите один из режимов очистки (имеющиеся данные НЕ будут уничтожены). После шифрования раздела/диска очистка НЕ выполняется. Когда раздел/диск полностью зашифрован, никакие незашифрованные данные на него не записываются. Любые данные сначала шифруются на лету в памяти и лишь затем сохраняются (зашифрованными) на диске. На ряде перезаписываемых носителей перезаписанные данные (например, когда данные удалены) можно восстановить с помощью спецтехник (магнитно-силовой микроскопии). Восстановление перезаписанных данных можно предотвратить (или сильно осложнить) многократной перезаписью псевдослучайными или определёнными неслучайными данными. Если неприятель способен применить подобные техники для восстановления данных, которые должны быть удалены, выберите один из многопроходных режимов очистки.\n\nПримечание: чем больше проходов, тем дольше длится стирание данных. Очистка \nПримечание: вы можете прервать процесс очистки, выключить компьютер, снова запустить скрытую систему и затем продолжить очистку (этот мастер запустится автоматически). Однако в этом случае весь процесс очистки придётся начать сначала. \n\nПримечание: если прервать очистку, то затем при возобновлении её придётся выполнить с самого начала. Отменить очистку (затирание данных)? ВНИМАНИЕ: Содержимое всего выбранного раздела/устройства будет уничтожено. Всё содержимое раздела, где находится исходная система, будет уничтожено.\n\n(Всё содержимое стираемого раздела было скопировано в этот скрытый системный раздел.) ВНИМАНИЕ: Если выбрать, например, трёхпроходную очистку, время шифрования диска/раздела увеличится в четыре раза. Аналогично, при выборе 35-проходного режима время увеличится в 36 раз (и может составить несколько недель).\n\nУчтите, однако, что очистка НЕ выполняется после того, как раздел/диск зашифрован. Когда раздел/диск полностью зашифрован, никакие незашифрованные данные на него не записываются. Любые записываемые на него данные сначала шифруются на лету в памяти и только затем сохраняются (в зашифрованном виде) на диске (т.е. на производительности это НЕ отражается).\n\nВы действительно хотите использовать режим очистки? Нет (самый быстрый) 1 проход (случайные данные) 3 прохода (US DoD 5220.22-M) 7 проходов (US DoD 5220.22-M) 35 проходов ('Gutmann') 256 проходов Число операционных систем ВНИМАНИЕ: Неопытным пользователям не следует пытаться шифровать Windows в мультизагрузочных конфигурациях.\n\nПродолжить? При создании/использовании скрытой операционной системы VeraCrypt поддерживает мультизагрузочные конфигурации только при следующих условиях:\n\n- работающая сейчас ОС должна быть установлена на загрузочном диске, на котором не должно быть других операционных систем;\n\n- операционные системы, установленные на других дисках, не должны использовать загрузчик, находящийся на диске, где установлена текущая ОС.\n\nЭти условия соблюдены? VeraCrypt не поддерживает эту мультизагрузочную конфигурацию при создании/использовании скрытой операционной системы. Загрузочный диск Работающая сейчас операционная система установлена на загрузочном диске?\n\nПримечание: иногда Windows бывает установлена не на том диске, с которого она загружается (где находится загрузочный раздел). Если это ваш случай, то выберите 'Нет'. В настоящее время VeraCrypt не поддерживает шифрование операционной системы, которая загружается не с того же диска, на котором она установлена. Число системных дисков Сколько дисков содержит операционная система?\n\nНапример, если одна операционная система (скажем, Windows, macOS, Linux и т.д.) установлена на первичном диске, а другая на вторичном, выберите '2 или более'. В настоящее время VeraCrypt не поддерживает шифрование всего диска, который содержит несколько операционных систем.\n\nВозможные варианты:\n\n- Можно зашифровать одну из систем, если вернуться назад и выбрать шифрование только одного системного раздела (а не всего системного диска).\n\n- Можно зашифровать весь диск, если переместить некоторые системы на другие диски, оставив только одну ОС на диске, который хотите зашифровать. Несколько систем на одном диске На диске, где установлена текущая ОС, есть другие операционные системы?\n\nНапример, если текущая ОС установлена на диске #0, содержащем несколько разделов, и если на одном из разделов находится Windows, а на другом - ещё одна ОС (Windows, macOS, Linux и т.д.), то выберите 'Да'. Не-Windows загрузчик В главной загрузочной записи (MBR) установлен не относящийся к Windows загрузчик (или загрузочный менеджер)?\n\nНапример, если в первом цилиндре загрузочного диска содержится GRUB, LILO, XOSL или какой-то другой не относящийся к Windows загрузочный менеджер, выберите 'Да'. Мультизагрузка В настоящее время VeraCrypt не поддерживает мультизагрузочные конфигурации, где в главной загрузочной записи (MBR) установлен не относящийся к Windows загрузчик.\n\nВозможные варианты:\n\n- Если вы используете загрузочный менеджер для загрузки Windows и Linux, перенесите его (обычно это GRUB) из MBR в раздел. Затем запустите снова этот мастер и зашифруйте системный раздел/диск. Обратите внимание, что загрузчик VeraCrypt станет основным загрузочным менеджером и позволит запускать исходный загрузочный менеджер (скажем, GRUB) как вторичный (нажатием Esc при выводе экрана загрузчика VeraCrypt) и, таким образом, запускать Linux. Если текущая ОС установлена на загрузочном разделе, то после его шифрования потребуется ввести правильный пароль, даже для запуска незашифрованных Windows-систем (так как они будут совместно использовать один и тот же зашифрованный загрузчик Windows).\n\nНапротив, если текущая ОС не установлена на загрузочном разделе (или загрузчик Windows не используется никакими иными системами), тогда после шифрования этой системы не надо вводить пароль для запуска других незашифрованных систем, достаточно будет просто нажать Esc (в случае нескольких незашифрованных систем также потребуется выбрать нужную ОС в меню загрузчика VeraCrypt).\n\n(Как правило, в загрузочном разделе бывает установлена наиболее ранняя версия Windows.) Шифрование защищённой области пользователя (HPA) В конце многих дисков имеется область, в обычных условиях скрытая от операционной системы (её обычно называют защищённой областью пользователя - Host Protected Area). Однако некоторые программы способны читать и записывать данные в таких областях.\n\nВНИМАНИЕ: Производители компьютеров (в частности, ноутбуков) могут использовать области HPA для хранения в них утилит и данных для RAID, восстановления системы, её настройки, диагностики и пр. Если такие утилиты или данные должны быть доступны перед загрузкой системы, скрытую область НЕ следует шифровать (выберите 'Нет').\n\nХотите, чтобы VeraCrypt обнаружила и зашифровала скрытую область (если таковая имеется) в конце системного диска? Тип шифрования системы Выберите эту опцию, чтобы просто зашифровать системный раздел или весь системный диск. Может так случиться, что вас вынудят расшифровать ОС. Порой вы просто не сможете от этого отказаться (например при вымогательстве). Эта опция позволяет создать скрытую ОС, наличие которой должно быть невозможно определить (при условии соблюдения указанных ниже рекомендаций). Таким образом, не придётся расшифровывать скрытую ОС или выдавать от неё пароль. Чтобы узнать подробности, щёлкните по ссылке ниже. Может так случиться, что вас вынудят расшифровать ОС. Порой вы просто не сможете от этого отказаться (например при вымогательстве).\n\nC помощью этого мастера можно создать скрытую операционную систему, наличие которой должно быть невозможно определить (при условии соблюдения указанных ниже рекомендаций). Таким образом, не придётся расшифровывать скрытую ОС или выдавать от неё пароль. Скрытая операционная система Сейчас вы создадите два тома (внешний и скрытый) в разделе, следующим за системным. Скрытый том будет содержать скрытую ОС, создаваемую копированием в него содержимого системного раздела (где установлена работающая сейчас ОС). Во внешний том нужно скопировать осмысленно выглядящие файлы, которые на самом деле вам прятать НЕ требуется, чтобы обмануть того, кто вынудит вас сообщить пароль от скрытого системного раздела (вы сообщите пароль для внешнего тома внутри скрытого системного раздела, наличие же скрытой ОС останется в тайне).\n\nА на системный раздел с работающей сейчас ОС вы установите новую, так называемую 'обманную' ОС и зашифруете её. В ней не должно быть конфиденциальных файлов, она нужна, если вас вынудят сообщить дозагрузочный пароль. В итоге будет три пароля. Два из них (для обманной ОС и внешнего тома) можно сообщать неприятелю. Третий пароль - для запуска скрытой ОС. Поиск скрытых секторов Подождите, идёт поиск скрытых секторов в конце системного диска. Это может занять продолжительное время.\n\nПримечание: в очень редких случаях на некоторых ПК во время этой операции система может перестать реагировать. Если это произошло, перезагрузите ПК, запустите VeraCrypt, повторите предыдущие этапы, но пропустите данный этап поиска. Эта проблема вызвана не ошибкой в VeraCrypt. Область шифрования Выберите эту опцию, чтобы зашифровать весь диск, где установлена работающая сейчас Windows. Будет зашифрован весь диск, включая все его разделы, кроме первой дорожки, где находится загрузчик VeraCrypt. Для доступа к установленной на этом диске ОС или файлам на нём потребуется вводить пароль перед каждой загрузкой системы. Эту опцию нельзя применять для шифрования второго или внешнего диска, если Windows на нём не установлена или загружается не с него. Сбор случайных данных Сгенерированные ключи Не удалось найти подключённый к ПК пишущий CD/DVD-накопитель, необходимый для записи загрузочного диска восстановления (VeraCrypt Rescue Disk) с копией ключей шифрования, загрузчика VeraCrypt, исходного системного загрузчика и др.\n\nНастоятельно рекомендуется записать диск восстановления VeraCrypt. Пишущего CD/DVD-накопителя нет, но я сохраню ISO-образ диска восстановления на сменном носителе (например на флэшке). Я подключу пишущий CD/DVD-накопитель позже. Сейчас я хочу прервать процесс. Пишущий CD/DVD-накопитель сейчас подключён к ПК. Продолжить и записать диск восстановления. Сделайте следующее:\n\n1) Подключите к ПК сменный накопитель (например флэшку).\n\n2) Скопируйте на сменный накопитель файл-образ (%s) диска восстановления VeraCrypt.\n\nЕсли в будущем вам понадобится диск восстановления VeraCrypt, вы просто подключите сменный накопитель (с образом диска восстановления VeraCrypt) к ПК с пишущим CD/DVD-накопителем и запишете этот образ на CD или DVD. ВАЖНО: Файл-образ диска восстановления VeraCrypt нужно записать на CD/DVD как ISO-образ диска (а не как обычный файл). Запись диска восстановления Диск восстановления создан Пре-тест шифрования системы Диск восстановления проверен \nДиск восстановления VeraCrypt (Rescue Disk) успешно прошёл проверку. Извлеките его из накопителя и уберите в надёжное место.\n\nНажмите 'Далее' для продолжения. ВНИМАНИЕ: Во время следующих этапов в накопителе НЕ должно быть диска восстановления VeraCrypt, иначе эти этапы не удастся корректно завершить.\n\nИзвлеките диск восстановления из накопителя и поместите в надёжное место. Затем нажмите OK. Внимание! Вследствие технических ограничений дозагрузочной среды, сообщения, выводимые VeraCrypt на этом этапе (т.е. до старта Windows), не подлежат локализации. Интерфейс загрузчика VeraCrypt - полностью на английском языке.\n\nПродолжить? Прежде чем зашифровать системный раздел или диск, необходимо проверить, что всё работает должным образом.\n\nПосле нажатия 'Тест' будут установлены все необходимые компоненты (например дозагрузочный аутентификатор, т.е. загрузчик VeraCrypt), и компьютер перезагрузится. Затем на экране загрузчика (VeraCrypt Boot Loader), который появится до старта Windows, вам потребуется ввести свой пароль. Результаты этого предварительного теста будут автоматически показаны после запуска Windows.\n\nБудет изменено следующее устройство: Диск #%d\n\n\nЕсли сейчас нажать 'Отмена', то ничего установлено не будет, и пре-тест не станет выполняться. ВАЖНЫЕ ЗАМЕЧАНИЯ -- ПРОЧИТАЙТЕ ИЛИ РАСПЕЧАТАЙТЕ (нажмите 'Печать'):\n\nНикакие файлы не будут зашифрованы, пока вы не перезагрузите успешно ПК и не запустите Windows. Поэтому если произойдёт какой-то сбой, с вашими данными ничего не случится. Однако если что-то пойдёт не так, возможны сложности с запуском Windows. Поэтому прочитайте (и по возможности распечатайте) следующие рекомендации о том, что делать, если Windows отказывается запускаться после перезагрузки ПК.\n\n Что делать, если Windows не загружается\n------------------------------------------------\n\nПРИМЕЧАНИЕ: Эти инструкции действительны, только если не было начато шифрование.\n\n- Если вы вводите правильный пароль, а Windows не загружается (или при вводе правильного пароля VeraCrypt раз за разом сообщает, что пароль неверный), не паникуйте. Перезагрузите (выключите и включите) ПК и при появлении экрана загрузчика VeraCrypt нажмите Esc (а если у вас несколько ОС, то выберите нужную). После этого Windows должна запуститься (если она не зашифрована), а VeraCrypt автоматически спросит, нужно ли удалить компонент дозагрузочной аутентификации. Внимание: предыдущие шаги НЕ работают, если системный раздел/диск зашифрован (без правильного пароля никто не может запустить Windows или получить доступ к зашифрованным данным, даже если выполнит предыдущие этапы).\n\n - Если вышесказанное не помогает или экран загрузчика VeraCrypt не появляется (перед стартом Windows), вставьте в CD/DVD-накопитель диск восстановления VeraCrypt (Rescue Disk) и перезагрузите ПК. Если экран загрузчика VeraCrypt не появляется (или нет пункта 'Repair Options' в группе 'Keyboard Controls' на экране загрузчика VeraCrypt), возможно, в BIOS вашего ПК настроена загрузка сначала с жёсткого диска, и лишь затем с CD/DVD. Если это так, перезагрузите ПК, нажмите F2 или Delete (как только увидите начальный экран BIOS) и дождитесь появления экрана с настройками BIOS. Если этот экран не появился, снова перезагрузите ПК (нажмите кнопку Reset), сразу же начав часто нажимать клавиши F2 или Delete. В появившемся экране настроек BIOS сконфигурируйте ПК так, чтобы он сначала загружался с CD/DVD (о том, как это сделать, см. в документации на вашу системную плату/BIOS). Снова перезагрузите компьютер. Сейчас должен появиться экран диска восстановления VeraCrypt. На этом экране выберите 'Repair Options', нажав клавишу F8. В меню 'Repair Options' выберите 'Restore original system loader'. После этого извлеките диск восстановления из CD/DVD-накопителя и перезагрузите ПК. Сейчас Windows должна запуститься нормально (при условии, что она не зашифрована).\n\n Внимание: предыдущие шаги НЕ работают, если системный раздел/диск зашифрован (без правильного пароля никто не может запустить Windows или получить доступ к зашифрованным данным, даже если выполнит предыдущие этапы).\n\n\nЕсли вы потеряете диск восстановления, а его найдёт неприятель, то он НЕ сможет с помощью этого диска расшифровать системный раздел или диск, если не знает правильного пароля. Пре-тест выполнен Пре-тест успешно завершён.\n\nВНИМАНИЕ: Если во время шифрования произойдёт сбой питания или из-за программной/аппаратной ошибки зависнет операционная система в то время, как VeraCrypt шифрует имеющиеся данные 'на месте', некоторые из них окажутся повреждёнными или утерянными. Поэтому прежде чем начать шифрование, убедитесь, что сделали резервную копию файлов, которые собираетесь зашифровать. Если нет, то сделайте это сейчас (нажмите 'Отложить', скопируйте файлы, затем в любое время снова запустите VeraCrypt, выберите 'Система' > 'Возобновить прерванный процесс', чтобы начать шифрование).\n\nКогда будете готовы, нажмите 'Шифрация', чтобы приступить к шифрованию. Вы можете в любой момент нажать 'Пауза' или 'Отложить', прервав (де)шифрование, выйти из этого мастера, перезагрузить или выключить ПК, а затем продолжить процесс (он возобновится с той точки, где был приостановлен). Для предотвращения замедления, когда система или приложения выполняют чтение или запись на системном диске, VeraCrypt ждёт, пока данные будут записаны или прочтены (см. статус выше), а затем продолжает (де)шифрование. \n\nВы можете в любой момент нажать 'Пауза' или 'Отложить', прервав шифрование, выйти из этого мастера, перезагрузить или выключить ПК, а затем продолжить процесс (он возобновится с той точки, где был приостановлен). Учтите, что том нельзя смонтировать, пока он не будет полностью зашифрован. \n\nВы можете в любой момент нажать 'Пауза' или 'Отложить', прервав дешифрование, выйти из этого мастера, перезагрузить или выключить ПК, а затем продолжить процесс (он возобновится с той точки, где был приостановлен). Учтите, что том нельзя смонтировать, пока он не будет полностью расшифрован. Скрытая система запущена Исходная система Windows создаёт на системном разделе (обычно без вашего ведома или согласия) различные файлы журналов, временные файлы и т.п. Кроме того, там же сохраняются содержимое ОЗУ для сна/гибернации и файлы подкачки. Поэтому если неприятель проанализирует файлы на разделе с исходной системой (клоном которой является скрытая ОС), он может узнать, например, что вы пользовались мастером VeraCrypt в режиме создания скрытой системы (и заподозрить наличие в ПК скрытой ОС).\n\nЧтобы это предотвратить, на следующих этапах VeraCrypt надёжно сотрёт всё содержимое раздела, где находится исходная система. Затем для правдоподобности отрицания причастности вам потребуется установить в раздел новую систему и зашифровать её. Таким образом, вы создадите обманную ОС, и на этом процесс создания скрытой ОС будет завершён. Скрытая ОС успешно создана. Но прежде чем её можно будет использовать (и иметь возможность правдоподобного отрицания причастности), требуется надёжно удалить (с помощью VeraCrypt) всё содержимое раздела, в котором сейчас установлена текущая ОС. Прежде чем это сделать, перезагрузите ПК и на экране загрузчика VeraCrypt (выводимого до старта Windows) введите пароль дозагрузочной аутентификации для скрытой ОС. Затем после старта скрытой системы автоматически запустится мастер VeraCrypt.\n\nПримечание: если сейчас прервать создание скрытой ОС, то возобновить этот процесс НЕ удастся, и скрытая ОС окажется недоступна (так как будет удалён загрузчик VeraCrypt). Вы запланировали создание скрытой операционной системы. Этот процесс ещё не закончен. Чтобы его завершить, нужно перезагрузить компьютер и на экране загрузчика VeraCrypt (он появляется перед запуском Windows) ввести пароль для скрытой операционной системы.\n\nПримечание: если вы решите прервать сейчас процесс создания скрытой ОС, то уже НЕ сможете его возобновить. Перезагрузить ПК и продолжить Окончательно прервать создание скрытой ОС Ничего не делать сейчас, спросить позже \nПО ВОЗМОЖНОСТИ РАСПЕЧАТАЙТЕ ЭТОТ ТЕКСТ (нажмите 'Печать' ниже).\n\n\nКак и когда использовать диск восстановления VeraCrypt (после шифрования) -----------------------------------------------------------------------------------\n\n I. Как загрузиться с диска восстановления VeraCrypt\n\nЧтобы воспользоваться диском восстановления VeraCrypt (Rescue Disk), вставьте его в CD/DVD-накопитель и перезагрузите ПК. Если экран загрузочного диска VeraCrypt не появляется (или если на экране нет пункта 'Repair Options' в группе 'Keyboard Controls'), вероятно, в BIOS компьютера настроена загрузка сначала с жёстких дисков, и лишь затем с CD/DVD-накопителей. Если это так, перезагрузите ПК, нажмите F2 или Delete (как только увидите начальный экран BIOS) и дождитесь появления экрана настроек BIOS. Если он не появился, снова перезагрузите ПК (нажмите кнопку Reset) и сразу же начинайте постоянно нажимать F2 или Delete. Когда появится экран настроек BIOS, сконфигурируйте ПК так, чтобы он сначала загружался с CD/DVD-накопителя (о том, как это сделать, см. в документации на вашу системную плату или BIOS). Затем перезагрузите компьютер. Теперь экран диска восстановления VeraCrypt должен появиться. Примечание: на экране диска восстановления VeraCrypt можно выбрать 'Repair Options', нажав F8 на клавиатуре.\n\n\n II. Когда и как использовать диск восстановления VeraCrypt (после шифрования)\n\n 1) Если после старта ПК экран загрузчика VeraCrypt не появляется (или не загружается Windows), возможно, повреждён загрузчик VeraCrypt. Диск восстановления VeraCrypt позволяет восстановить его и, таким образом, вновь получить доступ к зашифрованной системе и данным (однако всё равно нужно будет ввести правильный пароль). На экране Rescue Disk выберите 'Repair Options' > 'Restore VeraCrypt Boot Loader'. Затем нажмите 'Y', чтобы подтвердить действие, выньте диск восстановления из CD/DVD-накопителя и перезагрузите компьютер.\n\n 2) Если вы вводите правильный пароль, а VeraCrypt говорит, что он неверный, возможно, повреждены мастер-ключ или другие важные данные. Диск восстановления VeraCrypt позволяет восстановить их и, таким образом, вновь получить доступ к зашифрованной системе и данным (однако всё равно нужно будет ввести правильный пароль). На экране Rescue Disk выберите 'Repair Options' > 'Restore key data'. Затем введите свой пароль, нажмите 'Y' для подтверждения действия, выньте диск восстановления из CD/DVD-накопителя и перезагрузите компьютер.\n\n 3) Если загрузчик VeraCrypt повреждён или инфицирован вирусом, вы можете избежать его выполнения, загрузившись непосредственно с диска восстановления VeraCrypt. Вставьте диск восстановления в CD/DVD-накопитель и затем введите свой пароль на экране Rescue Disk.\n\n 4) Если Windows повреждена и не запускается, то с помощью диска восстановления VeraCrypt можно перманентно расшифровать раздел/диск до запуска Windows. На экране Rescue Disk выберите 'Repair Options' > 'Permanently decrypt system partition/drive'. Затем введите правильный пароль и дождитесь завершения дешифрования. После этого вы можете, например, загрузиться с установочного CD/DVD-диска Windows и восстановить Windows.\n\n Альтернативный вариант: если Windows повреждена (не запускается), и вам нужно её восстановить (или получить доступ к её файлам), дешифрования системного раздела/диска можно избежать, выполнив следующее. Если в компьютере установлено несколько операционных систем, загрузите ту из них, которая не требует дозагрузочной аутентификации. Если нескольких ОС нет, то можно загрузиться с CD/DVD с WinPE или BartPE, либо подключить системный диск как вторичный или внешний накопитель к другому компьютеру и загрузить установленную на этом ПК операционную систему. После того как система загрузится, запустите VeraCrypt, нажмите кнопку 'Устройство', выберите неисправный системный раздел, нажмите OK, выберите 'Система' > 'Смонтировать без дозагрузочной аутентификации', введите свой пароль для дозагрузочной аутентификации и нажмите OK. Раздел будет смонтирован как обычный том VeraCrypt (данные будут как обычно расшифровываться/шифроваться 'на лету' в ОЗУ при доступе к ним).\n\n\n Обратите внимание, что если вы потеряете свой диск восстановления VeraCrypt, а ваш неприятель его найдёт, он НЕ сможет с помощью этого диска расшифровать системный раздел или диск, если не знает правильного пароля. \n\nВ А Ж Н О -- ПО ВОЗМОЖНОСТИ РАСПЕЧАТАЙТЕ ЭТОТ ТЕКСТ (нажмите 'Печать').\n\n\nПримечание: этот текст отображается автоматически при каждом запуске скрытой системы, пока не будет создана обманная ОС.\n\n\n Как надёжно и безопасно создать обманную систему ----------------------------------------------------------------------------\n\nЧтобы добиться правдоподобного отрицания причастности, вам нужно создать сейчас обманную операционную систему. Для этого выполните следующее:\n\n 1) В целях безопасности выключите компьютер и не включайте его хотя бы несколько минут (чем дольше, тем лучше). Это нужно для очистки памяти, содержащей конфиденциальные данные. Затем включите ПК, но не загружайте скрытую систему.\n\n 2) Установите Windows в раздел, содержимое которого было удалено (т.е. в раздел, где была исходная ОС, клоном которой стала скрытая система).\n\nВАЖНО: КОГДА ВЫ НАЧНЁТЕ УСТАНАВЛИВАТЬ ОБМАННУЮ ОС, ЗАГРУЗКА СКРЫТОЙ СИСТЕМЫ СТАНЕТ *НЕВОЗМОЖНОЙ* (так как загрузчик VeraCrypt будет стёрт установщиком Windows). ЭТО НОРМАЛЬНАЯ СИТУАЦИЯ, ТАК И ДОЛЖНО БЫТЬ. НЕ ПАНИКУЙТЕ. ВЫ СМОЖЕТЕ СНОВА ЗАГРУЖАТЬ СКРЫТУЮ ОС, КАК ТОЛЬКО ПРИСТУПИТЕ К ШИФРОВАНИЮ ОБМАННОЙ СИСТЕМЫ (поскольку VeraCrypt затем автоматически установит свой загрузчик на системный диск).\n\nВАЖНО: Размер раздела с обманной ОС должен оставаться таким же, как и размер скрытого тома (это условие сейчас соблюдено). Более того, нельзя создавать никаких разделов между разделами с обманной и скрытой системами.\n\n 3) Загрузите обманную ОС (установленную на этапе 2) и установите в ней VeraCrypt.\n\nПомните, что обманная ОС не должна содержать никаких конфиденциальных данных.\n\n 4) В обманной ОС запустите VeraCrypt и выберите 'Система' > 'Зашифровать системный раздел/диск'. Должно появиться окно мастера создания томов VeraCrypt.\n\nСледующие шаги относятся к этому мастеру.\n\n 5) В окне мастера создания томов НЕ выбирайте опцию 'Скрытый'. Оставьте опцию 'Обычный' и нажмите 'Далее'.\n\n 6) Выберите опцию 'Зашифровать системный раздел Windows' и нажмите 'Далее'.\n\n 7) Если в ПК установлены только скрытая и обманная системы, выберите опцию 'Одиночная загрузка' (если помимо этих двух систем в ПК есть другие ОС, выберите 'Мультизагрузка'). Нажмите 'Далее'.\n\n 8) ВАЖНО: На этом этапе, ДЛЯ ОБМАННОЙ ОС, ВЫ ДОЛЖНЫ ВЫБРАТЬ ТЕ ЖЕ АЛГОРИТМЫ ШИФРОВАНИЯ И ХЕШИРОВАНИЯ, ЧТО И ДЛЯ СКРЫТОЙ СИСТЕМЫ! ИНАЧЕ СКРЫТАЯ СИСТЕМА БУДЕТ НЕДОСТУПНА! Иными словами, обманная ОС должна быть зашифрована тем же алгоритмом, что и скрытая ОС. Причина этого требования в том, что обманная и скрытая системы используют один и тот же загрузчик, поддерживающий только один алгоритм, выбранный пользователем (для каждого алгоритма есть свой загрузчик VeraCrypt).\n\n 9) Выберите пароль для обманной ОС. Это пароль, который можно выдать неприятелю, если вас вынудят сообщить пароль дозагрузочной аутентификации (также можно сообщить пароль для внешнего тома). Существование третьего пароля (т.е. пароля дозагрузочной аутентификации для скрытой ОС) останется тайной.\n\nВАЖНО: Пароль для обманной ОС должен существенно отличаться от пароля для скрытого тома (т.е. для скрытой ОС).\n\n 10) Следуйте инструкциям мастера для шифрования обманной ОС.\n\n\n\n После создания обманной системы ------------------------------------------------\n\nПо окончании шифрования обманной ОС процесс создания скрытой ОС будет завершён, и вы сможете пользоваться тремя паролями:\n\n1) Пароль дозагрузочной аутентификации для скрытой ОС.\n\n2) Пароль дозагрузочной аутентификации для обманной ОС.\n\n3) Пароль для внешнего тома.\n\n Если вы хотите запустить скрытую ОС, нужно просто ввести пароль для скрытой ОС на экране загрузчика VeraCrypt (который появляется при включении или перезагрузке ПК).\n\nЕсли вам нужно загрузить обманную ОС, введите пароль для обманной ОС на экране загрузчика VeraCrypt.\n\nПароль для обманной ОС можно сообщать всякому, кто потребует выдать пароль дозагрузочной аутентификации. Наличие скрытого тома (и скрытой ОС) останется в секрете.\n\n Третий пароль (для внешнего тома) можно сообщать всякому, кто потребует выдать пароль для первого раздела, следующего за системным, где находятся внешний и скрытый тома (со скрытой ОС). Существование скрытого тома (и скрытой ОС) останется секретом.\n\n\n Если вы сообщите неприятелю пароль от обманной ОС, и он спросит, почему свободное место на (обманном) системном разделе содержит случайные данные, вы сможете, например, ответить: 'Этот раздел раньше содержал систему, зашифрованную VeraCrypt, но я забыл(а) пароль дозагрузочной аутентификации (или система повредилась и перестала загружаться), поэтому мне пришлось переустановить Windows и снова зашифровать раздел'.\n\n\n Если выполнены все инструкции и учтены меры предосторожности из главы 'Требования безопасности и меры предосторожности касательно скрытых томов' в Руководстве пользователя VeraCrypt, определить наличие скрытого тома и скрытой ОС должно быть невозможно, даже если смонтирован внешний том или расшифрована/запущена обманная ОС.\n\nЕсли вы сохраните или распечатаете копию этого текста (что настоятельно рекомендуется сделать, если только принтер не хранит копии заданий на своём внутреннем накопителе), то, создав обманную систему и убедившись, что вы поняли всё, что тут написано, все копии данного текста следует уничтожить (иначе если такую копию обнаружат, это может навести на мысль о наличии в ПК скрытой ОС).\n\n ВНИМАНИЕ: ЕСЛИ ВЫ НЕ ЗАЩИТИЛИ СКРЫТЫЙ ТОМ (см. главу 'Защита скрытых томов от повреждений' в Руководстве пользователя VeraCrypt), НЕ ВЫПОЛНЯЙТЕ ЗАПИСЬ ВО ВНЕШНИЙ ТОМ (обратите внимание, что обманная ОС установлена НЕ во внешнем томе). ИНАЧЕ ВЫ МОЖЕТЕ ПЕРЕЗАПИСАТЬ И ПОВРЕДИТЬ СКРЫТЫЙ ТОМ (И СКРЫТУЮ ОС ВНУТРИ НЕГО)! Клонирование ОС На следующих этапах VeraCrypt создаст скрытую ОС, скопировав содержимое системного раздела в скрытый том (копируемые данные шифруются 'на лету' с ключом, отличным от используемого для обманной ОС).\n\nУчтите, что процесс выполняется на дозагрузочной стадии (до запуска Windows) и может занять много времени (несколько часов или даже дней, в зависимости от размера системного раздела и быстродействия ПК).\n\nВы сможете прервать этот процесс, выключить ПК, запустить ОС и затем возобновить его. Однако в случае прерывания, копирование системы придётся начать сначала (так как при клонировании содержимое системного раздела не должно изменяться). Отменить весь процесс создания скрытой операционной системы?\n\nПри отмене вы НЕ сможете затем продолжить процесс. Отменить пре-тест шифрования системы? Пре-тест шифрования системы не пройден. Повторить попытку?\n\nПри выборе 'Нет' компонент дозагрузочной аутентификации будет удалён.\n\nПримечания:\n\n- Если загрузчик VeraCrypt не просил ввести пароль перед стартом Windows, возможно, ОС загружается не с того диска, на котором она установлена. Такая конфигурация не поддерживается.\n\n- Если используется отличный от AES алгоритм шифрования, и пре-тест выдаёт ошибку (и вы ввели пароль), причина может быть в некорректном драйвере. Выберите 'Нет' и попробуйте снова зашифровать системный раздел/диск, но используя AES (у этого алгоритма наименьшие требования к памяти).\n\n- Другие причины и решения см. здесь: https://www.veracrypt.fr/en/Troubleshooting.html Похоже, системный раздел/диск не зашифрован (ни частично, ни полностью). Системный раздел/диск зашифрован (частично или полностью).\n\nПрежде чем продолжить, полностью расшифруйте системный раздел/диск. Чтобы это сделать, выберите в главном окне VeraCrypt меню 'Система' > 'Перманентно расшифровать системный раздел/диск'. Если системный раздел/диск зашифрован (частично или полностью), нельзя устанавливать VeraCrypt более старой версии (но можно более новую или ту же версию). Сейчас выполняется (де)шифрование или другая модификация системного раздела/диска. Прежде чем продолжить, прервите процесс шифрования/дешифрования/модификации (или дождитесь его окончания). В системе уже запущена копия мастера создания томов VeraCrypt, она выполняет или подготавливает (де)шифрование системного раздела/диска. Прежде чем продолжить, дождитесь завершения работы мастера или закройте его. Если закрыть окно мастера не удаётся, перезагрузите ПК и продолжите. (Де)шифрование системного раздела/диска не завершено. Прежде чем продолжить, дождитесь завершения этого процесса. ОШИБКА: Шифрование раздела/диска не было завершено. Сначала его нужно завершить. ОШИБКА: Шифрование раздела/тома не было завершено. Сначала его нужно завершить.\n\nПримечание: чтобы возобновить процесс, выберите команду 'Тома' > 'Продолжить прерванный процесс' в меню главного окна VeraCrypt. Пароль правильный. Программа VeraCrypt успешно расшифровала заголовок тома и обнаружила, что это скрытый системный том. Однако изменить заголовок скрытого системного тома таким способом нельзя.\n\nЧтобы изменить пароль скрытого системного тома, загрузите ОС, расположенную в скрытом томе, после чего в главном окне VeraCrypt выберите в меню 'Система' > 'Изменить пароль'.\n\nЧтобы установить алгоритм формирования ключа заголовка, загрузите скрытую ОС и выберите 'Система' > 'Установить алгоритм формирования ключа заголовка'. VeraCrypt не поддерживает дешифрование скрытого системного раздела 'на месте'.\n\nПримечание: если вы хотите расшифровать обманный системный раздел, загрузите обманную ОС, после чего выберите в главном окне VeraCrypt меню 'Система' > 'Перманентно расшифровать системный раздел/диск'. ОШИБКА: Неверный/недопустимый параметр. Вы выбрали раздел или устройство, но выбранный режим мастера подходит только для файловых контейнеров.\n\nХотите изменить режим мастера? Хотите вместо этого создать файловый контейнер VeraCrypt? Вы указали системный раздел/диск (или загрузочный раздел), но выбранный режим мастера подходит только для несистемных разделов/дисков.\n\nХотите установить дозагрузочную аутентификацию (т.е. нужно будет вводить пароль перед каждым запуском Windows) и зашифровать систему/раздел? Вы действительно хотите перманентно расшифровать системный раздел/диск? ОСТОРОЖНО: Если перманентно расшифровать системный раздел/диск, данные на него будут записываться в незашифрованном виде.\n\nВы действительно хотите перманентно расшифровать системный раздел/диск? Вы действительно хотите перманентно расшифровать этот том? ОСТОРОЖНО: Если перманентно расшифровать том VeraCrypt, данные на диск будут записываться в незашифрованном виде.\n\nВы действительно хотите перманентно расшифровать выбранный том? ВНИМАНИЕ: При каскадном шифровании системы возможны следующие затруднения:\n\n1) Так как загрузчик VeraCrypt больше стандартного, на первой дорожке диска недостаточно места для резервирования его копии. Поэтому если загрузчик VeraCrypt окажется повреждён (что часто случается, например, при активации некоторых некорректно написанных программ), потребуется диск восстановления (VeraCrypt Rescue Disk), чтобы загрузиться с него или исправить загрузчик VeraCrypt.\n\n2) На некоторых компьютерах выход из состояния сна/гибернации происходит дольше обычного.\n\nЭтих потенциальных проблем можно избежать, если выбрать некаскадный алгоритм шифрования (например AES).\n\nВы настаиваете на использовании каскадного шифрования? Если вы столкнулись с любой из ранее описанных проблем, расшифруйте раздел/диск (если он зашифрован), после чего попробуйте зашифровать его снова, используя некаскадный алгоритм шифрования (например AES). ВНИМАНИЕ: В целях безопасности и надёжности следует обновить VeraCrypt в обманной операционной системе, прежде чем вы обновите его в скрытой ОС.\n\nЧтобы это сделать, загрузите обманную ОС и запустите в ней установщик VeraCrypt. Затем загрузите скрытую систему и также запустите установщик ещё и оттуда.\n\nПримечание: обманная и скрытая системы используют один и тот же загрузчик. Если вы обновите VeraCrypt только на скрытой системе (но не на обманной), в обманной системе могут остаться драйвер и приложения VeraCrypt, чьи версии будут отличаться от версии загрузчика VeraCrypt. Такое различие может свидетельствовать о присутствии в данном ПК скрытой операционной системы.\n\n\nХотите продолжить? Номер версии загрузчика VeraCrypt, с помощью которого была загружена эта ОС, отличается от номера версии драйвера и приложений VeraCrypt, установленных в этой системе.\n\nВам следует запустить установщик VeraCrypt (той же версии, что и у загрузчика VeraCrypt), чтобы обновить VeraCrypt в этой операционной системе. Номер версии загрузчика VeraCrypt, с помощью которого загружена эта ОС, отличается от номера версии драйвера VeraCrypt (и приложений VeraCrypt) в этой системе. Более старые версии могут содержать ошибки, которых в новых версиях уже нет.\n\nЕсли вы не загружались с диска восстановления VeraCrypt, следует переустановить VeraCrypt или обновить до новейшей стабильной версии (при этом загрузчик также будет обновлён).\n\nЕсли вы загружались с диска восстановления VeraCrypt, следует обновить его ('Система' > 'Создать диск восстановления'). Загрузчик VeraCrypt обновлён.\n\nНастоятельно рекомендуется создать новый диск восстановления VeraCrypt (Rescue Disk), который будет содержать новую версию загрузчика VeraCrypt. Для этого после перезагрузки ПК выберите меню 'Система' > 'Создать диск восстановления'. Загрузчик VeraCrypt обновлён.\n\nНастоятельно рекомендуется загрузить обманную операционную систему и затем создать новый диск восстановления VeraCrypt (который будет содержать новую версию загрузчика VeraCrypt). Для этого выберите меню 'Система' > 'Создать диск восстановления'. Ошибка обновления загрузчика VeraCrypt. VeraCrypt не может определить настоящий размер системного диска, поэтому будет использовать размер, сообщённый операционной системой (он может быть меньше реального размера). Примечание: это не ошибка в VeraCrypt. ВНИМАНИЕ: Похоже, программа VeraCrypt уже пыталась обнаружить скрытые сектора на этом системном диске. Если во время предыдущей попытки обнаружения вы столкнулись с какими-то проблемами, то можете сейчас их избежать, пропустив поиск скрытых секторов. Обратите внимание, что в этом случае VeraCrypt будет использовать размер, сообщаемый операционной системой (он может быть меньше действительного размера диска).\n\nЭто происходит не из-за какой-либо ошибки в VeraCrypt. Не выполнять поиск скрытых секторов (использовать размер, сообщённый ОС) Попробовать найти скрытые сектора ещё раз ОШИБКА: Не удаётся прочитать сектора на диске (вероятно, из-за физического дефекта).\n\nШифрование 'на месте' может быть продолжено, только когда сектора снова будут доступны для чтения. VeraCrypt может попытаться сделать эти сектора читабельными, записав в них нули (впоследствии такие содержащие нули блоки будут зашифрованы). Данные в нечитаемых секторах при этом будут утеряны. Если вы хотите этого избежать, попробуйте хотя бы частично восстановить повреждённые данные с помощью соответствующих программ сторонних фирм.\n\nПримечание: если сектора повреждены физически (в отличие от простой порчи данных и ошибок контрольных сумм), большинство устройств хранения информации внутренне перераспределяют сектора при попытке записать в них данные (поэтому имеющиеся данные в повреждённых секторах могут оставаться на диске незашифрованными).\n\nЗаполнить нулями нечитаемые сектора? ОШИБКА: Невозможно прочитать содержимое одного или нескольких секторов диска (вероятно, из-за физического дефекта).\n\nЧтобы продолжить шифрование, VeraCrypt отбросит содержимое нечитаемых секторов (оно будет заменено псевдослучайными данными). Прежде чем продолжить, вы можете попытаться хотя бы частично восстановить повреждённые данные с помощью соответствующих программ сторонних фирм.\n\nОтбросить данные в нечитаемых секторах? Примечание: содержимое %I64d нечитаемых секторов (%s) заменено зашифрованными блоками с обычным заполненным нулями текстом. Примечание: содержимое %I64d нечитаемых секторов (%s) заменено псевдослучайными данными. Введите пароль/PIN для токена '%s': Чтобы обеспечить VeraCrypt доступ к токену безопасности\nили смарт-карте, сначала нужно установить программную библиотеку PKCS #11 для токена\nили смарт-карты. Эта библиотека может поставляться вместе с устройством,\nлибо она имеется на сайте поставщика или сторонней фирмы.\nУстановив библиотеку, вы можете выбрать её вручную, нажав 'Библиотека',\nлибо позволить VeraCrypt найти её автоматически, нажав 'Автоопределение библиотеки' (поиск выполняется только в системной папке Windows). ПРИМЕЧАНИЕ: Имя и расположение файла библиотеки PKCS #11\nдля токена или смарт-карты см. в документации к токену,\nсмарт-карте или ПО сторонних фирм.\n\nНажмите OK, чтобы выбрать путь и имя файла. Чтобы обеспечить VeraCrypt доступ к токену безопасности\nили смарт-карте, сначала нужно выбрать программную библиотеку\nPKCS #11 для токена/карты.\nДля этого выберите в меню 'Настройки' > 'Токены безопасности'. Ошибка инициализации библиотеки PKCS #11 для токена безопасности.\n\nУбедитесь, что указанные путь и имя файла действительно ссылаются на библиотеку PKCS #11. Чтобы указать путь и имя библиотеки PKCS #11, выберите в меню 'Настройки' > 'Токены безопасности'. В системной папке Windows библиотека PKCS #11 не обнаружена.\n\nПроверьте, установлена ли библиотека PKCS #11 для вашего токена безопасности (или смарт-карты).\nЭта библиотека может поставляться вместе с токеном/картой или же доступна на сайте производителя/сторонней фирмы.\nЕсли библиотека установлена в папке, отличной от системной папки Windows, нажмите кнопку 'Библиотека' и выберите её\n(например, это может быть папка, где установлено ПО для токена/карты). Токен безопасности не обнаружен.\n\nУбедитесь, что токен подключён к ПК, и для него установлен корректный драйвер. Ключевой файл токена безопасности не обнаружен. Ключевой файл токена безопасности с таким именем уже существует. Удалить выбранные файлы? Неверный путь к ключевому файлу токена безопасности. Ошибка токена безопасности Неверный пароль для токена безопасности. В токене безопасности недостаточно памяти для выполнения запрошенной операции.\n\nЕсли вы пытаетесь импортировать ключевой файл, выберите файл меньшего размера или используйте ключевой файл, сгенерированный VeraCrypt (выберите 'Сервис' > 'Генератор ключевых файлов'). Все открытые токен-сессии были закрыты. Выберите ключевые файлы токена безопасности Слот Токен Имя файла ВАЖНО: Учтите, что пароли дозагрузочной аутентификации всегда вводятся при стандартной раскладке американской клавиатуры. Поэтому том, пароль которого набран в любой другой раскладке, может оказаться невозможно смонтировать с помощью кэшированного пароля дозагрузочной аутентификации (это не ошибка VeraCrypt). Чтобы смонтировать такой том с паролем дозагрузочной аутентификации, выполните следующее:\n\n1) Нажмите кнопку 'Файл' или 'Устройство' и выберите том.\n2) В меню 'Тома' выберите 'Изменить пароль тома'.\n3) Введите текущий пароль для этого тома.\n4) Измените раскладку клавиатуры на английскую (США), щёлкнув по значку языка в панели задач Windows.\n5) В окне VeraCrypt в поле для нового пароля введите пароль для дозагрузочной аутентификации.\n6) Введите этот же пароль ещё раз в поле для проверки и нажмите OK.\nВНИМАНИЕ: Помните, что в результате пароль тома нужно будет всегда вводить в американской раскладке клавиатуры (которая гарантированно включена только на этапе дозагрузочной аутентификации). Системные избранные тома будут монтироваться с использованием пароля дозагрузочной аутентификации. Если у какого-то из таких томов другой пароль, этот том смонтирован не будет. Чтобы запретить функции VeraCrypt с обычными томами ('Размонтировать все', авторазмонтирование и др.) для избранных системных томов, нужно включить параметр 'Просматривать/размонтировать системные избранные тома могут лишь администраторы'. Кроме того, при запуске VeraCrypt без прав администратора (что стандартно для Vista и более новых версий Windows) избранные системные тома не будут отображаться в списке букв дисков в главном окне VeraCrypt. ВАЖНО: Если выбрана эта опция, а VeraCrypt не имеет административных привилегий, то смонтированные системные избранные тома НЕ отображаются в окне VeraCrypt и их нельзя размонтировать. Поэтому если, например, нужно размонтировать системный избранный том, сначала щёлкните ПКМ по значку VeraCrypt (в меню 'Пуск') и выберите запуск от имени администратора. То же самое относится к функции 'Размонтировать все', функциям авторазмонтирования, горячим клавишам 'Размонтировать все' и т.д. ВНИМАНИЕ: Эта установка вступит в силу после перезагрузки операционной системы. Ошибка обработки командной строки. Диск восстановления Выбрать и смонтировать &файл... Выбрать и смонтировать &устройство... Просматривать/размонтировать системные избранные тома могут лишь администраторы Монтировать системные избранные тома при старте Windows (в начальной фазе загрузки) ВНИМАНИЕ: Файловая система тома, смонтированного как '%s', не была аккуратно размонтирована и потому может содержать ошибки. Использование повреждённой файловой системы может привести к потере или порче данных.\n\nПримечание: прежде чем физически удалять или выключать устройство (например флэш-накопитель USB или внешний жёсткий диск), на котором находится смонтированный том VeraCrypt, сначала всегда следует размонтировать этот том.\n\n\nХотите, чтобы Windows попыталась найти и исправить ошибки (если они есть) файловой системы? ВНИМАНИЕ: Один или несколько системных избранных томов не были аккуратно размонтированы и потому могут содержать ошибки файловой системы. См. подробности в журнале системных событий.\n\nИспользование повреждённой файловой системы может привести к потере или порче данных. Проверьте такие тома на ошибки (щёлкните ПКМ на томе и выберите команду починки файловой системы). ВНИМАНИЕ: Исправление повреждённой файловой системы с помощью утилиты\nMicrosoft 'chkdsk' может привести к потере файлов в повреждённых участках.\nПоэтому рекомендуется сначала скопировать файлы с тома VeraCrypt на другой,\nнеповреждённый том VeraCrypt.\n\nИсправить файловую систему сейчас? Том '%s' смонтирован как 'только для чтения', поскольку была отвергнута попытка записи.\n\nПроверьте, достаточно ли у вас прав для записи в файловый контейнер (щёлкните ПКМ на контейнере и выберите 'Свойства' > 'Безопасность').\n\nОбратите внимание, что из-за ошибки в Windows это предупреждение может появляться даже при правильной установке прав доступа. Это не ошибка VeraCrypt. Возможное решение - перенос контейнера, например, в вашу папку 'Документы'.\n\nЕсли вы намереваетесь сохранить у этого тома доступ только для чтения, установите на контейнер атрибут 'Только чтение' (щёлкните по контейнеру ПКМ и выберите 'Свойства' > 'Только чтение'), чтобы не было данного предупреждения. Том '%s' смонтирован как 'только для чтения', поскольку была отвергнута попытка записи.\n\nПроверьте, не обращаются ли к разделу/устройству, на котором расположен том, другие приложения (например антивирусное ПО). Том '%s' смонтирован как 'только для чтения' - ОС запретила запись на хост-устройство.\n\nОбратите внимание, что некоторые драйверы чипсета (НМС) ошибочно представляют доступные для записи носители как устройства только для чтения. Эта проблема - не по вине VeraCrypt. Её можно решить обновлением или удалением имеющихся в системе драйверов чипсета сторонних производителей (не Microsoft). Hyper-Threading - это несколько логических ядер на одном физическом ядре. Если Hyper-Threading включена, число выше показывает количество логических процессоров/ядер. %d шт. Аппаратное ускорение AES отключено, что скажется на результатах теста (ухудшит производительность).\n\nЧтобы включить аппаратное ускорение, в меню 'Настройки' выберите пункт 'Быстродействие' и включите соответствующий параметр. Число потоков сейчас ограничено, что скажется на результатах теста (ухудшит производительность).\n\nЧтобы задействовать весь потенциал ЦП, в меню 'Настройки' выберите пункт 'Быстродействие' и отключите соответствующий параметр. Хотите попробовать отключить защиту от записи у раздела/диска? ВНИМАНИЕ: Этот параметр может ухудшить производительность.\n\nВы действительно хотите его включить? ВНИМАНИЕ: Том VeraCrypt автоматически размонтирован Прежде чем физически удалить или отключить устройство со смонтированным томом, сначала следует всегда размонтировать этот том в VeraCrypt.\n\nНеожиданное самопроизвольное размонтирование обычно бывает вызвано периодическими сбоями в кабеле, диске (корпусе) и т.д. Этот том создан с помощью TrueCrypt %x.%x. VeraCrypt поддерживает только тома TrueCrypt, созданные с помощью версий 6.x/7.x. Тест Ключевой файл Backspace Tab Очистить Enter Pause Caps Lock Пробел Page Up Page Down End Home Стрелка влево Стрелка вверх Стрелка вправо Стрелка вниз Клавиша выбора Клавиша печати Клавиша выполнения Print Screen Insert Delete Клавиша приложений Сон Num Lock Scroll Lock Браузер - назад Браузер - вперёд Браузер - обновить Браузер - стоп Браузер - поиск Браузер - избранное Браузер - начальная страница Без звука Уменьшить громкость Увеличить громкость Следующий трек Предыдущий трек Стоп Пуск/пауза Клавиша запуска почты Клавиша выбора носителя Приложение 1 Приложение 2 Attn СозВыд РасВыд Пуск Зум NumPad Shift Control Alt Win Б КБ МБ ГБ ТБ ПБ б/с КБ/с МБ/с ГБ/с ТБ/с ПБ/с Кэшировать &PIM вместе с паролем дозагрузочной аутентификации Кэшировать PIM вместе с паролем Отключённые сетевые диски доступны для монтирования Слишком длинный пароль: в UTF-8 он превышает 128 байт. Введённый пароль содержит символы Юникода, которые не удалось преобразовать в UTF-8. ОШИБКА: Не удалось загрузить системную библиотеку. Указанный в командной строке размер файла тома несовместим с выбранной файловой системой exFAT. Собрано энтропии из перемещений мыши ID тома: ID тома Применять ID тома для монтирования избранного Неверное значение ID тома В системе нет тома с указанным идентификатором (ID) Скопировать значение в буфер обмена... Без запроса PIM при дозагрузочной аутентификации (PIM на диске не зашифрован) ВНИМАНИЕ: Если включить эту опцию, то значение PIM будет храниться на диске в незашифрованном виде.\n\nВы действительно хотите включить эту опцию? Максимальное значение PIM (персонального умножителя итераций) - 2 147 468. Не проверять VRD Не показывать окно ожидания во время операций Не спрашивать алгоритм хеширования на экране дозагрузочной аутентификации Блочный шифр 'Кузнечик' (Kuznyechik) был впервые опубликован в 2015 году и утверждён в качестве российского стандарта GOST R 34.12-2015 и также RFC 7801. Ключ: 256 бит, блок: 128 бит. Режим работы: XTS. Совместная разработка японских компаний Mitsubishi Electric и NTT. Впервые опубликован в 2000 г. Ключ: 256 бит, блок: 128 бит. Режим работы: XTS. Одобрен для использования ISO/IEC, проектом Евросоюза NESSIE и японским проектом CRYPTREC. Время Итерации До загрузки Перед шифрованием раздела необходимо создать диск восстановления (VeraCrypt Rescue Disk, VRD), который служит следующим целям:\n\n- При повреждении загрузчика VeraCrypt, мастер-ключа или других критических данных диск VRD позволяет их восстановить (при этом всё равно понадобится ввести правильный пароль).\n\n- При повреждении и невозможности загрузки Windows диск VRD позволяет перманентно расшифровать раздел до запуска Windows.\n\n- VRD будет содержать резервную копию текущего загрузчика EFI и позволит при необходимости его восстановить.\n\nZip-образ диска восстановления VeraCrypt будет создан в указанном ниже месте. Zip-образ диска восстановления создан и сохранён в этом файле:\n%s\n\nСейчас нужно распаковать его на USB-флэшку, отформатированную в FAT/FAT32.\n\n%lsПосле создания диска восстановления нажмите 'Далее', чтобы проверить, правильно ли он был создан. Zip-образ диска восстановления создан и сохранён в этом файле:\n%s\n\nСейчас следует либо распаковать его на USB-флэшку, отформатированную в FAT/FAT32, либо перенести в надёжное место для использования в будущем.\n\n%lsНажмите 'Далее' для продолжения. ВАЖНО: Zip-файл необходимо распаковать в корневую папку USB-флэшки. Например, если флэшка имеет букву E:, то при распаковке Zip-файла на USB-флэшке должна быть создана папка E:\\EFI.\n\n Невозможно проверить правильность распаковки диска восстановления.\n\nЕсли вы его уже распаковали, выньте и снова вставьте USB-флэшку; затем нажмите 'Далее', чтобы повторить попытку. Если это не поможет, используйте другую флэшку и/или другую программу для работы с Zip-архивами.\n\nЕсли вы ещё не распаковали диск восстановления, сделайте это и затем нажмите 'Далее'.\n\nЕсли вы пытались проверить диск восстановления VeraCrypt, созданный до запуска этого мастера, учтите, что такой диск нельзя использовать, поскольку он был создан с другим мастер-ключом. Нужно распаковать новый созданный Zip-образ диска восстановления. Невозможно проверить правильность распаковки диска восстановления.\n\nЕсли вы его уже распаковали на USB-флэшку, выньте её и снова вставьте; затем повторите попытку. Если это не поможет, используйте другую Zip-программу и/или носитель.\n\nЕсли вы пытались проверить диск восстановления VeraCrypt, созданный с другим мастер-ключом, паролем, солью и т.д., учтите, что проверка такого диска будет всегда выдавать ошибку. Чтобы создать новый диск восстановления, полностью совместимый с текущей конфигурацией, выберите 'Система' > 'Создать диск восстановления'. Образ диска восстановления создан и сохранён в этом файле:\n%s\n\nСейчас нужно распаковать образ диска на USB-флэшку, отформатированную в FAT/FAT32.\n\nВАЖНО: Zip-файл необходимо распаковать в корневую папку USB-флэшки. Например, если флэшка имеет букву E:, то при распаковке Zip-файла на USB-флэшке должна быть создана папка E:\\EFI.\n\nПосле создания диска восстановления выберите 'Система' > 'Проверить диск восстановления', чтобы убедиться, что диск создан правильно. Безопасный рабочий стол при вводе пароля Указанный в командной строке размер файла несовместим с выбранной файловой системой ReFS. Правка конфигурации загрузчика Показать информацию о платформе EFI Файл конфигурации загрузчика Информация о платформе EFI ВНИМАНИЕ: Если у вас недостаточно опыта, не следует вручную редактировать настройки загрузчика.\n\nПродолжить? ВНИМАНИЕ: Ошибка проверки корректности XML-формата конфигурации загрузчика. Проверьте внесённые вами изменения. Расширенные настройки Настоятельно рекомендуем создать новый диск восстановления VeraCrypt (который будет содержать новую версию загрузчика VeraCrypt), выбрав 'Система' > 'Создать диск восстановления'.\nСделать это сейчас? Разрешить команду TRIM для несистемного SSD-раздела/диска Блокировать команду TRIM на системном разделе/диске ОШИБКА: Не удалось обнаружить на диске системный EFI-загрузчик Windows. Операция будет прервана. В настоящий момент невозможно зашифровать систему, если включена безопасная загрузка (Secure Boot) и если свои ключи VeraCrypt не загружены в прошивку машины. Чтобы зашифровать систему, отключите Secure Boot в настройках BIOS. Скопированный текст усечён до предельно допустимой длины пароля в 128 символов Достигнута максимальная длина пароля (128 символов).\nБольше ничего вводить нельзя. Выберите язык, который будет использован при установке: ОШИБКА: Размер файлового контейнера больше, чем свободно места на диске. Разрешить дефрагментатору Windows обрабатывать несистемный раздел/диск ВНИМАНИЕ: Дефрагментация несистемных разделов/дисков может способствовать утечке метаданных об их содержимом или вызывать проблемы со скрытыми томами, которые могут в них находиться.\n\nПродолжить? Виртуальное устройство Выбранный смонтированный том не ассоциирован с буквой диска в Windows, его нельзя открыть в Проводнике Windows. Удалять ключи шифрования из ОЗУ при подключении нового устройства ВАЖНО:\n - Состояние этой опции не сохраняется после выключения/перезагрузки - при следующем запуске ПК её нужно выбрать снова.\n\n - Если эта опция включена, то после подключения нового устройства компьютер перестанет реагировать и в итоге произойдёт сбой с BSOD, так как у Windows нет доступа к зашифрованному диску после удаления из памяти его ключей.\n Запуск Аппаратный генератор случайных чисел как дополнительный источник энтропии Устаревшая предельная длина пароля (64 символа) Шифровать ключи и пароли в ОЗУ Тест: Только создать виртуальное устройство, не монтируя на букву диска t;
- <entry lang="de" key="SHA512_HELP">SHA-512 ist nach Angaben des National Institute of Standards and Technology (NIST) und der Datenschutz- und Sicherheitsforschungsgemeinschaft sicher.</entry>
- <entry lang="de" key="CHOOSE_PASSWORD_TITLE">Passwort wählen</entry>
- <entry lang="de" key="TRANSLATED_PWD_NOT_WRITTEN">Warnung: Beim Schreiben des übersetzten Passworts ist ein Fehler aufgetreten! Bitte versuchen Sie es erneut. Wenn dieser Fehler erneut auftritt, ändern Sie das Tastaturlayout manuell in das US-Tastaturlayout.</entry>
- <entry lang="de" key="ERROR_TRANSLATE_PWD">Warnung: Beim Übersetzen des Passworts ist ein Fehler aufgetreten!\nBitte geben Sie das Passwort erneut ein und versuchen Sie es. Wenn dieser Fehler erneut auftritt, schalten Sie das Tastaturlayout manuell auf das US-Tastaturlayout um.</entry>
- <entry lang="de" key="ERROR_KEYB_LAYOUT_NOT_LOADED">Ihr System unterstützt nicht das Standard-US-Keyboard-Layout. Bitte stellen Sie sicher, dass das Layout verfügbar ist. Für weitere Hilfe besuchen Sie bitte: https://support.microsoft.com/en-us/windows/manage-the-input-and-display-language-settings-in-windows-10-12a10cb4-8626-9b77-0ccb-5013e0c7c7a2 </entry>
- <entry lang="de" key="ERROR_PASTE_ACTION">Das Einfügen von Text ist deaktiviert. Bitte geben Sie Ihr Passwort ein.</entry>
- <entry lang="de" key="WARNING_PASSWORD_NOT_IDENTICAL">Passwörter sind nicht identisch! Bitte geben Sie in beide Felder identische Passwörter ein!</entry>
- <entry lang="de" key="SYSENC_INFO">Dieser Assistent hilft Ihnen, Ihr Laufwerk (%c:) zu verschlüsseln</entry>
- <entry lang="de" key="SYSENC_INFO_2">Ein Windows-Kennwort kann von böswilligen Personen, die physischen Zugang zu Ihrem Gerät haben, leicht umgangen werden. Laufwerksverschlüsselung hilft, Ihre Daten vor dem Zugriff böswilligen Akteuren zu schützen. VeraCrypt Laufwerksverschlüsselung hält sie fern, indem es Ihre Daten mit einem zusätzlichen Passwort schützt. </entry>
- <entry lang="de" key="ADV_FEATURES_INTRO_TOOLTIP">Aktivieren Sie hier das versteckte Betriebssystem.</entry>
- <entry lang="de" key="ADV_FEATURES_NOTE">Die meisten Experten sind sich einig, dass die folgenden vorgewählten Optionen sicher sind. Ändern Sie sie nur, wenn Sie wissen, was Sie tun. </entry>
- <entry lang="de" key="PIM_INFO">Mit dem persönlichen Iterationsmultiplikator (PIM) können Sie die Anzahl der Passwort-Hash-Wiederholungen festlegen. Dies bietet mehr Flexibilität bei der Anpassung der gewünschten Sicherheitsstufe und steuert gleichzeitig die Geschwindigkeit des Einhänge-/Bootvorgangs.</entry>
- <entry lang="de" key="WIPE_INFO">Überschreibt Ihre Daten vor der Verschlüsselung. Dies verhindert eine mögliche Datenwiederherstellung. Das Löschen ist unter normalen Umständen nicht erforderlich.</entry>
- <entry lang="de" key="PRETEST_INFO">Vor der Verschlüsselung prüft VeraCrypt, ob alles richtig funktioniert. \n\nVeraCrypt führt einige Tests durch, startet Ihren Computer neu und Sie müssen Ihr Passwort eingeben, bevor Windows startet.</entry>
- <entry lang="de" key="PRETEST_CANCEL">Wenn Sie jetzt auf Abbrechen klicken, werden keine Änderungen an Ihrem System vorgenommen.</entry>
- <entry lang="de" key="ERROR_GETTING_PATH">Beim Abrufen des Pfads zur ausführbaren Datei ist ein Fehler aufgetreten.</entry>
- <entry lang="de" key="ERROR_GETTING_PWD">Beim Abrufen des Passworts ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut.</entry>
- <entry lang="de" key="ERROR_GETTING_KEYB_STATE">Beim Abrufen des Tastaturstatus ist ein Fehler aufgetreten.</entry>
- <entry lang="de" key="ERR_NO_TRANSLATION">Für die Taste, die Sie gedrückt haben, gibt es keine Übersetzung!</entry>
- <entry lang="de" key="DEAD_KEY_SUPPORT">Tote Tasten reproduzieren in diesem Fall keine toten Zeichen, da Ihr Passwort in das US-Tastaturlayout übersetzt werden muss, damit Sie Ihr Passwort in der Pre-Boot-Umgebung eingeben können.</entry>
- <entry lang="de" key="PRETEST_CHECKBOX"> Ich habe dafür gesorgt, dass meinem Gerät während des Verschlüsselungsvorgangs nicht der Strom ausgeht.</entry>
- <entry lang="de" key="OPEN_PATH_CHECKLIST_PAGE">Pfad öffnen</entry>
- <entry lang="de" key="RESCUE_DISK_PATH">Pfad des Rettungsdatenträgers</entry>
- <entry lang="de" key="PRETEST_BACK_BUTTON">Wenn Sie den Verschlüsselungsassistenten abbrechen möchten, klicken Sie bitte auf Abbrechen. In diesem Fall werden keine Änderungen an Ihrem Computer vorgenommen.</entry>
- <entry lang="de" key="WIPE_WARNING">Der Löschvorgang kann sehr lange dauern (bis zu Stunden). Das Löschen wird nicht empfohlen, wenn Sie ein SSD-Laufwerk haben.</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>
</localization>
<!-- XML-Schema -->
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="VeraCrypt">
<xs:complexType>
<xs:sequence>
<xs:element name="localization">
<xs:complexType>
<xs:sequence>
<xs:element name="language">
<xs:complexType>
<xs:attribute name="langid" type="xs:string" use="required" />
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="en-name" type="xs:string" use="required" />
<xs:attribute name="version" type="xs:string" use="required" />
<xs:attribute name="translators" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
<xs:element minOccurs="4" maxOccurs="4" name="font">
<xs:complexType>
<xs:attribute name="lang" type="xs:string" use="required" />
<xs:attribute name="class" type="xs:string" use="required" />
<xs:attribute name="size" type="xs:unsignedByte" use="required" />
<xs:attribute name="face" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
<xs:element maxOccurs="unbounded" name="entry">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="lang" type="xs:string" use="required" />
<xs:attribute name="key" type="xs:string" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="prog-version" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</VeraCrypt>
diff --git a/doc/html/Miscellaneous.html b/doc/html/Miscellaneous.html
deleted file mode 100644
index 95eb6af8..00000000
--- a/doc/html/Miscellaneous.html
+++ /dev/null
@@ -1,48 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="content-type" content="text/html; charset=utf-8" />
-<title>VeraCrypt - Free Open source disk encryption with strong security for the Paranoid</title>
-<meta name="description" content="VeraCrypt is free open-source disk encryption software for Windows, Mac OS X and Linux. In case an attacker forces you to reveal the password, VeraCrypt provides plausible deniability. In contrast to file encryption, data encryption performed by VeraCrypt is real-time (on-the-fly), automatic, transparent, needs very little memory, and does not involve temporary unencrypted files."/>
-<meta name="keywords" content="encryption, security"/>
-<link href="styles.css" rel="stylesheet" type="text/css" />
-</head>
-<body>
-
-<div>
-<a href="Documentation.html"><img src="VeraCrypt128x128.png" alt="VeraCrypt"/></a>
-</div>
-
-<div id="menu">
- <ul>
- <li><a href="Home.html">Home</a></li>
- <li><a href="/code/">Source Code</a></li>
- <li><a href="Downloads.html">Downloads</a></li>
- <li><a class="active" href="Documentation.html">Documentation</a></li>
- <li><a href="Donation.html">Donate</a></li>
- <li><a href="https://sourceforge.net/p/veracrypt/discussion/" target="_blank">Forums</a></li>
- </ul>
-</div>
-
-<div>
-<p>
-<a href="Documentation.html">Documentation</a>
-<img src="arrow_right.gif" alt=">>" style="margin-top: 5px">
-<a href="Miscellaneous.html">Miscellaneous</a>
-</p></div>
-
-<div class="wikidoc">
-<h1>Miscellaneous</h1>
-<ul>
-<li><a href="Using%20VeraCrypt%20Without%20Administrator%20Privileges.html">Use Without Admin Rights</a>
-</li><li><a href="Sharing%20over%20Network.html">Sharing over Network</a>
-</li><li><a href="VeraCrypt%20Background%20Task.html">Background Task</a>
-</li><li><a href="Removable%20Medium%20Volume.html">Removable Medium Volumes</a>
-</li><li><a href="VeraCrypt%20System%20Files.html">VeraCrypt System Files</a>
-</li><li><a href="Removing%20Encryption.html">Removing Encryption</a>
-</li><li><a href="Uninstalling%20VeraCrypt.html">Uninstalling VeraCrypt</a>
-</li><li><a href="Digital%20Signatures.html">Digital Signatures</a>
-</li></ul>
-</div>
-</body></html>
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index c3430525..2c707f5d 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -1,15722 +1,15671 @@
/*
Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses'
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. */
#include "Tcdefs.h"
#include <windowsx.h>
#include <dbghelp.h>
#include <dbt.h>
#include <Setupapi.h>
#include <aclapi.h>
#include <fcntl.h>
#include <io.h>
#include <math.h>
#include <shlobj.h>
#include <shlwapi.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <time.h>
#include <tchar.h>
#include <Richedit.h>
#if defined (TCMOUNT) || defined (VOLFORMAT)
#include <process.h>
#include <Tlhelp32.h>
#endif
#include "Resource.h"
#include "Platform/Finally.h"
#include "Platform/ForEach.h"
#include "Apidrvr.h"
#include "BootEncryption.h"
#include "Combo.h"
#include "Crc.h"
#include "Crypto.h"
#include "Dictionary.h"
#include "Dlgcode.h"
#include "EncryptionThreadPool.h"
#include "Endian.h"
#include "Format/Inplace.h"
#include "Language.h"
#include "Keyfiles.h"
#include "Pkcs5.h"
#include "Random.h"
#include "Registry.h"
#include "SecurityToken.h"
#include "Tests.h"
#include "Volumes.h"
#include "Wipe.h"
#include "Xml.h"
#include "Xts.h"
#include "Boot/Windows/BootCommon.h"
#include "Progress.h"
#include "zip.h"
#include "rdrand.h"
#include "jitterentropy.h"
#ifdef TCMOUNT
#include "Mount/Mount.h"
#include "Mount/resource.h"
#endif
#ifdef VOLFORMAT
#include "Format/Tcformat.h"
#endif
#ifdef SETUP
#include "Setup/Setup.h"
#endif
#include <Setupapi.h>
#include <Softpub.h>
#include <WinTrust.h>
#include <strsafe.h>
#define _WIN32_DCOM
#include <comdef.h>
#include <Wbemidl.h>
#pragma comment(lib, "wbemuuid.lib")
#pragma comment( lib, "setupapi.lib" )
#ifndef TTI_INFO_LARGE
#define TTI_INFO_LARGE 4
#endif
#ifndef TTI_WARNING_LARGE
#define TTI_WARNING_LARGE 5
#endif
#ifndef TTI_ERROR_LARGE
#define TTI_ERROR_LARGE 6
#endif
/* GPT Partition Type GUIDs */
#define LOCAL_DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) const GUID name = {l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8}
LOCAL_DEFINE_GUID(PARTITION_ENTRY_UNUSED_GUID, 0x00000000L, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); // Entry unused
LOCAL_DEFINE_GUID(PARTITION_SYSTEM_GUID, 0xC12A7328L, 0xF81F, 0x11D2, 0xBA, 0x4B, 0x00, 0xA0, 0xC9, 0x3E, 0xC9, 0x3B); // EFI system partition
LOCAL_DEFINE_GUID(PARTITION_MSFT_RESERVED_GUID, 0xE3C9E316L, 0x0B5C, 0x4DB8, 0x81, 0x7D, 0xF9, 0x2D, 0xF0, 0x02, 0x15, 0xAE); // Microsoft reserved space
LOCAL_DEFINE_GUID(PARTITION_BASIC_DATA_GUID, 0xEBD0A0A2L, 0xB9E5, 0x4433, 0x87, 0xC0, 0x68, 0xB6, 0xB7, 0x26, 0x99, 0xC7); // Basic data partition
LOCAL_DEFINE_GUID(PARTITION_LDM_METADATA_GUID, 0x5808C8AAL, 0x7E8F, 0x42E0, 0x85, 0xD2, 0xE1, 0xE9, 0x04, 0x34, 0xCF, 0xB3); // Logical Disk Manager metadata partition
LOCAL_DEFINE_GUID(PARTITION_LDM_DATA_GUID, 0xAF9B60A0L, 0x1431, 0x4F62, 0xBC, 0x68, 0x33, 0x11, 0x71, 0x4A, 0x69, 0xAD); // Logical Disk Manager data partition
LOCAL_DEFINE_GUID(PARTITION_MSFT_RECOVERY_GUID, 0xDE94BBA4L, 0x06D1, 0x4D40, 0xA1, 0x6A, 0xBF, 0xD5, 0x01, 0x79, 0xD6, 0xAC); // Microsoft recovery partition
LOCAL_DEFINE_GUID(PARTITION_CLUSTER_GUID, 0xdb97dba9L, 0x0840, 0x4bae, 0x97, 0xf0, 0xff, 0xb9, 0xa3, 0x27, 0xc7, 0xe1); // Cluster metadata partition
#ifndef PROCESSOR_ARCHITECTURE_ARM64
#define PROCESSOR_ARCHITECTURE_ARM64 12
#endif
#ifndef IMAGE_FILE_MACHINE_ARM64
#define IMAGE_FILE_MACHINE_ARM64 0xAA64
#endif
using namespace VeraCrypt;
LONG DriverVersion;
char *LastDialogId;
wchar_t szHelpFile[TC_MAX_PATH];
wchar_t szHelpFile2[TC_MAX_PATH];
wchar_t SecurityTokenLibraryPath[TC_MAX_PATH];
char CmdTokenPin [TC_MAX_PATH] = {0};
HFONT hFixedDigitFont = NULL;
HFONT hBoldFont = NULL;
HFONT hTitleFont = NULL;
HFONT hFixedFont = NULL;
HFONT hUserFont = NULL;
HFONT hUserUnderlineFont = NULL;
HFONT hUserBoldFont = NULL;
HFONT hUserUnderlineBoldFont = NULL;
HFONT WindowTitleBarFont;
WCHAR EditPasswordChar = 0;
int ScreenDPI = USER_DEFAULT_SCREEN_DPI;
double DPIScaleFactorX = 1;
double DPIScaleFactorY = 1;
double DlgAspectRatio = 1;
HWND MainDlg = NULL;
wchar_t *lpszTitle = NULL;
BOOL Silent = FALSE;
BOOL bPreserveTimestamp = TRUE;
BOOL bShowDisconnectedNetworkDrives = FALSE;
BOOL bHideWaitingDialog = FALSE;
BOOL bCmdHideWaitingDialog = FALSE;
BOOL bCmdHideWaitingDialogValid = FALSE;
BOOL bUseSecureDesktop = FALSE;
BOOL bUseLegacyMaxPasswordLength = FALSE;
BOOL bCmdUseSecureDesktop = FALSE;
BOOL bCmdUseSecureDesktopValid = FALSE;
BOOL bStartOnLogon = FALSE;
BOOL bMountDevicesOnLogon = FALSE;
BOOL bMountFavoritesOnLogon = FALSE;
BOOL bHistory = FALSE;
#ifndef SETUP
BOOL bLanguageSetInSetup = FALSE;
#else
extern BOOL bMakePackage;
#endif
#ifdef TCMOUNT
extern BOOL ServiceMode;
#endif
// Status of detection of hidden sectors (whole-system-drive encryption).
// 0 - Unknown/undetermined/completed, 1: Detection is or was in progress (but did not complete e.g. due to system crash).
int HiddenSectorDetectionStatus = 0;
OSVersionEnum nCurrentOS = WIN_UNKNOWN;
int CurrentOSMajor = 0;
int CurrentOSMinor = 0;
int CurrentOSServicePack = 0;
int CurrentOSBuildNumber = 0;
BOOL RemoteSession = FALSE;
BOOL UacElevated = FALSE;
BOOL bPortableModeConfirmed = FALSE; // TRUE if it is certain that the instance is running in portable mode
BOOL bInPlaceEncNonSysPending = FALSE; // TRUE if the non-system in-place encryption config file indicates that one or more partitions are scheduled to be encrypted. This flag is set only when config files are loaded during app startup.
/* Globals used by Mount and Format (separately per instance) */
BOOL PimEnable = FALSE;
BOOL KeyFilesEnable = FALSE;
KeyFile *FirstKeyFile = NULL;
KeyFilesDlgParam defaultKeyFilesParam = {0};
BOOL IgnoreWmDeviceChange = FALSE;
BOOL DeviceChangeBroadcastDisabled = FALSE;
BOOL LastMountedVolumeDirty;
BOOL MountVolumesAsSystemFavorite = FALSE;
BOOL FavoriteMountOnArrivalInProgress = FALSE;
BOOL MultipleMountOperationInProgress = FALSE;
volatile BOOL NeedPeriodicDeviceListUpdate = FALSE;
BOOL DisablePeriodicDeviceListUpdate = FALSE;
BOOL EnableMemoryProtection = FALSE;
BOOL WaitDialogDisplaying = FALSE;
/* Handle to the device driver */
HANDLE hDriver = INVALID_HANDLE_VALUE;
/* This mutex is used to prevent multiple instances of the wizard or main app from dealing with system encryption */
volatile HANDLE hSysEncMutex = NULL;
/* This mutex is used for non-system in-place encryption but only for informative (non-blocking) purposes,
such as whether an app should prompt the user whether to resume scheduled process. */
volatile HANDLE hNonSysInplaceEncMutex = NULL;
/* This mutex is used to prevent multiple instances of the wizard or main app from trying to install or
register the driver or from trying to launch it in portable mode at the same time. */
volatile HANDLE hDriverSetupMutex = NULL;
/* This mutex is used to prevent users from running the main TrueCrypt app or the wizard while an instance
of the TrueCrypt installer is running (which is also useful for enforcing restart before the apps can be used). */
volatile HANDLE hAppSetupMutex = NULL;
/* Critical section used to protect access to global variables used in WNetGetConnection calls */
CRITICAL_SECTION csWNetCalls;
/* Critical section used to protect access to global list of physical drives */
CRITICAL_SECTION csMountableDevices;
CRITICAL_SECTION csVolumeIdCandidates;
static std::vector<HostDevice> mountableDevices;
static std::vector<HostDevice> rawHostDeviceList;
/* Critical section used to ensure that only one thread at a time can create a secure desktop */
CRITICAL_SECTION csSecureDesktop;
/* Boolean that indicates if our Secure Desktop is active and being used or not */
volatile BOOL bSecureDesktopOngoing = FALSE;
TCHAR SecureDesktopName[65];
HINSTANCE hInst = NULL;
HCURSOR hCursor = NULL;
ATOM hDlgClass, hSplashClass;
/* This value may changed only by calling ChangeSystemEncryptionStatus(). Only the wizard can change it
(others may still read it though). */
int SystemEncryptionStatus = SYSENC_STATUS_NONE;
/* Only the wizard can change this value (others may only read it). */
WipeAlgorithmId nWipeMode = TC_WIPE_NONE;
BOOL bSysPartitionSelected = FALSE; /* TRUE if the user selected the system partition via the Select Device dialog */
BOOL bSysDriveSelected = FALSE; /* TRUE if the user selected the system drive via the Select Device dialog */
/* To populate these arrays, call GetSysDevicePaths(). If they contain valid paths, bCachedSysDevicePathsValid is TRUE. */
wchar_t SysPartitionDevicePath [TC_MAX_PATH];
wchar_t SysDriveDevicePath [TC_MAX_PATH];
wstring ExtraBootPartitionDevicePath;
char bCachedSysDevicePathsValid = FALSE;
BOOL bHyperLinkBeingTracked = FALSE;
int WrongPwdRetryCounter = 0;
static FILE *ConfigFileHandle;
char *ConfigBuffer;
BOOL SystemFileSelectorCallPending = FALSE;
DWORD SystemFileSelectorCallerThreadId;
#define RANDPOOL_DISPLAY_REFRESH_INTERVAL 30
#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] = {
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,
0x18, 0xD1, 0xD8, 0x32, 0x0E, 0xA4, 0x81, 0x3C, 0x19, 0xBF, 0x13, 0x11,
0xA4, 0x37, 0xD6, 0xDB, 0x26, 0xBA, 0xDC, 0x8F, 0x86, 0x96, 0x55, 0x96,
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
};
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"
/* Custom class names */
#define TC_DLG_CLASS L"VeraCryptCustomDlg"
#define TC_SPLASH_CLASS L"VeraCryptSplashDlg"
/* constant used by ChangeWindowMessageFilter calls */
#ifndef MSGFLT_ADD
#define MSGFLT_ADD 1
#endif
/* undocumented message sent during drag-n-drop */
#ifndef WM_COPYGLOBALDATA
#define WM_COPYGLOBALDATA 0x0049
#endif
/* Benchmarks */
#ifndef SETUP
#define BENCHMARK_MAX_ITEMS 100
#define BENCHMARK_DEFAULT_BUF_SIZE BYTES_PER_MB
#define HASH_FNC_BENCHMARKS FALSE // For development purposes only. Must be FALSE when building a public release.
#define PKCS5_BENCHMARKS FALSE // For development purposes only. Must be FALSE when building a public release.
#if PKCS5_BENCHMARKS && HASH_FNC_BENCHMARKS
#error PKCS5_BENCHMARKS and HASH_FNC_BENCHMARKS are both TRUE (at least one of them should be FALSE).
#endif
enum
{
BENCHMARK_TYPE_ENCRYPTION = 0,
BENCHMARK_TYPE_PRF,
BENCHMARK_TYPE_HASH
};
enum
{
BENCHMARK_SORT_BY_NAME = 0,
BENCHMARK_SORT_BY_SPEED
};
typedef struct
{
int id;
wchar_t name[100];
unsigned __int64 encSpeed;
unsigned __int64 decSpeed;
unsigned __int64 meanBytesPerSec;
} BENCHMARK_REC;
BENCHMARK_REC benchmarkTable [BENCHMARK_MAX_ITEMS];
int benchmarkTotalItems = 0;
int benchmarkBufferSize = BENCHMARK_DEFAULT_BUF_SIZE;
int benchmarkLastBufferSize = BENCHMARK_DEFAULT_BUF_SIZE;
int benchmarkSortMethod = BENCHMARK_SORT_BY_SPEED;
LARGE_INTEGER benchmarkPerformanceFrequency;
int benchmarkType = BENCHMARK_TYPE_ENCRYPTION;
int benchmarkPim = -1;
BOOL benchmarkPreBoot = FALSE;
BOOL benchmarkGPT = FALSE;
#endif // #ifndef SETUP
typedef struct
{
void *strings;
BOOL bold;
} MULTI_CHOICE_DLGPROC_PARAMS;
// Loads a 32-bit integer from the file at the specified file offset. The saved value is assumed to have been
// processed by mputLong(). The result is stored in *result. Returns TRUE if successful (otherwise FALSE).
BOOL LoadInt32 (const wchar_t *filePath, unsigned __int32 *result, __int64 fileOffset)
{
DWORD bufSize = sizeof(__int32);
unsigned char *buffer = (unsigned char *) malloc (bufSize);
unsigned char *bufferPtr = buffer;
HANDLE src = NULL;
DWORD bytesRead;
LARGE_INTEGER seekOffset, seekOffsetNew;
BOOL retVal = FALSE;
if (buffer == NULL)
return -1;
src = CreateFile (filePath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (src == INVALID_HANDLE_VALUE)
{
free (buffer);
return FALSE;
}
seekOffset.QuadPart = fileOffset;
if (SetFilePointerEx (src, seekOffset, &seekOffsetNew, FILE_BEGIN) == 0)
goto fsif_end;
if (ReadFile (src, buffer, bufSize, &bytesRead, NULL) == 0
|| bytesRead != bufSize)
goto fsif_end;
retVal = TRUE;
*result = mgetLong(bufferPtr);
fsif_end:
CloseHandle (src);
free (buffer);
return retVal;
}
// Loads a 16-bit integer from the file at the specified file offset. The saved value is assumed to have been
// processed by mputWord(). The result is stored in *result. Returns TRUE if successful (otherwise FALSE).
BOOL LoadInt16 (const wchar_t *filePath, int *result, __int64 fileOffset)
{
DWORD bufSize = sizeof(__int16);
unsigned char *buffer = (unsigned char *) malloc (bufSize);
unsigned char *bufferPtr = buffer;
HANDLE src = NULL;
DWORD bytesRead;
LARGE_INTEGER seekOffset, seekOffsetNew;
BOOL retVal = FALSE;
if (buffer == NULL)
return -1;
src = CreateFile (filePath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (src == INVALID_HANDLE_VALUE)
{
free (buffer);
return FALSE;
}
seekOffset.QuadPart = fileOffset;
if (SetFilePointerEx (src, seekOffset, &seekOffsetNew, FILE_BEGIN) == 0)
goto fsif_end;
if (ReadFile (src, buffer, bufSize, &bytesRead, NULL) == 0
|| bytesRead != bufSize)
goto fsif_end;
retVal = TRUE;
*result = mgetWord(bufferPtr);
fsif_end:
CloseHandle (src);
free (buffer);
return retVal;
}
// Returns NULL if there's any error. Although the buffer can contain binary data, it is always null-terminated.
char *LoadFile (const wchar_t *fileName, DWORD *size)
{
char *buf;
DWORD fileSize = INVALID_FILE_SIZE;
HANDLE h = CreateFile (fileName, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
*size = 0;
if (h == INVALID_HANDLE_VALUE)
return NULL;
if ((fileSize = GetFileSize (h, NULL)) == INVALID_FILE_SIZE)
{
CloseHandle (h);
return NULL;
}
buf = (char *) calloc (fileSize + 1, 1);
if (buf == NULL)
{
CloseHandle (h);
return NULL;
}
if (!ReadFile (h, buf, fileSize, size, NULL))
{
free (buf);
buf = NULL;
}
else
{
buf[*size] = 0; //make coverity happy eventhough buf is guaranteed to be null terminated because of fileSize+1 in calloc call
}
CloseHandle (h);
return buf;
}
// Returns NULL if there's any error.
char *LoadFileBlock (const wchar_t *fileName, __int64 fileOffset, DWORD count)
{
char *buf;
DWORD bytesRead = 0;
LARGE_INTEGER seekOffset, seekOffsetNew;
BOOL bStatus;
HANDLE h = CreateFile (fileName, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (h == INVALID_HANDLE_VALUE)
return NULL;
seekOffset.QuadPart = fileOffset;
if (SetFilePointerEx (h, seekOffset, &seekOffsetNew, FILE_BEGIN) == 0)
{
CloseHandle (h);
return NULL;
}
buf = (char *) calloc (count, 1);
if (buf == NULL)
{
CloseHandle (h);
return NULL;
}
bStatus = ReadFile (h, buf, count, &bytesRead, NULL);
CloseHandle (h);
if (!bStatus || (bytesRead != count))
{
free (buf);
return NULL;
}
return buf;
}
// Returns -1 if there is an error, or the size of the file.
__int64 GetFileSize64 (const wchar_t *path)
{
HANDLE h = CreateFile (path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
LARGE_INTEGER size;
__int64 retSize = -1;
if (h)
{
if (GetFileSizeEx (h, &size))
{
retSize = size.QuadPart;
}
CloseHandle (h);
}
return retSize;
}
// If bAppend is TRUE, the buffer is appended to an existing file. If bAppend is FALSE, any existing file
// is replaced. If an error occurs, the incomplete file is deleted (provided that bAppend is FALSE).
BOOL SaveBufferToFile (const char *inputBuffer, const wchar_t *destinationFile, DWORD inputLength, BOOL bAppend, BOOL bRenameIfFailed)
{
HANDLE dst;
DWORD bytesWritten;
BOOL res = TRUE;
DWORD dwLastError = 0;
dst = CreateFile (destinationFile,
GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, bAppend ? OPEN_EXISTING : CREATE_ALWAYS, 0, NULL);
dwLastError = GetLastError();
if (!bAppend && bRenameIfFailed && (dst == INVALID_HANDLE_VALUE) && (GetLastError () == ERROR_SHARING_VIOLATION))
{
wchar_t renamedPath[TC_MAX_PATH + 1];
StringCbCopyW (renamedPath, sizeof(renamedPath), destinationFile);
StringCbCatW (renamedPath, sizeof(renamedPath), VC_FILENAME_RENAMED_SUFFIX);
/* rename the locked file in order to be able to create a new one */
if (MoveFileEx (destinationFile, renamedPath, MOVEFILE_REPLACE_EXISTING))
{
dst = CreateFile (destinationFile,
GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, 0, NULL);
dwLastError = GetLastError();
if (dst == INVALID_HANDLE_VALUE)
{
/* restore the original file name */
MoveFileEx (renamedPath, destinationFile, MOVEFILE_REPLACE_EXISTING);
}
else
{
/* delete the renamed file when the machine reboots */
MoveFileEx (renamedPath, NULL, MOVEFILE_DELAY_UNTIL_REBOOT);
}
}
}
if (dst == INVALID_HANDLE_VALUE)
{
SetLastError (dwLastError);
handleWin32Error (MainDlg, SRC_POS);
return FALSE;
}
if (bAppend)
SetFilePointer (dst, 0, NULL, FILE_END);
if (!WriteFile (dst, inputBuffer, inputLength, &bytesWritten, NULL)
|| inputLength != bytesWritten)
{
res = FALSE;
}
if (!res)
{
// If CREATE_ALWAYS is used, ERROR_ALREADY_EXISTS is returned after successful overwrite
// of an existing file (it's not an error)
if (! (GetLastError() == ERROR_ALREADY_EXISTS && !bAppend) )
handleWin32Error (MainDlg, SRC_POS);
}
CloseHandle (dst);
if (!res && !bAppend)
_wremove (destinationFile);
return res;
}
// Returns -1 if the specified string is not found in the buffer. Otherwise, returns the
// offset of the first occurrence of the string. The string and the buffer may contain zeroes,
// which do NOT terminate them.
int64 FindString (const char *buf, const char *str, int64 bufLen, int64 strLen, int64 startOffset)
{
if (buf == NULL
|| str == NULL
|| strLen > bufLen
|| bufLen < 1
|| strLen < 1
|| startOffset > bufLen - strLen)
{
return -1;
}
for (int64 i = startOffset; i <= bufLen - strLen; i++)
{
if (memcmp (buf + i, str, (size_t) strLen) == 0)
return i;
}
return -1;
}
// Returns TRUE if the file or directory exists (both may be enclosed in quotation marks).
BOOL FileExists (const wchar_t *filePathPtr)
{
wchar_t filePath [TC_MAX_PATH * 2 + 1];
// Strip quotation marks (if any)
if (filePathPtr [0] == L'"')
{
StringCbCopyW (filePath, sizeof(filePath), filePathPtr + 1);
}
else
{
StringCbCopyW (filePath, sizeof(filePath), filePathPtr);
}
// Strip quotation marks (if any)
if (filePath [wcslen (filePath) - 1] == L'"')
filePath [wcslen (filePath) - 1] = 0;
return (_waccess (filePath, 0) != -1);
}
// Searches the file from its end for the LAST occurrence of the string str.
// The string may contain zeroes, which do NOT terminate the string.
// If the string is found, its offset from the start of the file is returned.
// If the string isn't found or if any error occurs, -1 is returned.
__int64 FindStringInFile (const wchar_t *filePath, const char* str, int strLen)
{
int bufSize = 64 * BYTES_PER_KB;
char *buffer = (char *) err_malloc (bufSize);
HANDLE src = NULL;
DWORD bytesRead;
BOOL readRetVal;
__int64 filePos = GetFileSize64 (filePath);
int bufPos = 0;
LARGE_INTEGER seekOffset, seekOffsetNew;
BOOL bExit = FALSE;
int filePosStep;
__int64 retVal = -1;
if (filePos <= 0
|| buffer == NULL
|| strLen > bufSize
|| strLen < 1)
{
if (buffer)
free (buffer);
return -1;
}
src = CreateFile (filePath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (src == INVALID_HANDLE_VALUE)
{
free (buffer);
return -1;
}
filePosStep = bufSize - strLen + 1;
do
{
filePos -= filePosStep;
if (filePos < 0)
{
filePos = 0;
bExit = TRUE;
}
seekOffset.QuadPart = filePos;
if (SetFilePointerEx (src, seekOffset, &seekOffsetNew, FILE_BEGIN) == 0)
goto fsif_end;
if ((readRetVal = ReadFile (src, buffer, bufSize, &bytesRead, NULL)) == 0
|| bytesRead == 0)
goto fsif_end;
bufPos = bytesRead - strLen;
while (bufPos > 0)
{
if (memcmp (buffer + bufPos, str, strLen) == 0)
{
// String found
retVal = filePos + bufPos;
goto fsif_end;
}
bufPos--;
}
} while (!bExit);
fsif_end:
CloseHandle (src);
free (buffer);
return retVal;
}
// System CopyFile() copies source file attributes (like FILE_ATTRIBUTE_ENCRYPTED)
// so we need to use our own copy function
BOOL TCCopyFileBase (HANDLE src, HANDLE dst)
{
__int8 *buffer;
FILETIME fileTime;
DWORD bytesRead, bytesWritten;
BOOL res;
buffer = (char *) malloc (64 * 1024);
if (!buffer)
{
CloseHandle (src);
CloseHandle (dst);
return FALSE;
}
while (res = ReadFile (src, buffer, 64 * 1024, &bytesRead, NULL))
{
if (bytesRead == 0)
{
res = 1;
break;
}
if (!WriteFile (dst, buffer, bytesRead, &bytesWritten, NULL)
|| bytesRead != bytesWritten)
{
res = 0;
break;
}
}
if (GetFileTime (src, NULL, NULL, &fileTime))
SetFileTime (dst, NULL, NULL, &fileTime);
CloseHandle (src);
CloseHandle (dst);
free (buffer);
return res != 0;
}
BOOL TCCopyFile (wchar_t *sourceFileName, wchar_t *destinationFile)
{
HANDLE src, dst;
src = CreateFileW (sourceFileName,
GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (src == INVALID_HANDLE_VALUE)
return FALSE;
dst = CreateFileW (destinationFile,
GENERIC_WRITE,
0, NULL, CREATE_ALWAYS, 0, NULL);
if (dst == INVALID_HANDLE_VALUE)
{
CloseHandle (src);
return FALSE;
}
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)
{
#if defined(NDEBUG) && !defined (VC_SKIP_OS_DRIVER_REQ_CHECK)
BOOL bResult = FALSE;
HRESULT hResult;
GUID gActionID = WINTRUST_ACTION_GENERIC_VERIFY_V2;
WINTRUST_FILE_INFO fileInfo = {0};
WINTRUST_DATA WVTData = {0};
wchar_t filePath [TC_MAX_PATH + 1024];
// we check our own authenticode signature only starting from Windows 10 since this is
// the minimal supported OS apart from XP where we can't verify SHA256 signatures
if (!IsOSAtLeast (WIN_10))
return TRUE;
// Strip quotation marks (if any)
if (path [0] == L'"')
{
StringCbCopyW (filePath, sizeof(filePath), path + 1);
}
else
{
StringCbCopyW (filePath, sizeof(filePath), path);
}
// Strip quotation marks (if any)
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;
WVTData.cbStruct = sizeof(WINTRUST_DATA);
WVTData.dwUIChoice = WTD_UI_NONE;
WVTData.fdwRevocationChecks = WTD_REVOKE_NONE;
WVTData.dwUnionChoice = WTD_CHOICE_FILE;
WVTData.pFile = &fileInfo;
WVTData.dwStateAction = WTD_STATEACTION_VERIFY;
WVTData.dwProvFlags = WTD_REVOCATION_CHECK_NONE | WTD_CACHE_ONLY_URL_RETRIEVAL;
hResult = WinVerifyTrustFn(0, &gActionID, &WVTData);
if (0 == hResult)
{
PCRYPT_PROVIDER_DATA pProviderData = WTHelperProvDataFromStateDataFn (WVTData.hWVTStateData);
if (pProviderData)
{
PCRYPT_PROVIDER_SGNR pProviderSigner = WTHelperGetProvSignerFromChainFn (pProviderData, 0, FALSE, 0);
if (pProviderSigner)
{
PCRYPT_PROVIDER_CERT pProviderCert = WTHelperGetProvCertFromChainFn (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))
)
{
bResult = TRUE;
}
}
}
}
}
WVTData.dwUIChoice = WTD_UI_NONE;
WVTData.dwStateAction = WTD_STATEACTION_CLOSE;
WinVerifyTrustFn(0, &gActionID, &WVTData);
FinalizeWintrust ();
return bResult;
#else
return TRUE;
#endif
}
DWORD handleWin32Error (HWND hwndDlg, const char* srcPos)
{
#ifndef VC_COMREG
PWSTR lpMsgBuf;
DWORD dwError = GetLastError ();
wchar_t szErrorValue[32];
wchar_t* pszDesc;
if (Silent || dwError == 0 || dwError == ERROR_INVALID_WINDOW_HANDLE)
return dwError;
// Access denied
if (dwError == ERROR_ACCESS_DENIED && !IsAdmin ())
{
ErrorDirect ( AppendSrcPos (GetString ("ERR_ACCESS_DENIED"), srcPos).c_str (), hwndDlg);
SetLastError (dwError); // Preserve the original error code
return dwError;
}
FormatMessageW (
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
dwError,
MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */
(PWSTR) &lpMsgBuf,
0,
NULL
);
if (lpMsgBuf)
pszDesc = (wchar_t*) lpMsgBuf;
else
{
StringCchPrintfW (szErrorValue, ARRAYSIZE (szErrorValue), L"Error 0x%.8X", dwError);
pszDesc = szErrorValue;
}
MessageBoxW (hwndDlg, AppendSrcPos (pszDesc, srcPos).c_str (), lpszTitle, ICON_HAND);
if (lpMsgBuf) LocalFree (lpMsgBuf);
// User-friendly hardware error explanation
if (IsDiskError (dwError))
Error ("ERR_HARDWARE_ERROR", hwndDlg);
// Device not ready
if (dwError == ERROR_NOT_READY)
HandleDriveNotReadyError(hwndDlg);
SetLastError (dwError); // Preserve the original error code
return dwError;
#else
return GetLastError();
#endif
}
int Error (char *stringId, HWND hwnd)
{
#ifndef VC_COMREG
if (Silent) return 0;
return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONERROR);
#else
return 0;
#endif
}
BOOL IsOSAtLeast (OSVersionEnum reqMinOS)
{
return IsOSVersionAtLeast (reqMinOS, 0);
}
// Returns TRUE if the operating system is at least reqMinOS and service pack at least reqMinServicePack.
// Example 1: IsOSVersionAtLeast (WIN_VISTA, 1) called under Windows 2008, returns TRUE.
// Example 2: IsOSVersionAtLeast (WIN_XP, 3) called under Windows XP SP1, returns FALSE.
// Example 3: IsOSVersionAtLeast (WIN_XP, 3) called under Windows Vista SP1, returns TRUE.
BOOL IsOSVersionAtLeast (OSVersionEnum reqMinOS, int reqMinServicePack)
{
/* When updating this function, update IsOSAtLeast() in Ntdriver.c too. */
if (CurrentOSMajor <= 0)
TC_THROW_FATAL_EXCEPTION;
int major = 0, minor = 0;
switch (reqMinOS)
{
case WIN_2000: major = 5; minor = 0; break;
case WIN_XP: major = 5; minor = 1; break;
case WIN_SERVER_2003: major = 5; minor = 2; break;
case WIN_VISTA: major = 6; minor = 0; break;
case WIN_7: major = 6; minor = 1; break;
case WIN_8: major = 6; minor = 2; break;
case WIN_8_1: major = 6; minor = 3; break;
case WIN_10: major = 10; minor = 0; break;
default:
TC_THROW_FATAL_EXCEPTION;
break;
}
return ((CurrentOSMajor << 16 | CurrentOSMinor << 8 | CurrentOSServicePack)
>= (major << 16 | minor << 8 | reqMinServicePack));
}
#ifdef SETUP_DLL
static BOOL GetWindowVersionFromFile(DWORD* pdwMajor, DWORD* pdwMinor, DWORD* pdwBuildNumber)
{
wchar_t dllPath[MAX_PATH];
BOOL bRet = FALSE;
LPBYTE versionInfo = NULL;
UINT size;
VS_FIXEDFILEINFO *vinfo;
/* Load dll explictely from System32 to avoid Dll hijacking attacks*/
if (!GetSystemDirectory(dllPath, MAX_PATH))
StringCbCopyW(dllPath, sizeof(dllPath), L"C:\\Windows\\System32");
StringCbCatW(dllPath, sizeof(dllPath), L"\\");
StringCbCatW(dllPath, sizeof(dllPath), L"Kernel32.dll");
size = GetFileVersionInfoSizeW(dllPath, NULL);
if (size)
{
versionInfo = (LPBYTE) TCalloc(size);
if (GetFileVersionInfo(dllPath, 0, size, versionInfo))
{
if (VerQueryValueW(versionInfo, L"\\", (LPVOID *)&vinfo, &size) && (size >=sizeof(VS_FIXEDFILEINFO)))
{
*pdwMajor = HIWORD(vinfo->dwProductVersionMS);
*pdwMinor = LOWORD(vinfo->dwProductVersionMS);
*pdwBuildNumber = HIWORD(vinfo->dwProductVersionLS);
bRet = TRUE;
}
}
}
if (versionInfo)
TCfree(versionInfo);
return bRet;
}
#endif
/*
* Use RtlGetVersion to get Windows version because GetVersionEx is affected by application manifestation.
*/
typedef NTSTATUS (WINAPI* RtlGetVersionPtr)(PRTL_OSVERSIONINFOW);
static BOOL GetWindowsVersion(LPOSVERSIONINFOW lpVersionInformation)
{
BOOL bRet = FALSE;
#ifdef SETUP_DLL
DWORD dwMajor, dwMinor, dwBuildNumber;
#endif
RtlGetVersionPtr RtlGetVersionFn = (RtlGetVersionPtr) GetProcAddress(GetModuleHandle (L"ntdll.dll"), "RtlGetVersion");
if (RtlGetVersionFn != NULL)
{
if (ERROR_SUCCESS == RtlGetVersionFn (lpVersionInformation))
bRet = TRUE;
}
if (!bRet)
bRet = GetVersionExW (lpVersionInformation);
#ifdef SETUP_DLL
// we get real version from Kernel32.dll version since MSI always sets current version to 6.0
// https://stackoverflow.com/questions/49335885/windows-10-not-detecting-on-installshield/49343826#49343826
if (GetWindowVersionFromFile(&dwMajor, &dwMinor, &dwBuildNumber))
{
lpVersionInformation->dwMajorVersion = dwMajor;
lpVersionInformation->dwMinorVersion = dwMinor;
lpVersionInformation->dwBuildNumber = dwBuildNumber;
}
#endif
return bRet;
}
void InitOSVersionInfo ()
{
OSVERSIONINFOEXW os;
os.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEXW);
if (GetWindowsVersion ((LPOSVERSIONINFOW) &os) == FALSE)
AbortProcess ("NO_OS_VER");
CurrentOSMajor = os.dwMajorVersion;
CurrentOSMinor = os.dwMinorVersion;
CurrentOSServicePack = os.wServicePackMajor;
CurrentOSBuildNumber = os.dwBuildNumber;
if (os.dwPlatformId == VER_PLATFORM_WIN32_NT && CurrentOSMajor == 5 && CurrentOSMinor == 0)
nCurrentOS = WIN_2000;
else if (os.dwPlatformId == VER_PLATFORM_WIN32_NT && CurrentOSMajor == 5 && CurrentOSMinor == 1)
nCurrentOS = WIN_XP;
else if (os.dwPlatformId == VER_PLATFORM_WIN32_NT && CurrentOSMajor == 5 && CurrentOSMinor == 2)
{
if (os.wProductType == VER_NT_SERVER || os.wProductType == VER_NT_DOMAIN_CONTROLLER)
nCurrentOS = WIN_SERVER_2003;
else
nCurrentOS = WIN_XP64;
}
else if (os.dwPlatformId == VER_PLATFORM_WIN32_NT && CurrentOSMajor == 6 && CurrentOSMinor == 0)
{
if (os.wProductType != VER_NT_WORKSTATION)
nCurrentOS = WIN_SERVER_2008;
else
nCurrentOS = WIN_VISTA;
}
else if (os.dwPlatformId == VER_PLATFORM_WIN32_NT && CurrentOSMajor == 6 && CurrentOSMinor == 1)
nCurrentOS = ((os.wProductType != VER_NT_WORKSTATION) ? WIN_SERVER_2008_R2 : WIN_7);
else if (os.dwPlatformId == VER_PLATFORM_WIN32_NT && CurrentOSMajor == 6 && CurrentOSMinor == 2)
nCurrentOS = ((os.wProductType != VER_NT_WORKSTATION) ? WIN_SERVER_2012 : WIN_8);
else if (os.dwPlatformId == VER_PLATFORM_WIN32_NT && CurrentOSMajor == 6 && CurrentOSMinor == 3)
nCurrentOS = ((os.wProductType != VER_NT_WORKSTATION) ? WIN_SERVER_2012_R2 : WIN_8_1);
else if (os.dwPlatformId == VER_PLATFORM_WIN32_NT && CurrentOSMajor == 10 && CurrentOSMinor == 0)
nCurrentOS = ((os.wProductType != VER_NT_WORKSTATION) ? WIN_SERVER_2016 : WIN_10);
else if (os.dwPlatformId == VER_PLATFORM_WIN32_NT && CurrentOSMajor == 4)
nCurrentOS = WIN_NT4;
else if (os.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS && os.dwMajorVersion == 4 && os.dwMinorVersion == 0)
nCurrentOS = WIN_95;
else if (os.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS && os.dwMajorVersion == 4 && os.dwMinorVersion == 10)
nCurrentOS = WIN_98;
else if (os.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS && os.dwMajorVersion == 4 && os.dwMinorVersion == 90)
nCurrentOS = WIN_ME;
else if (os.dwPlatformId == VER_PLATFORM_WIN32s)
nCurrentOS = WIN_31;
else
nCurrentOS = WIN_UNKNOWN;
}
#pragma warning(push)
#pragma warning(disable:4702)
void *err_malloc (size_t size)
{
void *z = (void *) TCalloc (size);
if (z)
return z;
AbortProcess ("OUTOFMEMORY");
return 0;
}
#pragma warning(pop)
char *err_strdup (char *lpszText)
{
size_t j = (strlen (lpszText) + 1) * sizeof (char);
char *z = (char *) err_malloc (j);
memmove (z, lpszText, j);
return z;
}
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);
}
void AbortProcess (char *stringId)
{
// Note that this function also causes localcleanup() to be called (see atexit())
#ifndef VC_COMREG
AbortProcessDirect (GetString (stringId));
#else
static wchar_t g_wszUnknown[1024];
StringCbPrintfW (g_wszUnknown, sizeof(g_wszUnknown), UNKNOWN_STRING_ID L"%hs" UNKNOWN_STRING_ID, stringId);
AbortProcessDirect (g_wszUnknown);
#endif
}
#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);
}
void InitGlobalLocks ()
{
InitializeCriticalSection (&csWNetCalls);
InitializeCriticalSection (&csMountableDevices);
InitializeCriticalSection (&csVolumeIdCandidates);
InitializeCriticalSection (&csSecureDesktop);
}
void FinalizeGlobalLocks ()
{
DeleteCriticalSection (&csWNetCalls);
DeleteCriticalSection (&csMountableDevices);
DeleteCriticalSection (&csVolumeIdCandidates);
DeleteCriticalSection (&csSecureDesktop);
}
void cleanup ()
{
burn (&CmdTokenPin, sizeof (CmdTokenPin));
#ifndef SETUP
KeyFileRemoveAll (&FirstKeyFile);
KeyFileRemoveAll (&defaultKeyFilesParam.FirstKeyFile);
#endif
/* Cleanup the GDI fonts */
if (hFixedFont != NULL)
DeleteObject (hFixedFont);
if (hFixedDigitFont != NULL)
DeleteObject (hFixedDigitFont);
if (hBoldFont != NULL)
DeleteObject (hBoldFont);
if (hTitleFont != NULL)
DeleteObject (hTitleFont);
if (hUserFont != NULL)
DeleteObject (hUserFont);
if (hUserUnderlineFont != NULL)
DeleteObject (hUserUnderlineFont);
if (hUserBoldFont != NULL)
DeleteObject (hUserBoldFont);
if (hUserUnderlineBoldFont != NULL)
DeleteObject (hUserUnderlineBoldFont);
/* Cleanup our dialog class */
if (hDlgClass)
UnregisterClassW (TC_DLG_CLASS, hInst);
if (hSplashClass)
UnregisterClassW (TC_SPLASH_CLASS, hInst);
/* Close the device driver handle */
if (hDriver != INVALID_HANDLE_VALUE)
{
// Unload driver mode if possible (non-install mode)
if (IsNonInstallMode ())
{
// If a dismount was forced in the lifetime of the driver, Windows may later prevent it to be loaded again from
// the same path. Therefore, the driver will not be unloaded even though it was loaded in non-install mode.
int driverUnloadDisabled;
DWORD dwResult;
if (!DeviceIoControl (hDriver, TC_IOCTL_IS_DRIVER_UNLOAD_DISABLED, NULL, 0, &driverUnloadDisabled, sizeof (driverUnloadDisabled), &dwResult, NULL))
driverUnloadDisabled = 0;
if (!driverUnloadDisabled)
DriverUnload ();
else
{
CloseHandle (hDriver);
hDriver = INVALID_HANDLE_VALUE;
}
}
else
{
CloseHandle (hDriver);
hDriver = INVALID_HANDLE_VALUE;
}
}
if (ConfigBuffer != NULL)
{
free (ConfigBuffer);
ConfigBuffer = NULL;
}
CoUninitialize ();
CloseSysEncMutex ();
#ifndef SETUP
try
{
if (SecurityToken::IsInitialized())
SecurityToken::CloseLibrary();
}
catch (...) { }
EncryptionThreadPoolStop();
#endif
FinalizeGlobalLocks ();
}
void LowerCaseCopy (wchar_t *lpszDest, const wchar_t *lpszSource)
{
size_t i = wcslen (lpszSource) + 1;
lpszDest[i - 1] = 0;
while (--i > 0)
{
lpszDest[i - 1] = (wchar_t) towlower (lpszSource[i - 1]);
}
}
void UpperCaseCopy (wchar_t *lpszDest, size_t cbDest, const wchar_t *lpszSource)
{
if (lpszDest && cbDest)
{
size_t i = wcslen (lpszSource);
if (i >= cbDest)
i = cbDest - 1;
lpszDest[i] = 0;
i++;
while (--i > 0)
{
lpszDest[i - 1] = (wchar_t) towupper (lpszSource[i - 1]);
}
}
}
std::wstring ToUpperCase (const std::wstring &str)
{
wstring u;
foreach (wchar_t c, str)
{
u += (wchar_t) towupper (c);
}
return u;
}
size_t TrimWhiteSpace(wchar_t *str)
{
wchar_t *end, *ptr = str;
size_t out_size;
if(!str || *str == 0)
return 0;
// Trim leading space
while(iswspace(*ptr)) ptr++;
if(*ptr == 0) // All spaces?
{
*str = 0;
return 0;
}
// Trim trailing space
end = str + wcslen(str) - 1;
while(end > ptr && iswspace(*end)) end--;
end++;
// Set output size to trimmed string length
out_size = (end - ptr);
// Copy trimmed string and add null terminator
wmemmove(str, ptr, out_size);
str[out_size] = 0;
return out_size;
}
BOOL IsNullTerminateString (const wchar_t* str, size_t cbSize)
{
if (str && cbSize)
{
for (size_t i = 0; i < cbSize; i++)
{
if (str[i] == 0)
return TRUE;
}
}
return FALSE;
}
// check the validity of a file name
BOOL IsValidFileName(const wchar_t* str)
{
static wchar_t invalidChars[9] = {L'<', L'>', L':', L'"', L'/', L'\\', L'|', L'?', L'*'};
wchar_t c;
int i;
BOOL bNotDotOnly = FALSE;
while ((c = *str))
{
if (c != L'.')
bNotDotOnly = TRUE;
for (i= 0; i < ARRAYSIZE(invalidChars); i++)
if (c == invalidChars[i])
return FALSE;
str++;
}
return bNotDotOnly;
}
BOOL IsVolumeDeviceHosted (const wchar_t *lpszDiskFile)
{
return wcsstr (lpszDiskFile, L"\\Device\\") == lpszDiskFile
|| wcsstr (lpszDiskFile, L"\\DEVICE\\") == lpszDiskFile;
}
void CreateFullVolumePath (wchar_t *lpszDiskFile, size_t cbDiskFile, const wchar_t *lpszFileName, BOOL * bDevice)
{
UpperCaseCopy (lpszDiskFile, cbDiskFile, lpszFileName);
*bDevice = FALSE;
if (wmemcmp (lpszDiskFile, L"\\DEVICE", 7) == 0)
{
*bDevice = TRUE;
}
StringCbCopyW (lpszDiskFile, cbDiskFile, lpszFileName);
#if _DEBUG
OutputDebugString (L"CreateFullVolumePath: ");
OutputDebugString (lpszDiskFile);
OutputDebugString (L"\n");
#endif
}
int FakeDosNameForDevice (const wchar_t *lpszDiskFile , wchar_t *lpszDosDevice , size_t cbDosDevice, wchar_t *lpszCFDevice , size_t cbCFDevice, BOOL bNameOnly)
{
BOOL bDosLinkCreated = TRUE;
StringCbPrintfW (lpszDosDevice, cbDosDevice,L"veracrypt%lu", GetCurrentProcessId ());
if (bNameOnly == FALSE)
bDosLinkCreated = DefineDosDevice (DDD_RAW_TARGET_PATH, lpszDosDevice, lpszDiskFile);
if (bDosLinkCreated == FALSE)
return ERR_OS_ERROR;
else
StringCbPrintfW (lpszCFDevice, cbCFDevice,L"\\\\.\\%s", lpszDosDevice);
return 0;
}
int RemoveFakeDosName (wchar_t *lpszDiskFile, wchar_t *lpszDosDevice)
{
BOOL bDosLinkRemoved = DefineDosDevice (DDD_RAW_TARGET_PATH | DDD_EXACT_MATCH_ON_REMOVE |
DDD_REMOVE_DEFINITION, lpszDosDevice, lpszDiskFile);
if (bDosLinkRemoved == FALSE)
{
return ERR_OS_ERROR;
}
return 0;
}
BOOL IsDiskReadError (DWORD error)
{
return (error == ERROR_CRC
|| error == ERROR_IO_DEVICE
|| error == ERROR_BAD_CLUSTERS
|| error == ERROR_SECTOR_NOT_FOUND
|| error == ERROR_READ_FAULT
|| error == ERROR_INVALID_FUNCTION // I/O error may be reported as ERROR_INVALID_FUNCTION by buggy chipset drivers
|| error == ERROR_SEM_TIMEOUT); // I/O operation timeout may be reported as ERROR_SEM_TIMEOUT
}
BOOL IsDiskWriteError (DWORD error)
{
return (error == ERROR_IO_DEVICE
|| error == ERROR_BAD_CLUSTERS
|| error == ERROR_SECTOR_NOT_FOUND
|| error == ERROR_WRITE_FAULT
|| error == ERROR_INVALID_FUNCTION // I/O error may be reported as ERROR_INVALID_FUNCTION by buggy chipset drivers
|| error == ERROR_SEM_TIMEOUT); // I/O operation timeout may be reported as ERROR_SEM_TIMEOUT
}
BOOL IsDiskError (DWORD error)
{
return IsDiskReadError (error) || IsDiskWriteError (error);
}
BOOL translateWin32Error (wchar_t *lpszMsgBuf, int nWSizeOfBuf)
{
DWORD dwError = GetLastError ();
if (FormatMessageW (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, dwError,
MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */
lpszMsgBuf, nWSizeOfBuf, NULL))
{
SetLastError (dwError); // Preserve the original error code
return TRUE;
}
SetLastError (dwError); // Preserve the original error code
return FALSE;
}
// If the user has a non-default screen DPI, all absolute font sizes must be
// converted using this function.
int CompensateDPIFont (int val)
{
if (ScreenDPI == USER_DEFAULT_SCREEN_DPI)
return val;
else
{
double tmpVal = (double) val * DPIScaleFactorY * DlgAspectRatio * 0.999;
if (tmpVal > 0)
return (int) floor(tmpVal);
else
return (int) ceil(tmpVal);
}
}
// If the user has a non-default screen DPI, some screen coordinates and sizes must
// be converted using this function
int CompensateXDPI (int val)
{
if (ScreenDPI == USER_DEFAULT_SCREEN_DPI)
return val;
else
{
double tmpVal = (double) val * DPIScaleFactorX;
if (tmpVal > 0)
return (int) floor(tmpVal);
else
return (int) ceil(tmpVal);
}
}
// If the user has a non-default screen DPI, some screen coordinates and sizes must
// be converted using this function
int CompensateYDPI (int val)
{
if (ScreenDPI == USER_DEFAULT_SCREEN_DPI)
return val;
else
{
double tmpVal = (double) val * DPIScaleFactorY;
if (tmpVal > 0)
return (int) floor(tmpVal);
else
return (int) ceil(tmpVal);
}
}
int GetTextGfxWidth (HWND hwndDlgItem, const wchar_t *text, HFONT hFont)
{
SIZE sizes;
TEXTMETRIC textMetrics;
HDC hdc = GetDC (hwndDlgItem);
SelectObject(hdc, (HGDIOBJ) hFont);
GetTextExtentPoint32W (hdc, text, (int) wcslen (text), &sizes);
GetTextMetrics(hdc, &textMetrics); // Necessary for non-TrueType raster fonts (tmOverhang)
ReleaseDC (hwndDlgItem, hdc);
return ((int) sizes.cx - (int) textMetrics.tmOverhang);
}
int GetTextGfxHeight (HWND hwndDlgItem, const wchar_t *text, HFONT hFont)
{
SIZE sizes;
HDC hdc = GetDC (hwndDlgItem);
SelectObject(hdc, (HGDIOBJ) hFont);
GetTextExtentPoint32W (hdc, text, (int) wcslen (text), &sizes);
ReleaseDC (hwndDlgItem, hdc);
return ((int) sizes.cy);
}
std::wstring FitPathInGfxWidth (HWND hwnd, HFONT hFont, LONG width, const std::wstring &path)
{
wstring newPath;
RECT rect;
rect.left = 0;
rect.top = 0;
rect.right = width;
rect.bottom = LONG_MAX;
HDC hdc = GetDC (hwnd);
SelectObject (hdc, (HGDIOBJ) hFont);
wchar_t pathBuf[TC_MAX_PATH];
StringCchCopyW (pathBuf, ARRAYSIZE (pathBuf), path.c_str());
if (DrawText (hdc, pathBuf, (int) path.size(), &rect, DT_CALCRECT | DT_MODIFYSTRING | DT_PATH_ELLIPSIS | DT_SINGLELINE) != 0)
newPath = pathBuf;
ReleaseDC (hwnd, hdc);
return newPath;
}
static LRESULT CALLBACK HyperlinkProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
WNDPROC wp = (WNDPROC) GetWindowLongPtrW (hwnd, GWLP_USERDATA);
switch (message)
{
case WM_SETCURSOR:
if (!bHyperLinkBeingTracked)
{
TRACKMOUSEEVENT trackMouseEvent;
trackMouseEvent.cbSize = sizeof(trackMouseEvent);
trackMouseEvent.dwFlags = TME_LEAVE;
trackMouseEvent.hwndTrack = hwnd;
bHyperLinkBeingTracked = TrackMouseEvent(&trackMouseEvent);
HandCursor();
}
return 0;
case WM_MOUSELEAVE:
bHyperLinkBeingTracked = FALSE;
NormalCursor();
return 0;
}
return CallWindowProcW (wp, hwnd, message, wParam, lParam);
}
BOOL ToHyperlink (HWND hwndDlg, UINT ctrlId)
{
return ToCustHyperlink (hwndDlg, ctrlId, hUserUnderlineFont);
}
BOOL ToCustHyperlink (HWND hwndDlg, UINT ctrlId, HFONT hFont)
{
HWND hwndCtrl = GetDlgItem (hwndDlg, ctrlId);
SendMessageW (hwndCtrl, WM_SETFONT, (WPARAM) hFont, 0);
SetWindowLongPtrW (hwndCtrl, GWLP_USERDATA, (LONG_PTR) GetWindowLongPtrW (hwndCtrl, GWLP_WNDPROC));
SetWindowLongPtrW (hwndCtrl, GWLP_WNDPROC, (LONG_PTR) HyperlinkProc);
// Resize the field according to its actual size in pixels and move it if centered or right-aligned.
// This should be done again if the link text changes.
AccommodateTextField (hwndDlg, ctrlId, TRUE, hFont);
return TRUE;
}
// Resizes a text field according to its actual width and height in pixels (font size is taken into account) and moves
// it accordingly if the field is centered or right-aligned. Should be used on all hyperlinks upon dialog init
// after localization (bFirstUpdate should be TRUE) and later whenever a hyperlink text changes (bFirstUpdate
// must be FALSE).
void AccommodateTextField (HWND hwndDlg, UINT ctrlId, BOOL bFirstUpdate, HFONT hFont)
{
RECT rec, wrec, trec;
HWND hwndCtrl = GetDlgItem (hwndDlg, ctrlId);
int width, origWidth, height, origHeight;
int horizSubOffset, vertSubOffset, vertOffset, alignPosDiff = 0;
wchar_t text [MAX_URL_LENGTH];
WINDOWINFO windowInfo;
BOOL bBorderlessWindow = !(GetWindowLongPtrW (hwndDlg, GWL_STYLE) & (WS_BORDER | WS_DLGFRAME));
// 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);
height = GetTextGfxHeight (hwndCtrl, text, hFont);
GetClientRect (hwndCtrl, &rec);
origWidth = rec.right;
origHeight = rec.bottom;
if (width >= 0
&& (!bFirstUpdate || origWidth > width)) // The original width of the field is the maximum allowed size
{
horizSubOffset = origWidth - width;
vertSubOffset = origHeight - height;
// Window coords
GetWindowRect(hwndDlg, &wrec);
GetClientRect(hwndDlg, &trec);
// Vertical "title bar" offset
vertOffset = wrec.bottom - wrec.top - trec.bottom - (bBorderlessWindow ? 0 : GetSystemMetrics(SM_CYFIXEDFRAME));
// Text field coords
GetWindowRect(hwndCtrl, &rec);
// Alignment offset
windowInfo.cbSize = sizeof(windowInfo);
GetWindowInfo (hwndCtrl, &windowInfo);
if (windowInfo.dwStyle & SS_CENTER)
alignPosDiff = horizSubOffset / 2;
else if (windowInfo.dwStyle & SS_RIGHT)
alignPosDiff = horizSubOffset;
// Resize/move
if (alignPosDiff > 0)
{
// Resize and move the text field
MoveWindow (hwndCtrl,
rec.left - wrec.left - (bBorderlessWindow ? 0 : GetSystemMetrics(SM_CXFIXEDFRAME)) + alignPosDiff,
rec.top - wrec.top - vertOffset,
origWidth - horizSubOffset,
origHeight - vertSubOffset,
TRUE);
}
else
{
// Resize the text field
SetWindowPos (hwndCtrl, 0, 0, 0,
origWidth - horizSubOffset,
origHeight - vertSubOffset,
SWP_NOMOVE | SWP_NOZORDER);
}
SetWindowPos (hwndCtrl, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
InvalidateRect (hwndCtrl, NULL, TRUE);
}
}
// 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)
{
EnableMenuItem (GetSystemMenu (hwndDlg, FALSE), SC_CLOSE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
}
void EnableCloseButton (HWND hwndDlg)
{
EnableMenuItem (GetSystemMenu (hwndDlg, FALSE), SC_CLOSE, MF_BYCOMMAND | MF_ENABLED);
}
void HandlePasswordEditWmChar (HWND hwnd, WPARAM wParam)
{
DWORD dwStartPos = 0, dwEndPos = 0;
short vk = VkKeyScanW ((WCHAR) wParam);
BYTE vkCode = LOBYTE (vk);
BYTE vkState = HIBYTE (vk);
bool ctrlPressed = (vkState & 2) && !(vkState & 4);
int dwMaxPassLen = (int) SendMessage (hwnd, EM_GETLIMITTEXT, 0, 0);
// check if there is a selected text
SendMessage (hwnd, EM_GETSEL, (WPARAM) &dwStartPos, (LPARAM) &dwEndPos);
if ((dwStartPos == dwEndPos)
&& (vkCode != VK_DELETE) && (vkCode != VK_BACK)
&& !ctrlPressed
&& (GetWindowTextLength (hwnd) == dwMaxPassLen))
{
EDITBALLOONTIP ebt;
DWORD dwTextSize = (DWORD) wcslen (GetString ("PASSWORD_MAXLENGTH_REACHED")) + 16;
WCHAR* szErrorText = (WCHAR*) malloc (dwTextSize * sizeof (WCHAR));
StringCchPrintf (szErrorText, dwTextSize, GetString ("PASSWORD_MAXLENGTH_REACHED"), dwMaxPassLen);
ebt.cbStruct = sizeof( EDITBALLOONTIP );
ebt.pszText = szErrorText;
ebt.pszTitle = lpszTitle;
ebt.ttiIcon = TTI_ERROR_LARGE; // tooltip warning icon
SendMessage(hwnd, EM_SHOWBALLOONTIP, 0, (LPARAM)&ebt);
MessageBeep (0xFFFFFFFF);
free (szErrorText);
}
else
SendMessage(hwnd, EM_HIDEBALLOONTIP, 0, 0);
}
-
-/* Protects an input field from having its content updated by a paste action */
+// Protects an input field from having its content updated by a Paste action (call ToBootPwdField() to use this).
static LRESULT CALLBACK BootPwdFieldProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
WNDPROC wp = (WNDPROC) GetWindowLongPtrW (hwnd, GWLP_USERDATA);
-
+
switch (message)
{
case WM_PASTE:
- Error ("ERROR_PASTE_ACTION", GetParent(hwnd));
return 1;
-
case WM_CHAR:
HandlePasswordEditWmChar (hwnd, wParam);
break;
}
+
return CallWindowProcW (wp, hwnd, message, wParam, lParam);
}
+
// Protects an input field from having its content updated by a Paste action. Used for pre-boot password
// input fields (only the US keyboard layout is supported in pre-boot environment so we must prevent the
// user from pasting a password typed using a non-US keyboard layout).
void ToBootPwdField (HWND hwndDlg, UINT ctrlId)
{
HWND hwndCtrl = GetDlgItem (hwndDlg, ctrlId);
WNDPROC originalwp = (WNDPROC) GetWindowLongPtrW (hwndCtrl, GWLP_USERDATA);
SendMessage (hwndCtrl, EM_LIMITTEXT, MAX_LEGACY_PASSWORD, 0);
// if ToNormalPwdField has been called before, GWLP_USERDATA already contains original WNDPROC
if (!originalwp)
{
SetWindowLongPtrW (hwndCtrl, GWLP_USERDATA, (LONG_PTR) GetWindowLongPtrW (hwndCtrl, GWLP_WNDPROC));
}
SetWindowLongPtrW (hwndCtrl, GWLP_WNDPROC, (LONG_PTR) BootPwdFieldProc);
}
-BOOL CheckIsIMESupported ()
-{
- if (himm32dll == NULL)
- return FALSE;
- return TRUE;
-}
// Ensures that a warning is displayed when user is pasting a password longer than the maximum
// length which is set to 64 characters
static LRESULT CALLBACK NormalPwdFieldProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
WNDPROC wp = (WNDPROC) GetWindowLongPtrW (hwnd, GWLP_USERDATA);
switch (message)
{
case WM_PASTE:
{
bool bBlock = false;
if (OpenClipboard (NULL))
{
HANDLE h = GetClipboardData (CF_UNICODETEXT);
if (h)
{
wchar_t *pchData = (wchar_t*)GlobalLock(h);
int txtlen = 0;
int dwMaxPassLen = bUseLegacyMaxPasswordLength? MAX_LEGACY_PASSWORD : MAX_PASSWORD;
while (*pchData)
{
if (*pchData == '\r' || *pchData == '\n')
break;
else
{
txtlen++;
pchData++;
}
}
if (txtlen)
{
int curLen = GetWindowTextLength (hwnd);
if (curLen == dwMaxPassLen)
{
EDITBALLOONTIP ebt;
DWORD dwTextSize = (DWORD) wcslen (GetString ("PASSWORD_MAXLENGTH_REACHED")) + 16;
WCHAR* szErrorText = (WCHAR*) malloc (dwTextSize * sizeof (WCHAR));
StringCchPrintf (szErrorText, dwTextSize, GetString ("PASSWORD_MAXLENGTH_REACHED"), dwMaxPassLen);
ebt.cbStruct = sizeof( EDITBALLOONTIP );
ebt.pszText = szErrorText;
ebt.pszTitle = lpszTitle;
ebt.ttiIcon = TTI_ERROR_LARGE; // tooltip warning icon
SendMessage(hwnd, EM_SHOWBALLOONTIP, 0, (LPARAM)&ebt);
MessageBeep (0xFFFFFFFF);
free (szErrorText);
bBlock = true;
}
else if ((txtlen + curLen) > dwMaxPassLen)
{
EDITBALLOONTIP ebt;
DWORD dwTextSize = (DWORD) wcslen (GetString ("PASSWORD_PASTED_TRUNCATED")) + 16;
WCHAR* szErrorText = (WCHAR*) malloc (dwTextSize * sizeof (WCHAR));
StringCchPrintf (szErrorText, dwTextSize, GetString ("PASSWORD_PASTED_TRUNCATED"), dwMaxPassLen);
ebt.cbStruct = sizeof( EDITBALLOONTIP );
ebt.pszText = szErrorText;
ebt.pszTitle = lpszTitle;
ebt.ttiIcon = TTI_WARNING_LARGE; // tooltip warning icon
SendMessage(hwnd, EM_SHOWBALLOONTIP, 0, (LPARAM)&ebt);
MessageBeep (0xFFFFFFFF);
free (szErrorText);
}
else
SendMessage(hwnd, EM_HIDEBALLOONTIP, 0, 0);
}
GlobalUnlock(h);
}
CloseClipboard ();
}
if (bBlock)
return FALSE;
}
break;
case WM_CHAR:
HandlePasswordEditWmChar (hwnd, wParam);
break;
}
return CallWindowProcW (wp, hwnd, message, wParam, lParam);
}
void ToNormalPwdField (HWND hwndDlg, UINT ctrlId)
{
HWND hwndCtrl = GetDlgItem (hwndDlg, ctrlId);
WNDPROC originalwp = (WNDPROC) GetWindowLongPtrW (hwndCtrl, GWLP_USERDATA);
DWORD dwMaxPassLen = bUseLegacyMaxPasswordLength? MAX_LEGACY_PASSWORD : MAX_PASSWORD;
SendMessage (hwndCtrl, EM_LIMITTEXT, dwMaxPassLen, 0);
// only change WNDPROC if not changed already
if (!originalwp)
{
SetWindowLongPtrW (hwndCtrl, GWLP_USERDATA, (LONG_PTR) GetWindowLongPtrW (hwndCtrl, GWLP_WNDPROC));
SetWindowLongPtrW (hwndCtrl, GWLP_WNDPROC, (LONG_PTR) NormalPwdFieldProc);
}
}
// This function currently serves the following purposes:
// - Determines scaling factors for current screen DPI and GUI aspect ratio.
// - Determines how Windows skews the GUI aspect ratio (which happens when the user has a non-default DPI).
// The determined values must be used when performing some GUI operations and calculations.
BOOL CALLBACK AuxiliaryDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_INITDIALOG:
{
HDC hDC = GetDC (hwndDlg);
if (hDC)
{
ScreenDPI = GetDeviceCaps (hDC, LOGPIXELSY);
ReleaseDC (hwndDlg, hDC);
}
DPIScaleFactorX = 1;
DPIScaleFactorY = 1;
DlgAspectRatio = 1;
if (ScreenDPI != USER_DEFAULT_SCREEN_DPI)
{
// Windows skews the GUI aspect ratio if the user has a non-default DPI. Hence, working with
// actual screen DPI is redundant and leads to incorrect results. What really matters here is
// how Windows actually renders our GUI. This is determined by comparing the expected and current
// sizes of a hidden calibration text field.
RECT trec;
trec.right = 0;
trec.bottom = 0;
GetClientRect (GetDlgItem (hwndDlg, IDC_ASPECT_RATIO_CALIBRATION_BOX), &trec);
if (trec.right != 0 && trec.bottom != 0)
{
// The size of the 282x282 IDC_ASPECT_RATIO_CALIBRATION_BOX rendered at the default DPI (96) is 423x458
DPIScaleFactorX = (double) trec.right / 423;
DPIScaleFactorY = (double) trec.bottom / 458;
DlgAspectRatio = DPIScaleFactorX / DPIScaleFactorY;
}
}
EndDialog (hwndDlg, 0);
return 1;
}
case WM_CLOSE:
EndDialog (hwndDlg, 0);
return 1;
}
return 0;
}
/* Except in response to the WM_INITDIALOG message, the dialog box procedure
should return nonzero if it processes the message, and zero if it does
not. - see DialogProc */
BOOL CALLBACK AboutDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
WORD lw = LOWORD (wParam);
static HBITMAP hbmTextualLogoBitmapRescaled = NULL;
switch (msg)
{
case WM_INITDIALOG:
{
wchar_t szTmp[100];
RECT rec;
LocalizeDialog (hwndDlg, "IDD_ABOUT_DLG");
// Hyperlink
SetWindowText (GetDlgItem (hwndDlg, IDC_HOMEPAGE), L"www.idrix.fr");
ToHyperlink (hwndDlg, IDC_HOMEPAGE);
// Logo area background (must not keep aspect ratio; must retain Windows-imposed distortion)
GetClientRect (GetDlgItem (hwndDlg, IDC_ABOUT_LOGO_AREA), &rec);
SetWindowPos (GetDlgItem (hwndDlg, IDC_ABOUT_BKG), HWND_TOP, 0, 0, rec.right, rec.bottom, SWP_NOMOVE);
// Resize the logo bitmap if the user has a non-default DPI
if (ScreenDPI != USER_DEFAULT_SCREEN_DPI)
{
// Logo (must recreate and keep the original aspect ratio as Windows distorts it)
hbmTextualLogoBitmapRescaled = RenderBitmap (MAKEINTRESOURCE (IDB_TEXTUAL_LOGO_288DPI),
GetDlgItem (hwndDlg, IDC_TEXTUAL_LOGO_IMG),
0, 0, 0, 0, FALSE, TRUE);
SetWindowPos (GetDlgItem (hwndDlg, IDC_ABOUT_BKG), HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}
// Version
SendMessage (GetDlgItem (hwndDlg, IDT_ABOUT_VERSION), WM_SETFONT, (WPARAM) hUserBoldFont, 0);
StringCbPrintfW (szTmp, sizeof(szTmp), L"VeraCrypt %s", _T(VERSION_STRING) _T(VERSION_STRING_SUFFIX));
#ifdef _WIN64
StringCbCatW (szTmp, sizeof(szTmp), L" (64-bit)");
#else
StringCbCatW (szTmp, sizeof(szTmp), L" (32-bit)");
#endif
#if (defined(_DEBUG) || defined(DEBUG))
StringCbCatW (szTmp, sizeof(szTmp), L" (debug)");
#endif
SetDlgItemText (hwndDlg, IDT_ABOUT_VERSION, szTmp);
SetDlgItemText (hwndDlg, IDT_ABOUT_RELEASE, TC_STR_RELEASED_BY);
// Credits
SendMessage (GetDlgItem (hwndDlg, IDC_ABOUT_CREDITS), WM_SETFONT, (WPARAM) hUserFont, (LPARAM) 0);
SendMessage (hwndDlg, WM_APP, 0, 0);
return 1;
}
case WM_APP:
SetWindowText (GetDlgItem (hwndDlg, IDC_ABOUT_CREDITS),
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 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 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 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"This software as a whole:\r\n"
L"Copyright \xA9 2013-2022 IDRIX. All rights reserved.\r\n\r\n"
L"An IDRIX Release");
return 1;
case WM_COMMAND:
if (lw == IDOK || lw == IDCANCEL)
{
PostMessage (hwndDlg, WM_CLOSE, 0, 0);
return 1;
}
if (lw == IDC_HOMEPAGE)
{
Applink ("main");
return 1;
}
// Disallow modification of credits
if (HIWORD (wParam) == EN_UPDATE)
{
SendMessage (hwndDlg, WM_APP, 0, 0);
return 1;
}
return 0;
case WM_CLOSE:
/* Delete buffered bitmaps (if any) */
if (hbmTextualLogoBitmapRescaled != NULL)
{
DeleteObject ((HGDIOBJ) hbmTextualLogoBitmapRescaled);
hbmTextualLogoBitmapRescaled = NULL;
}
EndDialog (hwndDlg, 0);
return 1;
}
return 0;
}
static HWND StaticModelessWaitDlgHandle = NULL;
// Call DisplayStaticModelessWaitDlg() to open this dialog and CloseStaticModelessWaitDlg() to close it.
static BOOL CALLBACK StaticModelessWaitDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
WORD lw = LOWORD (wParam);
switch (msg)
{
case WM_INITDIALOG:
{
LocalizeDialog (hwndDlg, NULL);
return 0;
}
case WM_COMMAND:
if (lw == IDOK || lw == IDCANCEL)
return 1;
return 0;
case WM_CLOSE:
StaticModelessWaitDlgHandle = NULL;
EndDialog (hwndDlg, 0);
return 1;
}
return 0;
}
// Opens a dialog window saying "Please wait..." which is not modal and does not need any GUI refresh after initialization.
void DisplayStaticModelessWaitDlg (HWND parent)
{
if (StaticModelessWaitDlgHandle != NULL)
return; // Already shown
StaticModelessWaitDlgHandle = CreateDialogParamW (hInst, MAKEINTRESOURCEW (IDD_STATIC_MODELESS_WAIT_DLG), parent, (DLGPROC) StaticModelessWaitDlgProc, (LPARAM) 0);
ShowWindow (StaticModelessWaitDlgHandle, SW_SHOWNORMAL);
// Allow synchronous use with the GUI being instantly and fully rendered
ProcessPaintMessages (StaticModelessWaitDlgHandle, 500);
}
void CloseStaticModelessWaitDlg (void)
{
if (StaticModelessWaitDlgHandle == NULL)
return; // Not shown
DestroyWindow (StaticModelessWaitDlgHandle);
}
BOOL IsButtonChecked (HWND hButton)
{
if (SendMessage (hButton, BM_GETCHECK, 0, 0) == BST_CHECKED)
return TRUE;
else
return FALSE;
}
void CheckButton (HWND hButton)
{
SendMessage (hButton, BM_SETCHECK, BST_CHECKED, 0);
}
void LeftPadString (wchar_t *szTmp, int len, int targetLen, wchar_t filler)
{
int i;
if (targetLen <= len)
return;
for (i = targetLen-1; i >= (targetLen-len); i--)
szTmp [i] = szTmp [i-(targetLen-len)];
wmemset (szTmp, filler, targetLen-len);
szTmp [targetLen] = 0;
}
/* InitDialog - initialize the applications main dialog, this function should
be called only once in the dialogs WM_INITDIALOG message handler */
void InitDialog (HWND hwndDlg)
{
NONCLIENTMETRICSW metric;
static BOOL aboutMenuAppended = FALSE;
int nHeight;
LOGFONTW lf;
HMENU hMenu;
Font *font;
/* Fonts */
memset (&lf, 0, sizeof(lf));
// Normal
font = GetFont ("font_normal");
metric.cbSize = sizeof (metric);
SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, sizeof(metric), &metric, 0);
WindowTitleBarFont = CreateFontIndirectW (&metric.lfCaptionFont);
metric.lfMessageFont.lfHeight = CompensateDPIFont (!font ? -11 : -font->Size);
metric.lfMessageFont.lfWidth = 0;
if (font && wcscmp (font->FaceName, L"default") != 0)
{
StringCbCopyW ((WCHAR *)metric.lfMessageFont.lfFaceName, sizeof (metric.lfMessageFont.lfFaceName), font->FaceName);
}
else if (IsOSAtLeast (WIN_VISTA))
{
// 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.
StringCbCopyW ((WCHAR *)metric.lfMessageFont.lfFaceName, sizeof (metric.lfMessageFont.lfFaceName), L"Tahoma");
}
hUserFont = CreateFontIndirectW (&metric.lfMessageFont);
metric.lfMessageFont.lfUnderline = TRUE;
hUserUnderlineFont = CreateFontIndirectW (&metric.lfMessageFont);
metric.lfMessageFont.lfUnderline = FALSE;
metric.lfMessageFont.lfWeight = FW_BOLD;
hUserBoldFont = CreateFontIndirectW (&metric.lfMessageFont);
metric.lfMessageFont.lfUnderline = TRUE;
metric.lfMessageFont.lfWeight = FW_BOLD;
hUserUnderlineBoldFont = CreateFontIndirectW (&metric.lfMessageFont);
// Fixed-size (hexadecimal digits)
nHeight = CompensateDPIFont (-12);
lf.lfHeight = nHeight;
lf.lfWidth = 0;
lf.lfEscapement = 0;
lf.lfOrientation = 0;
lf.lfWeight = FW_NORMAL;
lf.lfItalic = FALSE;
lf.lfUnderline = FALSE;
lf.lfStrikeOut = FALSE;
lf.lfCharSet = DEFAULT_CHARSET;
lf.lfOutPrecision = OUT_DEFAULT_PRECIS;
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf.lfQuality = PROOF_QUALITY;
lf.lfPitchAndFamily = FF_DONTCARE;
StringCbCopyW (lf.lfFaceName, sizeof(lf.lfFaceName), L"Courier New");
hFixedDigitFont = CreateFontIndirectW (&lf);
if (hFixedDigitFont == NULL)
{
handleWin32Error (hwndDlg, SRC_POS);
AbortProcess ("NOFONT");
}
// Bold
font = GetFont ("font_bold");
nHeight = CompensateDPIFont (!font ? -13 : -font->Size);
lf.lfHeight = nHeight;
lf.lfWeight = FW_BLACK;
StringCbCopyW (lf.lfFaceName, sizeof(lf.lfFaceName), !font ? L"Arial" : font->FaceName);
hBoldFont = CreateFontIndirectW (&lf);
if (hBoldFont == NULL)
{
handleWin32Error (hwndDlg, SRC_POS);
AbortProcess ("NOFONT");
}
// Title
font = GetFont ("font_title");
nHeight = CompensateDPIFont (!font ? -21 : -font->Size);
lf.lfHeight = nHeight;
lf.lfWeight = FW_REGULAR;
StringCbCopyW (lf.lfFaceName, sizeof(lf.lfFaceName),!font ? L"Times New Roman" : font->FaceName);
hTitleFont = CreateFontIndirectW (&lf);
if (hTitleFont == NULL)
{
handleWin32Error (hwndDlg, SRC_POS);
AbortProcess ("NOFONT");
}
// Fixed-size
font = GetFont ("font_fixed");
nHeight = CompensateDPIFont (!font ? -12 : -font->Size);
lf.lfHeight = nHeight;
lf.lfWidth = 0;
lf.lfEscapement = 0;
lf.lfOrientation = 0;
lf.lfWeight = FW_NORMAL;
lf.lfItalic = FALSE;
lf.lfUnderline = FALSE;
lf.lfStrikeOut = FALSE;
lf.lfCharSet = DEFAULT_CHARSET;
lf.lfOutPrecision = OUT_DEFAULT_PRECIS;
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf.lfQuality = PROOF_QUALITY;
lf.lfPitchAndFamily = FF_DONTCARE;
StringCbCopyW (lf.lfFaceName, sizeof(lf.lfFaceName),!font ? L"Lucida Console" : font->FaceName);
hFixedFont = CreateFontIndirectW (&lf);
if (hFixedFont == NULL)
{
handleWin32Error (hwndDlg, SRC_POS);
AbortProcess ("NOFONT");
}
if (!aboutMenuAppended)
{
hMenu = GetSystemMenu (hwndDlg, FALSE);
AppendMenu (hMenu, MF_SEPARATOR, 0, L"");
AppendMenuW (hMenu, MF_ENABLED | MF_STRING, IDC_ABOUT, GetString ("ABOUTBOX"));
aboutMenuAppended = TRUE;
}
}
// The parameter maxMessagesToProcess prevents endless processing of paint messages
void ProcessPaintMessages (HWND hwnd, int maxMessagesToProcess)
{
MSG paintMsg;
int msgCounter = maxMessagesToProcess;
while (PeekMessageW (&paintMsg, hwnd, 0, 0, PM_REMOVE | PM_QS_PAINT) != 0 && msgCounter-- > 0)
{
DispatchMessageW (&paintMsg);
}
}
HDC CreateMemBitmap (HINSTANCE hInstance, HWND hwnd, wchar_t *resource)
{
HBITMAP picture = LoadBitmap (hInstance, resource);
HDC viewDC = GetDC (hwnd), dcMem;
dcMem = CreateCompatibleDC (viewDC);
SetMapMode (dcMem, MM_TEXT);
SelectObject (dcMem, picture);
DeleteObject (picture);
ReleaseDC (hwnd, viewDC);
return dcMem;
}
/* Renders the specified bitmap at the specified location and stretches it to fit (anti-aliasing is applied).
If bDirectRender is FALSE and both nWidth and nHeight are zero, the width and height of hwndDest are
retrieved and adjusted according to screen DPI (the width and height of the resultant image are adjusted the
same way); furthermore, if bKeepAspectRatio is TRUE, the smaller DPI factor of the two (i.e. horiz. or vert.)
is used both for horiz. and vert. scaling (note that the overall GUI aspect ratio changes irregularly in
both directions depending on the DPI). If bDirectRender is TRUE, bKeepAspectRatio is ignored.
This function returns a handle to the scaled bitmap. When the bitmap is no longer needed, it should be
deleted by calling DeleteObject() with the handle passed as the parameter.
Known Windows issues:
- For some reason, anti-aliasing is not applied if the source bitmap contains less than 16K pixels.
- Windows 2000 may produce slightly inaccurate colors even when source, buffer, and target are 24-bit true color. */
HBITMAP RenderBitmap (wchar_t *resource, HWND hwndDest, int x, int y, int nWidth, int nHeight, BOOL bDirectRender, BOOL bKeepAspectRatio)
{
LRESULT lResult = 0;
HDC hdcSrc = CreateMemBitmap (hInst, hwndDest, resource);
if (!hdcSrc)
return NULL;
HGDIOBJ picture = GetCurrentObject (hdcSrc, OBJ_BITMAP);
HBITMAP hbmpRescaled = NULL;
BITMAP bitmap;
HDC hdcRescaled;
if (!bDirectRender && nWidth == 0 && nHeight == 0)
{
RECT rec;
GetClientRect (hwndDest, &rec);
if (bKeepAspectRatio)
{
if (DlgAspectRatio > 1)
{
// Do not fix this, it's correct. We use the Y scale factor intentionally for both
// directions to maintain aspect ratio (see above for more info).
nWidth = CompensateYDPI (rec.right);
nHeight = CompensateYDPI (rec.bottom);
}
else
{
// Do not fix this, it's correct. We use the X scale factor intentionally for both
// directions to maintain aspect ratio (see above for more info).
nWidth = CompensateXDPI (rec.right);
nHeight = CompensateXDPI (rec.bottom);
}
}
else
{
nWidth = CompensateXDPI (rec.right);
nHeight = CompensateYDPI (rec.bottom);
}
}
GetObject (picture, sizeof (BITMAP), &bitmap);
hdcRescaled = CreateCompatibleDC (hdcSrc);
if (hdcRescaled)
{
hbmpRescaled = CreateCompatibleBitmap (hdcSrc, nWidth, nHeight);
SelectObject (hdcRescaled, hbmpRescaled);
/* Anti-aliasing mode (HALFTONE is the only anti-aliasing algorithm natively supported by Windows 2000.
TODO: GDI+ offers higher quality -- InterpolationModeHighQualityBicubic) */
SetStretchBltMode (hdcRescaled, HALFTONE);
StretchBlt (hdcRescaled,
0,
0,
nWidth,
nHeight,
hdcSrc,
0,
0,
bitmap.bmWidth,
bitmap.bmHeight,
SRCCOPY);
DeleteDC (hdcSrc);
if (bDirectRender)
{
HDC hdcDest = GetDC (hwndDest);
if (hdcDest)
{
BitBlt (hdcDest, x, y, nWidth, nHeight, hdcRescaled, 0, 0, SRCCOPY);
ReleaseDC (hwndDest, hdcDest);
}
}
else
{
lResult = SendMessage (hwndDest, (UINT) STM_SETIMAGE, (WPARAM) IMAGE_BITMAP, (LPARAM) (HANDLE) hbmpRescaled);
}
if ((HGDIOBJ) lResult != NULL && (HGDIOBJ) lResult != (HGDIOBJ) hbmpRescaled)
DeleteObject ((HGDIOBJ) lResult);
DeleteDC (hdcRescaled);
}
return hbmpRescaled;
}
LRESULT CALLBACK
RedTick (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (uMsg == WM_CREATE)
{
}
else if (uMsg == WM_DESTROY)
{
}
else if (uMsg == WM_TIMER)
{
}
else if (uMsg == WM_PAINT)
{
PAINTSTRUCT tmp;
HPEN hPen;
HDC hDC;
BOOL bEndPaint;
RECT Rect;
if (GetUpdateRect (hwnd, NULL, FALSE))
{
hDC = BeginPaint (hwnd, &tmp);
bEndPaint = TRUE;
if (hDC == NULL)
return DefWindowProcW (hwnd, uMsg, wParam, lParam);
}
else
{
hDC = GetDC (hwnd);
bEndPaint = FALSE;
}
GetClientRect (hwnd, &Rect);
hPen = CreatePen (PS_SOLID, 2, RGB (0, 255, 0));
if (hPen != NULL)
{
HGDIOBJ hObj = SelectObject (hDC, hPen);
WORD bx = LOWORD (GetDialogBaseUnits ());
WORD by = HIWORD (GetDialogBaseUnits ());
MoveToEx (hDC, (Rect.right - Rect.left) / 2, Rect.bottom, NULL);
LineTo (hDC, Rect.right, Rect.top);
MoveToEx (hDC, (Rect.right - Rect.left) / 2, Rect.bottom, NULL);
LineTo (hDC, (3 * bx) / 4, (2 * by) / 8);
SelectObject (hDC, hObj);
DeleteObject (hPen);
}
if (bEndPaint)
EndPaint (hwnd, &tmp);
else
ReleaseDC (hwnd, hDC);
return TRUE;
}
return DefWindowProcW (hwnd, uMsg, wParam, lParam);
}
BOOL
RegisterRedTick (HINSTANCE hInstance)
{
WNDCLASSW wc;
ULONG rc;
memset(&wc, 0 , sizeof wc);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.cbClsExtra = 0;
wc.cbWndExtra = 4;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wc.hCursor = NULL;
wc.hbrBackground = (HBRUSH) GetStockObject (LTGRAY_BRUSH);
wc.lpszClassName = L"VCREDTICK";
wc.lpfnWndProc = &RedTick;
rc = (ULONG) RegisterClassW (&wc);
return rc == 0 ? FALSE : TRUE;
}
BOOL
UnregisterRedTick (HINSTANCE hInstance)
{
return UnregisterClassW (L"VCREDTICK", hInstance);
}
LRESULT CALLBACK
SplashDlgProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
return DefDlgProcW (hwnd, uMsg, wParam, lParam);
}
static int g_waitCursorCounter = 0;
void
WaitCursor ()
{
static HCURSOR hcWait = NULL;
if (hcWait == NULL)
hcWait = LoadCursor (NULL, IDC_WAIT);
if ((g_waitCursorCounter == 0) || (hCursor != hcWait))
{
if (!Silent) SetCursor (hcWait);
hCursor = hcWait;
}
g_waitCursorCounter++;
}
void
NormalCursor ()
{
static HCURSOR hcArrow = NULL;
if (hcArrow == NULL)
hcArrow = LoadCursor (NULL, IDC_ARROW);
if (g_waitCursorCounter > 0)
g_waitCursorCounter--;
if (g_waitCursorCounter == 0)
{
if (!Silent) SetCursor (hcArrow);
hCursor = NULL;
}
}
void
ArrowWaitCursor ()
{
static HCURSOR hcArrowWait = NULL;
if (hcArrowWait == NULL)
hcArrowWait = LoadCursor (NULL, IDC_APPSTARTING);
if ((g_waitCursorCounter == 0) || (hCursor != hcArrowWait))
{
if (!Silent) SetCursor (hcArrowWait);
hCursor = hcArrowWait;
}
g_waitCursorCounter++;
}
void HandCursor ()
{
static HCURSOR hcHand = NULL;
if (hcHand == NULL)
hcHand = LoadCursor (NULL, IDC_HAND);
SetCursor (hcHand);
hCursor = hcHand;
}
void
AddComboPair (HWND hComboBox, const wchar_t *lpszItem, int value)
{
LPARAM nIndex;
nIndex = SendMessage (hComboBox, CB_ADDSTRING, 0, (LPARAM) lpszItem);
nIndex = SendMessage (hComboBox, CB_SETITEMDATA, nIndex, (LPARAM) value);
}
void
SelectAlgo (HWND hComboBox, int *algo_id)
{
LPARAM nCount = SendMessage (hComboBox, CB_GETCOUNT, 0, 0);
LPARAM x, i;
for (i = 0; i < nCount; i++)
{
x = SendMessage (hComboBox, CB_GETITEMDATA, i, 0);
if (x == (LPARAM) *algo_id)
{
SendMessage (hComboBox, CB_SETCURSEL, i, 0);
return;
}
}
/* Something went wrong ; couldn't find the requested algo id so we drop
back to a default */
-
+
*algo_id = (int) SendMessage (hComboBox, CB_GETITEMDATA, 0, 0);
SendMessage (hComboBox, CB_SETCURSEL, 0, 0);
}
void PopulateWipeModeCombo (HWND hComboBox, BOOL bNA, BOOL bInPlaceEncryption, BOOL bHeaderWipe)
{
if (bNA)
{
AddComboPair (hComboBox, GetString ("NOT_APPLICABLE_OR_NOT_AVAILABLE"), TC_WIPE_NONE);
}
else
{
if (!bHeaderWipe)
{
AddComboPair (hComboBox, GetString ("WIPE_MODE_NONE"), TC_WIPE_NONE);
}
AddComboPair (hComboBox, GetString ("WIPE_MODE_1_RAND"), TC_WIPE_1_RAND);
AddComboPair (hComboBox, GetString ("WIPE_MODE_3_DOD_5220"), TC_WIPE_3_DOD_5220);
AddComboPair (hComboBox, GetString ("WIPE_MODE_7_DOD_5220"), TC_WIPE_7_DOD_5220);
AddComboPair (hComboBox, GetString ("WIPE_MODE_35_GUTMANN"), TC_WIPE_35_GUTMANN);
if (bHeaderWipe)
AddComboPair (hComboBox, GetString ("WIPE_MODE_256"), TC_WIPE_256); // paranoid wipe for volume header
}
}
wchar_t *GetWipeModeName (WipeAlgorithmId modeId)
{
switch (modeId)
{
case TC_WIPE_NONE:
return GetString ("WIPE_MODE_NONE");
case TC_WIPE_1_RAND:
return GetString ("WIPE_MODE_1_RAND");
case TC_WIPE_3_DOD_5220:
return GetString ("WIPE_MODE_3_DOD_5220");
case TC_WIPE_7_DOD_5220:
return GetString ("WIPE_MODE_7_DOD_5220");
case TC_WIPE_35_GUTMANN:
return GetString ("WIPE_MODE_35_GUTMANN");
case TC_WIPE_256:
return GetString ("WIPE_MODE_256");
default:
return GetString ("NOT_APPLICABLE_OR_NOT_AVAILABLE");
}
}
wchar_t *GetPathType (const wchar_t *path, BOOL bUpperCase, BOOL *bIsPartition)
{
if (wcsstr (path, L"Partition")
&& wcsstr (path, L"Partition0") == NULL)
{
*bIsPartition = TRUE;
return GetString (bUpperCase ? "PARTITION_UPPER_CASE" : "PARTITION_LOWER_CASE");
}
else if (wcsstr (path, L"HarddiskVolume"))
{
*bIsPartition = TRUE;
return GetString (bUpperCase ? "VOLUME_UPPER_CASE" : "VOLUME_LOWER_CASE");
}
*bIsPartition = FALSE;
return GetString (bUpperCase ? "DEVICE_UPPER_CASE" : "DEVICE_LOWER_CASE");
}
LRESULT CALLBACK CustomDlgProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (uMsg == WM_SETCURSOR && hCursor != NULL)
{
SetCursor (hCursor);
return TRUE;
}
return DefDlgProcW (hwnd, uMsg, wParam, lParam);
}
/*
static BOOL IsReturnAddress (DWORD64 address)
{
static size_t codeEnd = 0;
byte *sp = (byte *) address;
if (codeEnd == 0)
{
MEMORY_BASIC_INFORMATION mi;
if (VirtualQuery ((LPCVOID) 0x401000, &mi, sizeof (mi)) >= sizeof (mi))
codeEnd = (size_t) mi.BaseAddress + mi.RegionSize;
}
if (address < 0x401000 + 8 || address > codeEnd)
return FALSE;
return sp[-5] == 0xe8 // call ADDR
|| (sp[-6] == 0xff && sp[-5] == 0x15) // call [ADDR]
|| (sp[-2] == 0xff && (sp[-1] & 0xf0) == 0xd0); // call REG
}
*/
typedef struct
{
EXCEPTION_POINTERS *ExceptionPointers;
HANDLE ExceptionThread;
} ExceptionHandlerThreadArgs;
void ExceptionHandlerThread (void *threadArg)
{
ExceptionHandlerThreadArgs *args = (ExceptionHandlerThreadArgs *) threadArg;
EXCEPTION_POINTERS *ep = args->ExceptionPointers;
//DWORD addr;
DWORD exCode = ep->ExceptionRecord->ExceptionCode;
// SYSTEM_INFO si;
// wchar_t msg[8192];
// char modPath[MAX_PATH];
// int crc = 0;
// char url[MAX_URL_LENGTH];
// char lpack[128];
// stringstream callStack;
// addr = (DWORD) ep->ExceptionRecord->ExceptionAddress;
// PDWORD sp = (PDWORD) ep->ContextRecord->Esp;
// int frameNumber = 0;
switch (exCode)
{
case STATUS_IN_PAGE_ERROR:
case 0xeedfade:
// Exception not caused by VeraCrypt
MessageBoxW (0, GetString ("EXCEPTION_REPORT_EXT"),
GetString ("EXCEPTION_REPORT_TITLE"),
MB_ICONERROR | MB_OK | MB_SETFOREGROUND | MB_TOPMOST);
return;
}
// Call stack
/* HMODULE dbgDll = LoadLibrary ("dbghelp.dll");
if (dbgDll)
{
typedef DWORD (__stdcall *SymGetOptions_t) ();
typedef DWORD (__stdcall *SymSetOptions_t) (DWORD SymOptions);
typedef BOOL (__stdcall *SymInitialize_t) (HANDLE hProcess, PCSTR UserSearchPath, BOOL fInvadeProcess);
typedef BOOL (__stdcall *StackWalk64_t) (DWORD MachineType, HANDLE hProcess, HANDLE hThread, LPSTACKFRAME64 StackFrame, PVOID ContextRecord, PREAD_PROCESS_MEMORY_ROUTINE64 ReadMemoryRoutine, PFUNCTION_TABLE_ACCESS_ROUTINE64 FunctionTableAccessRoutine, PGET_MODULE_BASE_ROUTINE64 GetModuleBaseRoutine, PTRANSLATE_ADDRESS_ROUTINE64 TranslateAddress);
typedef BOOL (__stdcall * SymFromAddr_t) (HANDLE hProcess, DWORD64 Address, PDWORD64 Displacement, PSYMBOL_INFO Symbol);
SymGetOptions_t DbgHelpSymGetOptions = (SymGetOptions_t) GetProcAddress (dbgDll, "SymGetOptions");
SymSetOptions_t DbgHelpSymSetOptions = (SymSetOptions_t) GetProcAddress (dbgDll, "SymSetOptions");
SymInitialize_t DbgHelpSymInitialize = (SymInitialize_t) GetProcAddress (dbgDll, "SymInitialize");
PFUNCTION_TABLE_ACCESS_ROUTINE64 DbgHelpSymFunctionTableAccess64 = (PFUNCTION_TABLE_ACCESS_ROUTINE64) GetProcAddress (dbgDll, "SymFunctionTableAccess64");
PGET_MODULE_BASE_ROUTINE64 DbgHelpSymGetModuleBase64 = (PGET_MODULE_BASE_ROUTINE64) GetProcAddress (dbgDll, "SymGetModuleBase64");
StackWalk64_t DbgHelpStackWalk64 = (StackWalk64_t) GetProcAddress (dbgDll, "StackWalk64");
SymFromAddr_t DbgHelpSymFromAddr = (SymFromAddr_t) GetProcAddress (dbgDll, "SymFromAddr");
if (DbgHelpSymGetOptions && DbgHelpSymSetOptions && DbgHelpSymInitialize && DbgHelpSymFunctionTableAccess64 && DbgHelpSymGetModuleBase64 && DbgHelpStackWalk64 && DbgHelpSymFromAddr)
{
DbgHelpSymSetOptions (DbgHelpSymGetOptions() | SYMOPT_DEFERRED_LOADS | SYMOPT_ALLOW_ABSOLUTE_SYMBOLS | SYMOPT_NO_CPP);
if (DbgHelpSymInitialize (GetCurrentProcess(), NULL, TRUE))
{
STACKFRAME64 frame;
memset (&frame, 0, sizeof (frame));
frame.AddrPC.Offset = ep->ContextRecord->Eip;
frame.AddrPC.Mode = AddrModeFlat;
frame.AddrStack.Offset = ep->ContextRecord->Esp;
frame.AddrStack.Mode = AddrModeFlat;
frame.AddrFrame.Offset = ep->ContextRecord->Ebp;
frame.AddrFrame.Mode = AddrModeFlat;
string lastSymbol;
while (frameNumber < 32 && DbgHelpStackWalk64 (IMAGE_FILE_MACHINE_I386, GetCurrentProcess(), args->ExceptionThread, &frame, ep->ContextRecord, NULL, DbgHelpSymFunctionTableAccess64, DbgHelpSymGetModuleBase64, NULL))
{
if (!frame.AddrPC.Offset)
continue;
ULONG64 symbolBuffer[(sizeof (SYMBOL_INFO) + MAX_SYM_NAME * sizeof (TCHAR) + sizeof (ULONG64) - 1) / sizeof (ULONG64)];
memset (symbolBuffer, 0, sizeof (symbolBuffer));
PSYMBOL_INFO symbol = (PSYMBOL_INFO) symbolBuffer;
symbol->SizeOfStruct = sizeof (SYMBOL_INFO);
symbol->MaxNameLen = MAX_SYM_NAME;
if (DbgHelpSymFromAddr (GetCurrentProcess(), frame.AddrPC.Offset, NULL, symbol) && symbol->NameLen > 0)
{
for (size_t i = 0; i < symbol->NameLen; ++i)
{
if (!isalnum (symbol->Name[i]))
symbol->Name[i] = '_';
}
if (symbol->Name != lastSymbol)
callStack << "&st" << frameNumber++ << "=" << symbol->Name;
lastSymbol = symbol->Name;
}
else if (frameNumber == 0 || IsReturnAddress (frame.AddrPC.Offset))
{
callStack << "&st" << frameNumber++ << "=0x" << hex << frame.AddrPC.Offset << dec;
}
}
}
}
}
// StackWalk64() may fail due to missing frame pointers
list <DWORD> retAddrs;
if (frameNumber == 0)
retAddrs.push_back (ep->ContextRecord->Eip);
retAddrs.push_back (0);
MEMORY_BASIC_INFORMATION mi;
VirtualQuery (sp, &mi, sizeof (mi));
PDWORD stackTop = (PDWORD)((byte *) mi.BaseAddress + mi.RegionSize);
int i = 0;
while (retAddrs.size() < 16 && &sp[i] < stackTop)
{
if (IsReturnAddress (sp[i]))
{
bool duplicate = false;
foreach (DWORD prevAddr, retAddrs)
{
if (sp[i] == prevAddr)
{
duplicate = true;
break;
}
}
if (!duplicate)
retAddrs.push_back (sp[i]);
}
i++;
}
if (retAddrs.size() > 1)
{
foreach (DWORD addr, retAddrs)
{
callStack << "&st" << frameNumber++ << "=0x" << hex << addr << dec;
}
}
// Checksum of the module
if (GetModuleFileName (NULL, modPath, sizeof (modPath)))
{
HANDLE h = CreateFile (modPath, FILE_READ_DATA | FILE_READ_ATTRIBUTES, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (h != INVALID_HANDLE_VALUE)
{
BY_HANDLE_FILE_INFORMATION fi;
if (GetFileInformationByHandle (h, &fi))
{
char *buf = (char *) malloc (fi.nFileSizeLow);
if (buf)
{
DWORD bytesRead;
if (ReadFile (h, buf, fi.nFileSizeLow, &bytesRead, NULL) && bytesRead == fi.nFileSizeLow)
crc = GetCrc32 ((unsigned char *) buf, fi.nFileSizeLow);
free (buf);
}
}
CloseHandle (h);
}
}
GetSystemInfo (&si);
if (LocalizationActive)
sprintf_s (lpack, sizeof (lpack), "&langpack=%s_%s", GetPreferredLangId (), GetActiveLangPackVersion ());
else
lpack[0] = 0;
sprintf (url, TC_APPLINK_SECURE "&dest=err-report%s&os=%s&osver=%d.%d.%d&arch=%s&cpus=%d&app=%s&cksum=%x&dlg=%s&err=%x&addr=%x"
, lpack
, GetWindowsEdition().c_str()
, CurrentOSMajor
, CurrentOSMinor
, CurrentOSServicePack
, Is64BitOs () ? "x64" : "x86"
, si.dwNumberOfProcessors
#ifdef TCMOUNT
,"main"
#endif
#ifdef VOLFORMAT
,"format"
#endif
#ifdef SETUP
,"setup"
#endif
, crc
, LastDialogId ? LastDialogId : "-"
, exCode
, addr);
string urlStr = url + callStack.str();
_snwprintf (msg, array_capacity (msg), GetString ("EXCEPTION_REPORT"), urlStr.c_str());
if (IDYES == MessageBoxW (0, msg, GetString ("EXCEPTION_REPORT_TITLE"), MB_ICONERROR | MB_YESNO | MB_DEFBUTTON1))
ShellExecute (NULL, "open", urlStr.c_str(), NULL, NULL, SW_SHOWNORMAL);
else */
UnhandledExceptionFilter (ep);
}
LONG __stdcall ExceptionHandler (EXCEPTION_POINTERS *ep)
{
SetUnhandledExceptionFilter (NULL);
if (SystemFileSelectorCallPending && SystemFileSelectorCallerThreadId == GetCurrentThreadId())
{
MessageBoxW (NULL, GetString ("EXCEPTION_REPORT_EXT_FILESEL"), GetString ("EXCEPTION_REPORT_TITLE"), MB_ICONERROR | MB_OK | MB_SETFOREGROUND | MB_TOPMOST);
UnhandledExceptionFilter (ep);
return EXCEPTION_EXECUTE_HANDLER;
}
ExceptionHandlerThreadArgs args;
args.ExceptionPointers = ep;
args.ExceptionThread = GetCurrentThread();
WaitForSingleObject ((HANDLE) _beginthread (ExceptionHandlerThread, 0, &args), INFINITE);
return EXCEPTION_EXECUTE_HANDLER;
}
void InvalidParameterHandler (const wchar_t *expression, const wchar_t *function, const wchar_t *file, unsigned int line, uintptr_t reserved)
{
TC_THROW_FATAL_EXCEPTION;
}
static LRESULT CALLBACK NonInstallUacWndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
return DefWindowProcW (hWnd, message, wParam, lParam);
}
BOOL LaunchElevatedProcess (HWND hwndDlg, const wchar_t* szModPath, const wchar_t* args)
{
wchar_t newCmdLine[4096];
WNDCLASSEXW wcex;
HWND hWnd;
memset (&wcex, 0, sizeof (wcex));
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.lpfnWndProc = (WNDPROC) NonInstallUacWndProc;
wcex.hInstance = hInst;
wcex.lpszClassName = L"VeraCrypt";
RegisterClassExW (&wcex);
// A small transparent window is necessary to bring the new instance to foreground
hWnd = CreateWindowExW (WS_EX_TOOLWINDOW | WS_EX_LAYERED,
L"VeraCrypt", L"VeraCrypt", 0,
GetSystemMetrics (SM_CXSCREEN)/2,
GetSystemMetrics (SM_CYSCREEN)/2,
1, 1, NULL, NULL, hInst, NULL);
SetLayeredWindowAttributes (hWnd, 0, 0, LWA_ALPHA);
ShowWindow (hWnd, SW_SHOWNORMAL);
StringCbCopyW (newCmdLine, sizeof(newCmdLine), L"/q UAC ");
StringCbCatW (newCmdLine, sizeof (newCmdLine), args);
if ((int)ShellExecuteW (hWnd, L"runas", szModPath, newCmdLine, NULL, SW_SHOWNORMAL) <= 32)
{
if (hwndDlg)
handleWin32Error (hwndDlg, SRC_POS);
return FALSE;
}
else
{
Sleep (2000);
return TRUE;
}
}
// Mutex handling to prevent multiple instances of the wizard or main app from dealing with system encryption.
// Returns TRUE if the mutex is (or had been) successfully acquired (otherwise FALSE).
BOOL CreateSysEncMutex (void)
{
return TCCreateMutex (&hSysEncMutex, TC_MUTEX_NAME_SYSENC);
}
BOOL InstanceHasSysEncMutex (void)
{
return (hSysEncMutex != NULL);
}
// Mutex handling to prevent multiple instances of the wizard from dealing with system encryption
void CloseSysEncMutex (void)
{
TCCloseMutex (&hSysEncMutex);
}
// Returns TRUE if the mutex is (or had been) successfully acquired (otherwise FALSE).
BOOL CreateNonSysInplaceEncMutex (void)
{
return TCCreateMutex (&hNonSysInplaceEncMutex, TC_MUTEX_NAME_NONSYS_INPLACE_ENC);
}
BOOL InstanceHasNonSysInplaceEncMutex (void)
{
return (hNonSysInplaceEncMutex != NULL);
}
void CloseNonSysInplaceEncMutex (void)
{
TCCloseMutex (&hNonSysInplaceEncMutex);
}
// Returns TRUE if another instance of the wizard is preparing, resuming or performing non-system in-place encryption
BOOL NonSysInplaceEncInProgressElsewhere (void)
{
return (!InstanceHasNonSysInplaceEncMutex ()
&& MutexExistsOnSystem (TC_MUTEX_NAME_NONSYS_INPLACE_ENC));
}
// Mutex handling to prevent multiple instances of the wizard or main app from trying to install
// or register the driver or from trying to launch it in portable mode at the same time.
// Returns TRUE if the mutex is (or had been) successfully acquired (otherwise FALSE).
BOOL CreateDriverSetupMutex (void)
{
return TCCreateMutex (&hDriverSetupMutex, TC_MUTEX_NAME_DRIVER_SETUP);
}
void CloseDriverSetupMutex (void)
{
TCCloseMutex (&hDriverSetupMutex);
}
BOOL CreateAppSetupMutex (void)
{
return TCCreateMutex (&hAppSetupMutex, TC_MUTEX_NAME_APP_SETUP);
}
void CloseAppSetupMutex (void)
{
TCCloseMutex (&hAppSetupMutex);
}
BOOL IsTrueCryptInstallerRunning (void)
{
return (MutexExistsOnSystem (TC_MUTEX_NAME_APP_SETUP));
}
// Returns TRUE if the mutex is (or had been) successfully acquired (otherwise FALSE).
BOOL TCCreateMutex (volatile HANDLE *hMutex, wchar_t *name)
{
if (*hMutex != NULL)
return TRUE; // This instance already has the mutex
*hMutex = CreateMutex (NULL, TRUE, name);
if (*hMutex == NULL)
{
// In multi-user configurations, the OS returns "Access is denied" here when a user attempts
// to acquire the mutex if another user already has. However, on Vista, "Access is denied" is
// returned also if the mutex is owned by a process with admin rights while we have none.
return FALSE;
}
if (GetLastError () == ERROR_ALREADY_EXISTS)
{
ReleaseMutex (*hMutex);
CloseHandle (*hMutex);
*hMutex = NULL;
return FALSE;
}
return TRUE;
}
void TCCloseMutex (volatile HANDLE *hMutex)
{
if (*hMutex != NULL)
{
if (ReleaseMutex (*hMutex)
&& CloseHandle (*hMutex))
*hMutex = NULL;
}
}
// Returns TRUE if a process running on the system has the specified mutex (otherwise FALSE).
BOOL MutexExistsOnSystem (wchar_t *name)
{
if (name[0] == 0)
return FALSE;
HANDLE hMutex = OpenMutex (MUTEX_ALL_ACCESS, FALSE, name);
if (hMutex == NULL)
{
if (GetLastError () == ERROR_FILE_NOT_FOUND)
return FALSE;
if (GetLastError () == ERROR_ACCESS_DENIED) // On Vista, this is returned if the owner of the mutex is elevated while we are not
return TRUE;
// The call failed and it is not certain whether the mutex exists or not
return FALSE;
}
CloseHandle (hMutex);
return TRUE;
}
uint32 ReadDriverConfigurationFlags ()
{
DWORD configMap;
if (!ReadLocalMachineRegistryDword (L"SYSTEM\\CurrentControlSet\\Services\\veracrypt", TC_DRIVER_CONFIG_REG_VALUE_NAME, &configMap))
configMap = 0;
return configMap;
}
uint32 ReadServiceConfigurationFlags ()
{
DWORD configMap;
if (!ReadLocalMachineRegistryDword (L"SYSTEM\\CurrentControlSet\\Services\\" TC_SYSTEM_FAVORITES_SERVICE_NAME, TC_SYSTEM_FAVORITES_SERVICE_NAME L"Config", &configMap))
configMap = 0;
return configMap;
}
uint32 ReadEncryptionThreadPoolFreeCpuCountLimit ()
{
DWORD count;
if (!ReadLocalMachineRegistryDword (L"SYSTEM\\CurrentControlSet\\Services\\veracrypt", TC_ENCRYPTION_FREE_CPU_COUNT_REG_VALUE_NAME, &count))
count = 0;
return count;
}
BOOL LoadSysEncSettings ()
{
BOOL status = TRUE;
DWORD size = 0;
char *sysEncCfgFileBuf = LoadFile (GetConfigPath (TC_APPD_FILENAME_SYSTEM_ENCRYPTION), &size);
char *xml = sysEncCfgFileBuf;
char paramName[100], paramVal[MAX_PATH];
// Defaults
int newSystemEncryptionStatus = SYSENC_STATUS_NONE;
WipeAlgorithmId newnWipeMode = TC_WIPE_NONE;
if (!FileExists (GetConfigPath (TC_APPD_FILENAME_SYSTEM_ENCRYPTION)))
{
SystemEncryptionStatus = newSystemEncryptionStatus;
nWipeMode = newnWipeMode;
}
if (xml == NULL)
{
return FALSE;
}
while (xml = XmlFindElement (xml, "config"))
{
XmlGetAttributeText (xml, "key", paramName, sizeof (paramName));
XmlGetNodeText (xml, paramVal, sizeof (paramVal));
if (strcmp (paramName, "SystemEncryptionStatus") == 0)
{
newSystemEncryptionStatus = atoi (paramVal);
}
else if (strcmp (paramName, "WipeMode") == 0)
{
newnWipeMode = (WipeAlgorithmId) atoi (paramVal);
}
xml++;
}
SystemEncryptionStatus = newSystemEncryptionStatus;
nWipeMode = newnWipeMode;
free (sysEncCfgFileBuf);
return status;
}
// Returns the number of partitions where non-system in-place encryption is progress or had been in progress
// but was interrupted. In addition, via the passed pointer, returns the last selected wipe algorithm ID.
int LoadNonSysInPlaceEncSettings (WipeAlgorithmId *wipeAlgorithm)
{
char *fileBuf = NULL;
char *fileBuf2 = NULL;
DWORD size, size2;
int count;
*wipeAlgorithm = TC_WIPE_NONE;
if (!FileExists (GetConfigPath (TC_APPD_FILENAME_NONSYS_INPLACE_ENC)))
return 0;
if ((fileBuf = LoadFile (GetConfigPath (TC_APPD_FILENAME_NONSYS_INPLACE_ENC), &size)) == NULL)
return 0;
if (FileExists (GetConfigPath (TC_APPD_FILENAME_NONSYS_INPLACE_ENC_WIPE)))
{
if ((fileBuf2 = LoadFile (GetConfigPath (TC_APPD_FILENAME_NONSYS_INPLACE_ENC_WIPE), &size2)) != NULL)
*wipeAlgorithm = (WipeAlgorithmId) atoi (fileBuf2);
}
count = atoi (fileBuf);
if (fileBuf != NULL)
TCfree (fileBuf);
if (fileBuf2 != NULL)
TCfree (fileBuf2);
return (count);
}
void RemoveNonSysInPlaceEncNotifications (void)
{
if (FileExists (GetConfigPath (TC_APPD_FILENAME_NONSYS_INPLACE_ENC)))
_wremove (GetConfigPath (TC_APPD_FILENAME_NONSYS_INPLACE_ENC));
if (FileExists (GetConfigPath (TC_APPD_FILENAME_NONSYS_INPLACE_ENC_WIPE)))
_wremove (GetConfigPath (TC_APPD_FILENAME_NONSYS_INPLACE_ENC_WIPE));
if (!IsNonInstallMode () && SystemEncryptionStatus == SYSENC_STATUS_NONE)
ManageStartupSeqWiz (TRUE, L"");
}
void SavePostInstallTasksSettings (int command)
{
FILE *f = NULL;
if (IsNonInstallMode() && command != TC_POST_INSTALL_CFG_REMOVE_ALL)
return;
switch (command)
{
case TC_POST_INSTALL_CFG_REMOVE_ALL:
_wremove (GetConfigPath (TC_APPD_FILENAME_POST_INSTALL_TASK_TUTORIAL));
_wremove (GetConfigPath (TC_APPD_FILENAME_POST_INSTALL_TASK_RELEASE_NOTES));
_wremove (GetConfigPath (TC_APPD_FILENAME_POST_INSTALL_TASK_RESCUE_DISK));
break;
case TC_POST_INSTALL_CFG_TUTORIAL:
f = _wfopen (GetConfigPath (TC_APPD_FILENAME_POST_INSTALL_TASK_TUTORIAL), L"w");
break;
case TC_POST_INSTALL_CFG_RELEASE_NOTES:
f = _wfopen (GetConfigPath (TC_APPD_FILENAME_POST_INSTALL_TASK_RELEASE_NOTES), L"w");
break;
case TC_POST_INSTALL_CFG_RESCUE_DISK:
f = _wfopen (GetConfigPath (TC_APPD_FILENAME_POST_INSTALL_TASK_RESCUE_DISK), L"w");
break;
default:
return;
}
if (f == NULL)
return;
if (fputws (L"1", f) < 0)
{
// Error
fclose (f);
return;
}
TCFlushFile (f);
fclose (f);
}
void DoPostInstallTasks (HWND hwndDlg)
{
BOOL bDone = FALSE;
if (FileExists (GetConfigPath (TC_APPD_FILENAME_POST_INSTALL_TASK_TUTORIAL)))
{
if (AskYesNo ("AFTER_INSTALL_TUTORIAL", hwndDlg) == IDYES)
Applink ("beginnerstutorial");
bDone = TRUE;
}
if (FileExists (GetConfigPath (TC_APPD_FILENAME_POST_INSTALL_TASK_RELEASE_NOTES)))
{
if (AskYesNo ("AFTER_UPGRADE_RELEASE_NOTES", hwndDlg) == IDYES)
Applink ("releasenotes");
bDone = TRUE;
}
if (FileExists (GetConfigPath (TC_APPD_FILENAME_POST_INSTALL_TASK_RESCUE_DISK)))
{
if (AskYesNo ("AFTER_UPGRADE_RESCUE_DISK", hwndDlg) == IDYES)
PostMessage (hwndDlg, VC_APPMSG_CREATE_RESCUE_DISK, 0, 0);
bDone = TRUE;
}
if (bDone)
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");
StringCbCatW(dllPath, sizeof(dllPath), L"\\");
StringCbCatW(dllPath, sizeof(dllPath), szModuleName);
if (((*pHandle = LoadLibrary(dllPath)) == NULL) && !bIgnoreError)
{
// This error is fatal
handleWin32Error (NULL, srcPos);
AbortProcess ("INIT_DLL");
}
}
/* InitApp - initialize the application, this function is called once in the
applications WinMain function, but before the main dialog has been created */
void InitApp (HINSTANCE hInstance, wchar_t *lpszCommandLine)
{
WNDCLASSW wc;
char langId[6];
InitCommonControlsPtr InitCommonControlsFn = NULL;
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);
LoadSystemDll (L"userenv.dll", &hUserenvDll, TRUE, SRC_POS);
LoadSystemDll (L"rsaenh.dll", &hRsaenhDll, TRUE, SRC_POS);
#ifdef SETUP
if (nCurrentOS < 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);
}
}
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))
{
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);
}
#ifndef SETUP
LoadSystemDll (L"WINSCARD.DLL", &hwinscarddll, TRUE, SRC_POS);
#endif
LoadSystemDll (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
AbortProcess ("INIT_DLL");
LoadSystemDll (L"Riched20.dll", &hRichEditDll, FALSE, SRC_POS);
LoadSystemDll (L"Advapi32.dll", &hAdvapi32Dll, FALSE, SRC_POS);
#if !defined(SETUP)
if (!VerifyModuleSignature (modPath))
AbortProcess ("DIST_PACKAGE_CORRUPTED");
#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);
#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);
#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);
#endif
// Language
langId[0] = 0;
SetPreferredLangId (ConfigReadString ("Language", "", langId, sizeof (langId)));
#ifndef SETUP
if (langId[0] == 0)
{
// check if user selected a language during installation
WCHAR uiLang[6];
ReadRegistryString (L"Software\\VeraCrypt", L"SetupUILanguage", L"", uiLang, sizeof (uiLang));
if (0 < WideCharToMultiByte (CP_ACP, 0, uiLang, -1, langId, sizeof (langId), NULL, NULL))
{
SetPreferredLangId (langId);
bLanguageSetInSetup = TRUE;
}
}
#ifndef VCEXPANDER
// delete the registry key created by the installer (if any)
DeleteRegistryKey (HKEY_CURRENT_USER, L"Software\\VeraCrypt");
#endif
#endif
if (langId[0] == 0)
{
if (IsNonInstallMode ())
{
// only support automatic use of a language file in portable mode
// this is achieved by placing a unique language XML file in the same
// place as portable VeraCrypt binaries.
DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_LANGUAGE), NULL,
(DLGPROC) LanguageDlgProc, (LPARAM) 1);
}
else
{
// when installed, force using English as default language
SetPreferredLangId ("en");
}
}
LoadLanguageFile ();
#ifndef SETUP
// UAC elevation moniker cannot be used in portable mode.
// A new instance of the application must be created with elevated privileges.
if (IsNonInstallMode () && !IsAdmin () && IsUacSupported ())
{
if (wcsstr (lpszCommandLine, L"/q UAC ") == lpszCommandLine)
{
Error ("UAC_INIT_ERROR", NULL);
exit (1);
}
if (LaunchElevatedProcess (NULL, modPath, lpszCommandLine))
exit (0);
else
exit (1);
}
#endif
SetUnhandledExceptionFilter (ExceptionHandler);
_set_invalid_parameter_handler (InvalidParameterHandler);
RemoteSession = GetSystemMetrics (SM_REMOTESESSION) != 0;
#ifndef VC_SKIP_OS_DRIVER_REQ_CHECK
if (!IsSupportedOS())
{
MessageBoxW (NULL, GetString ("UNSUPPORTED_OS"), lpszTitle, MB_ICONSTOP);
exit (1);
}
#else
// in TESTSIGNING mode, we support only Windows Vista, Windows 7, Windows 8/8.1
if ( !IsOSVersionAtLeast(WIN_VISTA, 0)
#ifndef SETUP
|| IsOSVersionAtLeast(WIN_10, 0)
#else
|| (IsOSVersionAtLeast(WIN_10, 0) && !bMakePackage)
#endif
)
{
MessageBoxW (NULL, L"TESTSIGNING version of VeraCrypt targets only Windows Vista, Windows 7 and Windows 8/8.1.\n\nPlease use the standard version of VeraCrypt instead.", lpszTitle, MB_ICONSTOP);
exit (1);
}
else if ( !IsTestSigningModeEnabled()
#ifdef SETUP
&& !bMakePackage
#endif
)
{
MessageBoxW (NULL, L"Test-Signing Mode, which is required to run VeraCrypt TESTSIGNING binaries, is not enabled in Windows.\n\nExecution aborted!", lpszTitle, MB_ICONSTOP);
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)
{
handleWin32Error (NULL, SRC_POS);
AbortProcess ("INIT_REGISTER");
}
#ifndef SETUP
wc.hIcon = LoadIcon (hInstance, MAKEINTRESOURCE (IDI_TRUECRYPT_ICON));
#else
#include "../setup/resource.h"
wc.hIcon = LoadIcon (hInstance, MAKEINTRESOURCE (IDI_SETUP));
#endif
wc.lpszClassName = TC_DLG_CLASS;
wc.lpfnWndProc = &CustomDlgProc;
wc.hCursor = LoadCursor (NULL, IDC_ARROW);
wc.cbWndExtra = DLGWINDOWEXTRA;
hDlgClass = RegisterClassW (&wc);
if (hDlgClass == 0)
{
handleWin32Error (NULL, SRC_POS);
AbortProcess ("INIT_REGISTER");
}
wc.lpszClassName = TC_SPLASH_CLASS;
wc.lpfnWndProc = &SplashDlgProc;
wc.hCursor = LoadCursor (NULL, IDC_ARROW);
wc.cbWndExtra = DLGWINDOWEXTRA;
hSplashClass = RegisterClassW (&wc);
if (hSplashClass == 0)
{
handleWin32Error (NULL, SRC_POS);
AbortProcess ("INIT_REGISTER");
}
// DPI and GUI aspect ratio
DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_AUXILIARY_DLG), NULL,
(DLGPROC) AuxiliaryDlgProc, (LPARAM) 1);
InitHelpFileName ();
#ifndef SETUP
#ifdef _WIN64
if (IsOSAtLeast (WIN_7))
{
EnableRamEncryption ((ReadDriverConfigurationFlags() & VC_DRIVER_CONFIG_ENABLE_RAM_ENCRYPTION) ? TRUE : FALSE);
if (IsRamEncryptionEnabled())
{
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;
GetModuleFileNameW (NULL, szHelpFile, ARRAYSIZE (szHelpFile));
lpszTmp = wcsrchr (szHelpFile, L'\\');
if (lpszTmp)
{
wchar_t szTemp[TC_MAX_PATH];
++lpszTmp;
*lpszTmp = 0; // add null terminating character to prepare for append operations
// Primary file name
if (strcmp (GetPreferredLangId(), "en") == 0
|| strlen(GetPreferredLangId()) == 0)
{
StringCbCatW (szHelpFile, sizeof(szHelpFile), L"docs\\VeraCrypt User Guide.chm");
}
else
{
StringCbPrintfW (szTemp, sizeof(szTemp), L"docs\\VeraCrypt User Guide.%S.chm", GetPreferredLangId());
StringCbCatW (szHelpFile, sizeof(szHelpFile), szTemp);
}
// Secondary file name (used when localized documentation is not found).
GetModuleFileNameW (NULL, szHelpFile2, ARRAYSIZE (szHelpFile2));
lpszTmp = wcsrchr (szHelpFile2, L'\\');
if (lpszTmp)
{
++lpszTmp;
*lpszTmp = 0;
StringCbCatW (szHelpFile2, sizeof(szHelpFile2), L"docs\\VeraCrypt User Guide.chm");
}
}
}
#ifndef SETUP
BOOL OpenDevice (const wchar_t *lpszPath, OPEN_TEST_STRUCT *driver, BOOL detectFilesystem, BOOL computeVolumeIDs)
{
DWORD dwResult;
BOOL bResult;
wchar_t wszFileName[TC_MAX_PATH];
StringCbCopyW (wszFileName, sizeof(wszFileName), lpszPath);
memset (driver, 0, sizeof (OPEN_TEST_STRUCT));
memcpy (driver->wszFileName, wszFileName, sizeof (wszFileName));
driver->bDetectTCBootLoader = FALSE;
driver->DetectFilesystem = detectFilesystem;
driver->bComputeVolumeIDs = computeVolumeIDs;
bResult = DeviceIoControl (hDriver, TC_IOCTL_OPEN_TEST,
driver, sizeof (OPEN_TEST_STRUCT),
driver, sizeof (OPEN_TEST_STRUCT),
&dwResult, NULL);
// check variable driver
if ( bResult
&& ( (driver->bDetectTCBootLoader != TRUE && driver->bDetectTCBootLoader != FALSE) ||
(driver->TCBootLoaderDetected != TRUE && driver->TCBootLoaderDetected != FALSE) ||
(driver->DetectFilesystem != TRUE && driver->DetectFilesystem != FALSE) ||
(driver->FilesystemDetected != TRUE && driver->FilesystemDetected != FALSE) ||
(wcscmp (wszFileName, driver->wszFileName))
)
)
{
return FALSE;
}
if (bResult == FALSE)
{
dwResult = GetLastError ();
if (dwResult == ERROR_SHARING_VIOLATION || dwResult == ERROR_NOT_READY)
{
driver->TCBootLoaderDetected = FALSE;
driver->FilesystemDetected = FALSE;
memset (driver->VolumeIDComputed, 0, sizeof (driver->VolumeIDComputed));
return TRUE;
}
else
return FALSE;
}
return TRUE;
}
#endif
// Tells the driver that it's running in portable mode
void NotifyDriverOfPortableMode (void)
{
if (hDriver != INVALID_HANDLE_VALUE)
{
DWORD dwResult;
DeviceIoControl (hDriver, TC_IOCTL_SET_PORTABLE_MODE_STATUS, NULL, 0, NULL, 0, &dwResult, NULL);
}
}
BOOL GetDriveLabel (int driveNo, wchar_t *label, int labelSize)
{
DWORD fileSystemFlags;
wchar_t root[] = { L'A' + (wchar_t) driveNo, L':', L'\\', 0 };
return GetVolumeInformationW (root, label, labelSize / 2, NULL, NULL, &fileSystemFlags, NULL, 0);
}
#ifndef SETUP
/* Stores the device path of the system partition in SysPartitionDevicePath and the device path of the system drive
in SysDriveDevicePath.
IMPORTANT: As this may take a very long time if called for the first time, it should be called only before performing
a dangerous operation (such as header backup restore or formatting a supposedly non-system device) never
at WM_INITDIALOG or any other GUI events -- instead call IsSystemDevicePath (path, hwndDlg, FALSE) for
very fast preliminary GUI checks; also note that right after the "Select Device" dialog exits with an OK
return code, you can use the global flags bSysPartitionSelected and bSysDriveSelected to see if the user
selected the system partition/device.
After this function completes successfully, the results are cached for the rest of the session and repeated
executions complete very fast. Returns TRUE if successful (otherwise FALSE). */
BOOL GetSysDevicePaths (HWND hwndDlg)
{
if (!bCachedSysDevicePathsValid
|| wcslen (SysPartitionDevicePath) <= 1
|| wcslen (SysDriveDevicePath) <= 1)
{
foreach (const HostDevice &device, GetAvailableHostDevices (false, true))
{
if (device.ContainsSystem)
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))
{
if (drive.ContainsSystem)
{
foreach (const HostDevice &sysDrivePartition, drive.Partitions)
{
if (sysDrivePartition.Bootable)
{
if (sysDrivePartition.Size <= TC_MAX_EXTRA_BOOT_PARTITION_SIZE)
ExtraBootPartitionDevicePath = sysDrivePartition.Path;
break;
}
}
break;
}
}
}
bCachedSysDevicePathsValid = 1;
}
return (bCachedSysDevicePathsValid
&& wcslen (SysPartitionDevicePath) > 1
&& wcslen (SysDriveDevicePath) > 1);
}
/* Determines whether the device path is the path of the system partition or of the system drive (or neither).
If bReliableRequired is TRUE, very fast execution is guaranteed, but the results cannot be relied upon.
If it's FALSE and the function is called for the first time, execution may take up to one minute but the
results are reliable.
IMPORTANT: As the execution may take a very long time if called for the first time with bReliableRequired set
to TRUE, it should be called with bReliableRequired set to TRUE only before performing a dangerous
operation (such as header backup restore or formatting a supposedly non-system device) never at
WM_INITDIALOG or any other GUI events (use IsSystemDevicePath(path, hwndDlg, FALSE) for fast
preliminary GUI checks; also note that right after the "Select Device" dialog exits with an OK
return code, you can use the global flags bSysPartitionSelected and bSysDriveSelected to see if the
user selected the system partition/device).
After this function completes successfully, the results are cached for the rest of the session, bReliableRequired
is ignored (TRUE implied), repeated executions complete very fast, and the results are always reliable.
Return codes:
1 - it is the system partition path (e.g. \Device\Harddisk0\Partition1)
2 - it is the system drive path (e.g. \Device\Harddisk0\Partition0)
3 - it is the extra boot partition path
0 - it's not the system partition/drive path
-1 - the result can't be determined, isn't reliable, or there was an error. */
int IsSystemDevicePath (const wchar_t *path, HWND hwndDlg, BOOL bReliableRequired)
{
if (!bCachedSysDevicePathsValid
&& bReliableRequired)
{
if (!GetSysDevicePaths (hwndDlg))
return -1;
}
if (wcslen (SysPartitionDevicePath) <= 1 || wcslen (SysDriveDevicePath) <= 1)
return -1;
if (!path)
return -1;
if (wcsncmp (path, SysPartitionDevicePath, max (wcslen(path), wcslen(SysPartitionDevicePath))) == 0)
return 1;
else if (wcsncmp (path, SysDriveDevicePath, max (wcslen(path), wcslen(SysDriveDevicePath))) == 0)
return 2;
else if (ExtraBootPartitionDevicePath == path)
return 3;
return 0;
}
/* Determines whether the path points to a non-system partition on the system drive.
IMPORTANT: As this may take a very long time if called for the first time, it should be called
only before performing a dangerous operation, never at WM_INITDIALOG or any other GUI events.
Return codes:
0 - it isn't a non-system partition on the system drive
1 - it's a non-system partition on the system drive
-1 - the result can't be determined, isn't reliable, or there was an error. */
int IsNonSysPartitionOnSysDrive (const wchar_t *path)
{
wchar_t tmpPath [TC_MAX_PATH + 1];
int pos;
if (!GetSysDevicePaths (MainDlg))
return -1;
if (wcslen (SysPartitionDevicePath) <= 1 || wcslen (SysDriveDevicePath) <= 1)
return -1;
if (wcsncmp (path, SysPartitionDevicePath, max (wcslen(path), wcslen(SysPartitionDevicePath))) == 0
|| wcsncmp (path, SysDriveDevicePath, max (wcslen(path), wcslen(SysDriveDevicePath))) == 0)
{
// It is the system partition/drive path (it isn't a non-system partition)
return 0;
}
memset (tmpPath, 0, sizeof (tmpPath));
wcsncpy (tmpPath, path, ARRAYSIZE (tmpPath) - 1);
pos = (int) FindString ((const char*) tmpPath, (const char*) L"Partition", (int) wcslen (tmpPath) * 2, (int) wcslen (L"Partition") * 2, 0);
if (pos < 0)
return -1;
pos /= 2;
pos += (int) strlen ("Partition");
if (pos + 1 > ARRAYSIZE (tmpPath) - 1)
return -1;
tmpPath [pos] = L'0';
tmpPath [pos + 1] = 0;
if (wcsncmp (tmpPath, SysDriveDevicePath, max (wcslen(tmpPath), wcslen(SysDriveDevicePath))) == 0)
{
// It is a non-system partition on the system drive
return 1;
}
else
{
// The partition is not on the system drive
return 0;
}
}
#endif //!SETUP
wstring GetSysEncryptionPretestInfo2String (void)
{
// This huge string is divided into smaller portions to make it easier for translators to
// re-translate it when a minor modification is made to it (the whole huge string will not be
// reverted to English, so they will have to translate only a small portion of it).
return (wstring (L"\n")
+ GetString ("SYS_ENCRYPTION_PRETEST_INFO2_PORTION_1")
+ GetString ("SYS_ENCRYPTION_PRETEST_INFO2_PORTION_2")
+ GetString ("SYS_ENCRYPTION_PRETEST_INFO2_PORTION_3")
+ GetString ("SYS_ENCRYPTION_PRETEST_INFO2_PORTION_4"));
}
wstring GetRescueDiskHelpString (void)
{
// This huge string is divided into smaller portions to make it easier for translators to
// re-translate it when a minor modification is made to it (the whole huge string will not be
// reverted to English, so they will have to translate only a small portion of it).
return (wstring (
GetString ("RESCUE_DISK_HELP_PORTION_1"))
+ GetString ("RESCUE_DISK_HELP_PORTION_2")
+ GetString ("RESCUE_DISK_HELP_PORTION_3")
+ GetString ("RESCUE_DISK_HELP_PORTION_4")
+ GetString ("RESCUE_DISK_HELP_PORTION_5")
+ GetString ("RESCUE_DISK_HELP_PORTION_6")
+ GetString ("RESCUE_DISK_HELP_PORTION_7")
+ GetString ("RESCUE_DISK_HELP_PORTION_8")
+ GetString ("RESCUE_DISK_HELP_PORTION_9"));
}
wstring GetDecoyOsInstructionsString (void)
{
// This huge string is divided into smaller portions to make it easier for translators to
// re-translate it when a minor modification is made to it (the whole huge string will not be
// reverted to English, so they will have to translate only a small portion of it).
return (wstring (
GetString ("DECOY_OS_INSTRUCTIONS_PORTION_1"))
+ GetString ("DECOY_OS_INSTRUCTIONS_PORTION_2")
+ GetString ("DECOY_OS_INSTRUCTIONS_PORTION_3")
+ GetString ("DECOY_OS_INSTRUCTIONS_PORTION_4")
+ GetString ("DECOY_OS_INSTRUCTIONS_PORTION_5")
+ GetString ("DECOY_OS_INSTRUCTIONS_PORTION_6")
+ GetString ("DECOY_OS_INSTRUCTIONS_PORTION_7")
+ GetString ("DECOY_OS_INSTRUCTIONS_PORTION_8")
+ GetString ("DECOY_OS_INSTRUCTIONS_PORTION_9")
+ GetString ("DECOY_OS_INSTRUCTIONS_PORTION_10")
+ GetString ("DECOY_OS_INSTRUCTIONS_PORTION_11")
+ GetString ("DECOY_OS_INSTRUCTIONS_PORTION_12")
+ GetString ("DECOY_OS_INSTRUCTIONS_PORTION_13")
+ GetString ("DECOY_OS_INSTRUCTIONS_PORTION_14")
+ GetString ("DECOY_OS_INSTRUCTIONS_PORTION_15")
+ GetString ("DECOY_OS_INSTRUCTIONS_PORTION_16")
+ GetString ("DECOY_OS_INSTRUCTIONS_PORTION_17")
+ GetString ("DECOY_OS_INSTRUCTIONS_PORTION_18"));
}
struct _TEXT_EDIT_DIALOG_PARAM {
BOOL ReadOnly;
std::string& Text;
const WCHAR* Title;
_TEXT_EDIT_DIALOG_PARAM (const _TEXT_EDIT_DIALOG_PARAM& other) : ReadOnly (other.ReadOnly), Text (other.Text), Title (other.Title) {}
_TEXT_EDIT_DIALOG_PARAM(BOOL _readOnly, const WCHAR* title, std::string& _text) : ReadOnly(_readOnly), Text(_text), Title(title) {}
_TEXT_EDIT_DIALOG_PARAM& operator=( const _TEXT_EDIT_DIALOG_PARAM& other) {
if (this != &other)
{
ReadOnly = other.ReadOnly;
Text = other.Text;
Title = other.Title;
}
return *this;
}
};
typedef struct _TEXT_EDIT_DIALOG_PARAM TEXT_INFO_DIALOG_PARAM,*TEXT_INFO_DIALOG_PARAM_PTR;
INT_PTR TextEditDialogBox (BOOL readOnly, HWND parent, const WCHAR* Title, std::string& text)
{
TEXT_INFO_DIALOG_PARAM pm(readOnly, Title, text);
return DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_TEXT_EDIT_DLG), parent, (DLGPROC) TextEditDlgProc, (LPARAM) &pm);
}
BOOL CALLBACK TextEditDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
WORD lw = LOWORD (wParam);
static int nID = 0;
static TEXT_INFO_DIALOG_PARAM_PTR prm;
switch (msg)
{
case WM_INITDIALOG:
{
prm = (TEXT_INFO_DIALOG_PARAM_PTR)lParam;
// increase size limit of rich edit control
SendMessage(GetDlgItem (hwndDlg, IDC_INFO_BOX_TEXT), EM_EXLIMITTEXT, 0, -1);
SetWindowTextW (hwndDlg, prm->Title);
// Left margin for rich edit text field
SendMessage (GetDlgItem (hwndDlg, IDC_INFO_BOX_TEXT), EM_SETMARGINS, (WPARAM) EC_LEFTMARGIN, (LPARAM) CompensateXDPI (4));
if (prm->ReadOnly)
{
// switch rich edit control to ReadOnly
SendMessage(GetDlgItem (hwndDlg, IDC_INFO_BOX_TEXT), ES_READONLY, TRUE, 0);
// hide cancel button
ShowWindow(GetDlgItem(hwndDlg, IDCANCEL), SW_HIDE);
}
SendMessage (hwndDlg, TC_APPMSG_LOAD_TEXT_BOX_CONTENT, 0, 0);
}
return 0;
case WM_COMMAND:
if (lw == IDOK )
{
if (!prm->ReadOnly)
{
prm->Text.resize(GetWindowTextLengthA (GetDlgItem (hwndDlg, IDC_INFO_BOX_TEXT)) + 1);
GetWindowTextA (GetDlgItem (hwndDlg, IDC_INFO_BOX_TEXT), &(prm->Text)[0], (int) prm->Text.size());
}
NormalCursor ();
EndDialog (hwndDlg, IDOK);
return 1;
}
if (lw == IDCANCEL )
{
NormalCursor ();
EndDialog (hwndDlg, IDCANCEL);
return 1;
}
return 0;
case TC_APPMSG_LOAD_TEXT_BOX_CONTENT:
{
SetWindowTextA (GetDlgItem (hwndDlg, IDC_INFO_BOX_TEXT), prm->Text.c_str());
}
return 0;
case WM_CLOSE:
NormalCursor ();
EndDialog (hwndDlg, 0);
return 1;
}
return 0;
}
INT_PTR TextInfoDialogBox (int nID)
{
return DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_TEXT_INFO_DIALOG_BOX_DLG), MainDlg, (DLGPROC) TextInfoDialogBoxDlgProc, (LPARAM) nID);
}
BOOL CALLBACK TextInfoDialogBoxDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
WORD lw = LOWORD (wParam);
static int nID = 0;
switch (msg)
{
case WM_INITDIALOG:
{
nID = (int) lParam;
// increase size limit of rich edit control
SendMessage(GetDlgItem (hwndDlg, IDC_INFO_BOX_TEXT), EM_EXLIMITTEXT, 0, -1);
// Left margin for rich edit text field
SendMessage (GetDlgItem (hwndDlg, IDC_INFO_BOX_TEXT), EM_SETMARGINS, (WPARAM) EC_LEFTMARGIN, (LPARAM) CompensateXDPI (4));
ShowWindow(GetDlgItem(hwndDlg, IDC_PRINT), SW_HIDE);
switch (nID)
{
case TC_TBXID_LEGAL_NOTICES:
LocalizeDialog (hwndDlg, "LEGAL_NOTICES_DLG_TITLE");
break;
case TC_TBXID_SYS_ENCRYPTION_PRETEST:
LocalizeDialog (hwndDlg, NULL);
ShowWindow(GetDlgItem(hwndDlg, IDC_PRINT), SW_SHOW);
break;
case TC_TBXID_SYS_ENC_RESCUE_DISK:
LocalizeDialog (hwndDlg, NULL);
ShowWindow(GetDlgItem(hwndDlg, IDC_PRINT), SW_SHOW);
break;
case TC_TBXID_DECOY_OS_INSTRUCTIONS:
LocalizeDialog (hwndDlg, NULL);
ShowWindow(GetDlgItem(hwndDlg, IDC_PRINT), SW_SHOW);
break;
case TC_TBXID_EXTRA_BOOT_PARTITION_REMOVAL_INSTRUCTIONS:
LocalizeDialog (hwndDlg, NULL);
ShowWindow(GetDlgItem(hwndDlg, IDC_PRINT), SW_SHOW);
break;
}
SendMessage (hwndDlg, TC_APPMSG_LOAD_TEXT_BOX_CONTENT, 0, 0);
}
return 0;
case WM_COMMAND:
if (lw == IDOK || lw == IDCANCEL)
{
NormalCursor ();
EndDialog (hwndDlg, 0);
return 1;
}
if (lw == IDC_PRINT)
{
switch (nID)
{
case TC_TBXID_SYS_ENCRYPTION_PRETEST:
PrintHardCopyTextUTF16 ((wchar_t *) GetSysEncryptionPretestInfo2String ().c_str(), L"Pre-Boot Troubleshooting", GetSysEncryptionPretestInfo2String ().length () * 2);
break;
case TC_TBXID_SYS_ENC_RESCUE_DISK:
PrintHardCopyTextUTF16 ((wchar_t *) GetRescueDiskHelpString ().c_str(), L"VeraCrypt Rescue Disk Help", GetRescueDiskHelpString ().length () * 2);
break;
case TC_TBXID_DECOY_OS_INSTRUCTIONS:
PrintHardCopyTextUTF16 ((wchar_t *) GetDecoyOsInstructionsString ().c_str(), L"How to Create Decoy OS", GetDecoyOsInstructionsString ().length () * 2);
break;
case TC_TBXID_EXTRA_BOOT_PARTITION_REMOVAL_INSTRUCTIONS:
PrintHardCopyTextUTF16 (GetString ("EXTRA_BOOT_PARTITION_REMOVAL_INSTRUCTIONS"), L"How to Remove Extra Boot Partition", wcslen (GetString ("EXTRA_BOOT_PARTITION_REMOVAL_INSTRUCTIONS")) * 2);
break;
}
return 1;
}
return 0;
case TC_APPMSG_LOAD_TEXT_BOX_CONTENT:
{
char *r = NULL;
switch (nID)
{
case TC_TBXID_LEGAL_NOTICES:
LocalizeDialog (hwndDlg, "LEGAL_NOTICES_DLG_TITLE");
r = GetLegalNotices ();
if (r != NULL)
{
SETTEXTEX TextInfo = {0};
TextInfo.flags = ST_SELECTION;
TextInfo.codepage = CP_ACP;
SendMessage(GetDlgItem (hwndDlg, IDC_INFO_BOX_TEXT), EM_SETTEXTEX, (WPARAM)&TextInfo, (LPARAM)r);
free (r);
}
break;
case TC_TBXID_SYS_ENCRYPTION_PRETEST:
LocalizeDialog (hwndDlg, NULL);
SetWindowTextW (GetDlgItem (hwndDlg, IDC_INFO_BOX_TEXT), (wchar_t *) GetSysEncryptionPretestInfo2String ().c_str());
break;
case TC_TBXID_SYS_ENC_RESCUE_DISK:
LocalizeDialog (hwndDlg, NULL);
SetWindowTextW (GetDlgItem (hwndDlg, IDC_INFO_BOX_TEXT), (wchar_t *) GetRescueDiskHelpString ().c_str());
break;
case TC_TBXID_DECOY_OS_INSTRUCTIONS:
LocalizeDialog (hwndDlg, NULL);
SetWindowTextW (GetDlgItem (hwndDlg, IDC_INFO_BOX_TEXT), (wchar_t *) GetDecoyOsInstructionsString ().c_str());
break;
case TC_TBXID_EXTRA_BOOT_PARTITION_REMOVAL_INSTRUCTIONS:
LocalizeDialog (hwndDlg, NULL);
SetWindowTextW (GetDlgItem (hwndDlg, IDC_INFO_BOX_TEXT), GetString ("EXTRA_BOOT_PARTITION_REMOVAL_INSTRUCTIONS"));
break;
}
}
return 1;
case WM_CLOSE:
NormalCursor ();
EndDialog (hwndDlg, 0);
return 1;
}
return 0;
}
char * GetLegalNotices ()
{
static char *resource;
static DWORD size;
char *buf = NULL;
if (resource == NULL)
resource = (char *) MapResource (L"Text", IDR_LICENSE, &size);
if (resource != NULL)
{
buf = (char *) malloc (size + 1);
if (buf != NULL)
{
memcpy (buf, resource, size);
buf[size] = 0;
}
}
return buf;
}
#ifndef SETUP
BOOL CALLBACK RawDevicesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static wchar_t *lpszFileName; // This is actually a pointer to a GLOBAL array
static vector <HostDevice> devices;
static map <int, HostDevice> itemToDeviceMap;
WORD lw = LOWORD (wParam);
switch (msg)
{
case WM_INITDIALOG:
{
LVCOLUMNW LvCol;
HWND hList = GetDlgItem (hwndDlg, IDC_DEVICELIST);
RawDevicesDlgParam* pDlgParam = (RawDevicesDlgParam *) lParam;
LocalizeDialog (hwndDlg, "IDD_RAWDEVICES_DLG");
SendMessage (hList,LVM_SETEXTENDEDLISTVIEWSTYLE,0,
LVS_EX_FULLROWSELECT|LVS_EX_HEADERDRAGDROP|LVS_EX_TWOCLICKACTIVATE|LVS_EX_LABELTIP
);
memset (&LvCol,0,sizeof(LvCol));
LvCol.mask = LVCF_TEXT|LVCF_WIDTH|LVCF_SUBITEM|LVCF_FMT;
LvCol.pszText = GetString ("DEVICE");
LvCol.cx = CompensateXDPI (186);
LvCol.fmt = LVCFMT_LEFT;
SendMessage (hList,LVM_INSERTCOLUMNW,0,(LPARAM)&LvCol);
LvCol.pszText = GetString ("DRIVE");
LvCol.cx = CompensateXDPI (38);
LvCol.fmt = LVCFMT_LEFT;
SendMessage (hList,LVM_INSERTCOLUMNW,1,(LPARAM)&LvCol);
LvCol.pszText = GetString ("SIZE");
LvCol.cx = CompensateXDPI (64);
LvCol.fmt = LVCFMT_RIGHT;
SendMessage (hList,LVM_INSERTCOLUMNW,2,(LPARAM)&LvCol);
LvCol.pszText = GetString ("LABEL");
LvCol.cx = CompensateXDPI (128);
LvCol.fmt = LVCFMT_LEFT;
SendMessage (hList,LVM_INSERTCOLUMNW,3,(LPARAM)&LvCol);
devices.clear();
itemToDeviceMap.clear();
if (pDlgParam->devices.empty())
{
WaitCursor();
devices = GetAvailableHostDevices (false, true, false);
NormalCursor();
}
else
devices = pDlgParam->devices;
if (devices.empty())
{
MessageBoxW (hwndDlg, GetString ("RAWDEVICES"), lpszTitle, ICON_HAND);
EndDialog (hwndDlg, IDCANCEL);
return 1;
}
int line = 1;
LVITEM item;
memset (&item, 0, sizeof (item));
item.mask = LVIF_TEXT;
foreach (const HostDevice &device, devices)
{
item.iSubItem = 1;
if (device.ContainsSystem)
{
if (device.IsPartition)
StringCbCopyW (SysPartitionDevicePath, sizeof (SysPartitionDevicePath), device.Path.c_str());
else
StringCbCopyW (SysDriveDevicePath, sizeof (SysDriveDevicePath), device.Path.c_str());
}
// Path
if (!device.IsPartition || device.DynamicVolume)
{
if (!device.Floppy && (device.Size == 0)
&& (device.IsPartition || device.Partitions.empty() || device.Partitions[0].Size == 0)
)
continue;
if (line > 1)
{
ListItemAdd (hList, item.iItem, L"");
item.iItem = line++;
}
if (device.Floppy || device.DynamicVolume)
{
ListItemAdd (hList, item.iItem, (wchar_t *) device.Path.c_str());
}
else
{
wchar_t s[1024];
if (device.Removable)
StringCbPrintfW (s, sizeof(s), L"%s %d", GetString ("REMOVABLE_DISK"), device.SystemNumber);
else
StringCbPrintfW (s, sizeof(s), L"%s %d", GetString ("HARDDISK"), device.SystemNumber);
if (!device.Partitions.empty())
StringCbCatW (s, sizeof(s), L":");
ListItemAdd (hList, item.iItem, s);
}
}
else
{
ListItemAdd (hList, item.iItem, (wchar_t *) device.Path.c_str());
}
itemToDeviceMap[item.iItem] = device;
// Size
if (device.Size != 0)
{
wchar_t size[100] = { 0 };
GetSizeString (device.Size, size, sizeof(size));
ListSubItemSet (hList, item.iItem, 2, size);
}
// Mount point
if (!device.MountPoint.empty())
ListSubItemSet (hList, item.iItem, 1, (wchar_t *) device.MountPoint.c_str());
// Label
if (!device.Name.empty())
ListSubItemSet (hList, item.iItem, 3, (wchar_t *) device.Name.c_str());
#ifdef TCMOUNT
else
{
bool useInExplorer = false;
wstring favoriteLabel = GetFavoriteVolumeLabel (device.Path, useInExplorer);
if (!favoriteLabel.empty())
ListSubItemSet (hList, item.iItem, 3, (wchar_t *) favoriteLabel.c_str());
}
#endif
item.iItem = line++;
}
SendMessageW(hList, LVM_SETCOLUMNWIDTH, 0, MAKELPARAM(LVSCW_AUTOSIZE_USEHEADER, 0));
SendMessageW(hList, LVM_SETCOLUMNWIDTH, 1, MAKELPARAM(LVSCW_AUTOSIZE_USEHEADER, 0));
SendMessageW(hList, LVM_SETCOLUMNWIDTH, 2, MAKELPARAM(LVSCW_AUTOSIZE_USEHEADER, 0));
SendMessageW(hList, LVM_SETCOLUMNWIDTH, 3, MAKELPARAM(LVSCW_AUTOSIZE_USEHEADER, 0));
lpszFileName = pDlgParam->pszFileName;
#ifdef VOLFORMAT
EnableWindow (GetDlgItem (hwndDlg, IDOK), FALSE);
#endif
return 1;
}
case WM_COMMAND:
case WM_NOTIFY:
// catch non-device line selected
if (msg == WM_NOTIFY && ((LPNMHDR) lParam)->code == LVN_ITEMCHANGED && (((LPNMLISTVIEW) lParam)->uNewState & LVIS_FOCUSED ))
{
BOOL bEnableOkButton = FALSE;
LVITEM LvItem;
memset(&LvItem,0,sizeof(LvItem));
LvItem.mask = LVIF_TEXT | LVIF_PARAM;
LvItem.iItem = ((LPNMLISTVIEW) lParam)->iItem;
LvItem.pszText = lpszFileName;
LvItem.cchTextMax = TC_MAX_PATH;
lpszFileName[0] = 0;
SendMessage (GetDlgItem (hwndDlg, IDC_DEVICELIST), LVM_GETITEM, LvItem.iItem, (LPARAM) &LvItem);
if (lpszFileName[0] != 0 && lpszFileName[0] != ' ')
{
bEnableOkButton = TRUE;
#ifdef VOLFORMAT
if ( bInPlaceEncNonSysResumed && (WizardMode == WIZARD_MODE_NONSYS_DEVICE)
&& LvItem.iItem != -1 && itemToDeviceMap.find (LvItem.iItem) != itemToDeviceMap.end()
)
{
const HostDevice selectedDevice = itemToDeviceMap[LvItem.iItem];
if (selectedDevice.ContainsSystem)
{
bEnableOkButton = FALSE;
}
}
#endif
}
EnableWindow (GetDlgItem ((HWND) hwndDlg, IDOK), bEnableOkButton);
return 1;
}
if (msg == WM_COMMAND && lw == IDOK || msg == WM_NOTIFY && ((NMHDR *)lParam)->code == LVN_ITEMACTIVATE)
{
int selectedItem = ListView_GetSelectionMark (GetDlgItem (hwndDlg, IDC_DEVICELIST));
if (selectedItem == -1 || itemToDeviceMap.find (selectedItem) == itemToDeviceMap.end())
return 1; // non-device line selected
const HostDevice selectedDevice = itemToDeviceMap[selectedItem];
StringCchCopyW (lpszFileName, TC_MAX_PATH, selectedDevice.Path.c_str());
#ifdef VOLFORMAT
if (selectedDevice.ContainsSystem && selectedDevice.IsPartition)
{
if (WizardMode != WIZARD_MODE_SYS_DEVICE)
{
if (bInPlaceEncNonSysResumed && (WizardMode == WIZARD_MODE_NONSYS_DEVICE))
{
// disable selection
return 1;
}
if (AskYesNo ("CONFIRM_SYSTEM_ENCRYPTION_MODE", hwndDlg) == IDNO)
{
EndDialog (hwndDlg, IDCANCEL);
return 1;
}
bSysPartitionSelected = TRUE;
bSysDriveSelected = FALSE;
lpszFileName[0] = 0;
SwitchWizardToSysEncMode ();
NormalCursor ();
EndDialog (hwndDlg, IDOK);
return 1;
}
else
{
// This should never be the case because the Select Device dialog is not available in this wizard mode
bSysPartitionSelected = TRUE;
bSysDriveSelected = FALSE;
lpszFileName[0] = 0;
SwitchWizardToSysEncMode ();
NormalCursor ();
EndDialog (hwndDlg, IDCANCEL);
return 1;
}
}
if (!(selectedDevice.ContainsSystem && !selectedDevice.IsPartition))
{
if (bWarnDeviceFormatAdvanced
&& !bHiddenVolDirect
&& AskWarnNoYes("FORMAT_DEVICE_FOR_ADVANCED_ONLY", hwndDlg) == IDNO)
{
if (AskNoYes("CONFIRM_CHANGE_WIZARD_MODE_TO_FILE_CONTAINER", hwndDlg) == IDYES)
{
SwitchWizardToFileContainerMode ();
}
EndDialog (hwndDlg, IDCANCEL);
return 1;
}
if (!bHiddenVolDirect)
bWarnDeviceFormatAdvanced = FALSE;
}
#else // #ifdef VOLFORMAT
bSysPartitionSelected = (selectedDevice.ContainsSystem && selectedDevice.IsPartition);
bSysDriveSelected = FALSE;
#endif // #ifdef VOLFORMAT
if (!selectedDevice.IsPartition && !selectedDevice.Floppy)
{
// Whole device selected
#ifdef VOLFORMAT
if (selectedDevice.ContainsSystem && !selectedDevice.IsPartition)
{
if (WizardMode != WIZARD_MODE_SYS_DEVICE)
{
if (bInPlaceEncNonSysResumed && (WizardMode == WIZARD_MODE_NONSYS_DEVICE))
{
// disable selection
return 1;
}
if (AskYesNo ("CONFIRM_SYSTEM_ENCRYPTION_MODE", hwndDlg) == IDNO)
{
NormalCursor ();
EndDialog (hwndDlg, IDCANCEL);
return 1;
}
bSysDriveSelected = TRUE;
bSysPartitionSelected = FALSE;
lpszFileName[0] = 0;
SwitchWizardToSysEncMode ();
NormalCursor ();
EndDialog (hwndDlg, IDOK);
return 1;
}
else
{
// This should never be the case because the Select Device dialog is not available in this wizard mode
bSysDriveSelected = TRUE;
bSysPartitionSelected = FALSE;
lpszFileName[0] = 0;
SwitchWizardToSysEncMode ();
NormalCursor ();
EndDialog (hwndDlg, IDCANCEL);
return 1;
}
}
// Disallow format if the device contains partitions, but not if the partition is virtual or system
if (!selectedDevice.IsVirtualPartition
&& !bHiddenVolDirect)
{
if (!selectedDevice.Partitions.empty())
{
EnableWindow (GetDlgItem (hwndDlg, IDOK), FALSE);
Error ("DEVICE_PARTITIONS_ERR_W_INPLACE_ENC_NOTE", hwndDlg);
return 1;
}
if (AskWarnNoYes ("WHOLE_NONSYS_DEVICE_ENC_CONFIRM", hwndDlg) == IDNO)
return 1;
}
#else // #ifdef VOLFORMAT
bSysDriveSelected = (selectedDevice.ContainsSystem && !selectedDevice.IsPartition);
bSysPartitionSelected = FALSE;
#endif // #ifdef VOLFORMAT
}
else
bSysDriveSelected = FALSE;
#ifdef VOLFORMAT
bRemovableHostDevice = selectedDevice.Removable;
#endif
NormalCursor ();
EndDialog (hwndDlg, IDOK);
return 1;
}
if ((msg == WM_COMMAND) && (lw == IDCANCEL))
{
NormalCursor ();
EndDialog (hwndDlg, IDCANCEL);
return 1;
}
return 0;
}
return 0;
}
#endif //!SETUP
BOOL DoDriverInstall (HWND hwndDlg)
{
#ifdef SETUP
if (SystemEncryptionUpdate)
return TRUE;
#endif
SC_HANDLE hManager, hService = NULL;
BOOL bOK = FALSE, bRet;
hManager = OpenSCManager (NULL, NULL, SC_MANAGER_ALL_ACCESS);
if (hManager == NULL)
goto error;
#ifdef SETUP
StatusMessage (hwndDlg, "INSTALLING_DRIVER");
#endif
hService = CreateService (hManager, L"veracrypt", L"veracrypt",
SERVICE_ALL_ACCESS, SERVICE_KERNEL_DRIVER, SERVICE_SYSTEM_START, SERVICE_ERROR_NORMAL,
L"System32\\drivers\\veracrypt.sys",
NULL, NULL, NULL, NULL, NULL);
if (hService == NULL)
goto error;
else
CloseServiceHandle (hService);
hService = OpenService (hManager, L"veracrypt", SERVICE_ALL_ACCESS);
if (hService == NULL)
goto error;
#ifdef SETUP
StatusMessage (hwndDlg, "STARTING_DRIVER");
#endif
bRet = StartService (hService, 0, NULL);
if (bRet == FALSE)
goto error;
bOK = TRUE;
error:
if (bOK == FALSE && GetLastError () != ERROR_SERVICE_ALREADY_RUNNING)
{
handleWin32Error (hwndDlg, SRC_POS);
MessageBoxW (hwndDlg, GetString ("DRIVER_INSTALL_FAILED"), lpszTitle, MB_ICONHAND);
}
else
bOK = TRUE;
if (hService != NULL)
CloseServiceHandle (hService);
if (hManager != NULL)
CloseServiceHandle (hManager);
return bOK;
}
// Install and start driver service and mark it for removal (non-install mode)
static int DriverLoad ()
{
HANDLE file;
WIN32_FIND_DATA find;
SC_HANDLE hManager, hService = NULL;
wchar_t driverPath[TC_MAX_PATH*2];
BOOL res;
wchar_t *tmp;
DWORD startType;
if (ReadLocalMachineRegistryDword (L"SYSTEM\\CurrentControlSet\\Services\\veracrypt", L"Start", &startType) && startType == SERVICE_BOOT_START)
return ERR_PARAMETER_INCORRECT;
GetModuleFileName (NULL, driverPath, ARRAYSIZE (driverPath));
tmp = wcsrchr (driverPath, L'\\');
if (!tmp)
{
driverPath[0] = L'.';
driverPath[1] = 0;
}
else
*tmp = 0;
StringCbCatW (driverPath, sizeof(driverPath), !Is64BitOs () ? L"\\veracrypt.sys" : IsARM()? L"\\veracrypt-arm64.sys" : L"\\veracrypt-x64.sys");
file = FindFirstFile (driverPath, &find);
if (file == INVALID_HANDLE_VALUE)
{
MessageBoxW (0, GetString ("DRIVER_NOT_FOUND"), lpszTitle, ICON_HAND);
return ERR_DONT_REPORT;
}
FindClose (file);
hManager = OpenSCManager (NULL, NULL, SC_MANAGER_ALL_ACCESS);
if (hManager == NULL)
{
if (GetLastError () == ERROR_ACCESS_DENIED)
{
MessageBoxW (0, GetString ("ADMIN_PRIVILEGES_DRIVER"), lpszTitle, ICON_HAND);
return ERR_DONT_REPORT;
}
return ERR_OS_ERROR;
}
hService = OpenService (hManager, L"veracrypt", SERVICE_ALL_ACCESS);
if (hService != NULL)
{
// Remove stale service (driver is not loaded but service exists)
DeleteService (hService);
CloseServiceHandle (hService);
Sleep (500);
}
hService = CreateService (hManager, L"veracrypt", L"veracrypt",
SERVICE_ALL_ACCESS, SERVICE_KERNEL_DRIVER, SERVICE_DEMAND_START, SERVICE_ERROR_NORMAL,
driverPath, NULL, NULL, NULL, NULL, NULL);
if (hService == NULL)
{
CloseServiceHandle (hManager);
return ERR_OS_ERROR;
}
res = StartService (hService, 0, NULL);
DeleteService (hService);
CloseServiceHandle (hManager);
CloseServiceHandle (hService);
return !res ? ERR_OS_ERROR : ERROR_SUCCESS;
}
BOOL DriverUnload ()
{
MOUNT_LIST_STRUCT driver;
int refCount;
int volumesMounted;
DWORD dwResult;
BOOL bResult;
SC_HANDLE hManager, hService = NULL;
BOOL bRet;
SERVICE_STATUS status;
int x;
BOOL driverUnloaded = FALSE;
if (hDriver == INVALID_HANDLE_VALUE)
return TRUE;
try
{
if (BootEncryption (NULL).GetStatus().DeviceFilterActive)
return FALSE;
}
catch (...) { }
// 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)
return FALSE;
}
else
return TRUE;
// Test for any applications attached to driver
refCount = GetDriverRefCount ();
if (refCount > 1)
return FALSE;
CloseHandle (hDriver);
hDriver = INVALID_HANDLE_VALUE;
// Stop driver service
hManager = OpenSCManager (NULL, NULL, SC_MANAGER_ALL_ACCESS);
if (hManager == NULL)
goto error;
hService = OpenService (hManager, L"veracrypt", SERVICE_ALL_ACCESS);
if (hService == NULL)
goto error;
bRet = QueryServiceStatus (hService, &status);
if (bRet != TRUE)
goto error;
if (status.dwCurrentState != SERVICE_STOPPED)
{
ControlService (hService, SERVICE_CONTROL_STOP, &status);
for (x = 0; x < 10; x++)
{
bRet = QueryServiceStatus (hService, &status);
if (bRet != TRUE)
goto error;
if (status.dwCurrentState == SERVICE_STOPPED)
{
driverUnloaded = TRUE;
break;
}
Sleep (200);
}
}
else
driverUnloaded = TRUE;
error:
if (hService != NULL)
CloseServiceHandle (hService);
if (hManager != NULL)
CloseServiceHandle (hManager);
if (driverUnloaded)
{
hDriver = INVALID_HANDLE_VALUE;
return TRUE;
}
return FALSE;
}
int DriverAttach (void)
{
/* Try to open a handle to the device driver. It will be closed later. */
#ifndef SETUP
int nLoadRetryCount = 0;
start:
#endif
hDriver = CreateFile (WIN32_ROOT_PREFIX, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (hDriver == INVALID_HANDLE_VALUE)
{
#ifndef SETUP
LoadSysEncSettings ();
if (!CreateDriverSetupMutex ())
{
// Another instance is already attempting to install, register or start the driver
while (!CreateDriverSetupMutex ())
{
Sleep (100); // Wait until the other instance finishes
}
// Try to open a handle to the driver again (keep the mutex in case the other instance failed)
goto start;
}
else
{
// No other instance is currently attempting to install, register or start the driver
if (SystemEncryptionStatus != SYSENC_STATUS_NONE)
{
// This is an inconsistent state. The config file indicates system encryption should be
// active, but the driver is not running. This may happen e.g. when the pretest fails and
// the user selects "Last Known Good Configuration" from the Windows boot menu.
// To fix this, we're going to reinstall the driver, start it, and register it for boot.
if (DoDriverInstall (NULL))
{
Sleep (1000);
hDriver = CreateFile (WIN32_ROOT_PREFIX, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
try
{
BootEncryption bootEnc (NULL);
bootEnc.RegisterBootDriver (bootEnc.GetHiddenOSCreationPhase() != TC_HIDDEN_OS_CREATION_PHASE_NONE ? true : false);
}
catch (Exception &e)
{
e.Show (NULL);
}
}
CloseDriverSetupMutex ();
}
else
{
// Attempt to load the driver (non-install/portable mode)
load:
BOOL res = DriverLoad ();
CloseDriverSetupMutex ();
if (res != ERROR_SUCCESS)
return res;
bPortableModeConfirmed = TRUE;
if (hDriver != INVALID_HANDLE_VALUE)
CloseHandle (hDriver);
hDriver = CreateFile (WIN32_ROOT_PREFIX, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
}
if (bPortableModeConfirmed)
NotifyDriverOfPortableMode ();
}
#endif // #ifndef SETUP
if (hDriver == INVALID_HANDLE_VALUE)
return ERR_OS_ERROR;
}
CloseDriverSetupMutex ();
if (hDriver != INVALID_HANDLE_VALUE)
{
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);
#ifndef SETUP // Don't check version during setup to allow removal of another version
if (bResult == FALSE)
{
return ERR_OS_ERROR;
}
else if (DriverVersion != VERSION_NUM)
{
// Unload an incompatbile version of the driver loaded in non-install mode and load the required version
if (IsNonInstallMode () && CreateDriverSetupMutex () && DriverUnload () && nLoadRetryCount++ < 3)
goto load;
#ifdef TCMOUNT
// don't fail in case of service. This solves issues during upgrade when system encryption is enabled
if (!ServiceMode)
#endif
{
CloseDriverSetupMutex ();
CloseHandle (hDriver);
hDriver = INVALID_HANDLE_VALUE;
return ERR_DRIVER_VERSION;
}
}
#else
if (!bResult)
DriverVersion = 0;
#endif
}
return 0;
}
void ResetCurrentDirectory ()
{
wchar_t p[MAX_PATH];
if (!IsNonInstallMode () && SHGetFolderPath (NULL, CSIDL_PROFILE, NULL, 0, p) == ERROR_SUCCESS)
{
SetCurrentDirectory (p);
}
else
{
GetModPath (p, ARRAYSIZE (p));
SetCurrentDirectory (p);
}
}
BOOL BrowseFiles (HWND hwndDlg, char *stringId, wchar_t *lpszFileName, BOOL keepHistory, BOOL saveMode, wchar_t *browseFilter)
{
return BrowseFilesInDir (hwndDlg, stringId, NULL, lpszFileName, keepHistory, saveMode, browseFilter);
}
-BOOL BrowseFile (HWND hwndDlg, char *stringId, wchar_t *initialDir)
-{
- OPENFILENAMEW ofn;
- wchar_t file[TC_MAX_PATH] = { 0 };
- wchar_t filter[1024];
- BOOL status = FALSE;
-
- CoInitialize (NULL);
-
- ZeroMemory (&ofn, sizeof (ofn));
-
- if (initialDir)
- {
- ofn.lpstrInitialDir = initialDir;
- }
-
- ofn.lStructSize = sizeof (ofn);
- ofn.hwndOwner = hwndDlg;
- StringCbPrintfW (filter, sizeof(filter), L"%ls (*.*)%c*.*%c",
- GetString ("ALL_FILES"), 0, 0);
- ofn.lpstrFilter = filter;
- ofn.nFilterIndex = 1;
- ofn.lpstrFile = NULL;
- ofn.nMaxFile = sizeof (file) / sizeof (file[0]);
- ofn.lpstrTitle = GetString (stringId);
- ofn.lpstrDefExt = NULL;
- ofn.Flags = OFN_HIDEREADONLY
- | OFN_PATHMUSTEXIST
- | OFN_DONTADDTORECENT;
-
- SystemFileSelectorCallerThreadId = GetCurrentThreadId();
- SystemFileSelectorCallPending = TRUE;
-
- if (!GetOpenFileNameW (&ofn))
- goto ret;
-
- SystemFileSelectorCallPending = FALSE;
-
- status = TRUE;
-
-ret:
- SystemFileSelectorCallPending = FALSE;
- ResetCurrentDirectory();
- CoUninitialize();
-
- return status;
-}
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 };
wchar_t filter[1024];
BOOL status = FALSE;
CoInitialize (NULL);
ZeroMemory (&ofn, sizeof (ofn));
*lpszFileName = 0;
if (initialDir)
{
ofn.lpstrInitialDir = initialDir;
}
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)
{
if (!GetOpenFileNameW (&ofn))
goto ret;
}
else
{
if (!GetSaveFileNameW (&ofn))
goto ret;
}
SystemFileSelectorCallPending = FALSE;
StringCchCopyW (lpszFileName, MAX_PATH, file);
if (!keepHistory)
CleanLastVisitedMRU ();
status = TRUE;
ret:
SystemFileSelectorCallPending = FALSE;
ResetCurrentDirectory();
CoUninitialize();
return status;
}
static wchar_t SelectMultipleFilesPath[131072];
static int SelectMultipleFilesOffset;
BOOL SelectMultipleFiles (HWND hwndDlg, const char *stringId, wchar_t *lpszFileName, size_t cbFileName,BOOL keepHistory)
{
OPENFILENAMEW ofn;
wchar_t filter[1024];
BOOL status = FALSE;
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 ();
SystemFileSelectorCallerThreadId = GetCurrentThreadId();
SystemFileSelectorCallPending = TRUE;
if (!GetOpenFileNameW (&ofn))
goto ret;
SystemFileSelectorCallPending = FALSE;
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);
}
if (!keepHistory)
CleanLastVisitedMRU ();
status = TRUE;
ret:
SystemFileSelectorCallPending = FALSE;
ResetCurrentDirectory();
CoUninitialize();
return status;
}
BOOL SelectMultipleFilesNext (wchar_t *lpszFileName, size_t cbFileName)
{
if (SelectMultipleFilesOffset == 0)
return FALSE;
StringCbCopyW (lpszFileName, cbFileName,SelectMultipleFilesPath);
lpszFileName[TC_MAX_PATH - 1] = 0;
if (lpszFileName[wcslen (lpszFileName) - 1] != L'\\')
StringCbCatW (lpszFileName, cbFileName,L"\\");
StringCbCatW (lpszFileName, cbFileName,SelectMultipleFilesPath + SelectMultipleFilesOffset);
SelectMultipleFilesOffset += (int) wcslen (SelectMultipleFilesPath + SelectMultipleFilesOffset) + 1;
if (SelectMultipleFilesPath[SelectMultipleFilesOffset] == 0)
{
SelectMultipleFilesOffset = 0;
SecureZeroMemory (SelectMultipleFilesPath, sizeof (SelectMultipleFilesPath));
}
return TRUE;
}
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;
}
case BFFM_SELCHANGED:
{
wchar_t szDir[TC_MAX_PATH];
/* Set the status window to the currently selected path. */
if (SHGetPathFromIDList((LPITEMIDLIST) lp ,szDir))
{
SendMessage (hwnd,BFFM_SETSTATUSTEXT,0,(LPARAM)szDir);
}
break;
}
default:
break;
}
return 0;
}
BOOL BrowseDirectories (HWND hwndDlg, char *lpszTitle, wchar_t *dirName)
{
BROWSEINFOW bi;
LPITEMIDLIST pidl;
LPMALLOC pMalloc;
BOOL bOK = FALSE;
CoInitialize (NULL);
if (SUCCEEDED (SHGetMalloc (&pMalloc)))
{
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;
pidl = SHBrowseForFolderW (&bi);
if (pidl != NULL)
{
if (SHGetPathFromIDList(pidl, dirName))
{
bOK = TRUE;
}
pMalloc->Free (pidl);
pMalloc->Release();
}
}
CoUninitialize();
return bOK;
}
std::wstring GetWrongPasswordErrorMessage (HWND hwndDlg)
{
WCHAR szTmp[8192];
StringCbPrintfW (szTmp, sizeof(szTmp), GetString (KeyFilesEnable ? "PASSWORD_OR_KEYFILE_WRONG" : "PASSWORD_WRONG"));
if (CheckCapsLock (hwndDlg, TRUE))
StringCbCatW (szTmp, sizeof(szTmp), GetString ("PASSWORD_WRONG_CAPSLOCK_ON"));
#ifdef TCMOUNT
wchar_t szDevicePath [TC_MAX_PATH+1] = {0};
GetWindowText (GetDlgItem (MainDlg, IDC_VOLUME), szDevicePath, ARRAYSIZE (szDevicePath));
if (TCBootLoaderOnInactiveSysEncDrive (szDevicePath))
{
StringCbPrintfW (szTmp, sizeof(szTmp), GetString (KeyFilesEnable ? "PASSWORD_OR_KEYFILE_OR_MODE_WRONG" : "PASSWORD_OR_MODE_WRONG"));
if (CheckCapsLock (hwndDlg, TRUE))
StringCbCatW (szTmp, sizeof(szTmp), GetString ("PASSWORD_WRONG_CAPSLOCK_ON"));
StringCbCatW (szTmp, sizeof(szTmp), GetString ("SYSENC_MOUNT_WITHOUT_PBA_NOTE"));
}
#endif
wstring msg = szTmp;
#ifdef TCMOUNT
if (KeyFilesEnable && HiddenFilesPresentInKeyfilePath)
{
msg += GetString ("HIDDEN_FILES_PRESENT_IN_KEYFILE_PATH");
HiddenFilesPresentInKeyfilePath = FALSE;
}
#endif
return msg;
}
void handleError (HWND hwndDlg, int code, const char* srcPos)
{
WCHAR szTmp[4096];
if (Silent) return;
switch (code & 0x0000FFFF)
{
case ERR_OS_ERROR:
handleWin32Error (hwndDlg, srcPos);
break;
case ERR_OUTOFMEMORY:
MessageBoxW (hwndDlg, AppendSrcPos (GetString ("OUTOFMEMORY"), srcPos).c_str(), lpszTitle, ICON_HAND);
break;
case ERR_PASSWORD_WRONG:
MessageBoxW (hwndDlg, AppendSrcPos (GetWrongPasswordErrorMessage (hwndDlg).c_str(), srcPos).c_str(), lpszTitle, MB_ICONWARNING);
break;
case ERR_DRIVE_NOT_FOUND:
MessageBoxW (hwndDlg, AppendSrcPos (GetString ("NOT_FOUND"), srcPos).c_str(), lpszTitle, ICON_HAND);
break;
case ERR_FILES_OPEN:
MessageBoxW (hwndDlg, AppendSrcPos (GetString ("OPENFILES_DRIVER"), srcPos).c_str(), lpszTitle, ICON_HAND);
break;
case ERR_FILES_OPEN_LOCK:
MessageBoxW (hwndDlg, AppendSrcPos (GetString ("OPENFILES_LOCK"), srcPos).c_str(), lpszTitle, ICON_HAND);
break;
case ERR_VOL_SIZE_WRONG:
MessageBoxW (hwndDlg, AppendSrcPos (GetString ("VOL_SIZE_WRONG"), srcPos).c_str(), lpszTitle, ICON_HAND);
break;
case ERR_COMPRESSION_NOT_SUPPORTED:
MessageBoxW (hwndDlg, AppendSrcPos (GetString ("COMPRESSION_NOT_SUPPORTED"), srcPos).c_str(), lpszTitle, ICON_HAND);
break;
case ERR_PASSWORD_CHANGE_VOL_TYPE:
MessageBoxW (hwndDlg, AppendSrcPos (GetString ("WRONG_VOL_TYPE"), srcPos).c_str(), lpszTitle, ICON_HAND);
break;
case ERR_VOL_SEEKING:
MessageBoxW (hwndDlg, AppendSrcPos (GetString ("VOL_SEEKING"), srcPos).c_str(), lpszTitle, ICON_HAND);
break;
case ERR_CIPHER_INIT_FAILURE:
MessageBoxW (hwndDlg, AppendSrcPos (GetString ("ERR_CIPHER_INIT_FAILURE"), srcPos).c_str(), lpszTitle, ICON_HAND);
break;
case ERR_CIPHER_INIT_WEAK_KEY:
MessageBoxW (hwndDlg, AppendSrcPos (GetString ("ERR_CIPHER_INIT_WEAK_KEY"), srcPos).c_str(), lpszTitle, ICON_HAND);
break;
case ERR_VOL_ALREADY_MOUNTED:
MessageBoxW (hwndDlg, AppendSrcPos (GetString ("VOL_ALREADY_MOUNTED"), srcPos).c_str(), lpszTitle, ICON_HAND);
break;
case ERR_FILE_OPEN_FAILED:
MessageBoxW (hwndDlg, AppendSrcPos (GetString ("FILE_OPEN_FAILED"), srcPos).c_str(), lpszTitle, ICON_HAND);
break;
case ERR_VOL_MOUNT_FAILED:
MessageBoxW (hwndDlg, AppendSrcPos (GetString ("VOL_MOUNT_FAILED"), srcPos).c_str(), lpszTitle, ICON_HAND);
break;
case ERR_NO_FREE_DRIVES:
MessageBoxW (hwndDlg, AppendSrcPos (GetString ("NO_FREE_DRIVES"), srcPos).c_str(), lpszTitle, ICON_HAND);
break;
case ERR_ACCESS_DENIED:
MessageBoxW (hwndDlg, AppendSrcPos (GetString ("ACCESS_DENIED"), srcPos).c_str(), lpszTitle, ICON_HAND);
break;
case ERR_DRIVER_VERSION:
Error ("DRIVER_VERSION", hwndDlg);
break;
case ERR_NEW_VERSION_REQUIRED:
MessageBoxW (hwndDlg, AppendSrcPos (GetString ("NEW_VERSION_REQUIRED"), srcPos).c_str(), lpszTitle, ICON_HAND);
break;
case ERR_SELF_TESTS_FAILED:
Error ("ERR_SELF_TESTS_FAILED", hwndDlg);
break;
case ERR_VOL_FORMAT_BAD:
Error ("ERR_VOL_FORMAT_BAD", hwndDlg);
break;
case ERR_ENCRYPTION_NOT_COMPLETED:
Error ("ERR_ENCRYPTION_NOT_COMPLETED", hwndDlg);
break;
case ERR_NONSYS_INPLACE_ENC_INCOMPLETE:
Error ("ERR_NONSYS_INPLACE_ENC_INCOMPLETE", hwndDlg);
break;
case ERR_SYS_HIDVOL_HEAD_REENC_MODE_WRONG:
Error ("ERR_SYS_HIDVOL_HEAD_REENC_MODE_WRONG", hwndDlg);
break;
case ERR_PARAMETER_INCORRECT:
Error ("ERR_PARAMETER_INCORRECT", hwndDlg);
break;
case ERR_USER_ABORT:
case ERR_DONT_REPORT:
// 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 ());
MessageBoxW (hwndDlg, AppendSrcPos (szTmp, srcPos).c_str(), lpszTitle, MB_ICONERROR);
break;
case ERR_CAPI_INIT_FAILED:
StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("CAPI_RAND"), SRC_POS, CryptoAPILastError);
MessageBoxW (hwndDlg, AppendSrcPos (szTmp, srcPos).c_str(), lpszTitle, MB_ICONERROR);
break;
#endif
default:
StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("ERR_UNKNOWN"), code);
MessageBoxW (hwndDlg, AppendSrcPos (szTmp, srcPos).c_str(), lpszTitle, ICON_HAND);
}
}
BOOL CheckFileStreamWriteErrors (HWND hwndDlg, FILE *file, const wchar_t *fileName)
{
if (ferror (file))
{
wchar_t s[TC_MAX_PATH];
StringCbPrintfW (s, sizeof (s), GetString ("CANNOT_WRITE_FILE_X"), fileName);
ErrorDirect (s, hwndDlg);
return FALSE;
}
return TRUE;
}
static BOOL CALLBACK LocalizeDialogEnum( HWND hwnd, LPARAM font)
{
// Localization of controls
if (LocalizationActive)
{
int ctrlId = GetDlgCtrlID (hwnd);
if (ctrlId != 0)
{
WCHAR name[10] = { 0 };
GetClassNameW (hwnd, name, array_capacity (name));
if (_wcsicmp (name, L"Button") == 0 || _wcsicmp (name, L"Static") == 0)
{
wchar_t *str = (wchar_t *) GetDictionaryValueByInt (ctrlId);
if (str != NULL)
SetWindowTextW (hwnd, str);
}
}
}
// Font
SendMessageW (hwnd, WM_SETFONT, (WPARAM) font, 0);
return TRUE;
}
void LocalizeDialog (HWND hwnd, char *stringId)
{
LastDialogId = stringId;
SetWindowLongPtrW (hwnd, GWLP_USERDATA, (LONG_PTR) 'VERA');
SendMessageW (hwnd, WM_SETFONT, (WPARAM) hUserFont, 0);
if (stringId == NULL)
SetWindowTextW (hwnd, L"VeraCrypt");
else
SetWindowTextW (hwnd, GetString (stringId));
if (hUserFont != 0)
EnumChildWindows (hwnd, LocalizeDialogEnum, (LPARAM) hUserFont);
}
void OpenVolumeExplorerWindow (int driveNo)
{
wchar_t dosName[5];
SHFILEINFO fInfo;
StringCbPrintfW (dosName, sizeof(dosName), L"%c:\\", (wchar_t) driveNo + L'A');
// Force explorer to discover the drive
SHGetFileInfo (dosName, 0, &fInfo, sizeof (fInfo), 0);
SafeOpenURL (dosName);
}
static BOOL explorerCloseSent;
static HWND explorerTopLevelWindow;
static BOOL CALLBACK CloseVolumeExplorerWindowsChildEnum (HWND hwnd, LPARAM driveStr)
{
WCHAR s[MAX_PATH];
SendMessageW (hwnd, WM_GETTEXT, array_capacity (s), (LPARAM) s);
if (wcsstr (s, (WCHAR *) driveStr) != NULL)
{
PostMessageW (explorerTopLevelWindow, WM_CLOSE, 0, 0);
explorerCloseSent = TRUE;
return FALSE;
}
return TRUE;
}
static BOOL CALLBACK CloseVolumeExplorerWindowsEnum (HWND hwnd, LPARAM driveNo)
{
WCHAR driveStr[10];
WCHAR s[MAX_PATH];
StringCbPrintfW (driveStr, sizeof(driveStr), L"%c:\\", driveNo + L'A');
GetClassNameW (hwnd, s, array_capacity (s));
if (wcscmp (s, L"CabinetWClass") == 0)
{
GetWindowTextW (hwnd, s, array_capacity (s));
if (wcsstr (s, driveStr) != NULL)
{
PostMessageW (hwnd, WM_CLOSE, 0, 0);
explorerCloseSent = TRUE;
return TRUE;
}
explorerTopLevelWindow = hwnd;
EnumChildWindows (hwnd, CloseVolumeExplorerWindowsChildEnum, (LPARAM) driveStr);
}
return TRUE;
}
BOOL CloseVolumeExplorerWindows (HWND hwnd, int driveNo)
{
if (driveNo >= 0)
{
explorerCloseSent = FALSE;
EnumWindows (CloseVolumeExplorerWindowsEnum, (LPARAM) driveNo);
}
return explorerCloseSent;
}
BOOL UpdateDriveCustomLabel (int driveNo, wchar_t* effectiveLabel, BOOL bSetValue)
{
wchar_t wszRegPath[MAX_PATH];
wchar_t driveStr[] = {L'A' + (wchar_t) driveNo, 0};
HKEY hKey;
LSTATUS lStatus;
DWORD cbLabelLen = (DWORD) ((wcslen (effectiveLabel) + 1) * sizeof (wchar_t));
BOOL bToBeDeleted = FALSE;
StringCbPrintfW (wszRegPath, sizeof (wszRegPath), L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\DriveIcons\\%s\\DefaultLabel", driveStr);
if (bSetValue)
lStatus = RegCreateKeyExW (HKEY_CURRENT_USER, wszRegPath, NULL, NULL, 0,
KEY_READ | KEY_WRITE | KEY_SET_VALUE, NULL, &hKey, NULL);
else
lStatus = RegOpenKeyExW (HKEY_CURRENT_USER, wszRegPath, 0, KEY_READ | KEY_WRITE | KEY_SET_VALUE, &hKey);
if (ERROR_SUCCESS == lStatus)
{
if (bSetValue)
lStatus = RegSetValueExW (hKey, NULL, NULL, REG_SZ, (LPCBYTE) effectiveLabel, cbLabelLen);
else
{
wchar_t storedLabel[34] = {0};
DWORD cbStoredLen = sizeof (storedLabel) - 1, dwType;
lStatus = RegQueryValueExW (hKey, NULL, NULL, &dwType, (LPBYTE) storedLabel, &cbStoredLen);
if ((ERROR_SUCCESS == lStatus) && (REG_SZ == dwType) && (0 == wcscmp(storedLabel, effectiveLabel)))
{
// same label stored. mark key for deletion
bToBeDeleted = TRUE;
}
}
RegCloseKey (hKey);
}
if (bToBeDeleted)
{
StringCbPrintfW (wszRegPath, sizeof (wszRegPath), L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\DriveIcons\\%s", driveStr);
lStatus = RegOpenKeyExW (HKEY_CURRENT_USER, wszRegPath, 0, KEY_READ | KEY_WRITE | KEY_SET_VALUE, &hKey);
if (ERROR_SUCCESS == lStatus)
{
lStatus = RegDeleteKeyW (hKey, L"DefaultLabel");
RegCloseKey (hKey);
}
// delete drive letter of nothing else is present under it
RegDeleteKeyW (HKEY_CURRENT_USER, wszRegPath);
}
return (ERROR_SUCCESS == lStatus)? TRUE : FALSE;
}
wstring GetUserFriendlyVersionString (int version)
{
wchar_t szTmp [64];
StringCbPrintfW (szTmp, sizeof(szTmp), L"%x", version);
wstring versionString (szTmp);
versionString.insert (version > 0xfff ? 2 : 1,L".");
return (versionString);
}
wstring IntToWideString (int val)
{
wchar_t szTmp [64];
StringCbPrintfW (szTmp, sizeof(szTmp), L"%d", val);
return szTmp;
}
wstring ArrayToHexWideString (const unsigned char* pbData, int cbData)
{
static wchar_t* hexChar = L"0123456789ABCDEF";
wstring result;
if (pbData)
{
for (int i = 0; i < cbData; i++)
{
result += hexChar[pbData[i] >> 4];
result += hexChar[pbData[i] & 0x0F];
}
}
return result;
}
bool HexToByte (wchar_t c, byte& b)
{
bool bRet = true;
if (c >= L'0' && c <= L'9')
b = (byte) (c - L'0');
else if (c >= L'a' && c <= L'z')
b = (byte) (c - L'a' + 10);
else if (c >= L'A' && c <= L'Z')
b = (byte) (c - L'A' + 10);
else
bRet = false;
return bRet;
}
bool HexWideStringToArray (const wchar_t* hexStr, std::vector<byte>& arr)
{
byte b1, b2;
size_t i, len = wcslen (hexStr);
arr.clear();
if (len %2)
return false;
for (i = 0; i < len/2; i++)
{
if (!HexToByte (*hexStr++, b1) || !HexToByte (*hexStr++, b2))
return false;
arr.push_back (b1 << 4 | b2);
}
return true;
}
wstring GetTempPathString ()
{
wchar_t tempPath[MAX_PATH];
DWORD tempLen = ::GetTempPath (ARRAYSIZE (tempPath), tempPath);
if (tempLen == 0 || tempLen > ARRAYSIZE (tempPath))
throw ParameterIncorrect (SRC_POS);
return wstring (tempPath);
}
void GetSizeString (unsigned __int64 size, wchar_t *str, size_t cbStr)
{
static wchar_t *b, *kb, *mb, *gb, *tb, *pb;
static int serNo;
if (b == NULL || serNo != LocalizationSerialNo)
{
serNo = LocalizationSerialNo;
kb = GetString ("KB");
mb = GetString ("MB");
gb = GetString ("GB");
tb = GetString ("TB");
pb = GetString ("PB");
b = GetString ("BYTE");
}
if (size > 1024I64*1024*1024*1024*1024*99)
StringCbPrintfW (str, cbStr, L"%I64d %s", size/1024/1024/1024/1024/1024, pb);
else if (size > 1024I64*1024*1024*1024*1024)
StringCbPrintfW (str, cbStr, L"%.1f %s",(double)(size/1024.0/1024/1024/1024/1024), pb);
else if (size > 1024I64*1024*1024*1024*99)
StringCbPrintfW (str, cbStr, L"%I64d %s",size/1024/1024/1024/1024, tb);
else if (size > 1024I64*1024*1024*1024)
StringCbPrintfW (str, cbStr, L"%.1f %s",(double)(size/1024.0/1024/1024/1024), tb);
else if (size > 1024I64*1024*1024*99)
StringCbPrintfW (str, cbStr, L"%I64d %s",size/1024/1024/1024, gb);
else if (size > 1024I64*1024*1024)
StringCbPrintfW (str, cbStr, L"%.1f %s",(double)(size/1024.0/1024/1024), gb);
else if (size > 1024I64*1024*99)
StringCbPrintfW (str, cbStr, L"%I64d %s", size/1024/1024, mb);
else if (size > 1024I64*1024)
StringCbPrintfW (str, cbStr, L"%.1f %s",(double)(size/1024.0/1024), mb);
else if (size >= 1024I64)
StringCbPrintfW (str, cbStr, L"%I64d %s", size/1024, kb);
else
StringCbPrintfW (str, cbStr, L"%I64d %s", size, b);
}
#ifndef SETUP
void GetSpeedString (unsigned __int64 speed, wchar_t *str, size_t cbStr)
{
static wchar_t *b, *kb, *mb, *gb, *tb, *pb;
static int serNo;
if (b == NULL || serNo != LocalizationSerialNo)
{
serNo = LocalizationSerialNo;
kb = GetString ("KB_PER_SEC");
mb = GetString ("MB_PER_SEC");
gb = GetString ("GB_PER_SEC");
tb = GetString ("TB_PER_SEC");
pb = GetString ("PB_PER_SEC");
b = GetString ("B_PER_SEC");
}
if (speed > 1024I64*1024*1024*1024*1024*99)
StringCbPrintfW (str, cbStr, L"%I64d %s", speed/1024/1024/1024/1024/1024, pb);
else if (speed > 1024I64*1024*1024*1024*1024)
StringCbPrintfW (str, cbStr, L"%.1f %s",(double)(speed/1024.0/1024/1024/1024/1024), pb);
else if (speed > 1024I64*1024*1024*1024*99)
StringCbPrintfW (str, cbStr, L"%I64d %s",speed/1024/1024/1024/1024, tb);
else if (speed > 1024I64*1024*1024*1024)
StringCbPrintfW (str, cbStr, L"%.1f %s",(double)(speed/1024.0/1024/1024/1024), tb);
else if (speed > 1024I64*1024*1024*99)
StringCbPrintfW (str, cbStr, L"%I64d %s",speed/1024/1024/1024, gb);
else if (speed > 1024I64*1024*1024)
StringCbPrintfW (str, cbStr, L"%.1f %s",(double)(speed/1024.0/1024/1024), gb);
else if (speed > 1024I64*1024*99)
StringCbPrintfW (str, cbStr, L"%I64d %s", speed/1024/1024, mb);
else if (speed > 1024I64*1024)
StringCbPrintfW (str, cbStr, L"%.1f %s",(double)(speed/1024.0/1024), mb);
else if (speed > 1024I64)
StringCbPrintfW (str, cbStr, L"%I64d %s", speed/1024, kb);
else
StringCbPrintfW (str, cbStr, L"%I64d %s", speed, b);
}
static void ResetBenchmarkList (HWND hwndDlg)
{
LVCOLUMNW LvCol;
HWND hList = GetDlgItem (hwndDlg, IDC_RESULTS);
/* Render the results */
// delete data
SendMessage (hList, LVM_DELETEALLITEMS, 0, 0);
// Delete headers
SendMessageW (hList, LVM_DELETECOLUMN, 1, 0);
SendMessageW (hList, LVM_DELETECOLUMN, 1, 0);
SendMessageW (hList, LVM_DELETECOLUMN, 1, 0);
memset (&LvCol,0,sizeof(LvCol));
LvCol.mask = LVCF_TEXT|LVCF_WIDTH|LVCF_SUBITEM|LVCF_FMT;
switch(benchmarkType) {
case BENCHMARK_TYPE_ENCRYPTION:
// Create headers
LvCol.pszText = GetString ("ENCRYPTION");
LvCol.cx = CompensateXDPI (80);
LvCol.fmt = LVCFMT_RIGHT;
SendMessageW (hList,LVM_INSERTCOLUMNW,1,(LPARAM)&LvCol);
LvCol.pszText = GetString ("DECRYPTION");
LvCol.cx = CompensateXDPI (80);
LvCol.fmt = LVCFMT_RIGHT;
SendMessageW (hList,LVM_INSERTCOLUMNW,2,(LPARAM)&LvCol);
LvCol.pszText = GetString ("MEAN");
LvCol.cx = CompensateXDPI (80);
LvCol.fmt = LVCFMT_RIGHT;
SendMessageW (hList,LVM_INSERTCOLUMNW,3,(LPARAM)&LvCol);
break;
case BENCHMARK_TYPE_HASH:
LvCol.pszText = GetString ("MEAN");
LvCol.cx = CompensateXDPI (80);
LvCol.fmt = LVCFMT_RIGHT;
SendMessageW (hList,LVM_INSERTCOLUMNW,1,(LPARAM)&LvCol);
break;
case BENCHMARK_TYPE_PRF:
LvCol.pszText = GetString ("TIME");
LvCol.cx = CompensateXDPI (80);
LvCol.fmt = LVCFMT_RIGHT;
SendMessageW (hList,LVM_INSERTCOLUMNW,1,(LPARAM)&LvCol);
LvCol.pszText = GetString ("ITERATIONS");
LvCol.cx = CompensateXDPI (80);
LvCol.fmt = LVCFMT_RIGHT;
SendMessageW (hList,LVM_INSERTCOLUMNW,2,(LPARAM)&LvCol);
break;
}
}
static void DisplayBenchmarkResults (HWND hwndDlg)
{
wchar_t item1[100]={0};
LVITEMW LvItem;
HWND hList = GetDlgItem (hwndDlg, IDC_RESULTS);
int ea, i;
BOOL unsorted = TRUE;
BENCHMARK_REC tmp_line;
ResetBenchmarkList (hwndDlg);
/* Sort the list */
switch (benchmarkSortMethod)
{
case BENCHMARK_SORT_BY_SPEED:
while (unsorted)
{
unsorted = FALSE;
for (i = 0; i < benchmarkTotalItems - 1; i++)
{
if (((benchmarkType == BENCHMARK_TYPE_PRF) && (benchmarkTable[i].meanBytesPerSec > benchmarkTable[i+1].meanBytesPerSec)) ||
((benchmarkType != BENCHMARK_TYPE_PRF) && (benchmarkTable[i].meanBytesPerSec < benchmarkTable[i+1].meanBytesPerSec))
)
{
unsorted = TRUE;
memcpy (&tmp_line, &benchmarkTable[i], sizeof(BENCHMARK_REC));
memcpy (&benchmarkTable[i], &benchmarkTable[i+1], sizeof(BENCHMARK_REC));
memcpy (&benchmarkTable[i+1], &tmp_line, sizeof(BENCHMARK_REC));
}
}
}
break;
case BENCHMARK_SORT_BY_NAME:
while (unsorted)
{
unsorted = FALSE;
for (i = 0; i < benchmarkTotalItems - 1; i++)
{
if (benchmarkTable[i].id > benchmarkTable[i+1].id)
{
unsorted = TRUE;
memcpy (&tmp_line, &benchmarkTable[i], sizeof(BENCHMARK_REC));
memcpy (&benchmarkTable[i], &benchmarkTable[i+1], sizeof(BENCHMARK_REC));
memcpy (&benchmarkTable[i+1], &tmp_line, sizeof(BENCHMARK_REC));
}
}
}
break;
}
for (i = 0; i < benchmarkTotalItems; i++)
{
ea = benchmarkTable[i].id;
memset (&LvItem,0,sizeof(LvItem));
LvItem.mask = LVIF_TEXT;
LvItem.iItem = i;
LvItem.iSubItem = 0;
LvItem.pszText = (LPWSTR) benchmarkTable[i].name;
SendMessageW (hList, LVM_INSERTITEM, 0, (LPARAM)&LvItem);
switch(benchmarkType) {
case BENCHMARK_TYPE_ENCRYPTION:
GetSpeedString ((unsigned __int64) (benchmarkLastBufferSize / ((float) benchmarkTable[i].encSpeed / benchmarkPerformanceFrequency.QuadPart)), item1, sizeof(item1));
LvItem.iSubItem = 1;
LvItem.pszText = item1;
SendMessageW (hList, LVM_SETITEMW, 0, (LPARAM)&LvItem);
GetSpeedString ((unsigned __int64) (benchmarkLastBufferSize / ((float) benchmarkTable[i].decSpeed / benchmarkPerformanceFrequency.QuadPart)), item1, sizeof(item1));
LvItem.iSubItem = 2;
LvItem.pszText = item1;
SendMessageW (hList, LVM_SETITEMW, 0, (LPARAM)&LvItem);
GetSpeedString (benchmarkTable[i].meanBytesPerSec, item1, sizeof(item1));
LvItem.iSubItem = 3;
LvItem.pszText = item1;
SendMessageW (hList, LVM_SETITEMW, 0, (LPARAM)&LvItem);
break;
case BENCHMARK_TYPE_HASH:
GetSpeedString (benchmarkTable[i].meanBytesPerSec, item1, sizeof(item1));
LvItem.iSubItem = 1;
LvItem.pszText = item1;
SendMessageW (hList, LVM_SETITEMW, 0, (LPARAM)&LvItem);
break;
case BENCHMARK_TYPE_PRF:
swprintf_s (item1, sizeof(item1) / sizeof(item1[0]), L"%d ms", (int) benchmarkTable[i].meanBytesPerSec);
LvItem.iSubItem = 1;
LvItem.pszText = item1;
SendMessageW (hList, LVM_SETITEMW, 0, (LPARAM)&LvItem);
swprintf_s (item1, sizeof(item1) / sizeof(item1[0]), L"%d", (int) benchmarkTable[i].decSpeed);
LvItem.iSubItem = 2;
LvItem.pszText = item1;
SendMessageW (hList, LVM_SETITEMW, 0, (LPARAM)&LvItem);
break;
}
}
SendMessageW(hList, LVM_SETCOLUMNWIDTH, 0, MAKELPARAM(LVSCW_AUTOSIZE_USEHEADER, 0));
SendMessageW(hList, LVM_SETCOLUMNWIDTH, 1, MAKELPARAM(LVSCW_AUTOSIZE_USEHEADER, 0));
SendMessageW(hList, LVM_SETCOLUMNWIDTH, 2, MAKELPARAM(LVSCW_AUTOSIZE_USEHEADER, 0));
SendMessageW(hList, LVM_SETCOLUMNWIDTH, 3, MAKELPARAM(LVSCW_AUTOSIZE_USEHEADER, 0));
}
// specific implementation for support of benchmark operation in wait dialog mechanism
typedef struct
{
HWND hBenchDlg;
BOOL bStatus;
} BenchmarkThreadParam;
static BOOL PerformBenchmark(HWND hBenchDlg, HWND hwndDlg);
void CALLBACK BenchmarkThreadProc(void* pArg, HWND hwndDlg)
{
BenchmarkThreadParam* pThreadParam = (BenchmarkThreadParam*) pArg;
pThreadParam->bStatus = PerformBenchmark (pThreadParam->hBenchDlg, hwndDlg);
}
static BOOL PerformBenchmark(HWND hBenchDlg, HWND hwndDlg)
{
LARGE_INTEGER performanceCountStart, performanceCountEnd;
BYTE *lpTestBuffer = NULL;
PCRYPTO_INFO ci = NULL;
UINT64_STRUCT startDataUnitNo;
size_t cpuCount = GetCpuCount(NULL);
startDataUnitNo.Value = 0;
/* set priority to critical only when there are 2 or more CPUs on the system */
if (cpuCount > 1 && (benchmarkType != BENCHMARK_TYPE_ENCRYPTION))
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
ci = crypto_open ();
if (!ci)
return FALSE;
if (QueryPerformanceFrequency (&benchmarkPerformanceFrequency) == 0)
{
if (ci)
crypto_close (ci);
MessageBoxW (hwndDlg, GetString ("ERR_PERF_COUNTER"), lpszTitle, ICON_HAND);
return FALSE;
}
if (benchmarkType != BENCHMARK_TYPE_PRF)
{
lpTestBuffer = (BYTE *) _aligned_malloc(benchmarkBufferSize - (benchmarkBufferSize % 16), 16);
if (lpTestBuffer == NULL)
{
if (ci)
crypto_close (ci);
MessageBoxW (hwndDlg, GetString ("ERR_MEM_ALLOC"), lpszTitle, ICON_HAND);
return FALSE;
}
VirtualLock (lpTestBuffer, benchmarkBufferSize - (benchmarkBufferSize % 16));
}
WaitCursor ();
benchmarkTotalItems = 0;
switch(benchmarkType) {
case BENCHMARK_TYPE_HASH:
/* Measures the speed at which each of the hash algorithms processes the message to produce
a single digest.
*/
{
BYTE digest [MAX_DIGESTSIZE];
WHIRLPOOL_CTX wctx;
blake2s_state bctx;
sha512_ctx s2ctx;
sha256_ctx s256ctx;
STREEBOG_CTX stctx;
int hid, i;
for (hid = FIRST_PRF_ID; hid <= LAST_PRF_ID; hid++)
{
if (QueryPerformanceCounter (&performanceCountStart) == 0)
goto counter_error;
for (i = 1; i <= 2; i++)
{
switch (hid)
{
case SHA512:
sha512_begin (&s2ctx);
sha512_hash (lpTestBuffer, benchmarkBufferSize, &s2ctx);
sha512_end ((unsigned char *) digest, &s2ctx);
break;
case SHA256:
sha256_begin (&s256ctx);
sha256_hash (lpTestBuffer, benchmarkBufferSize, &s256ctx);
sha256_end ((unsigned char *) digest, &s256ctx);
break;
case BLAKE2S:
blake2s_init(&bctx);
blake2s_update(&bctx, lpTestBuffer, benchmarkBufferSize);
blake2s_final(&bctx, (unsigned char *) digest);
break;
case WHIRLPOOL:
WHIRLPOOL_init (&wctx);
WHIRLPOOL_add (lpTestBuffer, benchmarkBufferSize, &wctx);
WHIRLPOOL_finalize (&wctx, (unsigned char *) digest);
break;
case STREEBOG:
STREEBOG_init(&stctx);
STREEBOG_add(&stctx, lpTestBuffer, benchmarkBufferSize);
STREEBOG_finalize(&stctx, (unsigned char *)digest);
break;
}
}
if (QueryPerformanceCounter (&performanceCountEnd) == 0)
goto counter_error;
benchmarkTable[benchmarkTotalItems].encSpeed = performanceCountEnd.QuadPart - performanceCountStart.QuadPart;
benchmarkTable[benchmarkTotalItems].decSpeed = benchmarkTable[benchmarkTotalItems].encSpeed;
benchmarkTable[benchmarkTotalItems].id = hid;
benchmarkTable[benchmarkTotalItems].meanBytesPerSec = (unsigned __int64) (benchmarkBufferSize / ((float) benchmarkTable[benchmarkTotalItems].encSpeed / benchmarkPerformanceFrequency.QuadPart / 2));
StringCbPrintfW (benchmarkTable[benchmarkTotalItems].name, sizeof(benchmarkTable[benchmarkTotalItems].name),L"%s", HashGetName(hid));
benchmarkTotalItems++;
}
}
break;
case BENCHMARK_TYPE_PRF:
/* Measures the time that it takes for the PKCS-5 routine to derive a header key using
each of the implemented PRF algorithms.
*/
{
int thid, i;
char dk[MASTER_KEYDATA_SIZE];
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"};
for (thid = FIRST_PRF_ID; thid <= LAST_PRF_ID; thid++)
{
if (benchmarkPreBoot && !benchmarkGPT && !HashForSystemEncryption (thid))
continue;
if (QueryPerformanceCounter (&performanceCountStart) == 0)
goto counter_error;
for (i = 1; i <= 2; i++)
{
switch (thid)
{
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);
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);
break;
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);
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);
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);
break;
}
}
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].meanBytesPerSec = (unsigned __int64) (1000 * ((float) benchmarkTable[benchmarkTotalItems].encSpeed / benchmarkPerformanceFrequency.QuadPart / 2));
if (benchmarkPreBoot)
{
/* heuristics for boot times */
if (benchmarkGPT)
{
benchmarkTable[benchmarkTotalItems].meanBytesPerSec = (benchmarkTable[benchmarkTotalItems].meanBytesPerSec * 8) / 5;
}
else
{
if (thid == SHA256)
{
#ifdef _WIN64
benchmarkTable[benchmarkTotalItems].meanBytesPerSec = (benchmarkTable[benchmarkTotalItems].meanBytesPerSec * 26);
#else
benchmarkTable[benchmarkTotalItems].meanBytesPerSec = (benchmarkTable[benchmarkTotalItems].meanBytesPerSec * 24);
#endif
}
else
{
#ifdef _WIN64
benchmarkTable[benchmarkTotalItems].meanBytesPerSec = (benchmarkTable[benchmarkTotalItems].meanBytesPerSec * 21) / 5;
#else
benchmarkTable[benchmarkTotalItems].meanBytesPerSec = (benchmarkTable[benchmarkTotalItems].meanBytesPerSec * 18) / 5;
#endif
}
}
}
StringCbPrintfW (benchmarkTable[benchmarkTotalItems].name, sizeof(benchmarkTable[benchmarkTotalItems].name),L"%s", get_pkcs5_prf_name (thid));
benchmarkTotalItems++;
}
}
break;
case BENCHMARK_TYPE_ENCRYPTION:
{
/* Encryption algorithm benchmarks */
// CPU "warm up" (an attempt to prevent skewed results on systems where CPU frequency
// gradually changes depending on CPU load).
ci->ea = EAGetFirst();
if (!EAInit (ci->ea, ci->master_keydata, ci->ks))
{
ci->mode = FIRST_MODE_OF_OPERATION_ID;
if (EAInitMode (ci, ci->k2))
{
int i;
#ifdef _WIN64
if (IsRamEncryptionEnabled ())
VcProtectKeys (ci, VcGetEncryptionID (ci));
#endif
for (i = 0; i < 10; i++)
{
EncryptDataUnits (lpTestBuffer, &startDataUnitNo, (TC_LARGEST_COMPILER_UINT) benchmarkBufferSize / ENCRYPTION_DATA_UNIT_SIZE, ci);
DecryptDataUnits (lpTestBuffer, &startDataUnitNo, (TC_LARGEST_COMPILER_UINT) benchmarkBufferSize / ENCRYPTION_DATA_UNIT_SIZE, ci);
}
}
}
for (ci->ea = EAGetFirst(); ci->ea != 0; ci->ea = EAGetNext(ci->ea))
{
if (!EAIsFormatEnabled (ci->ea))
continue;
if (ERR_CIPHER_INIT_FAILURE == EAInit (ci->ea, ci->master_keydata, ci->ks))
goto counter_error;
ci->mode = FIRST_MODE_OF_OPERATION_ID;
if (!EAInitMode (ci, ci->k2))
goto counter_error;
#ifdef _WIN64
if (IsRamEncryptionEnabled ())
VcProtectKeys (ci, VcGetEncryptionID (ci));
#endif
if (QueryPerformanceCounter (&performanceCountStart) == 0)
goto counter_error;
EncryptDataUnits (lpTestBuffer, &startDataUnitNo, (TC_LARGEST_COMPILER_UINT) benchmarkBufferSize / ENCRYPTION_DATA_UNIT_SIZE, ci);
if (QueryPerformanceCounter (&performanceCountEnd) == 0)
goto counter_error;
benchmarkTable[benchmarkTotalItems].encSpeed = performanceCountEnd.QuadPart - performanceCountStart.QuadPart;
if (QueryPerformanceCounter (&performanceCountStart) == 0)
goto counter_error;
DecryptDataUnits (lpTestBuffer, &startDataUnitNo, (TC_LARGEST_COMPILER_UINT) benchmarkBufferSize / ENCRYPTION_DATA_UNIT_SIZE, ci);
if (QueryPerformanceCounter (&performanceCountEnd) == 0)
goto counter_error;
benchmarkTable[benchmarkTotalItems].decSpeed = performanceCountEnd.QuadPart - performanceCountStart.QuadPart;
benchmarkTable[benchmarkTotalItems].id = ci->ea;
benchmarkTable[benchmarkTotalItems].meanBytesPerSec = ((unsigned __int64) (benchmarkBufferSize / ((float) benchmarkTable[benchmarkTotalItems].encSpeed / benchmarkPerformanceFrequency.QuadPart)) + (unsigned __int64) (benchmarkBufferSize / ((float) benchmarkTable[benchmarkTotalItems].decSpeed / benchmarkPerformanceFrequency.QuadPart))) / 2;
EAGetName (benchmarkTable[benchmarkTotalItems].name, 100, ci->ea, 1);
benchmarkTotalItems++;
}
}
break;
}
if (ci)
crypto_close (ci);
if (lpTestBuffer)
{
VirtualUnlock (lpTestBuffer, benchmarkBufferSize - (benchmarkBufferSize % 16));
_aligned_free(lpTestBuffer);
}
benchmarkLastBufferSize = benchmarkBufferSize;
DisplayBenchmarkResults(hBenchDlg);
EnableWindow (GetDlgItem (hBenchDlg, IDC_PERFORM_BENCHMARK), TRUE);
EnableWindow (GetDlgItem (hBenchDlg, IDCLOSE), TRUE);
NormalCursor ();
return TRUE;
counter_error:
if (ci)
crypto_close (ci);
if (lpTestBuffer)
{
VirtualUnlock (lpTestBuffer, benchmarkBufferSize - (benchmarkBufferSize % 16));
_aligned_free(lpTestBuffer);
}
NormalCursor ();
EnableWindow (GetDlgItem (hBenchDlg, IDC_PERFORM_BENCHMARK), TRUE);
EnableWindow (GetDlgItem (hBenchDlg, IDCLOSE), TRUE);
MessageBoxW (hwndDlg, GetString ("ERR_PERF_COUNTER"), lpszTitle, ICON_HAND);
return FALSE;
}
BOOL CALLBACK BenchmarkDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
WORD lw = LOWORD (wParam);
LPARAM nIndex;
static HWND hCboxSortMethod = NULL, hCboxBufferSize = NULL, hCboxList = NULL;
switch (msg)
{
case WM_INITDIALOG:
{
LVCOLUMNW LvCol;
wchar_t s[128];
HWND hList = GetDlgItem (hwndDlg, IDC_RESULTS);
hCboxSortMethod = GetDlgItem (hwndDlg, IDC_BENCHMARK_SORT_METHOD);
hCboxBufferSize = GetDlgItem (hwndDlg, IDC_BENCHMARK_BUFFER_SIZE);
hCboxList = GetDlgItem (hwndDlg, IDC_BENCHMARK_LIST);
LocalizeDialog (hwndDlg, "IDD_BENCHMARK_DLG");
benchmarkBufferSize = BENCHMARK_DEFAULT_BUF_SIZE;
benchmarkSortMethod = BENCHMARK_SORT_BY_SPEED;
benchmarkType = BENCHMARK_TYPE_ENCRYPTION;
if (lParam)
{
benchmarkGPT = TRUE;
}
else
benchmarkGPT = FALSE;
SendMessage (hList,LVM_SETEXTENDEDLISTVIEWSTYLE,0,
LVS_EX_FULLROWSELECT|LVS_EX_HEADERDRAGDROP|LVS_EX_LABELTIP
);
memset (&LvCol,0,sizeof(LvCol));
LvCol.mask = LVCF_TEXT|LVCF_WIDTH|LVCF_SUBITEM|LVCF_FMT;
LvCol.pszText = GetString ("ALGORITHM");
LvCol.cx = CompensateXDPI (114);
LvCol.fmt = LVCFMT_LEFT;
SendMessage (hList,LVM_INSERTCOLUMNW,0,(LPARAM)&LvCol);
ResetBenchmarkList (hwndDlg);
/* Combo boxes */
// Sort method
SendMessage (hCboxSortMethod, CB_RESETCONTENT, 0, 0);
nIndex = SendMessageW (hCboxSortMethod, CB_ADDSTRING, 0, (LPARAM) GetString ("ALPHABETICAL_CATEGORIZED"));
SendMessage (hCboxSortMethod, CB_SETITEMDATA, nIndex, (LPARAM) 0);
nIndex = SendMessageW (hCboxSortMethod, CB_ADDSTRING, 0, (LPARAM) GetString ("MEAN_SPEED"));
SendMessage (hCboxSortMethod, CB_SETITEMDATA, nIndex, (LPARAM) 0);
SendMessage (hCboxSortMethod, CB_SETCURSEL, 1, 0); // Default sort method
// benchmark list
SendMessage (hCboxList, CB_RESETCONTENT, 0, 0);
nIndex = SendMessageW (hCboxList, CB_ADDSTRING, 0, (LPARAM) GetString ("ENCRYPTION_ALGORITHM"));
SendMessage (hCboxList, CB_SETITEMDATA, nIndex, (LPARAM) 0);
nIndex = SendMessageW (hCboxList, CB_ADDSTRING, 0, (LPARAM) GetString ("PKCS5_PRF"));
SendMessage (hCboxList, CB_SETITEMDATA, nIndex, (LPARAM) 0);
nIndex = SendMessageW (hCboxList, CB_ADDSTRING, 0, (LPARAM) GetString ("IDT_HASH_ALGO"));
SendMessage (hCboxList, CB_SETITEMDATA, nIndex, (LPARAM) 0);
SendMessage (hCboxList, CB_SETCURSEL, 0, 0); // Default: benchmark of encryption
// Buffer size
SendMessage (hCboxBufferSize, CB_RESETCONTENT, 0, 0);
StringCbPrintfW (s, sizeof(s), L"100 %s", GetString ("KB"));
nIndex = SendMessageW (hCboxBufferSize, CB_ADDSTRING, 0, (LPARAM) s);
SendMessage (hCboxBufferSize, CB_SETITEMDATA, nIndex, (LPARAM) 100 * BYTES_PER_KB);
StringCbPrintfW (s, sizeof(s), L"500 %s", GetString ("KB"));
nIndex = SendMessageW (hCboxBufferSize, CB_ADDSTRING, 0, (LPARAM) s);
SendMessage (hCboxBufferSize, CB_SETITEMDATA, nIndex, (LPARAM) 500 * BYTES_PER_KB);
StringCbPrintfW (s, sizeof(s), L"1 %s", GetString ("MB"));
nIndex = SendMessageW (hCboxBufferSize, CB_ADDSTRING, 0, (LPARAM) s);
SendMessage (hCboxBufferSize, CB_SETITEMDATA, nIndex, (LPARAM) 1 * BYTES_PER_MB);
StringCbPrintfW (s, sizeof(s), L"5 %s", GetString ("MB"));
nIndex = SendMessageW (hCboxBufferSize, CB_ADDSTRING, 0, (LPARAM) s);
SendMessage (hCboxBufferSize, CB_SETITEMDATA, nIndex, (LPARAM) 5 * BYTES_PER_MB);
StringCbPrintfW (s, sizeof(s), L"10 %s", GetString ("MB"));
nIndex = SendMessageW (hCboxBufferSize, CB_ADDSTRING, 0, (LPARAM) s);
SendMessage (hCboxBufferSize, CB_SETITEMDATA, nIndex, (LPARAM) 10 * BYTES_PER_MB);
StringCbPrintfW (s, sizeof(s), L"50 %s", GetString ("MB"));
nIndex = SendMessageW (hCboxBufferSize, CB_ADDSTRING, 0, (LPARAM) s);
SendMessage (hCboxBufferSize, CB_SETITEMDATA, nIndex, (LPARAM) 50 * BYTES_PER_MB);
StringCbPrintfW (s, sizeof(s), L"100 %s", GetString ("MB"));
nIndex = SendMessageW (hCboxBufferSize, CB_ADDSTRING, 0, (LPARAM) s);
SendMessage (hCboxBufferSize, CB_SETITEMDATA, nIndex, (LPARAM) 100 * BYTES_PER_MB);
StringCbPrintfW (s, sizeof(s), L"200 %s", GetString ("MB"));
nIndex = SendMessageW (hCboxBufferSize, CB_ADDSTRING, 0, (LPARAM) s);
SendMessage (hCboxBufferSize, CB_SETITEMDATA, nIndex, (LPARAM) 200 * BYTES_PER_MB);
StringCbPrintfW (s, sizeof(s), L"500 %s", GetString ("MB"));
nIndex = SendMessageW (hCboxBufferSize, CB_ADDSTRING, 0, (LPARAM) s);
SendMessage (hCboxBufferSize, CB_SETITEMDATA, nIndex, (LPARAM) 500 * BYTES_PER_MB);
StringCbPrintfW (s, sizeof(s), L"1 %s", GetString ("GB"));
nIndex = SendMessageW (hCboxBufferSize, CB_ADDSTRING, 0, (LPARAM) s);
SendMessage (hCboxBufferSize, CB_SETITEMDATA, nIndex, (LPARAM) 1 * BYTES_PER_GB);
SendMessage (hCboxBufferSize, CB_SETCURSEL, 5, 0); // Default buffer size
uint32 driverConfig = ReadDriverConfigurationFlags();
int isAesHwSupported = HasAESNI();
SetDlgItemTextW (hwndDlg, IDC_HW_AES, (wstring (L" ") + (GetString (isAesHwSupported ? ((driverConfig & TC_DRIVER_CONFIG_DISABLE_HARDWARE_ENCRYPTION) ? "UISTR_DISABLED" : "UISTR_YES") : "NOT_APPLICABLE_OR_NOT_AVAILABLE"))).c_str());
ToHyperlink (hwndDlg, IDC_HW_AES_LABEL_LINK);
if (isAesHwSupported && (driverConfig & TC_DRIVER_CONFIG_DISABLE_HARDWARE_ENCRYPTION))
{
Warning ("DISABLED_HW_AES_AFFECTS_PERFORMANCE", hwndDlg);
}
size_t cpuCount = GetCpuCount (NULL);
size_t nbrThreads = GetEncryptionThreadCount();
wchar_t nbrThreadsStr [300];
if (cpuCount < 2)
{
StringCbCopyW (nbrThreadsStr, sizeof(nbrThreadsStr), GetString ("NOT_APPLICABLE_OR_NOT_AVAILABLE"));
}
else if (nbrThreads < 2)
{
StringCbCopyW (nbrThreadsStr, sizeof(nbrThreadsStr), GetString ("UISTR_DISABLED"));
}
else
{
StringCbPrintfW (nbrThreadsStr, sizeof(nbrThreadsStr), GetString ("NUMBER_OF_THREADS"), nbrThreads);
}
SetDlgItemTextW (hwndDlg, IDC_PARALLELIZATION, (wstring (L" ") + nbrThreadsStr).c_str());
ToHyperlink (hwndDlg, IDC_PARALLELIZATION_LABEL_LINK);
if (nbrThreads < min (cpuCount, GetMaxEncryptionThreadCount())
&& cpuCount > 1)
{
Warning ("LIMITED_THREAD_COUNT_AFFECTS_PERFORMANCE", hwndDlg);
}
return 1;
}
break;
case WM_COMMAND:
switch (lw)
{
case IDC_BENCHMARK_SORT_METHOD:
nIndex = SendMessage (hCboxSortMethod, CB_GETCURSEL, 0, 0);
if (nIndex != benchmarkSortMethod)
{
benchmarkSortMethod = (int) nIndex;
DisplayBenchmarkResults (hwndDlg);
}
return 1;
case IDC_BENCHMARK_LIST:
nIndex = SendMessage (hCboxList, CB_GETCURSEL, 0, 0);
if (nIndex != benchmarkType)
{
benchmarkType = (int) nIndex;
benchmarkTotalItems = 0;
ResetBenchmarkList (hwndDlg);
}
if (benchmarkType == BENCHMARK_TYPE_PRF)
{
ShowWindow (GetDlgItem (hwndDlg, IDC_BENCHMARK_BUFFER_SIZE), SW_HIDE);
ShowWindow (GetDlgItem (hwndDlg, IDT_BUFFER_SIZE), SW_HIDE);
ShowWindow (GetDlgItem (hwndDlg, IDC_PIM), SW_SHOW);
ShowWindow (GetDlgItem (hwndDlg, IDT_PIM), SW_SHOW);
ShowWindow (GetDlgItem (hwndDlg, IDC_BENCHMARK_PREBOOT), SW_SHOW);
}
else
{
ShowWindow (GetDlgItem (hwndDlg, IDC_BENCHMARK_BUFFER_SIZE), SW_SHOW);
ShowWindow (GetDlgItem (hwndDlg, IDT_BUFFER_SIZE), SW_SHOW);
ShowWindow (GetDlgItem (hwndDlg, IDC_PIM), SW_HIDE);
ShowWindow (GetDlgItem (hwndDlg, IDT_PIM), SW_HIDE);
ShowWindow (GetDlgItem (hwndDlg, IDC_BENCHMARK_PREBOOT), SW_HIDE);
}
return 1;
case IDC_PERFORM_BENCHMARK:
if (benchmarkType == BENCHMARK_TYPE_PRF)
{
benchmarkPim = GetPim (hwndDlg, IDC_PIM, 0);
benchmarkPreBoot = GetCheckBox (hwndDlg, IDC_BENCHMARK_PREBOOT);
}
else
{
nIndex = SendMessage (hCboxBufferSize, CB_GETCURSEL, 0, 0);
benchmarkBufferSize = (int) SendMessage (hCboxBufferSize, CB_GETITEMDATA, nIndex, 0);
}
BenchmarkThreadParam threadParam;
threadParam.hBenchDlg = hwndDlg;
threadParam.bStatus = FALSE;
WaitCursor ();
ShowWaitDialog (hwndDlg, TRUE, BenchmarkThreadProc, &threadParam);
NormalCursor ();
if (threadParam.bStatus == FALSE)
{
EndDialog (hwndDlg, IDCLOSE);
}
return 1;
case IDC_HW_AES_LABEL_LINK:
Applink ("hwacceleration");
return 1;
case IDC_PARALLELIZATION_LABEL_LINK:
Applink ("parallelization");
return 1;
case IDCLOSE:
case IDCANCEL:
EndDialog (hwndDlg, IDCLOSE);
return 1;
}
return 0;
break;
case WM_CLOSE:
EndDialog (hwndDlg, IDCLOSE);
return 1;
break;
}
return 0;
}
static BOOL CALLBACK RandomPoolEnrichementDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
WORD lw = LOWORD (wParam);
WORD hw = HIWORD (wParam);
static unsigned char randPool [RNG_POOL_SIZE];
static unsigned char lastRandPool [RNG_POOL_SIZE];
static unsigned char maskRandPool [RNG_POOL_SIZE];
static BOOL bUseMask = FALSE;
static DWORD mouseEntropyGathered = 0xFFFFFFFF;
static DWORD mouseEventsInitialCount = 0;
/* max value of entropy needed to fill all random pool = 8 * RNG_POOL_SIZE = 2560 bits */
static const DWORD maxEntropyLevel = RNG_POOL_SIZE * 8;
static HWND hEntropyBar = NULL;
static wchar_t outputDispBuffer [RNG_POOL_SIZE * 3 + RANDPOOL_DISPLAY_ROWS + 2];
static BOOL bDisplayPoolContents = FALSE;
static BOOL bRandPoolDispAscii = FALSE;
int hash_algo = RandGetHashFunction();
int hid;
switch (msg)
{
case WM_INITDIALOG:
{
HWND hComboBox = GetDlgItem (hwndDlg, IDC_PRF_ID);
HCRYPTPROV hRngProv = NULL;
VirtualLock (randPool, sizeof(randPool));
VirtualLock (lastRandPool, sizeof(lastRandPool));
VirtualLock (outputDispBuffer, sizeof(outputDispBuffer));
VirtualLock (&mouseEntropyGathered, sizeof(mouseEntropyGathered));
VirtualLock (&mouseEventsInitialCount, sizeof(mouseEventsInitialCount));
VirtualLock (maskRandPool, sizeof(maskRandPool));
mouseEntropyGathered = 0xFFFFFFFF;
mouseEventsInitialCount = 0;
bUseMask = FALSE;
if (CryptAcquireContext (&hRngProv, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT))
{
if (CryptGenRandom (hRngProv, sizeof (maskRandPool), maskRandPool))
bUseMask = TRUE;
CryptReleaseContext (hRngProv, 0);
}
LocalizeDialog (hwndDlg, "IDD_RANDOM_POOL_ENRICHMENT");
SendMessage (hComboBox, CB_RESETCONTENT, 0, 0);
for (hid = FIRST_PRF_ID; hid <= LAST_PRF_ID; hid++)
{
if (!HashIsDeprecated (hid))
AddComboPair (hComboBox, HashGetName(hid), hid);
}
SelectAlgo (hComboBox, &hash_algo);
SetCheckBox (hwndDlg, IDC_DISPLAY_POOL_CONTENTS, bDisplayPoolContents);
SetTimer (hwndDlg, 0xfd, RANDPOOL_DISPLAY_REFRESH_INTERVAL, NULL);
SendMessage (GetDlgItem (hwndDlg, IDC_POOL_CONTENTS), WM_SETFONT, (WPARAM) hFixedDigitFont, (LPARAM) TRUE);
hEntropyBar = GetDlgItem (hwndDlg, IDC_ENTROPY_BAR);
SendMessage (hEntropyBar, PBM_SETRANGE32, 0, maxEntropyLevel);
SendMessage (hEntropyBar, PBM_SETSTEP, 1, 0);
SendMessage (hEntropyBar, PBM_SETSTATE, PBST_ERROR, 0);
return 1;
}
case WM_TIMER:
{
wchar_t tmp[4];
unsigned char tmpByte;
int col, row;
DWORD mouseEventsCounter;
RandpeekBytes (hwndDlg, randPool, sizeof (randPool), &mouseEventsCounter);
ProcessEntropyEstimate (hEntropyBar, &mouseEventsInitialCount, mouseEventsCounter, maxEntropyLevel, &mouseEntropyGathered);
if (memcmp (lastRandPool, randPool, sizeof(lastRandPool)) != 0)
{
outputDispBuffer[0] = 0;
for (row = 0; row < RANDPOOL_DISPLAY_ROWS; row++)
{
for (col = 0; col < RANDPOOL_DISPLAY_COLUMNS; col++)
{
if (bDisplayPoolContents)
{
tmpByte = randPool[row * RANDPOOL_DISPLAY_COLUMNS + col];
StringCbPrintfW (tmp, sizeof(tmp), bRandPoolDispAscii ? ((tmpByte >= 32 && tmpByte < 255 && tmpByte != L'&') ? L" %c " : L" . ") : L"%02X ", tmpByte);
}
else if (bUseMask)
{
/* use mask to compute a randomized ascii representation */
tmpByte = (randPool[row * RANDPOOL_DISPLAY_COLUMNS + col] -
lastRandPool[row * RANDPOOL_DISPLAY_COLUMNS + col]) ^ maskRandPool [row * RANDPOOL_DISPLAY_COLUMNS + col];
tmp[0] = (wchar_t) (((tmpByte >> 4) % 6) + L'*');
tmp[1] = (wchar_t) (((tmpByte & 0x0F) % 6) + L'*');
tmp[2] = L' ';
tmp[3] = 0;
}
else
{
StringCbCopyW (tmp, sizeof(tmp), L"** ");
}
StringCbCatW (outputDispBuffer, sizeof(outputDispBuffer), tmp);
}
StringCbCatW (outputDispBuffer, sizeof(outputDispBuffer), L"\n");
}
SetWindowText (GetDlgItem (hwndDlg, IDC_POOL_CONTENTS), outputDispBuffer);
memcpy (lastRandPool, randPool, sizeof(lastRandPool));
}
return 1;
}
case WM_COMMAND:
if (lw == IDC_CONTINUE)
lw = IDOK;
if (lw == IDOK || lw == IDCLOSE || lw == IDCANCEL)
{
goto exit;
}
if (lw == IDC_PRF_ID && hw == CBN_SELCHANGE)
{
hid = (int) SendMessage (GetDlgItem (hwndDlg, IDC_PRF_ID), CB_GETCURSEL, 0, 0);
hash_algo = (int) SendMessage (GetDlgItem (hwndDlg, IDC_PRF_ID), CB_GETITEMDATA, hid, 0);
RandSetHashFunction (hash_algo);
return 1;
}
if (lw == IDC_DISPLAY_POOL_CONTENTS)
{
if (!(bDisplayPoolContents = GetCheckBox (hwndDlg, IDC_DISPLAY_POOL_CONTENTS)))
{
wchar_t tmp[RNG_POOL_SIZE+1];
wmemset (tmp, L' ', ARRAYSIZE(tmp));
tmp [RNG_POOL_SIZE] = 0;
SetWindowText (GetDlgItem (hwndDlg, IDC_POOL_CONTENTS), tmp);
}
return 1;
}
return 0;
case WM_CLOSE:
{
wchar_t tmp[RNG_POOL_SIZE+1];
exit:
KillTimer (hwndDlg, 0xfd);
burn (randPool, sizeof(randPool));
burn (lastRandPool, sizeof(lastRandPool));
burn (outputDispBuffer, sizeof(outputDispBuffer));
burn (&mouseEntropyGathered, sizeof(mouseEntropyGathered));
burn (&mouseEventsInitialCount, sizeof(mouseEventsInitialCount));
burn (maskRandPool, sizeof(maskRandPool));
// Attempt to wipe the pool contents in the GUI text area
wmemset (tmp, L' ', RNG_POOL_SIZE);
tmp [RNG_POOL_SIZE] = 0;
SetWindowText (GetDlgItem (hwndDlg, IDC_POOL_CONTENTS), tmp);
if (msg == WM_COMMAND && lw == IDOK)
EndDialog (hwndDlg, IDOK);
else
EndDialog (hwndDlg, IDCLOSE);
return 1;
}
}
return 0;
}
/* Randinit is always called before UserEnrichRandomPool, so we don't need
* the extra Randinit call here since it will always succeed but we keep it
* for clarity purposes
*/
void UserEnrichRandomPool (HWND hwndDlg)
{
if ((0 == Randinit()) && !IsRandomPoolEnrichedByUser())
{
INT_PTR result = DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_RANDOM_POOL_ENRICHMENT), hwndDlg ? hwndDlg : MainDlg, (DLGPROC) RandomPoolEnrichementDlgProc, (LPARAM) 0);
SetRandomPoolEnrichedByUserStatus (result == IDOK);
}
}
/* Except in response to the WM_INITDIALOG message, the dialog box procedure
should return nonzero if it processes the message, and zero if it does
not. - see DialogProc */
BOOL CALLBACK KeyfileGeneratorDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
WORD lw = LOWORD (wParam);
WORD hw = HIWORD (wParam);
static unsigned char randPool [RNG_POOL_SIZE];
static unsigned char lastRandPool [RNG_POOL_SIZE];
static unsigned char maskRandPool [RNG_POOL_SIZE];
static BOOL bUseMask = FALSE;
static DWORD mouseEntropyGathered = 0xFFFFFFFF;
static DWORD mouseEventsInitialCount = 0;
/* max value of entropy needed to fill all random pool = 8 * RNG_POOL_SIZE = 2560 bits */
static const DWORD maxEntropyLevel = RNG_POOL_SIZE * 8;
static HWND hEntropyBar = NULL;
static wchar_t outputDispBuffer [RNG_POOL_SIZE * 3 + RANDPOOL_DISPLAY_ROWS + 2];
static BOOL bDisplayPoolContents = FALSE;
static BOOL bRandPoolDispAscii = FALSE;
int hash_algo = RandGetHashFunction();
int hid;
switch (msg)
{
case WM_INITDIALOG:
{
HWND hComboBox = GetDlgItem (hwndDlg, IDC_PRF_ID);
HCRYPTPROV hRngProv = NULL;
VirtualLock (randPool, sizeof(randPool));
VirtualLock (lastRandPool, sizeof(lastRandPool));
VirtualLock (outputDispBuffer, sizeof(outputDispBuffer));
VirtualLock (&mouseEntropyGathered, sizeof(mouseEntropyGathered));
VirtualLock (&mouseEventsInitialCount, sizeof(mouseEventsInitialCount));
VirtualLock (maskRandPool, sizeof(maskRandPool));
mouseEntropyGathered = 0xFFFFFFFF;
mouseEventsInitialCount = 0;
bUseMask = FALSE;
if (CryptAcquireContext (&hRngProv, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT))
{
if (CryptGenRandom (hRngProv, sizeof (maskRandPool), maskRandPool))
bUseMask = TRUE;
CryptReleaseContext (hRngProv, 0);
}
LocalizeDialog (hwndDlg, "IDD_KEYFILE_GENERATOR");
SendMessage (hComboBox, CB_RESETCONTENT, 0, 0);
for (hid = FIRST_PRF_ID; hid <= LAST_PRF_ID; hid++)
{
if (!HashIsDeprecated (hid))
AddComboPair (hComboBox, HashGetName(hid), hid);
}
SelectAlgo (hComboBox, &hash_algo);
SetCheckBox (hwndDlg, IDC_DISPLAY_POOL_CONTENTS, bDisplayPoolContents);
hEntropyBar = GetDlgItem (hwndDlg, IDC_ENTROPY_BAR);
SendMessage (hEntropyBar, PBM_SETRANGE32, 0, maxEntropyLevel);
SendMessage (hEntropyBar, PBM_SETSTEP, 1, 0);
SendMessage (hEntropyBar, PBM_SETSTATE, PBST_ERROR, 0);
#ifndef VOLFORMAT
if (Randinit ())
{
handleError (hwndDlg, (CryptoAPILastError == ERROR_SUCCESS)? ERR_RAND_INIT_FAILED : ERR_CAPI_INIT_FAILED, SRC_POS);
EndDialog (hwndDlg, IDCLOSE);
}
#endif
SetTimer (hwndDlg, 0xfd, RANDPOOL_DISPLAY_REFRESH_INTERVAL, NULL);
SendMessage (GetDlgItem (hwndDlg, IDC_POOL_CONTENTS), WM_SETFONT, (WPARAM) hFixedDigitFont, (LPARAM) TRUE);
// 9-digit limit for the number of keyfiles (more than enough!)
SendMessage (GetDlgItem (hwndDlg, IDC_NUMBER_KEYFILES), EM_SETLIMITTEXT, (WPARAM) 9, 0);
SetWindowText(GetDlgItem (hwndDlg, IDC_NUMBER_KEYFILES), L"1");
// maximum keyfile size is 1048576, so limit the edit control to 7 characters
SendMessage (GetDlgItem (hwndDlg, IDC_KEYFILES_SIZE), EM_SETLIMITTEXT, (WPARAM) 7, 0);
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);
return 1;
}
case WM_TIMER:
{
wchar_t tmp[4];
unsigned char tmpByte;
int col, row;
DWORD mouseEventsCounter;
RandpeekBytes (hwndDlg, randPool, sizeof (randPool), &mouseEventsCounter);
ProcessEntropyEstimate (hEntropyBar, &mouseEventsInitialCount, mouseEventsCounter, maxEntropyLevel, &mouseEntropyGathered);
if (memcmp (lastRandPool, randPool, sizeof(lastRandPool)) != 0)
{
outputDispBuffer[0] = 0;
for (row = 0; row < RANDPOOL_DISPLAY_ROWS; row++)
{
for (col = 0; col < RANDPOOL_DISPLAY_COLUMNS; col++)
{
if (bDisplayPoolContents)
{
tmpByte = randPool[row * RANDPOOL_DISPLAY_COLUMNS + col];
StringCbPrintfW (tmp, sizeof(tmp), bRandPoolDispAscii ? ((tmpByte >= 32 && tmpByte < 255 && tmpByte != L'&') ? L" %c " : L" . ") : L"%02X ", tmpByte);
}
else if (bUseMask)
{
/* use mask to compute a randomized ASCII representation */
tmpByte = (randPool[row * RANDPOOL_DISPLAY_COLUMNS + col] -
lastRandPool[row * RANDPOOL_DISPLAY_COLUMNS + col]) ^ maskRandPool [row * RANDPOOL_DISPLAY_COLUMNS + col];
tmp[0] = (wchar_t) (((tmpByte >> 4) % 6) + L'*');
tmp[1] = (wchar_t) (((tmpByte & 0x0F) % 6) + L'*');
tmp[2] = L' ';
tmp[3] = 0;
}
else
{
StringCbCopyW (tmp, sizeof(tmp), L"** ");
}
StringCbCatW (outputDispBuffer, sizeof(outputDispBuffer), tmp);
}
StringCbCatW (outputDispBuffer, sizeof(outputDispBuffer), L"\n");
}
SetWindowText (GetDlgItem (hwndDlg, IDC_POOL_CONTENTS), outputDispBuffer);
memcpy (lastRandPool, randPool, sizeof(lastRandPool));
}
return 1;
}
case WM_COMMAND:
if (lw == IDCLOSE || lw == IDCANCEL)
{
goto exit;
}
if (lw == IDC_PRF_ID && hw == CBN_SELCHANGE)
{
hid = (int) SendMessage (GetDlgItem (hwndDlg, IDC_PRF_ID), CB_GETCURSEL, 0, 0);
hash_algo = (int) SendMessage (GetDlgItem (hwndDlg, IDC_PRF_ID), CB_GETITEMDATA, hid, 0);
RandSetHashFunction (hash_algo);
return 1;
}
if (lw == IDC_DISPLAY_POOL_CONTENTS)
{
if (!(bDisplayPoolContents = GetCheckBox (hwndDlg, IDC_DISPLAY_POOL_CONTENTS)))
{
wchar_t tmp[RNG_POOL_SIZE+1];
wmemset (tmp, L' ', ARRAYSIZE(tmp));
tmp [RNG_POOL_SIZE] = 0;
SetWindowText (GetDlgItem (hwndDlg, IDC_POOL_CONTENTS), tmp);
}
return 1;
}
if (lw == IDC_KEYFILES_RANDOM_SIZE)
{
EnableWindow(GetDlgItem (hwndDlg, IDC_KEYFILES_SIZE), !GetCheckBox (hwndDlg, IDC_KEYFILES_RANDOM_SIZE));
}
if (lw == IDC_GENERATE_AND_SAVE_KEYFILE)
{
wchar_t szNumber[16] = {0};
wchar_t szFileBaseName[TC_MAX_PATH];
wchar_t szDirName[TC_MAX_PATH];
wchar_t szFileName [2*TC_MAX_PATH + 16];
unsigned char *keyfile = NULL;
int fhKeyfile = -1, status;
long keyfilesCount = 0, keyfilesSize = 0, i;
wchar_t* fileExtensionPtr = 0;
wchar_t szSuffix[32];
BOOL bRandomSize = GetCheckBox (hwndDlg, IDC_KEYFILES_RANDOM_SIZE);
if (!GetWindowText(GetDlgItem (hwndDlg, IDC_NUMBER_KEYFILES), szNumber, ARRAYSIZE(szNumber)))
szNumber[0] = 0;
keyfilesCount = wcstoul(szNumber, NULL, 0);
if (keyfilesCount <= 0 || keyfilesCount == LONG_MAX)
{
Warning("KEYFILE_INCORRECT_NUMBER", hwndDlg);
SendMessage(hwndDlg, WM_NEXTDLGCTL, (WPARAM) GetDlgItem (hwndDlg, IDC_NUMBER_KEYFILES), TRUE);
return 1;
}
if (!bRandomSize)
{
if (!GetWindowText(GetDlgItem (hwndDlg, IDC_KEYFILES_SIZE), szNumber, ARRAYSIZE(szNumber)))
szNumber[0] = 0;
keyfilesSize = wcstoul(szNumber, NULL, 0);
if (keyfilesSize < 64 || keyfilesSize > 1024*1024)
{
Warning("KEYFILE_INCORRECT_SIZE", hwndDlg);
SendMessage(hwndDlg, WM_NEXTDLGCTL, (WPARAM) GetDlgItem (hwndDlg, IDC_KEYFILES_SIZE), TRUE);
return 1;
}
}
if (!GetWindowText(GetDlgItem (hwndDlg, IDC_KEYFILES_BASE_NAME), szFileBaseName, TC_MAX_PATH))
szFileBaseName[0] = 0;
// Trim trailing space
if (TrimWhiteSpace(szFileBaseName) == 0)
{
Warning("KEYFILE_EMPTY_BASE_NAME", hwndDlg);
SendMessage(hwndDlg, WM_NEXTDLGCTL, (WPARAM) GetDlgItem (hwndDlg, IDC_KEYFILES_BASE_NAME), TRUE);
return 1;
}
if (!IsValidFileName(szFileBaseName))
{
Warning("KEYFILE_INVALID_BASE_NAME", hwndDlg);
SendMessage(hwndDlg, WM_NEXTDLGCTL, (WPARAM) GetDlgItem (hwndDlg, IDC_KEYFILES_BASE_NAME), TRUE);
return 1;
}
fileExtensionPtr = wcsrchr(szFileBaseName, L'.');
/* Select directory */
if (!BrowseDirectories (hwndDlg, "SELECT_KEYFILE_GENERATION_DIRECTORY", szDirName))
return 1;
if (szDirName[wcslen(szDirName) - 1] != L'\\' && szDirName[wcslen(szDirName) - 1] != L'/')
StringCbCat(szDirName, sizeof(szDirName), L"\\");
WaitCursor();
keyfile = (unsigned char*) TCalloc( bRandomSize? KEYFILE_MAX_READ_LEN : keyfilesSize );
for (i= 0; i < keyfilesCount; i++)
{
StringCbCopyW(szFileName, sizeof(szFileName), szDirName);
if (i > 0)
{
StringCbPrintfW(szSuffix, sizeof(szSuffix), L"_%d", i);
// Append the counter to the name
if (fileExtensionPtr)
{
StringCchCatN(szFileName, ARRAYSIZE(szFileName), szFileBaseName, (size_t) (fileExtensionPtr - szFileBaseName));
StringCbCat(szFileName, sizeof(szFileName), szSuffix);
StringCbCat(szFileName, sizeof(szFileName), fileExtensionPtr);
}
else
{
StringCbCat(szFileName, sizeof(szFileName), szFileBaseName);
StringCbCat(szFileName, sizeof(szFileName), szSuffix);
}
}
else
StringCbCat(szFileName, sizeof(szFileName), szFileBaseName);
// check if the file exists
if ((fhKeyfile = _wopen(szFileName, _O_RDONLY|_O_BINARY, _S_IREAD|_S_IWRITE)) != -1)
{
WCHAR s[4*TC_MAX_PATH] = {0};
_close (fhKeyfile);
StringCbPrintfW (s, sizeof(s), GetString ("KEYFILE_ALREADY_EXISTS"), szFileName);
status = AskWarnNoYesString (s, hwndDlg);
if (status == IDNO)
{
TCfree(keyfile);
NormalCursor();
return 1;
}
}
/* Conceive the file */
if ((fhKeyfile = _wopen(szFileName, _O_CREAT|_O_TRUNC|_O_WRONLY|_O_BINARY, _S_IREAD|_S_IWRITE)) == -1)
{
TCfree(keyfile);
NormalCursor();
handleWin32Error (hwndDlg, SRC_POS);
return 1;
}
if (bRandomSize)
{
/* Generate a random size */
if (!RandgetBytes (hwndDlg, (unsigned char*) &keyfilesSize, sizeof(keyfilesSize), FALSE))
{
_close (fhKeyfile);
DeleteFile (szFileName);
TCfree(keyfile);
NormalCursor();
return 1;
}
/* since keyfilesSize < 1024 * 1024, we mask with 0x000FFFFF */
keyfilesSize = (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;
}
/* Write the keyfile */
status = _write (fhKeyfile, keyfile, keyfilesSize);
burn (keyfile, keyfilesSize);
_close (fhKeyfile);
if (status == -1)
{
TCfree(keyfile);
NormalCursor();
handleWin32Error (hwndDlg, SRC_POS);
return 1;
}
}
TCfree(keyfile);
NormalCursor();
Info("KEYFILE_CREATED", hwndDlg);
return 1;
}
return 0;
case WM_CLOSE:
{
wchar_t tmp[RNG_POOL_SIZE+1];
exit:
WaitCursor();
KillTimer (hwndDlg, 0xfd);
#ifndef VOLFORMAT
RandStop (FALSE);
#endif
/* Cleanup */
burn (randPool, sizeof(randPool));
burn (lastRandPool, sizeof(lastRandPool));
burn (outputDispBuffer, sizeof(outputDispBuffer));
burn (&mouseEntropyGathered, sizeof(mouseEntropyGathered));
burn (&mouseEventsInitialCount, sizeof(mouseEventsInitialCount));
burn (maskRandPool, sizeof(maskRandPool));
// Attempt to wipe the pool contents in the GUI text area
wmemset (tmp, L' ', RNG_POOL_SIZE);
tmp [RNG_POOL_SIZE] = 0;
SetWindowText (GetDlgItem (hwndDlg, IDC_POOL_CONTENTS), tmp);
EndDialog (hwndDlg, IDCLOSE);
NormalCursor ();
return 1;
}
}
return 0;
}
/* Except in response to the WM_INITDIALOG message, the dialog box procedure
should return nonzero if it processes the message, and zero if it does
not. - see DialogProc */
BOOL CALLBACK
CipherTestDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
static int idTestCipher = -1; /* Currently selected cipher for the test vector facility (none = -1). */
static BOOL bXTSTestEnabled = FALSE;
PCRYPTO_INFO ci;
WORD lw = LOWORD (wParam);
WORD hw = HIWORD (wParam);
switch (uMsg)
{
case WM_INITDIALOG:
{
int ea;
wchar_t buf[100];
LocalizeDialog (hwndDlg, "IDD_CIPHER_TEST_DLG");
SendMessage(GetDlgItem(hwndDlg, IDC_TESTS_MESSAGE), WM_SETFONT, (WPARAM)hBoldFont, MAKELPARAM(TRUE,0));
SendMessage(GetDlgItem(hwndDlg, IDC_KEY), EM_LIMITTEXT, 128,0);
SendMessage(GetDlgItem(hwndDlg, IDC_KEY), WM_SETFONT, (WPARAM)hFixedDigitFont, MAKELPARAM(1,0));
SendMessage(GetDlgItem(hwndDlg, IDC_PLAINTEXT), EM_LIMITTEXT,64,0);
SendMessage(GetDlgItem(hwndDlg, IDC_PLAINTEXT), WM_SETFONT, (WPARAM)hFixedDigitFont, MAKELPARAM(1,0));
SendMessage(GetDlgItem(hwndDlg, IDC_CIPHERTEXT), EM_LIMITTEXT,64,0);
SendMessage(GetDlgItem(hwndDlg, IDC_CIPHERTEXT), WM_SETFONT, (WPARAM)hFixedDigitFont, MAKELPARAM(1,0));
SendMessage(GetDlgItem(hwndDlg, IDC_SECONDARY_KEY), EM_LIMITTEXT, 128,0);
SendMessage(GetDlgItem(hwndDlg, IDC_SECONDARY_KEY), WM_SETFONT, (WPARAM)hFixedDigitFont, MAKELPARAM(1,0));
SendMessage(GetDlgItem(hwndDlg, IDC_TEST_DATA_UNIT_NUMBER), EM_LIMITTEXT,32,0);
SendMessage(GetDlgItem(hwndDlg, IDC_TEST_DATA_UNIT_NUMBER), WM_SETFONT, (WPARAM)hFixedDigitFont, MAKELPARAM(1,0));
SetCheckBox (hwndDlg, IDC_XTS_MODE_ENABLED, bXTSTestEnabled);
EnableWindow (GetDlgItem (hwndDlg, IDC_SECONDARY_KEY), bXTSTestEnabled);
EnableWindow (GetDlgItem (hwndDlg, IDT_SECONDARY_KEY), bXTSTestEnabled);
EnableWindow (GetDlgItem (hwndDlg, IDC_TEST_BLOCK_NUMBER), bXTSTestEnabled);
EnableWindow (GetDlgItem (hwndDlg, IDT_TEST_BLOCK_NUMBER), bXTSTestEnabled);
EnableWindow (GetDlgItem (hwndDlg, IDC_TEST_DATA_UNIT_NUMBER), bXTSTestEnabled);
EnableWindow (GetDlgItem (hwndDlg, IDT_TEST_DATA_UNIT_NUMBER), bXTSTestEnabled);
if (idTestCipher == -1)
idTestCipher = (int) lParam;
SendMessage (GetDlgItem (hwndDlg, IDC_CIPHER), CB_RESETCONTENT, 0, 0);
for (ea = EAGetFirst (); ea != 0; ea = EAGetNext (ea))
{
if (EAGetCipherCount (ea) == 1 && EAIsFormatEnabled (ea))
AddComboPair (GetDlgItem (hwndDlg, IDC_CIPHER), EAGetName (buf, ARRAYSIZE(buf),ea, 1), EAGetFirstCipher (ea));
}
ResetCipherTest(hwndDlg, idTestCipher);
SelectAlgo (GetDlgItem (hwndDlg, IDC_CIPHER), &idTestCipher);
return 1;
}
case WM_COMMAND:
if (hw == CBN_SELCHANGE && lw == IDC_CIPHER)
{
idTestCipher = (int) SendMessage (GetDlgItem (hwndDlg, IDC_CIPHER), CB_GETITEMDATA, SendMessage (GetDlgItem (hwndDlg, IDC_CIPHER), CB_GETCURSEL, 0, 0), 0);
ResetCipherTest(hwndDlg, idTestCipher);
SendMessage (hwndDlg, WM_INITDIALOG, 0, 0);
return 1;
}
if (hw == CBN_SELCHANGE && lw == IDC_KEY_SIZE)
{
// NOP
return 1;
}
if (lw == IDC_RESET)
{
ResetCipherTest(hwndDlg, idTestCipher);
return 1;
}
if (lw == IDC_AUTO)
{
WaitCursor ();
if (!AutoTestAlgorithms())
{
ShowWindow(GetDlgItem(hwndDlg, IDC_TESTS_MESSAGE), SW_SHOWNORMAL);
SetWindowTextW(GetDlgItem(hwndDlg, IDC_TESTS_MESSAGE), GetString ("TESTS_FAILED"));
}
else
{
ShowWindow(GetDlgItem(hwndDlg, IDC_TESTS_MESSAGE), SW_SHOWNORMAL);
SetWindowTextW(GetDlgItem(hwndDlg, IDC_TESTS_MESSAGE), GetString ("TESTS_PASSED"));
ShowWindow(GetDlgItem(hwndDlg, IDC_REDTICK), SW_SHOWNORMAL);
}
NormalCursor ();
return 1;
}
if (lw == IDC_XTS_MODE_ENABLED)
{
bXTSTestEnabled = GetCheckBox (hwndDlg, IDC_XTS_MODE_ENABLED);
EnableWindow (GetDlgItem (hwndDlg, IDC_SECONDARY_KEY), bXTSTestEnabled);
EnableWindow (GetDlgItem (hwndDlg, IDT_SECONDARY_KEY), bXTSTestEnabled);
EnableWindow (GetDlgItem (hwndDlg, IDC_TEST_BLOCK_NUMBER), bXTSTestEnabled);
EnableWindow (GetDlgItem (hwndDlg, IDT_TEST_BLOCK_NUMBER), bXTSTestEnabled);
EnableWindow (GetDlgItem (hwndDlg, IDT_TEST_DATA_UNIT_NUMBER), bXTSTestEnabled);
EnableWindow (GetDlgItem (hwndDlg, IDC_TEST_DATA_UNIT_NUMBER), bXTSTestEnabled);
if (bXTSTestEnabled)
SendMessage(GetDlgItem(hwndDlg, IDC_KEY_SIZE), CB_SETCURSEL, 0,0);
}
if (lw == IDOK || lw == IDC_ENCRYPT || lw == IDC_DECRYPT)
{
CRYPTOPP_ALIGN_DATA(16) char key[128+1], inputtext[128+1], secondaryKey[64+1], dataUnitNo[16+1];
wchar_t szTmp[128+1];
int ks, pt, n, tlen, blockNo = 0;
BOOL bEncrypt;
ShowWindow(GetDlgItem(hwndDlg, IDC_TESTS_MESSAGE), SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_REDTICK), SW_HIDE);
ks = (int) SendMessage(GetDlgItem(hwndDlg, IDC_KEY_SIZE), CB_GETCURSEL, 0,0);
ks = (int) SendMessage(GetDlgItem(hwndDlg, IDC_KEY_SIZE), CB_GETITEMDATA, ks,0);
pt = (int) SendMessage(GetDlgItem(hwndDlg, IDC_PLAINTEXT_SIZE), CB_GETITEMDATA, 0,0);
bEncrypt = lw == IDC_ENCRYPT;
memset(key,0,sizeof(key));
memset(szTmp,0,sizeof(szTmp));
n = GetWindowText(GetDlgItem(hwndDlg, IDC_KEY), szTmp, ARRAYSIZE(szTmp));
if (n != ks * 2)
{
Warning ("TEST_KEY_SIZE", hwndDlg);
return 1;
}
for (n = 0; n < ks; n ++)
{
wchar_t szTmp2[3], *ptr;
long x;
szTmp2[2] = 0;
szTmp2[0] = szTmp[n * 2];
szTmp2[1] = szTmp[n * 2 + 1];
x = wcstol(szTmp2, &ptr, 16);
key[n] = (char) x;
}
memset(inputtext, 0, sizeof(inputtext));
memset(secondaryKey, 0, sizeof(secondaryKey));
memset(dataUnitNo, 0, sizeof(dataUnitNo));
memset(szTmp, 0, sizeof(szTmp));
if (bEncrypt)
{
n = GetWindowText(GetDlgItem(hwndDlg, IDC_PLAINTEXT), szTmp, ARRAYSIZE(szTmp));
}
else
{
n = GetWindowText(GetDlgItem(hwndDlg, IDC_CIPHERTEXT), szTmp, ARRAYSIZE(szTmp));
}
if (n != pt * 2)
{
if (bEncrypt)
{
Warning ("TEST_PLAINTEXT_SIZE", hwndDlg);
return 1;
}
else
{
Warning ("TEST_CIPHERTEXT_SIZE", hwndDlg);
return 1;
}
}
for (n = 0; n < pt; n ++)
{
wchar_t szTmp2[3], *ptr;
long x;
szTmp2[2] = 0;
szTmp2[0] = szTmp[n * 2];
szTmp2[1] = szTmp[n * 2 + 1];
x = wcstol(szTmp2, &ptr, 16);
inputtext[n] = (char) x;
}
// XTS
if (bXTSTestEnabled)
{
// Secondary key
if (GetWindowText(GetDlgItem(hwndDlg, IDC_SECONDARY_KEY), szTmp, ARRAYSIZE(szTmp)) != 64)
{
Warning ("TEST_INCORRECT_SECONDARY_KEY_SIZE", hwndDlg);
return 1;
}
for (n = 0; n < 64; n ++)
{
wchar_t szTmp2[3], *ptr;
long x;
szTmp2[2] = 0;
szTmp2[0] = szTmp[n * 2];
szTmp2[1] = szTmp[n * 2 + 1];
x = wcstol(szTmp2, &ptr, 16);
secondaryKey[n] = (char) x;
}
// Data unit number
tlen = GetWindowText(GetDlgItem(hwndDlg, IDC_TEST_DATA_UNIT_NUMBER), szTmp, ARRAYSIZE(szTmp));
if (tlen > 16 || tlen < 1)
{
Warning ("TEST_INCORRECT_TEST_DATA_UNIT_SIZE", hwndDlg);
return 1;
}
LeftPadString (szTmp, tlen, 16, L'0');
for (n = 0; n < 16; n ++)
{
wchar_t szTmp2[3], *ptr;
long x;
szTmp2[2] = 0;
szTmp2[0] = szTmp[n * 2];
szTmp2[1] = szTmp[n * 2 + 1];
x = wcstol(szTmp2, &ptr, 16);
dataUnitNo[n] = (char) x;
}
// Block number
blockNo = (int) SendMessage (GetDlgItem (hwndDlg, IDC_TEST_BLOCK_NUMBER), CB_GETITEMDATA, SendMessage (GetDlgItem (hwndDlg, IDC_TEST_BLOCK_NUMBER), CB_GETCURSEL, 0, 0), 0);
} // if (bXTSTestEnabled)
/* Perform the actual tests */
if (ks != CB_ERR && pt != CB_ERR)
{
char tmp[128];
int tmpRetVal;
/* Copy the plain/ciphertext */
memcpy(tmp,inputtext, pt);
if (bXTSTestEnabled)
{
UINT64_STRUCT structDataUnitNo;
/* XTS mode */
ci = crypto_open ();
if (!ci)
return 1;
ci->mode = XTS;
for (ci->ea = EAGetFirst (); ci->ea != 0 ; ci->ea = EAGetNext (ci->ea))
if (EAGetCipherCount (ci->ea) == 1 && EAGetFirstCipher (ci->ea) == idTestCipher)
break;
if ((tmpRetVal = EAInit (ci->ea, (unsigned char *) key, ci->ks)) != ERR_SUCCESS)
{
handleError (hwndDlg, tmpRetVal, SRC_POS);
crypto_close (ci);
return 1;
}
memcpy (&ci->k2, secondaryKey, sizeof (secondaryKey));
if (!EAInitMode (ci, ci->k2))
{
crypto_close (ci);
return 1;
}
structDataUnitNo.Value = BE64(((unsigned __int64 *)dataUnitNo)[0]);
if (bEncrypt)
EncryptBufferXTS ((unsigned char *) tmp, pt, &structDataUnitNo, blockNo, (unsigned char *) (ci->ks), (unsigned char *) ci->ks2, idTestCipher);
else
DecryptBufferXTS ((unsigned char *) tmp, pt, &structDataUnitNo, blockNo, (unsigned char *) (ci->ks), (unsigned char *) ci->ks2, idTestCipher);
crypto_close (ci);
}
else
{
CipherInit2(idTestCipher, key, ks_tmp, ks);
if (bEncrypt)
{
EncipherBlock(idTestCipher, tmp, ks_tmp);
}
else
{
DecipherBlock(idTestCipher, tmp, ks_tmp);
}
}
*szTmp = 0;
for (n = 0; n < pt; n ++)
{
wchar_t szTmp2[3];
StringCbPrintfW(szTmp2, sizeof(szTmp2), L"%02x", (int)((unsigned char)tmp[n]));
StringCbCatW(szTmp, sizeof(szTmp), szTmp2);
}
if (bEncrypt)
SetWindowText(GetDlgItem(hwndDlg,IDC_CIPHERTEXT), szTmp);
else
SetWindowText(GetDlgItem(hwndDlg,IDC_PLAINTEXT), szTmp);
}
return 1;
}
if (lw == IDCLOSE || lw == IDCANCEL)
{
idTestCipher = -1;
EndDialog (hwndDlg, 0);
return 1;
}
break;
case WM_CLOSE:
idTestCipher = -1;
EndDialog (hwndDlg, 0);
return 1;
}
return 0;
}
void
ResetCipherTest(HWND hwndDlg, int idTestCipher)
{
int ndx;
ShowWindow(GetDlgItem(hwndDlg, IDC_TESTS_MESSAGE), SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_REDTICK), SW_HIDE);
EnableWindow(GetDlgItem(hwndDlg,IDC_KEY_SIZE), FALSE);
/* Setup the keysize and plaintext sizes for the selected cipher */
SendMessage (GetDlgItem(hwndDlg, IDC_PLAINTEXT_SIZE), CB_RESETCONTENT, 0,0);
SendMessage (GetDlgItem(hwndDlg, IDC_KEY_SIZE), CB_RESETCONTENT, 0,0);
SendMessage (GetDlgItem(hwndDlg, IDC_TEST_BLOCK_NUMBER), CB_RESETCONTENT, 0,0);
ndx = (int) SendMessage (GetDlgItem(hwndDlg, IDC_PLAINTEXT_SIZE), CB_ADDSTRING, 0,(LPARAM) L"64");
SendMessage(GetDlgItem(hwndDlg, IDC_PLAINTEXT_SIZE), CB_SETITEMDATA, ndx,(LPARAM) 8);
SendMessage(GetDlgItem(hwndDlg, IDC_PLAINTEXT_SIZE), CB_SETCURSEL, ndx,0);
for (ndx = 0; ndx < BLOCKS_PER_XTS_DATA_UNIT; ndx++)
{
wchar_t tmpStr [16];
StringCbPrintfW (tmpStr, sizeof(tmpStr), L"%d", ndx);
ndx = (int) SendMessage (GetDlgItem(hwndDlg, IDC_TEST_BLOCK_NUMBER), CB_ADDSTRING, 0,(LPARAM) tmpStr);
SendMessage(GetDlgItem(hwndDlg, IDC_TEST_BLOCK_NUMBER), CB_SETITEMDATA, ndx,(LPARAM) ndx);
}
SendMessage(GetDlgItem(hwndDlg, IDC_TEST_BLOCK_NUMBER), CB_SETCURSEL, 0, 0);
SetWindowText(GetDlgItem(hwndDlg, IDC_SECONDARY_KEY), L"0000000000000000000000000000000000000000000000000000000000000000");
SetWindowText(GetDlgItem(hwndDlg, IDC_TEST_DATA_UNIT_NUMBER), L"0");
SetWindowText(GetDlgItem(hwndDlg, IDC_PLAINTEXT), L"0000000000000000");
SetWindowText(GetDlgItem(hwndDlg, IDC_CIPHERTEXT), L"0000000000000000");
if (idTestCipher == AES || idTestCipher == SERPENT || idTestCipher == TWOFISH || idTestCipher == CAMELLIA
|| idTestCipher == KUZNYECHIK
)
{
ndx = (int) SendMessage (GetDlgItem(hwndDlg, IDC_KEY_SIZE), CB_ADDSTRING, 0,(LPARAM) L"256");
SendMessage(GetDlgItem(hwndDlg, IDC_KEY_SIZE), CB_SETITEMDATA, ndx,(LPARAM) 32);
SendMessage(GetDlgItem(hwndDlg, IDC_KEY_SIZE), CB_SETCURSEL, ndx,0);
SendMessage (GetDlgItem(hwndDlg, IDC_PLAINTEXT_SIZE), CB_RESETCONTENT, 0,0);
ndx = (int) SendMessage (GetDlgItem(hwndDlg, IDC_PLAINTEXT_SIZE), CB_ADDSTRING, 0,(LPARAM) L"128");
SendMessage(GetDlgItem(hwndDlg, IDC_PLAINTEXT_SIZE), CB_SETITEMDATA, ndx,(LPARAM) 16);
SendMessage(GetDlgItem(hwndDlg, IDC_PLAINTEXT_SIZE), CB_SETCURSEL, ndx,0);
SetWindowText(GetDlgItem(hwndDlg, IDC_KEY), L"0000000000000000000000000000000000000000000000000000000000000000");
SetWindowText(GetDlgItem(hwndDlg, IDC_PLAINTEXT), L"00000000000000000000000000000000");
SetWindowText(GetDlgItem(hwndDlg, IDC_CIPHERTEXT), L"00000000000000000000000000000000");
}
}
#endif // #ifndef SETUP
BOOL CALLBACK MultiChoiceDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
int nChoiceIDs [MAX_MULTI_CHOICES+1] = { IDC_MULTI_CHOICE_MSG, IDC_CHOICE1, IDC_CHOICE2, IDC_CHOICE3,
IDC_CHOICE4, IDC_CHOICE5, IDC_CHOICE6, IDC_CHOICE7, IDC_CHOICE8, IDC_CHOICE9, IDC_CHOICE10 };
int nBaseButtonWidth = 0;
int nBaseButtonHeight = 0;
int nActiveChoices = -1;
int nStr = 0;
int vertSubOffset, horizSubOffset, vertMsgHeightOffset;
int vertOffset = 0;
int nLongestButtonCaptionWidth = 6;
int nLongestButtonCaptionCharLen = 1;
int nTextGfxLineHeight = 0;
int nMainTextLenInChars = 0;
int newLineSeqCount = 0;
RECT rec, wrec, wtrec, trec;
BOOL bResolve;
WORD lw = LOWORD (wParam);
switch (uMsg)
{
case WM_INITDIALOG:
{
char **pStr = (char **) ((MULTI_CHOICE_DLGPROC_PARAMS *) lParam)->strings;
char **pStrOrig = pStr;
wchar_t **pwStr = (wchar_t **) ((MULTI_CHOICE_DLGPROC_PARAMS *) lParam)->strings;
wchar_t **pwStrOrig = pwStr;
LocalizeDialog (hwndDlg, NULL);
SetWindowPos (hwndDlg, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
SetWindowPos (hwndDlg, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
bResolve = (*pStr == NULL);
// Style
if (((MULTI_CHOICE_DLGPROC_PARAMS *) lParam)->bold)
{
SendMessage (GetDlgItem (hwndDlg, IDC_MULTI_CHOICE_MSG), WM_SETFONT, (WPARAM) hUserBoldFont, (LPARAM) TRUE);
}
// Process the strings
pStr++;
pwStr++;
do
{
if (*pStr != 0)
{
SetWindowTextW (GetDlgItem(hwndDlg, nChoiceIDs[nStr]), bResolve ? GetString(*pStr) : *pwStr);
if (nStr > 0)
{
nLongestButtonCaptionWidth = max (
GetTextGfxWidth (GetDlgItem(hwndDlg, IDC_CHOICE1),
bResolve ? GetString(*pStr) : *pwStr,
hUserFont),
nLongestButtonCaptionWidth);
nLongestButtonCaptionCharLen = max (nLongestButtonCaptionCharLen,
(int) wcslen ((const wchar_t *) (bResolve ? GetString(*pStr) : *pwStr)));
}
nActiveChoices++;
pStr++;
pwStr++;
}
else
{
ShowWindow(GetDlgItem(hwndDlg, nChoiceIDs[nStr]), SW_HIDE);
}
nStr++;
} while (nStr < MAX_MULTI_CHOICES+1);
// Length of main message in characters (not bytes)
nMainTextLenInChars = (int) wcslen ((const wchar_t *) (bResolve ? GetString(*(pStrOrig+1)) : *(pwStrOrig+1)));
if (nMainTextLenInChars > 200
&& nMainTextLenInChars / nLongestButtonCaptionCharLen >= 10)
{
// As the main text is longer than 200 characters, we will "pad" the widest button caption with
// spaces (if it is not wide enough) so as to increase the width of the whole dialog window.
// Otherwise, it would look too tall (dialog boxes look better when they are more wide than tall).
nLongestButtonCaptionWidth = CompensateXDPI (max (
nLongestButtonCaptionWidth,
min (350, nMainTextLenInChars)));
}
// Get the window coords
GetWindowRect(hwndDlg, &wrec);
// Get the base button size
GetClientRect(GetDlgItem(hwndDlg, IDC_CHOICE1), &rec);
nBaseButtonWidth = rec.right + 2;
nBaseButtonHeight = rec.bottom + 2;
// Increase in width based on the gfx length of the widest button caption
horizSubOffset = min (CompensateXDPI (500), max (0, nLongestButtonCaptionWidth + CompensateXDPI (50) - nBaseButtonWidth));
// Vertical "title bar" offset
GetClientRect(hwndDlg, &wtrec);
vertOffset = wrec.bottom - wrec.top - wtrec.bottom - GetSystemMetrics(SM_CYFIXEDFRAME);
// Height/width of the message text
GetClientRect(GetDlgItem(hwndDlg, IDC_MULTI_CHOICE_MSG), &trec);
// Determine the number of newlines contained in the message text
{
int64 offset = -1;
do
{
offset = FindString ((char *) (bResolve ? GetString(*(pStrOrig+1)) : *(pwStrOrig+1)),
(char *) L"\n",
nMainTextLenInChars * 2,
(int) wcslen (L"\n") * 2,
offset + 1);
newLineSeqCount++;
} while (offset != -1);
}
nTextGfxLineHeight = GetTextGfxHeight (GetDlgItem(hwndDlg, IDC_MULTI_CHOICE_MSG),
bResolve ? GetString(*(pStrOrig+1)) : *(pwStrOrig+1),
hUserFont);
vertMsgHeightOffset = ((GetTextGfxWidth (GetDlgItem(hwndDlg, IDC_MULTI_CHOICE_MSG),
bResolve ? GetString(*(pStrOrig+1)) : *(pwStrOrig+1),
hUserFont) / (trec.right + horizSubOffset) + 1) * nTextGfxLineHeight) - trec.bottom;
vertMsgHeightOffset = min (CompensateYDPI (350), vertMsgHeightOffset + newLineSeqCount * nTextGfxLineHeight + (trec.bottom + vertMsgHeightOffset) / 10); // As reserve, we are adding 10% and the number of lines equal to the number of newlines in the message
// Reduction in height according to the number of shown buttons
vertSubOffset = ((MAX_MULTI_CHOICES - nActiveChoices) * nBaseButtonHeight);
if (horizSubOffset > 0
|| vertMsgHeightOffset > 0
|| vertOffset > 0)
{
// Resize/move each button if necessary
for (nStr = 1; nStr < MAX_MULTI_CHOICES+1; nStr++)
{
GetWindowRect(GetDlgItem(hwndDlg, nChoiceIDs[nStr]), &rec);
MoveWindow (GetDlgItem(hwndDlg, nChoiceIDs[nStr]),
rec.left - wrec.left - GetSystemMetrics(SM_CXFIXEDFRAME),
rec.top - wrec.top - vertOffset + vertMsgHeightOffset,
nBaseButtonWidth + horizSubOffset,
nBaseButtonHeight,
TRUE);
}
// Resize/move the remaining GUI elements
GetWindowRect(GetDlgItem(hwndDlg, IDC_MULTI_CHOICE_MSG), &rec);
GetClientRect(GetDlgItem(hwndDlg, IDC_MULTI_CHOICE_MSG), &trec);
MoveWindow (GetDlgItem(hwndDlg, IDC_MULTI_CHOICE_MSG),
rec.left - wrec.left - GetSystemMetrics(SM_CXFIXEDFRAME),
rec.top - wrec.top - vertOffset,
trec.right + 2 + horizSubOffset,
trec.bottom + 2 + vertMsgHeightOffset,
TRUE);
GetWindowRect(GetDlgItem(hwndDlg, IDC_MC_DLG_HR1), &rec);
GetClientRect(GetDlgItem(hwndDlg, IDC_MC_DLG_HR1), &trec);
MoveWindow (GetDlgItem(hwndDlg, IDC_MC_DLG_HR1),
rec.left - wrec.left - GetSystemMetrics(SM_CXFIXEDFRAME),
rec.top - wrec.top - vertOffset,
trec.right + 2 + horizSubOffset,
trec.bottom + 2,
TRUE);
GetWindowRect(GetDlgItem(hwndDlg, IDC_MC_DLG_HR2), &rec);
GetClientRect(GetDlgItem(hwndDlg, IDC_MC_DLG_HR2), &trec);
MoveWindow (GetDlgItem(hwndDlg, IDC_MC_DLG_HR2),
rec.left - wrec.left - GetSystemMetrics(SM_CXFIXEDFRAME),
rec.top - wrec.top - vertOffset + vertMsgHeightOffset,
trec.right + 2 + horizSubOffset,
trec.bottom + 2,
TRUE);
}
// Resize the window according to number of shown buttons and the longest button caption
MoveWindow (hwndDlg,
wrec.left - horizSubOffset / 2,
wrec.top + vertSubOffset / 2 - vertMsgHeightOffset / 2,
wrec.right - wrec.left + horizSubOffset,
wrec.bottom - wrec.top - vertSubOffset + 1 + vertMsgHeightOffset,
TRUE);
DisableCloseButton (hwndDlg);
return 1;
}
case WM_COMMAND:
if (lw == IDCLOSE || lw == IDCANCEL)
{
EndDialog (hwndDlg, 0);
return 1;
}
for (nStr = 1; nStr < MAX_MULTI_CHOICES+1; nStr++)
{
if (lw == nChoiceIDs[nStr])
{
EndDialog (hwndDlg, nStr);
return 1;
}
}
break;
case WM_CLOSE:
// This prevents the window from being closed by pressing Alt-F4 (the Close button is hidden).
// Note that the OS handles modal MessageBox() dialog windows the same way.
return 1;
}
return 0;
}
BOOL CheckCapsLock (HWND hwnd, BOOL quiet)
{
if ((GetKeyState(VK_CAPITAL) & 1) != 0)
{
if (!quiet)
{
MessageBoxW (hwnd, GetString ("CAPSLOCK_ON"), lpszTitle, MB_ICONEXCLAMATION);
}
return TRUE;
}
return FALSE;
}
// Checks whether the file extension is not used for executable files or similarly problematic, which often
// causes Windows and antivirus software to interfere with the container.
BOOL CheckFileExtension (wchar_t *fileName)
{
int i = 0;
wchar_t *ext = wcsrchr (fileName, L'.');
static wchar_t *problemFileExt[] = {
// These are protected by the Windows Resource Protection
L".asa", L".asp", L".aspx", L".ax", L".bas", L".bat", L".bin", L".cer", L".chm", L".clb", L".cmd", L".cnt", L".cnv",
L".com", L".cpl", L".cpx", L".crt", L".csh", L".dll", L".drv", L".dtd", L".exe", L".fxp", L".grp", L".h1s", L".hlp",
L".hta", L".ime", L".inf", L".ins", L".isp", L".its", L".js", L".jse", L".ksh", L".lnk", L".mad", L".maf", L".mag",
L".mam", L".man", L".maq", L".mar", L".mas", L".mat", L".mau", L".mav", L".maw", L".mda", L".mdb", L".mde", L".mdt",
L".mdw", L".mdz", L".msc", L".msi", L".msp", L".mst", L".mui", L".nls", L".ocx", L".ops", L".pal", L".pcd", L".pif",
L".prf", L".prg", L".pst", L".reg", L".scf", L".scr", L".sct", L".shb", L".shs", L".sys", L".tlb", L".tsp", L".url",
L".vb", L".vbe", L".vbs", L".vsmacros", L".vss", L".vst", L".vsw", L".ws", L".wsc", L".wsf", L".wsh", L".xsd", L".xsl",
// These additional file extensions are usually watched by antivirus programs
L".386", L".acm", L".ade", L".adp", L".ani", L".app", L".asd", L".asf", L".asx", L".awx", L".ax", L".boo", L".bz2", L".cdf",
L".class", L".dhtm", L".dhtml",L".dlo", L".emf", L".eml", L".flt", L".fot", L".gz", L".hlp", L".htm", L".html", L".ini",
L".j2k", L".jar", L".jff", L".jif", L".jmh", L".jng", L".jp2", L".jpe", L".jpeg", L".jpg", L".lsp", L".mod", L".nws",
L".obj", L".olb", L".osd", L".ov1", L".ov2", L".ov3", L".ovl", L".ovl", L".ovr", L".pdr", L".pgm", L".php", L".pkg",
L".pl", L".png", L".pot", L".pps", L".ppt", L".ps1", L".ps1xml", L".psc1", L".rar", L".rpl", L".rtf", L".sbf", L".script", L".sh", L".sha", L".shtm",
L".shtml", L".spl", L".swf", L".tar", L".tgz", L".tmp", L".ttf", L".vcs", L".vlm", L".vxd", L".vxo", L".wiz", L".wll", L".wmd",
L".wmf", L".wms", L".wmz", L".wpc", L".wsc", L".wsh", L".wwk", L".xhtm", L".xhtml", L".xl", L".xml", L".zip", L".7z", 0};
if (!ext)
return FALSE;
while (problemFileExt[i])
{
if (!_wcsicmp (ext, problemFileExt[i++]))
return TRUE;
}
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 '\' */
size_t i, len = wcslen (fileName);
for (i = 0; i < len; i++)
{
if (fileName [i] == L'/')
fileName [i] = L'\\';
}
}
void CorrectFileName (std::wstring& fileName)
{
/* replace '/' by '\' */
size_t i, len = fileName.length();
for (i = 0; i < len; i++)
{
if (fileName [i] == L'/')
fileName [i] = L'\\';
}
}
void CorrectURL (wchar_t* fileName)
{
/* replace '\' by '/' */
size_t i, len = wcslen (fileName);
for (i = 0; i < len; i++)
{
if (fileName [i] == L'\\')
fileName [i] = L'/';
}
}
void IncreaseWrongPwdRetryCount (int count)
{
WrongPwdRetryCounter += count;
}
void ResetWrongPwdRetryCount (void)
{
WrongPwdRetryCounter = 0;
}
BOOL WrongPwdRetryCountOverLimit (void)
{
return (WrongPwdRetryCounter > TC_TRY_HEADER_BAK_AFTER_NBR_WRONG_PWD_TRIES);
}
DWORD GetUsedLogicalDrives (void)
{
DWORD dwUsedDrives = GetLogicalDrives();
if (!bShowDisconnectedNetworkDrives)
{
static DWORD g_dwLastMappedDrives = 0;
static time_t g_lastCallTime = 0;
EnterCriticalSection (&csWNetCalls);
finally_do ({ LeaveCriticalSection (&csWNetCalls); });
/* update values every 1 minute to reduce CPU consumption */
if ((time (NULL) - g_lastCallTime) > 60)
{
/* detect disconnected mapped network shares and removed
* their associated drives from the list
*/
WCHAR remotePath[512];
WCHAR drive[3] = {L'A', L':', 0};
DWORD dwLen, status;
g_dwLastMappedDrives = 0;
for (WCHAR i = 0; i <= MAX_MOUNTED_VOLUME_DRIVE_NUMBER; i++)
{
if ((dwUsedDrives & (1 << i)) == 0)
{
drive[0] = L'A' + i;
dwLen = ARRAYSIZE (remotePath);
status = WNetGetConnection (drive, remotePath, &dwLen);
if ((NO_ERROR == status) || (status == ERROR_CONNECTION_UNAVAIL))
{
/* this is a mapped network share, mark it as used */
g_dwLastMappedDrives |= (1 << i);
}
}
}
g_lastCallTime = time (NULL);
}
dwUsedDrives |= g_dwLastMappedDrives;
}
return dwUsedDrives;
}
int GetFirstAvailableDrive ()
{
DWORD dwUsedDrives = GetUsedLogicalDrives();
int i, drive;
/* let A: and B: be used as last resort since they can introduce side effects */
for (i = 2; i < 28; i++)
{
drive = (i < 26) ? i : (i - 26);
if (!(dwUsedDrives & 1 << drive))
return i;
}
return -1;
}
int GetLastAvailableDrive ()
{
DWORD dwUsedDrives = GetUsedLogicalDrives();
int i;
for (i = 25; i >= 0; i--)
{
if (!(dwUsedDrives & 1 << i))
return i;
}
return -1;
}
BOOL IsDriveAvailable (int driveNo)
{
if (driveNo >= 0 && driveNo < 26)
return (GetUsedLogicalDrives() & (1 << driveNo)) == 0;
else
return FALSE;
}
BOOL IsDeviceMounted (wchar_t *deviceName)
{
BOOL bResult = FALSE;
DWORD dwResult;
HANDLE dev = INVALID_HANDLE_VALUE;
if ((dev = CreateFile (deviceName,
GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
0,
NULL)) != INVALID_HANDLE_VALUE)
{
bResult = DeviceIoControl (dev, FSCTL_IS_VOLUME_MOUNTED, NULL, 0, NULL, 0, &dwResult, NULL);
CloseHandle (dev);
}
return bResult;
}
int DriverUnmountVolume (HWND hwndDlg, int nDosDriveNo, BOOL forced)
{
UNMOUNT_STRUCT unmount;
DWORD dwResult;
VOLUME_PROPERTIES_STRUCT prop;
BOOL bResult;
WCHAR wszLabel[33] = {0};
BOOL bDriverSetLabel = FALSE;
memset (&prop, 0, sizeof(prop));
prop.driveNo = nDosDriveNo;
if ( DeviceIoControl (hDriver, TC_IOCTL_GET_VOLUME_PROPERTIES, &prop, sizeof (prop), &prop, sizeof (prop), &dwResult, NULL)
&& prop.driveNo == nDosDriveNo
)
{
memcpy (wszLabel, prop.wszLabel, sizeof (wszLabel));
bDriverSetLabel = prop.bDriverSetLabel;
}
unmount.nDosDriveNo = nDosDriveNo;
unmount.ignoreOpenFiles = forced;
bResult = DeviceIoControl (hDriver, TC_IOCTL_DISMOUNT_VOLUME, &unmount,
sizeof (unmount), &unmount, sizeof (unmount), &dwResult, NULL);
if (bResult == FALSE)
{
handleWin32Error (hwndDlg, SRC_POS);
return 1;
}
else if ((unmount.nReturnCode == ERR_SUCCESS) && bDriverSetLabel && wszLabel[0])
UpdateDriveCustomLabel (nDosDriveNo, wszLabel, FALSE);
#ifdef TCMOUNT
if (unmount.nReturnCode == ERR_SUCCESS
&& unmount.HiddenVolumeProtectionTriggered
&& !VolumeNotificationsList.bHidVolDamagePrevReported [nDosDriveNo]
&& !Silent)
{
wchar_t msg[4096];
VolumeNotificationsList.bHidVolDamagePrevReported [nDosDriveNo] = TRUE;
StringCbPrintfW (msg, sizeof(msg), GetString ("DAMAGE_TO_HIDDEN_VOLUME_PREVENTED"), nDosDriveNo + L'A');
SetForegroundWindow (hwndDlg);
MessageBoxW (hwndDlg, msg, lpszTitle, MB_ICONWARNING | MB_SETFOREGROUND | MB_TOPMOST);
}
#endif // #ifdef TCMOUNT
return unmount.nReturnCode;
}
void BroadcastDeviceChange (WPARAM message, int nDosDriveNo, DWORD driveMap)
{
DEV_BROADCAST_VOLUME dbv;
DWORD_PTR dwResult;
LONG eventId = 0;
int i;
if (DeviceChangeBroadcastDisabled)
return;
if (message == DBT_DEVICEARRIVAL)
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.
eventId = SHCNE_DRIVEREMOVED;
if (driveMap == 0)
driveMap = (1 << nDosDriveNo);
if (eventId != 0)
{
for (i = 0; i < 26; i++)
{
if (driveMap & (1 << i))
{
wchar_t root[] = { (wchar_t) i + L'A', L':', L'\\', 0 };
SHChangeNotify (eventId, SHCNF_PATH, root, NULL);
}
}
}
dbv.dbcv_size = sizeof (dbv);
dbv.dbcv_devicetype = DBT_DEVTYP_VOLUME;
dbv.dbcv_reserved = 0;
dbv.dbcv_unitmask = driveMap;
dbv.dbcv_flags = 0;
UINT timeOut = 1000;
// SHChangeNotify() works on Vista, so the Explorer does not require WM_DEVICECHANGE
if (CurrentOSMajor >= 6)
timeOut = 100;
IgnoreWmDeviceChange = TRUE;
SendMessageTimeout (HWND_BROADCAST, WM_DEVICECHANGE, message, (LPARAM)(&dbv), SMTO_ABORTIFHUNG, timeOut, &dwResult);
// Explorer prior Vista sometimes fails to register a new drive
if (CurrentOSMajor < 6 && message == DBT_DEVICEARRIVAL)
SendMessageTimeout (HWND_BROADCAST, WM_DEVICECHANGE, message, (LPARAM)(&dbv), SMTO_ABORTIFHUNG, 200, &dwResult);
IgnoreWmDeviceChange = FALSE;
}
static BOOL GetDeviceStorageProperty (HANDLE hDevice, STORAGE_PROPERTY_ID propertyId, DWORD dwDescSize, void* pDesc)
{
DWORD dwRet = NO_ERROR;
if (!pDesc)
return FALSE;
ZeroMemory (pDesc, dwDescSize);
// Set the input data structure
STORAGE_PROPERTY_QUERY storagePropertyQuery;
ZeroMemory(&storagePropertyQuery, sizeof(STORAGE_PROPERTY_QUERY));
storagePropertyQuery.PropertyId = propertyId;
storagePropertyQuery.QueryType = PropertyStandardQuery;
// Get the necessary output buffer size
STORAGE_DESCRIPTOR_HEADER descHeader = {0};
DWORD dwBytesReturned = 0;
BOOL bRet = ::DeviceIoControl(hDevice, IOCTL_STORAGE_QUERY_PROPERTY,
&storagePropertyQuery, sizeof(STORAGE_PROPERTY_QUERY),
&descHeader, sizeof(STORAGE_DESCRIPTOR_HEADER),
&dwBytesReturned, NULL);
if (bRet)
{
if (dwBytesReturned == sizeof(STORAGE_DESCRIPTOR_HEADER))
{
unsigned char* outputBuffer = (unsigned char*) TCalloc (descHeader.Size);
bRet = ::DeviceIoControl(hDevice, IOCTL_STORAGE_QUERY_PROPERTY,
&storagePropertyQuery, sizeof(STORAGE_PROPERTY_QUERY),
outputBuffer, descHeader.Size,
&dwBytesReturned, NULL);
if (bRet)
{
if (dwBytesReturned >= dwDescSize)
{
memcpy (pDesc, outputBuffer, dwDescSize);
((STORAGE_DESCRIPTOR_HEADER*)pDesc)->Version = dwDescSize;
((STORAGE_DESCRIPTOR_HEADER*)pDesc)->Size = dwDescSize;
}
else
{
bRet = FALSE;
dwRet = ERROR_UNHANDLED_ERROR;
}
}
else
dwRet = ::GetLastError();
TCfree (outputBuffer);
}
else
{
bRet = FALSE;
dwRet = ERROR_UNHANDLED_ERROR;
}
}
else
dwRet = ::GetLastError();
if (!bRet)
{
SetLastError (dwRet);
return FALSE;
}
else
return TRUE;
}
BOOL GetPhysicalDriveStorageInformation(UINT nDriveNumber, STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR* pAlignmentDesc, STORAGE_ADAPTER_DESCRIPTOR* pAdapterDesc)
{
DWORD dwRet = NO_ERROR;
if (!pAlignmentDesc || pAdapterDesc)
{
SetLastError (ERROR_INVALID_PARAMETER);
return FALSE;
}
// Format physical drive path (may be '\\.\PhysicalDrive0', '\\.\PhysicalDrive1' and so on).
TCHAR strDrivePath[512];
StringCbPrintf(strDrivePath, sizeof(strDrivePath), _T("\\\\.\\PhysicalDrive%u"), nDriveNumber);
// Get a handle to physical drive
HANDLE hDevice = ::CreateFile(strDrivePath, 0, FILE_SHARE_READ,
NULL, OPEN_EXISTING, 0, NULL);
if(INVALID_HANDLE_VALUE == hDevice)
return FALSE;
BOOL bRet = (GetDeviceStorageProperty (hDevice, StorageAccessAlignmentProperty, sizeof (STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR), pAlignmentDesc)
|| GetDeviceStorageProperty (hDevice, StorageAdapterProperty, sizeof (STORAGE_ADAPTER_DESCRIPTOR), pAdapterDesc))? TRUE : FALSE;
dwRet = ::GetLastError();
::CloseHandle(hDevice);
if (!bRet)
{
SetLastError (dwRet);
return FALSE;
}
else
return TRUE;
}
#ifndef SETUP
/************************************************************/
// implementation of the generic wait dialog mechanism
static UINT g_wmWaitDlg = ::RegisterWindowMessage(L"VeraCryptWaitDlgMessage");
typedef struct
{
HWND hwnd;
void* pArg;
WaitThreadProc callback;
} WaitThreadParam;
static void _cdecl WaitThread (void* pParam)
{
WaitThreadParam* pThreadParam = (WaitThreadParam*) pParam;
pThreadParam->callback(pThreadParam->pArg, pThreadParam->hwnd);
/* close the wait dialog */
PostMessage (pThreadParam->hwnd, g_wmWaitDlg, 0, 0);
}
BOOL CALLBACK WaitDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
WORD lw = LOWORD (wParam);
switch (msg)
{
case WM_INITDIALOG:
{
WaitThreadParam* thParam = (WaitThreadParam*) lParam;
// set the progress bar type to MARQUEE (indefinite progress)
HWND hProgress = GetDlgItem (hwndDlg, IDC_WAIT_PROGRESS_BAR);
if (hProgress)
{
SetWindowLongPtrW (hProgress, GWL_STYLE, PBS_MARQUEE | GetWindowLongPtrW (hProgress, GWL_STYLE));
::SendMessageW(hProgress, PBM_SETMARQUEE, (WPARAM) TRUE, (LPARAM) 0);
}
thParam->hwnd = hwndDlg;
// For now, we don't have system menu is the resources but we leave this code
// if it is enabled in the future
HMENU hSysMenu = GetSystemMenu(hwndDlg, FALSE);
if (hSysMenu)
{
//disable the X
EnableMenuItem(hSysMenu,SC_CLOSE, MF_BYCOMMAND|MF_GRAYED);
// set icons
HICON hIcon = (HICON)::LoadImage(hInst, MAKEINTRESOURCE(IDI_TRUECRYPT_ICON), IMAGE_ICON, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON), LR_DEFAULTCOLOR);
::SendMessage(hwndDlg, WM_SETICON, TRUE, (LPARAM)hIcon);
HICON hIconSmall = (HICON)::LoadImage(hInst, MAKEINTRESOURCE(IDI_TRUECRYPT_ICON), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
::SendMessage(hwndDlg, WM_SETICON, FALSE, (LPARAM)hIconSmall);
}
LocalizeDialog (hwndDlg, NULL);
_beginthread(WaitThread, 0, thParam);
return 0;
}
case WM_COMMAND:
if (lw == IDOK || lw == IDCANCEL)
return 1;
else
return 0;
default:
if (msg == g_wmWaitDlg)
{
EndDialog (hwndDlg, IDOK);
return 1;
}
return 0;
}
}
// Based on source: https://www.codeproject.com/Tips/76427/How-to-bring-window-to-top-with-SetForegroundWindo?msg=5285754#xx5285754xx
void BringToForeground (HWND hWnd)
{
if(!::IsWindow(hWnd)) return;
HWND hCurrWnd = ::GetForegroundWindow();
DWORD dwThisTID = ::GetCurrentThreadId(),
dwCurrTID = ::GetWindowThreadProcessId(hCurrWnd,0);
// This structure will be used to create the keyboard
// input event.
INPUT ip;
if (hCurrWnd != hWnd)
{
if(dwThisTID != dwCurrTID)
{
// Set up a generic keyboard event.
ip.type = INPUT_KEYBOARD;
ip.ki.wScan = 0; // hardware scan code for key
ip.ki.time = 0;
ip.ki.dwExtraInfo = 0;
// Press the "A" key
ip.ki.wVk = VK_MENU; // virtual-key code for the "a" key
ip.ki.dwFlags = 0; // 0 for key press
SendInput(1, &ip, sizeof(INPUT));
::Sleep(250); //Sometimes SetForegroundWindow will fail and the window will flash instead of it being show. Sleeping for a bit seems to help.
}
::SetForegroundWindow(hWnd);
if(dwThisTID != dwCurrTID)
{
// Release the "A" key
ip.ki.dwFlags = KEYEVENTF_KEYUP; // KEYEVENTF_KEYUP for key release
SendInput(1, &ip, sizeof(INPUT));
}
}
#ifdef TCMOUNT
if (hWnd == MainDlg)
{
SetFocus (hWnd);
::SendMessage(hWnd, WM_NEXTDLGCTL, (WPARAM) GetDlgItem (hWnd, IDC_DRIVELIST), 1L);
}
#endif
}
static LRESULT CALLBACK ShowWaitDialogParentWndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
return DefWindowProcW (hWnd, message, wParam, lParam);
}
void ShowWaitDialog(HWND hwnd, BOOL bUseHwndAsParent, WaitThreadProc callback, void* pArg)
{
BOOL bEffectiveHideWaitingDialog = bCmdHideWaitingDialogValid? bCmdHideWaitingDialog : bHideWaitingDialog;
WaitThreadParam threadParam;
threadParam.callback = callback;
threadParam.pArg = pArg;
if (WaitDialogDisplaying || bEffectiveHideWaitingDialog)
{
if (!WaitDialogDisplaying) WaitCursor ();
callback (pArg, hwnd);
if (!WaitDialogDisplaying) NormalCursor ();
}
else
{
const wchar_t *className = L"VeraCryptShowWaitDialogParent";
BOOL bIsForeground = FALSE;
HWND creatorWnd = hwnd? hwnd : MainDlg;
WaitDialogDisplaying = TRUE;
HWND hParent = NULL;
if (creatorWnd)
{
if (GetForegroundWindow () == creatorWnd)
bIsForeground = TRUE;
EnableWindow (creatorWnd, FALSE);
}
if (hwnd && bUseHwndAsParent)
hParent = hwnd;
else
{
/* create invisible window and use it as parent */
WNDCLASSEXW winClass;
memset (&winClass, 0, sizeof (winClass));
winClass.cbSize = sizeof (WNDCLASSEX);
winClass.lpfnWndProc = (WNDPROC) ShowWaitDialogParentWndProc;
winClass.hInstance = hInst;
winClass.lpszClassName = className;
RegisterClassExW (&winClass);
hParent = CreateWindowExW (WS_EX_TOOLWINDOW | WS_EX_LAYERED, className, L"VeraCrypt ShowWaitDialog Parent", 0, 0, 0, 1, 1, NULL, NULL, hInst, NULL);
if (hParent)
{
SetLayeredWindowAttributes (hParent, 0, 1, LWA_ALPHA);
ShowWindow (hParent, SW_SHOWNORMAL);
}
}
finally_do_arg2 (HWND, creatorWnd, BOOL, bIsForeground, { if (finally_arg) { EnableWindow(finally_arg, TRUE); if (finally_arg2) BringToForeground (finally_arg);}});
DialogBoxParamW (hInst,
MAKEINTRESOURCEW (IDD_STATIC_MODAL_WAIT_DLG), hParent,
(DLGPROC) WaitDlgProc, (LPARAM) &threadParam);
WaitDialogDisplaying = FALSE;
if (!(hwnd && bUseHwndAsParent))
{
if (hParent)
DestroyWindow (hParent);
UnregisterClassW (className, hInst);
}
}
}
#ifndef SETUP
/************************************************************************/
static BOOL PerformMountIoctl (MOUNT_STRUCT* pmount, LPDWORD pdwResult, BOOL useVolumeID, BYTE volumeID[VOLUME_ID_SIZE])
{
if (useVolumeID)
{
wstring devicePath = FindDeviceByVolumeID (volumeID, FALSE);
if (devicePath == L"")
{
if (pdwResult)
*pdwResult = 0;
SetLastError (ERROR_PATH_NOT_FOUND);
return FALSE;
}
else
{
BOOL bDevice = FALSE;
CreateFullVolumePath (pmount->wszVolume, sizeof(pmount->wszVolume), devicePath.c_str(), &bDevice);
}
}
return DeviceIoControl (hDriver, TC_IOCTL_MOUNT_VOLUME, pmount,
sizeof (MOUNT_STRUCT), pmount, sizeof (MOUNT_STRUCT), pdwResult, NULL);
}
// specific definitions and implementation for support of mount operation
// in wait dialog mechanism
typedef struct
{
MOUNT_STRUCT* pmount;
BOOL useVolumeID;
BYTE volumeID[VOLUME_ID_SIZE];
BOOL* pbResult;
DWORD* pdwResult;
DWORD dwLastError;
} MountThreadParam;
void CALLBACK MountWaitThreadProc(void* pArg, HWND )
{
MountThreadParam* pThreadParam = (MountThreadParam*) pArg;
*(pThreadParam->pbResult) = PerformMountIoctl (pThreadParam->pmount, pThreadParam->pdwResult, pThreadParam->useVolumeID, pThreadParam->volumeID);
pThreadParam->dwLastError = GetLastError ();
}
/************************************************************************/
// Use only cached passwords if password = NULL
//
// Returns:
// -1 = user aborted mount / error
// 0 = mount failed
// 1 = mount OK
// 2 = mount OK in shared mode
//
// Note that some code calling this relies on the content of the mountOptions struct
// to remain unmodified (don't remove the 'const' without proper revision).
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)
{
MOUNT_STRUCT mount;
DWORD dwResult, dwLastError = ERROR_SUCCESS;
BOOL bResult, bDevice;
wchar_t root[MAX_PATH];
int favoriteMountOnArrivalRetryCount = 0;
BOOL useVolumeID = FALSE;
BYTE volumeID[VOLUME_ID_SIZE] = {0};
#ifdef TCMOUNT
if (mountOptions->PartitionInInactiveSysEncScope)
{
if (!CheckSysEncMountWithoutPBA (hwndDlg, volumePath, quiet))
return -1;
}
#endif
if (IsMountedVolume (volumePath))
{
if (!quiet)
Error ("VOL_ALREADY_MOUNTED", hwndDlg);
return -1;
}
if (!IsDriveAvailable (driveNo))
{
if (!quiet)
Error ("DRIVE_LETTER_UNAVAILABLE", hwndDlg);
return -1;
}
// If using cached passwords, check cache status first
if (password == NULL && IsPasswordCacheEmpty ())
return 0;
ZeroMemory (&mount, sizeof (mount));
mount.bExclusiveAccess = sharedAccess ? FALSE : TRUE;
mount.SystemFavorite = MountVolumesAsSystemFavorite;
mount.UseBackupHeader = mountOptions->UseBackupHeader;
mount.RecoveryMode = mountOptions->RecoveryMode;
StringCbCopyW (mount.wszLabel, sizeof (mount.wszLabel), mountOptions->Label);
retry:
mount.nDosDriveNo = driveNo;
mount.bCache = cachePassword;
mount.bCachePim = cachePim;
mount.bPartitionInInactiveSysEncScope = FALSE;
if (password != NULL)
mount.VolumePassword = *password;
else
mount.VolumePassword.Length = 0;
if (!mountOptions->ReadOnly && mountOptions->ProtectHiddenVolume)
{
mount.ProtectedHidVolPassword = mountOptions->ProtectedHidVolPassword;
mount.bProtectHiddenVolume = TRUE;
mount.ProtectedHidVolPkcs5Prf = mountOptions->ProtectedHidVolPkcs5Prf;
mount.ProtectedHidVolPim = mountOptions->ProtectedHidVolPim;
}
else
mount.bProtectHiddenVolume = FALSE;
mount.bMountReadOnly = mountOptions->ReadOnly;
mount.bMountRemovable = mountOptions->Removable;
mount.bPreserveTimestamp = mountOptions->PreserveTimestamp;
if (mountOptions->DisableMountManager)
mount.bMountManager = FALSE;
else
mount.bMountManager = TRUE;
mount.pkcs5_prf = pkcs5;
mount.bTrueCryptMode = truecryptMode;
mount.VolumePim = pim;
wstring path = volumePath;
if (path.find (L"\\\\?\\") == 0)
{
// Remove \\?\ prefix
path = path.substr (4);
StringCchCopyW (volumePath, TC_MAX_PATH, path.c_str());
}
if (path.find (L"Volume{") == 0 && path.rfind (L"}\\") == path.size() - 2)
{
wstring resolvedPath = VolumeGuidPathToDevicePath (path);
if (!resolvedPath.empty())
StringCchCopyW (volumePath, TC_MAX_PATH, resolvedPath.c_str());
}
if ((path.length () >= 3) && (_wcsnicmp (path.c_str(), L"ID:", 3) == 0))
{
std::vector<byte> arr;
if ( (path.length() == (3 + 2*VOLUME_ID_SIZE))
&& HexWideStringToArray (path.c_str() + 3, arr)
&& (arr.size() == VOLUME_ID_SIZE)
)
{
useVolumeID = TRUE;
bDevice = TRUE;
memcpy (volumeID, &arr[0], VOLUME_ID_SIZE);
}
else
{
if (!quiet)
Error ("VOLUME_ID_INVALID", hwndDlg);
SetLastError (ERROR_INVALID_PARAMETER);
return -1;
}
}
else
CreateFullVolumePath (mount.wszVolume, sizeof(mount.wszVolume), volumePath, &bDevice);
if (!bDevice)
{
// put default values
mount.BytesPerSector = 512;
mount.BytesPerPhysicalSector = 512;
mount.MaximumTransferLength = 65536;
mount.MaximumPhysicalPages = 17;
mount.AlignmentMask = 0;
// UNC path
if (path.find (L"\\\\") == 0)
{
StringCbCopyW (mount.wszVolume, sizeof (mount.wszVolume), (L"UNC" + path.substr (1)).c_str());
}
if (GetVolumePathName (volumePath, root, ARRAYSIZE (root) - 1))
{
DWORD bps, flags, d;
if (GetDiskFreeSpace (root, &d, &bps, &d, &d))
{
mount.BytesPerSector = bps;
mount.BytesPerPhysicalSector = bps;
}
if (IsOSAtLeast (WIN_VISTA))
{
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];
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 (extents.NumberOfDiskExtents > 0)
{
STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR accessDesc;
STORAGE_ADAPTER_DESCRIPTOR adapterDesc;
if (GetPhysicalDriveStorageInformation (extents.Extents[0].DiskNumber, &accessDesc, &adapterDesc))
{
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;
}
}
}
}
CloseHandle (dev);
}
}
}
// Read-only host filesystem
if (!mount.bMountReadOnly && GetVolumeInformation (root, NULL, 0, NULL, &d, &flags, NULL, 0))
mount.bMountReadOnly = (flags & FILE_READ_ONLY_VOLUME) != 0;
}
}
if (mountOptions->PartitionInInactiveSysEncScope)
{
if (mount.wszVolume == NULL || swscanf_s ((const wchar_t *) mount.wszVolume,
WIDE("\\Device\\Harddisk%d\\Partition"),
&mount.nPartitionInInactiveSysEncScopeDriveNo,
sizeof(mount.nPartitionInInactiveSysEncScopeDriveNo)) != 1)
{
if (!quiet)
Warning ("NO_SYSENC_PARTITION_SELECTED", hwndDlg);
return -1;
}
mount.bPartitionInInactiveSysEncScope = TRUE;
}
if (!quiet)
{
MountThreadParam mountThreadParam;
mountThreadParam.pmount = &mount;
mountThreadParam.useVolumeID = useVolumeID;
memcpy (mountThreadParam.volumeID, volumeID, VOLUME_ID_SIZE);
mountThreadParam.pbResult = &bResult;
mountThreadParam.pdwResult = &dwResult;
mountThreadParam.dwLastError = ERROR_SUCCESS;
ShowWaitDialog (hwndDlg, FALSE, MountWaitThreadProc, &mountThreadParam);
dwLastError = mountThreadParam.dwLastError;
}
else
{
bResult = PerformMountIoctl (&mount, &dwResult, useVolumeID, volumeID);
dwLastError = GetLastError ();
}
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);
if (bResult == FALSE)
{
// Volume already open by another process
if (GetLastError () == ERROR_SHARING_VIOLATION)
{
if (FavoriteMountOnArrivalInProgress && ++favoriteMountOnArrivalRetryCount < 10)
{
Sleep (500);
goto retry;
}
if (mount.bExclusiveAccess == FALSE)
{
if (!quiet)
Error ("FILE_IN_USE_FAILED", hwndDlg);
return -1;
}
else
{
if (quiet)
{
mount.bExclusiveAccess = FALSE;
goto retry;
}
// Ask user
if (IDYES == AskWarnNoYes ("FILE_IN_USE", hwndDlg))
{
mount.bExclusiveAccess = FALSE;
goto retry;
}
}
return -1;
}
if (!quiet && (!MultipleMountOperationInProgress || GetLastError() != ERROR_NOT_READY))
handleWin32Error (hwndDlg, SRC_POS);
return -1;
}
if (mount.nReturnCode != 0)
{
if (mount.nReturnCode == ERR_PASSWORD_WRONG)
{
// Do not report wrong password, if not instructed to
if (bReportWrongPassword)
{
IncreaseWrongPwdRetryCount (1); // We increase the count here only if bReportWrongPassword is TRUE, because "Auto-Mount All Devices" and other callers do it separately
if (WrongPwdRetryCountOverLimit ()
&& !mount.UseBackupHeader)
{
// Retry using embedded header backup (if any)
mount.UseBackupHeader = TRUE;
goto retry;
}
if (bDevice && mount.bProtectHiddenVolume)
{
int driveNo;
if (swscanf (volumePath, L"\\Device\\Harddisk%d\\Partition", &driveNo) == 1)
{
OPEN_TEST_STRUCT openTestStruct;
memset (&openTestStruct, 0, sizeof (openTestStruct));
openTestStruct.bDetectTCBootLoader = TRUE;
StringCchPrintfW ((wchar_t *) openTestStruct.wszFileName, array_capacity (openTestStruct.wszFileName), L"\\Device\\Harddisk%d\\Partition0", driveNo);
DWORD dwResult;
if (DeviceIoControl (hDriver, TC_IOCTL_OPEN_TEST, &openTestStruct, sizeof (OPEN_TEST_STRUCT), &openTestStruct, sizeof (OPEN_TEST_STRUCT), &dwResult, NULL) && openTestStruct.TCBootLoaderDetected)
WarningDirect ((GetWrongPasswordErrorMessage (hwndDlg) + L"\n\n" + GetString ("HIDDEN_VOL_PROT_PASSWORD_US_KEYB_LAYOUT")).c_str(), hwndDlg);
else
handleError (hwndDlg, mount.nReturnCode, SRC_POS);
}
}
else
handleError (hwndDlg, mount.nReturnCode, SRC_POS);
}
return 0;
}
if (!quiet)
handleError (hwndDlg, mount.nReturnCode, SRC_POS);
return 0;
}
// Mount successful
if (mount.UseBackupHeader != mountOptions->UseBackupHeader
&& mount.UseBackupHeader)
{
if (bReportWrongPassword && !Silent)
Warning ("HEADER_DAMAGED_AUTO_USED_HEADER_BAK", hwndDlg);
}
LastMountedVolumeDirty = mount.FilesystemDirty;
if (mount.FilesystemDirty)
{
wchar_t msg[1024];
wchar_t mountPoint[] = { L'A' + (wchar_t) driveNo, L':', 0 };
StringCbPrintfW (msg, sizeof(msg), GetString ("MOUNTED_VOLUME_DIRTY"), mountPoint);
if (AskWarnYesNoStringTopmost (msg, hwndDlg) == IDYES)
CheckFilesystem (hwndDlg, driveNo, TRUE);
}
if (mount.VolumeMountedReadOnlyAfterAccessDenied
&& !Silent
&& !bDevice
&& !FileHasReadOnlyAttribute (volumePath)
&& !IsFileOnReadOnlyFilesystem (volumePath))
{
wchar_t msg[1024];
wchar_t mountPoint[] = { L'A' + (wchar_t) driveNo, L':', 0 };
StringCbPrintfW (msg, sizeof(msg), GetString ("MOUNTED_CONTAINER_FORCED_READ_ONLY"), mountPoint);
WarningDirect (msg, hwndDlg);
}
if (mount.VolumeMountedReadOnlyAfterAccessDenied
&& !Silent
&& bDevice)
{
wchar_t msg[1024];
wchar_t mountPoint[] = { L'A' + (wchar_t) driveNo, L':', 0 };
StringCbPrintfW (msg, sizeof(msg), GetString ("MOUNTED_DEVICE_FORCED_READ_ONLY"), mountPoint);
WarningDirect (msg, hwndDlg);
}
if (mount.VolumeMountedReadOnlyAfterDeviceWriteProtected
&& !Silent
&& wcsstr (volumePath, L"\\Device\\Harddisk") == volumePath)
{
wchar_t msg[1024];
wchar_t mountPoint[] = { L'A' + (wchar_t) driveNo, L':', 0 };
StringCbPrintfW (msg, sizeof(msg), GetString ("MOUNTED_DEVICE_FORCED_READ_ONLY_WRITE_PROTECTION"), mountPoint);
WarningDirect (msg, hwndDlg);
if (CurrentOSMajor >= 6
&& wcsstr (volumePath, L"\\Device\\HarddiskVolume") != volumePath
&& AskNoYes ("ASK_REMOVE_DEVICE_WRITE_PROTECTION", hwndDlg) == IDYES)
{
RemoveDeviceWriteProtection (hwndDlg, volumePath);
}
}
if (mount.wszLabel[0] && !mount.bDriverSetLabel)
{
// try setting the drive label on user-mode using registry
UpdateDriveCustomLabel (driveNo, mount.wszLabel, TRUE);
}
ResetWrongPwdRetryCount ();
BroadcastDeviceChange (DBT_DEVICEARRIVAL, driveNo, 0);
if (mount.bExclusiveAccess == FALSE)
return 2;
return 1;
}
#endif
typedef struct
{
int nDosDriveNo;
BOOL forced;
int dismountMaxRetries;
DWORD retryDelay;
int* presult;
DWORD dwLastError;
} UnmountThreadParam;
void CALLBACK UnmountWaitThreadProc(void* pArg, HWND hwnd)
{
UnmountThreadParam* pThreadParam = (UnmountThreadParam*) pArg;
int dismountMaxRetries = pThreadParam->dismountMaxRetries;
DWORD retryDelay = pThreadParam->retryDelay;
do
{
*pThreadParam->presult = DriverUnmountVolume (hwnd, pThreadParam->nDosDriveNo, pThreadParam->forced);
if (*pThreadParam->presult == ERR_FILES_OPEN)
Sleep (retryDelay);
else
break;
} while (--dismountMaxRetries > 0);
pThreadParam->dwLastError = GetLastError ();
}
static BOOL UnmountVolumeBase (HWND hwndDlg, int nDosDriveNo, BOOL forceUnmount, BOOL ntfsFormatCase)
{
int result;
BOOL forced = forceUnmount;
int dismountMaxRetries = ntfsFormatCase? 5 : UNMOUNT_MAX_AUTO_RETRIES;
DWORD retryDelay = ntfsFormatCase? 2000: UNMOUNT_AUTO_RETRY_DELAY;
UnmountThreadParam param;
retry:
BroadcastDeviceChange (DBT_DEVICEREMOVEPENDING, nDosDriveNo, 0);
param.nDosDriveNo = nDosDriveNo;
param.forced = forced;
param.dismountMaxRetries = dismountMaxRetries;
param.retryDelay = retryDelay;
param.presult = &result;
if (Silent)
{
UnmountWaitThreadProc (&param, hwndDlg);
}
else
{
ShowWaitDialog (hwndDlg, FALSE, UnmountWaitThreadProc, &param);
}
SetLastError (param.dwLastError);
if (result != 0)
{
if (result == ERR_FILES_OPEN && !Silent)
{
if (IDYES == AskWarnYesNoTopmost ("UNMOUNT_LOCK_FAILED", hwndDlg))
{
forced = TRUE;
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);
}
return FALSE;
}
Error ("UNMOUNT_FAILED", hwndDlg);
return FALSE;
}
BroadcastDeviceChange (DBT_DEVICEREMOVECOMPLETE, nDosDriveNo, 0);
return TRUE;
}
BOOL UnmountVolume (HWND hwndDlg, int nDosDriveNo, BOOL forceUnmount)
{
return UnmountVolumeBase (hwndDlg, nDosDriveNo, forceUnmount, FALSE);
}
BOOL UnmountVolumeAfterFormatExCall (HWND hwndDlg, int nDosDriveNo)
{
return UnmountVolumeBase (hwndDlg, nDosDriveNo, FALSE, TRUE);
}
BOOL IsPasswordCacheEmpty (void)
{
DWORD dw;
return !DeviceIoControl (hDriver, TC_IOCTL_GET_PASSWORD_CACHE_STATUS, 0, 0, 0, 0, &dw, 0);
}
BOOL IsMountedVolumeID (BYTE volumeID[VOLUME_ID_SIZE])
{
MOUNT_LIST_STRUCT mlist;
DWORD dwResult;
int i;
memset (&mlist, 0, sizeof (mlist));
if ( !DeviceIoControl (hDriver, TC_IOCTL_GET_MOUNTED_VOLUMES, &mlist,
sizeof (mlist), &mlist, sizeof (mlist), &dwResult,
NULL)
|| (mlist.ulMountedDrives >= (1 << 26))
)
{
return FALSE;
}
if (mlist.ulMountedDrives)
{
for (i=0 ; i<26; i++)
{
if ((mlist.ulMountedDrives & (1 << i)) && (0 == memcmp (mlist.volumeID[i], volumeID, VOLUME_ID_SIZE)))
return TRUE;
}
}
return FALSE;
}
BOOL IsMountedVolume (const wchar_t *volname)
{
if ((wcslen (volname) == (3 + 2*VOLUME_ID_SIZE)) && _wcsnicmp (volname, L"ID:", 3) == 0)
{
/* Volume ID specified. Use it for matching mounted volumes. */
std::vector<byte> arr;
if (HexWideStringToArray (&volname[3], arr) && (arr.size() == VOLUME_ID_SIZE))
{
return IsMountedVolumeID (&arr[0]);
}
}
else
{
MOUNT_LIST_STRUCT mlist;
DWORD dwResult;
int i;
wchar_t volume[TC_MAX_PATH*2+16];
StringCbCopyW (volume, sizeof(volume), volname);
if (wcsstr (volname, L"\\Device\\") != volname)
StringCbPrintfW(volume, sizeof(volume), L"\\??\\%s", volname);
wstring resolvedPath = VolumeGuidPathToDevicePath (volname);
if (!resolvedPath.empty())
StringCbCopyW (volume, sizeof (volume), resolvedPath.c_str());
memset (&mlist, 0, sizeof (mlist));
if ( !DeviceIoControl (hDriver, TC_IOCTL_GET_MOUNTED_VOLUMES, &mlist,
sizeof (mlist), &mlist, sizeof (mlist), &dwResult,
NULL)
|| (mlist.ulMountedDrives >= (1 << 26))
)
{
return FALSE;
}
if (mlist.ulMountedDrives)
{
for (i=0 ; i<26; i++)
{
if ((mlist.ulMountedDrives & (1 << i))
&& IsNullTerminateString (mlist.wszVolume[i], TC_MAX_PATH)
&& (0 == _wcsicmp ((wchar_t *) mlist.wszVolume[i], volume))
)
{
return TRUE;
}
}
}
}
return FALSE;
}
int GetMountedVolumeDriveNo (wchar_t *volname)
{
MOUNT_LIST_STRUCT mlist;
DWORD dwResult;
int i;
wchar_t volume[TC_MAX_PATH*2+16];
if (volname == NULL)
return -1;
StringCbCopyW (volume, sizeof(volume), volname);
if (wcsstr (volname, L"\\Device\\") != volname)
StringCbPrintfW (volume, sizeof(volume), L"\\??\\%s", volname);
wstring resolvedPath = VolumeGuidPathToDevicePath (volname);
if (!resolvedPath.empty())
StringCbCopyW (volume, sizeof (volume), resolvedPath.c_str());
memset (&mlist, 0, sizeof (mlist));
if ( !DeviceIoControl (hDriver, TC_IOCTL_GET_MOUNTED_VOLUMES, &mlist,
sizeof (mlist), &mlist, sizeof (mlist), &dwResult,
NULL)
|| (mlist.ulMountedDrives >= (1 << 26))
)
{
return -1;
}
if (mlist.ulMountedDrives)
{
for (i=0 ; i<26; i++)
{
if ((mlist.ulMountedDrives & (1 << i))
&& IsNullTerminateString (mlist.wszVolume[i], TC_MAX_PATH)
&& (0 == _wcsicmp ((wchar_t *) mlist.wszVolume[i], (WCHAR *)volume))
)
{
return i;
}
}
}
return -1;
}
#endif //!SETUP
BOOL IsAdmin (void)
{
return IsUserAnAdmin ();
}
BOOL IsBuiltInAdmin ()
{
HANDLE procToken;
DWORD size;
if (!IsAdmin() || !OpenProcessToken (GetCurrentProcess(), TOKEN_QUERY, &procToken))
return FALSE;
finally_do_arg (HANDLE, procToken, { CloseHandle (finally_arg); });
if (GetTokenInformation (procToken, TokenUser, NULL, 0, &size) || GetLastError() != ERROR_INSUFFICIENT_BUFFER)
return FALSE;
TOKEN_USER *tokenUser = (TOKEN_USER *) malloc (size);
if (!tokenUser)
return FALSE;
finally_do_arg (void *, tokenUser, { free (finally_arg); });
if (!GetTokenInformation (procToken, TokenUser, tokenUser, size, &size))
return FALSE;
return IsWellKnownSid (tokenUser->User.Sid, WinAccountAdministratorSid);
}
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)
value = 1;
RegCloseKey (hkey);
}
return value != 0;
}
BOOL ResolveSymbolicLink (const wchar_t *symLinkName, PWSTR targetName, size_t cbTargetName)
{
BOOL bResult;
DWORD dwResult;
RESOLVE_SYMLINK_STRUCT resolve;
memset (&resolve, 0, sizeof(resolve));
StringCbCopyW (resolve.symLinkName, sizeof(resolve.symLinkName), symLinkName);
bResult = DeviceIoControl (hDriver, TC_IOCTL_GET_RESOLVED_SYMLINK, &resolve,
sizeof (resolve), &resolve, sizeof (resolve), &dwResult,
NULL);
StringCbCopyW (targetName, cbTargetName, resolve.targetName);
return bResult;
}
BOOL GetPartitionInfo (const wchar_t *deviceName, PPARTITION_INFORMATION rpartInfo)
{
BOOL bResult;
DWORD dwResult;
DISK_PARTITION_INFO_STRUCT dpi;
memset (&dpi, 0, sizeof(dpi));
StringCbCopyW ((PWSTR) &dpi.deviceName, sizeof(dpi.deviceName), deviceName);
bResult = DeviceIoControl (hDriver, TC_IOCTL_GET_DRIVE_PARTITION_INFO, &dpi,
sizeof (dpi), &dpi, sizeof (dpi), &dwResult, NULL);
memcpy (rpartInfo, &dpi.partInfo, sizeof (PARTITION_INFORMATION));
return bResult;
}
BOOL GetDeviceInfo (const wchar_t *deviceName, DISK_PARTITION_INFO_STRUCT *info)
{
DWORD dwResult;
memset (info, 0, sizeof(*info));
StringCbCopyW ((PWSTR) &info->deviceName, sizeof(info->deviceName), deviceName);
return DeviceIoControl (hDriver, TC_IOCTL_GET_DRIVE_PARTITION_INFO, info, sizeof (*info), info, sizeof (*info), &dwResult, NULL);
}
#ifndef SETUP
BOOL GetDriveGeometry (const wchar_t *deviceName, PDISK_GEOMETRY_EX diskGeometry)
{
BOOL bResult;
DWORD dwResult;
DISK_GEOMETRY_EX_STRUCT dg;
memset (&dg, 0, sizeof(dg));
StringCbCopyW ((PWSTR) &dg.deviceName, sizeof(dg.deviceName), deviceName);
bResult = DeviceIoControl (hDriver, VC_IOCTL_GET_DRIVE_GEOMETRY_EX, &dg,
sizeof (dg), &dg, sizeof (dg), &dwResult, NULL);
if (bResult && (dwResult == sizeof (dg)) && dg.diskGeometry.BytesPerSector)
{
ZeroMemory (diskGeometry, sizeof (DISK_GEOMETRY_EX));
memcpy (&diskGeometry->Geometry, &dg.diskGeometry, sizeof (DISK_GEOMETRY));
diskGeometry->DiskSize.QuadPart = dg.DiskSize.QuadPart;
return TRUE;
}
else
return FALSE;
}
BOOL GetPhysicalDriveGeometry (int driveNumber, PDISK_GEOMETRY_EX diskGeometry)
{
HANDLE hDev;
BOOL bResult = FALSE;
TCHAR devicePath[MAX_PATH];
StringCchPrintfW (devicePath, ARRAYSIZE (devicePath), L"\\\\.\\PhysicalDrive%d", driveNumber);
if ((hDev = CreateFileW (devicePath, 0, 0, NULL, OPEN_EXISTING, 0, NULL)) != INVALID_HANDLE_VALUE)
{
DWORD bytesRead = 0;
ZeroMemory (diskGeometry, sizeof (DISK_GEOMETRY_EX));
BYTE dgBuffer[256];
if ( DeviceIoControl (hDev, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, NULL, 0, dgBuffer, sizeof (dgBuffer), &bytesRead, NULL)
&& (bytesRead >= (sizeof (DISK_GEOMETRY) + sizeof (LARGE_INTEGER)))
&& ((PDISK_GEOMETRY_EX) dgBuffer)->Geometry.BytesPerSector)
{
memcpy (&diskGeometry->Geometry, &((PDISK_GEOMETRY_EX) dgBuffer)->Geometry, sizeof (DISK_GEOMETRY));
diskGeometry->DiskSize.QuadPart = ((PDISK_GEOMETRY_EX) dgBuffer)->DiskSize.QuadPart;
bResult = TRUE;
}
else
{
DISK_GEOMETRY geo;
if ( DeviceIoControl (hDev, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, (LPVOID) &geo, sizeof (geo), &bytesRead, NULL)
&& (bytesRead >= sizeof (DISK_GEOMETRY))
&& geo.BytesPerSector)
{
memcpy (&diskGeometry->Geometry, &geo, sizeof (DISK_GEOMETRY));
diskGeometry->DiskSize.QuadPart = geo.Cylinders.QuadPart * geo.SectorsPerTrack * geo.TracksPerCylinder * geo.BytesPerSector;
bResult = TRUE;
if (CurrentOSMajor >= 6)
{
STORAGE_READ_CAPACITY storage = {0};
storage.Version = sizeof (STORAGE_READ_CAPACITY);
storage.Size = sizeof (STORAGE_READ_CAPACITY);
if (DeviceIoControl (hDev, IOCTL_STORAGE_READ_CAPACITY, NULL, 0, (LPVOID) &storage, sizeof (storage), &bytesRead, NULL)
&& (bytesRead >= sizeof (storage))
&& (storage.Size == sizeof (STORAGE_READ_CAPACITY))
)
{
diskGeometry->DiskSize.QuadPart = storage.DiskLength.QuadPart;
}
}
}
}
CloseHandle (hDev);
}
return bResult;
}
#endif
// Returns drive letter number assigned to device (-1 if none)
int GetDiskDeviceDriveLetter (PWSTR deviceName)
{
int i;
WCHAR link[MAX_PATH];
WCHAR target[MAX_PATH];
WCHAR device[MAX_PATH];
if (!ResolveSymbolicLink (deviceName, device, sizeof(device)))
StringCchCopyW (device, MAX_PATH, deviceName);
for (i = 0; i < 26; i++)
{
WCHAR drive[] = { (WCHAR) i + L'A', L':', 0 };
StringCchCopyW (link, MAX_PATH, L"\\DosDevices\\");
StringCchCatW (link, MAX_PATH, drive);
if ( ResolveSymbolicLink (link, target, sizeof(target))
&& (wcscmp (device, target) == 0)
)
{
return i;
}
}
return -1;
}
// WARNING: This function does NOT provide 100% reliable results -- do NOT use it for critical/dangerous operations!
// Return values: 0 - filesystem does not appear empty, 1 - filesystem appears empty, -1 - an error occurred
int FileSystemAppearsEmpty (const wchar_t *devicePath)
{
float percentFreeSpace = 0.0;
__int64 occupiedBytes = 0;
if (GetStatsFreeSpaceOnPartition (devicePath, &percentFreeSpace, &occupiedBytes, TRUE) != -1)
{
if (occupiedBytes > BYTES_PER_GB && percentFreeSpace < 99.99 // "percentFreeSpace < 99.99" is needed because an NTFS filesystem larger than several terabytes can have more than 1GB of data in use, even if there are no files stored on it.
|| percentFreeSpace < 88) // A 24-MB NTFS filesystem has 11.5% of space in use even if there are no files stored on it.
{
return 0;
}
else
return 1;
}
else
return -1;
}
// Returns the free space on the specified partition (volume) in bytes. If the 'occupiedBytes' pointer
// is not NULL, size of occupied space (in bytes) is written to the pointed location. In addition, if the
// 'percent' pointer is not NULL, % of free space is stored in the pointed location. If there's an error,
// returns -1.
__int64 GetStatsFreeSpaceOnPartition (const wchar_t *devicePath, float *percentFree, __int64 *occupiedBytes, BOOL silent)
{
WCHAR devPath [MAX_PATH];
int driveLetterNo = -1;
wchar_t szRootPath[4] = {0, L':', L'\\', 0};
ULARGE_INTEGER freeSpaceSize;
ULARGE_INTEGER totalNumberOfBytes;
ULARGE_INTEGER totalNumberOfFreeBytes;
StringCbCopyW (devPath, sizeof(devPath), devicePath);
driveLetterNo = GetDiskDeviceDriveLetter (devPath);
szRootPath[0] = (wchar_t) driveLetterNo + L'A';
if (!GetDiskFreeSpaceEx (szRootPath, &freeSpaceSize, &totalNumberOfBytes, &totalNumberOfFreeBytes))
{
if (!silent)
{
handleWin32Error (MainDlg, SRC_POS);
Error ("CANNOT_CALC_SPACE", MainDlg);
}
return -1;
}
if (percentFree != NULL || occupiedBytes != NULL)
{
// Determine occupied space and % of free space
PARTITION_INFORMATION partitionInfo;
if (!GetPartitionInfo (devicePath, &partitionInfo))
{
if (!silent)
{
handleWin32Error (MainDlg, SRC_POS);
Error ("CANT_GET_VOLSIZE", MainDlg);
}
return -1;
}
if (occupiedBytes != NULL)
*occupiedBytes = partitionInfo.PartitionLength.QuadPart - freeSpaceSize.QuadPart;
if (percentFree != NULL)
*percentFree = (float) ((double) freeSpaceSize.QuadPart / (double) partitionInfo.PartitionLength.QuadPart * 100.0);
}
return freeSpaceSize.QuadPart;
}
// Returns -1 if there's an error.
__int64 GetDeviceSize (const wchar_t *devicePath)
{
PARTITION_INFORMATION partitionInfo;
if (!GetPartitionInfo (devicePath, &partitionInfo))
return -1;
return partitionInfo.PartitionLength.QuadPart;
}
HANDLE DismountDrive (wchar_t *devName, wchar_t *devicePath)
{
DWORD dwResult;
HANDLE hVolume;
BOOL bResult = FALSE;
int attempt = UNMOUNT_MAX_AUTO_RETRIES;
int driveLetterNo = -1;
WCHAR devPath [MAX_PATH];
StringCbCopyW (devPath, sizeof(devPath), devicePath);
driveLetterNo = GetDiskDeviceDriveLetter (devPath);
hVolume = CreateFile (devName, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (hVolume == INVALID_HANDLE_VALUE)
return INVALID_HANDLE_VALUE;
// Try to lock the volume first so that dismount is not forced.
// If we fail, we will dismount anyway even if it needs to be forced.
CloseVolumeExplorerWindows (MainDlg, driveLetterNo);
while (!(bResult = DeviceIoControl (hVolume, FSCTL_LOCK_VOLUME, NULL, 0, NULL, 0, &dwResult, NULL))
&& attempt > 0)
{
Sleep (UNMOUNT_AUTO_RETRY_DELAY);
attempt--;
}
// Try to dismount the volume
attempt = UNMOUNT_MAX_AUTO_RETRIES;
while (!(bResult = DeviceIoControl (hVolume, FSCTL_DISMOUNT_VOLUME, NULL, 0, NULL, 0, &dwResult, NULL))
&& attempt > 0)
{
Sleep (UNMOUNT_AUTO_RETRY_DELAY);
attempt--;
}
if (!bResult)
CloseHandle (hVolume);
return (bResult ? hVolume : INVALID_HANDLE_VALUE);
}
BOOL DecompressZipToDir (const unsigned char *inputBuffer, DWORD inputLength, const wchar_t *destinationDir, ProgressFn progressFnPtr, HWND hwndDlg)
{
BOOL res = TRUE;
zip_error_t zerr;
zip_int64_t numFiles, i;
zip_stat_t sb;
zip_source_t* zsrc = zip_source_buffer_create (inputBuffer, inputLength, 0, &zerr);
if (!zsrc)
return FALSE;
zip_t* z = zip_open_from_source (zsrc, ZIP_CHECKCONS | ZIP_RDONLY, &zerr);
if (!z)
{
zip_source_free (zsrc);
return FALSE;
}
finally_do_arg (zip_t*, z, { zip_close (finally_arg); });
numFiles = zip_get_num_entries (z, 0);
if (numFiles <= 0)
return FALSE;
for (i = 0; (i < numFiles) && res; i++)
{
ZeroMemory (&sb, sizeof (sb));
if ((0 == zip_stat_index (z, i, 0, &sb)) && (sb.valid & (ZIP_STAT_NAME | ZIP_STAT_SIZE)) && (sb.size > 0))
{
std::wstring wname = Utf8StringToWide (sb.name);
CorrectFileName (wname);
std::wstring filePath = destinationDir + wname;
size_t pos = filePath.find_last_of (L"/\\");
// create the parent directory if it doesn't exist
if (pos != std::wstring::npos)
{
SHCreateDirectoryEx (NULL, filePath.substr (0, pos).c_str(), NULL);
}
zip_file_t *f = zip_fopen_index (z, i, 0);
if (f)
{
ByteArray buffer((ByteArray::size_type) sb.size);
zip_fread (f, buffer.data(), sb.size);
zip_fclose (f);
if (progressFnPtr)
progressFnPtr (hwndDlg, filePath.c_str());
res = SaveBufferToFile ((char *) buffer.data(), filePath.c_str(), (DWORD) buffer.size(), FALSE, TRUE);
}
}
}
return res;
}
// Proper flush for Windows systems. Returns TRUE if successful.
BOOL TCFlushFile (FILE *f)
{
HANDLE hf = (HANDLE) _get_osfhandle (_fileno (f));
fflush (f);
if (hf == INVALID_HANDLE_VALUE)
return FALSE;
return FlushFileBuffers (hf) != 0;
}
// Prints a UTF-16 text (note that this involves a real printer, not a screen).
// textByteLen - length of the text in bytes
// title - printed as part of the page header and used as the filename for a temporary file
BOOL PrintHardCopyTextUTF16 (wchar_t *text, wchar_t *title, size_t textByteLen)
{
wchar_t cl [MAX_PATH*3] = {L"/p \""};
wchar_t path [MAX_PATH * 2] = { 0 };
wchar_t filename [MAX_PATH + 1] = { 0 };
StringCbCopyW (filename, sizeof(filename), title);
//strcat (filename, ".txt");
GetTempPath (ARRAYSIZE (path), path);
if (!FileExists (path))
{
StringCbCopyW (path, sizeof(path), GetConfigPath (filename));
if (wcslen(path) < 2)
return FALSE;
}
else
{
StringCbCatW (path, sizeof(path), filename);
}
// Write the Unicode signature
if (!SaveBufferToFile ("\xFF\xFE", path, 2, FALSE, FALSE))
{
_wremove (path);
return FALSE;
}
// Write the actual text
if (!SaveBufferToFile ((char *) text, path, (DWORD) textByteLen, TRUE, FALSE))
{
_wremove (path);
return FALSE;
}
StringCbCatW (cl, sizeof(cl), path);
StringCbCatW (cl, sizeof(cl), L"\"");
// Get the absolute path for notepad
if (GetWindowsDirectory(filename, MAX_PATH))
{
if (filename[wcslen (filename) - 1] != L'\\')
StringCbCatW (filename, sizeof(filename), L"\\");
StringCbCatW(filename, sizeof(filename), PRINT_TOOL);
}
else
StringCbCopyW(filename, sizeof(filename), L"C:\\Windows\\" PRINT_TOOL);
WaitCursor ();
ShellExecute (NULL, L"open", filename, cl, NULL, SW_HIDE);
Sleep (6000);
NormalCursor();
_wremove (path);
return TRUE;
}
+
+
BOOL IsNonInstallMode ()
{
HKEY hkey, hkeybis;
DWORD dw;
WCHAR szBuffer[512];
DWORD dwBufferSize = sizeof(szBuffer);
std::wstring msiProductGUID;
if (bPortableModeConfirmed)
return TRUE;
if (hDriver != INVALID_HANDLE_VALUE)
{
// The driver is running
if (DeviceIoControl (hDriver, TC_IOCTL_GET_PORTABLE_MODE_STATUS, NULL, 0, NULL, 0, &dw, 0))
{
bPortableModeConfirmed = TRUE;
return TRUE;
}
else
{
// This is also returned if we fail to determine the status (it does not mean that portable mode is disproved).
return FALSE;
}
}
else
{
// The tests in this block are necessary because this function is in some cases called before DriverAttach().
HANDLE hDriverTmp = CreateFile (WIN32_ROOT_PREFIX, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (hDriverTmp == INVALID_HANDLE_VALUE)
{
// The driver was not found in the system path
wchar_t path[MAX_PATH * 2] = { 0 };
// We can't use GetConfigPath() here because it would call us back (indirect recursion)
if (SUCCEEDED(SHGetFolderPath (NULL, CSIDL_APPDATA, NULL, 0, path)))
{
StringCbCatW (path, MAX_PATH * 2, L"\\VeraCrypt\\");
StringCbCatW (path, MAX_PATH * 2, TC_APPD_FILENAME_SYSTEM_ENCRYPTION);
if (FileExists (path))
{
// To maintain consistency and safety, if the system encryption config file exits, we cannot
// allow portable mode. (This happens e.g. when the pretest fails and the user selects
// "Last Known Good Configuration" from the Windows boot menu.)
// However, if UAC elevation is needed, we have to confirm portable mode first (after we are elevated, we won't).
if (!IsAdmin () && IsUacSupported ())
return TRUE;
return FALSE;
}
}
// As the driver was not found in the system path, we can predict that we will run in portable mode
return TRUE;
}
else
CloseHandle (hDriverTmp);
}
// The following test checks whether the MSI is installed, which means we're not in portable mode.
// The ProductGUID is read from registry.
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\VeraCrypt_MSI", 0, KEY_QUERY_VALUE | KEY_WOW64_32KEY, &hkey) == ERROR_SUCCESS ||
RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\VeraCrypt_MSI", 0, KEY_QUERY_VALUE, &hkey) == ERROR_SUCCESS)
{
if (ERROR_SUCCESS == RegQueryValueExW(hkey, L"ProductGuid", 0, NULL, (LPBYTE)szBuffer, &dwBufferSize))
{
msiProductGUID = szBuffer;
std::wstring regKey = L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\";
regKey += msiProductGUID;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, regKey.c_str(), 0, KEY_READ | KEY_WOW64_32KEY, &hkeybis) == ERROR_SUCCESS ||
RegOpenKeyEx(HKEY_LOCAL_MACHINE, regKey.c_str(), 0, KEY_READ, &hkeybis) == ERROR_SUCCESS)
{
RegCloseKey(hkeybis);
return FALSE;
}
}
RegCloseKey(hkey);
}
// The following test may be unreliable in some cases (e.g. after the user selects restore "Last Known Good
// Configuration" from the Windows boot menu).
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\VeraCrypt", 0, KEY_READ | KEY_WOW64_32KEY, &hkey) == ERROR_SUCCESS)
{
RegCloseKey (hkey);
return FALSE;
}
else
return TRUE;
}
+
LRESULT SetCheckBox (HWND hwndDlg, int dlgItem, BOOL state)
{
return SendDlgItemMessage (hwndDlg, dlgItem, BM_SETCHECK, state ? BST_CHECKED : BST_UNCHECKED, 0);
}
BOOL GetCheckBox (HWND hwndDlg, int dlgItem)
{
return IsButtonChecked (GetDlgItem (hwndDlg, dlgItem));
}
// Scroll the listview vertically so that the item with index of topMostVisibleItem is the topmost visible item.
void SetListScrollHPos (HWND hList, int topMostVisibleItem)
{
int testedPos = 0;
do
{
SendMessage (hList, LVM_SCROLL, 0, testedPos);
} while (ListView_GetTopIndex (hList) < topMostVisibleItem && ++testedPos < 10000);
}
// Adds or removes TrueCrypt.exe to/from the system startup sequence (with appropriate command line arguments)
void ManageStartupSeq (void)
{
if (!IsNonInstallMode ())
{
wchar_t regk [64];
GetStartupRegKeyName (regk, sizeof(regk));
if (bStartOnLogon || bMountDevicesOnLogon || bMountFavoritesOnLogon)
{
wchar_t exe[MAX_PATH * 2] = { L'"' };
GetModuleFileName (NULL, exe + 1, ARRAYSIZE (exe) - 1);
#ifdef VOLFORMAT
{
wchar_t *tmp = NULL;
if (tmp = wcsrchr (exe, L'\\'))
{
*tmp = 0;
StringCbCatW (exe, MAX_PATH * 2, L"\\VeraCrypt.exe");
}
}
#endif
StringCbCatW (exe, MAX_PATH * 2, L"\" /q preferences /a logon");
if (bMountDevicesOnLogon) StringCbCatW (exe, MAX_PATH * 2, L" /a devices");
if (bMountFavoritesOnLogon) StringCbCatW (exe, MAX_PATH * 2, L" /a favorites");
WriteRegistryString (regk, L"VeraCrypt", exe);
}
else
DeleteRegistryValue (regk, L"VeraCrypt");
}
}
// Adds or removes the VeraCrypt Volume Creation Wizard to/from the system startup sequence
void ManageStartupSeqWiz (BOOL bRemove, const wchar_t *arg)
{
wchar_t regk [64];
GetStartupRegKeyName (regk, sizeof(regk));
if (!bRemove)
{
size_t exeSize = (MAX_PATH * 2) + 3 + 20 + wcslen (arg); // enough room for all concatenation operations
wchar_t* exe = (wchar_t*) calloc(1, exeSize * sizeof (wchar_t));
exe[0] = L'"';
GetModuleFileName (NULL, exe + 1, (DWORD) (exeSize - 1));
#ifndef VOLFORMAT
{
wchar_t *tmp = NULL;
if (tmp = wcsrchr (exe, L'\\'))
{
*tmp = 0;
StringCchCatW (exe, exeSize, L"\\VeraCrypt Format.exe");
}
}
#endif
if (wcslen (arg) > 0)
{
StringCchCatW (exe, exeSize, L"\" ");
StringCchCatW (exe, exeSize, arg);
}
WriteRegistryString (regk, L"VeraCrypt Format", exe);
free(exe);
}
else
DeleteRegistryValue (regk, L"VeraCrypt Format");
}
// Delete the last used Windows file selector path for TrueCrypt from the registry
void CleanLastVisitedMRU (void)
{
WCHAR exeFilename[MAX_PATH];
WCHAR *strToMatch;
WCHAR strTmp[4096];
WCHAR regPath[128];
WCHAR key[64];
int id, len;
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"");
for (id = (IsOSAtLeast (WIN_VISTA) ? 0 : L'a'); id <= (IsOSAtLeast (WIN_VISTA) ? 1000 : L'z'); id++)
{
*strTmp = 0;
StringCbPrintfW (key, sizeof(key), (IsOSAtLeast (WIN_VISTA) ? L"%d" : L"%c"), id);
if ((len = ReadRegistryBytes (regPath, key, (char *) strTmp, sizeof (strTmp))) > 0)
{
if (_wcsicmp (strTmp, strToMatch) == 0)
{
char buf[65536], bufout[sizeof (buf)];
// Overwrite the entry with zeroes while keeping its original size
memset (strTmp, 0, len);
if (!WriteRegistryBytes (regPath, key, (char *) strTmp, len))
MessageBoxW (NULL, GetString ("CLEAN_WINMRU_FAILED"), lpszTitle, ICON_HAND);
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);
if (*p == id)
{
p++;
len -= sizeof (int);
continue;
}
*pout++ = *p++;
}
WriteRegistryBytes (L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\LastVisitedPidlMRU", L"MRUListEx", bufout, len);
}
else
{
wchar_t *p = (wchar_t*) buf;
wchar_t *pout = (wchar_t*) bufout;
ReadRegistryString (L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\LastVisitedMRU", L"MRUList", L"", (wchar_t*) buf, sizeof (buf));
while (*p)
{
if (*p == id)
{
p++;
continue;
}
*pout++ = *p++;
}
*pout++ = 0;
WriteRegistryString (L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\LastVisitedMRU", L"MRUList", (wchar_t*) bufout);
}
break;
}
}
}
}
#ifndef SETUP
void ClearHistory (HWND hwndDlgItem)
{
ArrowWaitCursor ();
ClearCombo (hwndDlgItem);
DumpCombo (hwndDlgItem, TRUE);
CleanLastVisitedMRU ();
NormalCursor ();
}
#endif // #ifndef SETUP
LRESULT ListItemAdd (HWND list, int index, const wchar_t *string)
{
LVITEM li;
memset (&li, 0, sizeof(li));
li.mask = LVIF_TEXT;
li.pszText = (wchar_t*) string;
li.iItem = index;
li.iSubItem = 0;
return ListView_InsertItem (list, &li);
}
LRESULT ListSubItemSet (HWND list, int index, int subIndex, const wchar_t *string)
{
LVITEM li;
memset (&li, 0, sizeof(li));
li.mask = LVIF_TEXT;
li.pszText = (wchar_t*) string;
li.iItem = index;
li.iSubItem = subIndex;
return ListView_SetItem (list, &li);
}
BOOL GetMountList (MOUNT_LIST_STRUCT *list)
{
DWORD dwResult;
MOUNT_LIST_STRUCT localList = {0};
if ( list && DeviceIoControl (hDriver, TC_IOCTL_GET_MOUNTED_VOLUMES, &localList,
sizeof (localList), &localList, sizeof (localList), &dwResult,
NULL)
&& (localList.ulMountedDrives < (1 << 26))
)
{
memcpy (list, &localList, sizeof (MOUNT_LIST_STRUCT));
return TRUE;
}
else
return FALSE;
}
int GetDriverRefCount ()
{
DWORD dwResult;
BOOL bResult;
int refCount;
bResult = DeviceIoControl (hDriver, TC_IOCTL_GET_DEVICE_REFCOUNT, &refCount, sizeof (refCount), &refCount,
sizeof (refCount), &dwResult, NULL);
if (bResult)
return refCount;
else
return -1;
}
wchar_t *GetModPath (wchar_t *path, int maxSize)
{
GetModuleFileName (NULL, path, maxSize);
wchar_t* ptr = wcsrchr (path, L'\\');
if (ptr)
ptr[1] = 0;
return path;
}
wchar_t *GetConfigPath (wchar_t *fileName)
{
static wchar_t path[MAX_PATH * 2] = { 0 };
if (IsNonInstallMode ())
{
GetModPath (path, ARRAYSIZE (path));
StringCchCatW (path, (MAX_PATH * 2), fileName);
return path;
}
if (SUCCEEDED(SHGetFolderPath (NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, path)))
{
StringCchCatW (path, (MAX_PATH * 2), L"\\VeraCrypt\\");
CreateDirectory (path, NULL);
StringCchCatW (path, (MAX_PATH * 2), fileName);
}
else
path[0] = 0;
return path;
}
wchar_t *GetProgramConfigPath (wchar_t *fileName)
{
static wchar_t path[MAX_PATH * 2] = { 0 };
if (SUCCEEDED (SHGetFolderPath (NULL, CSIDL_COMMON_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, path)))
{
StringCchCatW (path, (MAX_PATH * 2), L"\\VeraCrypt\\");
CreateDirectory (path, NULL);
StringCchCatW (path, (MAX_PATH * 2), fileName);
}
else
path[0] = 0;
return path;
}
std::wstring GetServiceConfigPath (const wchar_t *fileName, bool useLegacy)
{
wchar_t sysPath[TC_MAX_PATH];
if (Is64BitOs() && useLegacy)
{
typedef UINT (WINAPI *GetSystemWow64Directory_t) (LPWSTR lpBuffer, UINT uSize);
GetSystemWow64Directory_t getSystemWow64Directory = (GetSystemWow64Directory_t) GetProcAddress (GetModuleHandle (L"kernel32"), "GetSystemWow64DirectoryW");
getSystemWow64Directory (sysPath, ARRAYSIZE (sysPath));
}
else
GetSystemDirectory (sysPath, ARRAYSIZE (sysPath));
return wstring (sysPath) + L"\\" + fileName;
}
// Returns 0 if an error occurs or the drive letter (as an upper-case char) of the system partition (e.g. 'C');
wchar_t GetSystemDriveLetter (void)
{
wchar_t systemDir [MAX_PATH];
if (GetSystemDirectory (systemDir, ARRAYSIZE (systemDir)))
return (wchar_t) (towupper (systemDir [0]));
else
return 0;
}
void TaskBarIconDisplayBalloonTooltip (HWND hwnd, wchar_t *headline, wchar_t *text, BOOL warning)
{
NOTIFYICONDATAW tnid;
ZeroMemory (&tnid, sizeof (tnid));
tnid.cbSize = sizeof (tnid);
tnid.hWnd = hwnd;
tnid.uID = IDI_TRUECRYPT_ICON;
//tnid.uVersion = (IsOSAtLeast (WIN_VISTA) ? NOTIFYICON_VERSION_4 : NOTIFYICON_VERSION);
//Shell_NotifyIconW (NIM_SETVERSION, &tnid);
tnid.uFlags = NIF_INFO;
tnid.dwInfoFlags = (warning ? NIIF_WARNING : NIIF_INFO);
tnid.uTimeout = (IsOSAtLeast (WIN_VISTA) ? 1000 : 5000); // in ms
StringCbCopyW (tnid.szInfoTitle, sizeof(tnid.szInfoTitle), headline);
StringCbCopyW (tnid.szInfo, sizeof(tnid.szInfo),text);
// Display the balloon tooltip quickly twice in a row to avoid the slow and unwanted "fade-in" phase
Shell_NotifyIconW (NIM_MODIFY, &tnid);
Shell_NotifyIconW (NIM_MODIFY, &tnid);
}
// Either of the pointers may be NULL
void InfoBalloon (char *headingStringId, char *textStringId, HWND hwnd)
{
if (Silent)
return;
TaskBarIconDisplayBalloonTooltip (hwnd,
headingStringId == NULL ? L"VeraCrypt" : GetString (headingStringId),
textStringId == NULL ? L" " : GetString (textStringId),
FALSE);
}
// Either of the pointers may be NULL
void InfoBalloonDirect (wchar_t *headingString, wchar_t *textString, HWND hwnd)
{
if (Silent)
return;
TaskBarIconDisplayBalloonTooltip (hwnd,
headingString == NULL ? L"VeraCrypt" : headingString,
textString == NULL ? L" " : textString,
FALSE);
}
// Either of the pointers may be NULL
void WarningBalloon (char *headingStringId, char *textStringId, HWND hwnd)
{
if (Silent)
return;
TaskBarIconDisplayBalloonTooltip (hwnd,
headingStringId == NULL ? L"VeraCrypt" : GetString (headingStringId),
textStringId == NULL ? L" " : GetString (textStringId),
TRUE);
}
// Either of the pointers may be NULL
void WarningBalloonDirect (wchar_t *headingString, wchar_t *textString, HWND hwnd)
{
if (Silent)
return;
TaskBarIconDisplayBalloonTooltip (hwnd,
headingString == NULL ? L"VeraCrypt" : headingString,
textString == NULL ? L" " : textString,
TRUE);
}
int Info (char *stringId, HWND hwnd)
{
if (Silent) return 0;
return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONINFORMATION);
}
int InfoTopMost (char *stringId, HWND hwnd)
{
if (Silent) return 0;
return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONINFORMATION | MB_SETFOREGROUND | MB_TOPMOST);
}
int InfoDirect (const wchar_t *msg, HWND hwnd)
{
if (Silent) return 0;
return MessageBoxW (hwnd, msg, lpszTitle, MB_ICONINFORMATION);
}
int Warning (char *stringId, HWND hwnd)
{
if (Silent) return 0;
return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONWARNING);
}
int WarningTopMost (char *stringId, HWND hwnd)
{
if (Silent) return 0;
return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONWARNING | MB_SETFOREGROUND | MB_TOPMOST);
}
int WarningDirect (const wchar_t *warnMsg, HWND hwnd)
{
if (Silent) return 0;
return MessageBoxW (hwnd, warnMsg, lpszTitle, MB_ICONWARNING);
}
int ErrorRetryCancel (char *stringId, HWND hwnd)
{
if (Silent) return 0;
return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONERROR | MB_RETRYCANCEL);
}
int ErrorTopMost (char *stringId, HWND hwnd)
{
if (Silent) return 0;
return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONERROR | MB_SETFOREGROUND | MB_TOPMOST);
}
int ErrorDirect (const wchar_t *errMsg, HWND hwnd)
{
if (Silent) return 0;
return MessageBoxW (hwnd, errMsg, lpszTitle, MB_ICONERROR);
}
int AskYesNo (char *stringId, HWND hwnd)
{
if (Silent) return IDNO;
return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON1);
}
int AskYesNoString (const wchar_t *str, HWND hwnd)
{
if (Silent) return IDNO;
return MessageBoxW (hwnd, str, lpszTitle, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON1);
}
int AskYesNoTopmost (char *stringId, HWND hwnd)
{
if (Silent) return IDNO;
return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON1 | MB_SETFOREGROUND | MB_TOPMOST);
}
int AskNoYes (char *stringId, HWND hwnd)
{
if (Silent) return IDNO;
return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2);
}
int AskNoYesString (const wchar_t *string, HWND hwnd)
{
if (Silent) return IDNO;
return MessageBoxW (hwnd, string, lpszTitle, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2);
}
int AskOkCancel (char *stringId, HWND hwnd)
{
if (Silent) return IDCANCEL;
return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONQUESTION | MB_OKCANCEL | MB_DEFBUTTON1);
}
int AskWarnYesNo (char *stringId, HWND hwnd)
{
if (Silent) return IDNO;
return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON1);
}
int AskWarnYesNoString (const wchar_t *string, HWND hwnd)
{
if (Silent) return IDNO;
return MessageBoxW (hwnd, string, lpszTitle, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON1);
}
int AskWarnYesNoTopmost (char *stringId, HWND hwnd)
{
if (Silent) return IDNO;
return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON1 | MB_SETFOREGROUND | MB_TOPMOST);
}
int AskWarnYesNoStringTopmost (const wchar_t *string, HWND hwnd)
{
if (Silent) return IDNO;
return MessageBoxW (hwnd, string, lpszTitle, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON1 | MB_SETFOREGROUND | MB_TOPMOST);
}
int AskWarnNoYes (char *stringId, HWND hwnd)
{
if (Silent) return IDNO;
return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2);
}
int AskWarnNoYesString (const wchar_t *string, HWND hwnd)
{
if (Silent) return IDNO;
return MessageBoxW (hwnd, string, lpszTitle, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2);
}
int AskWarnNoYesTopmost (char *stringId, HWND hwnd)
{
if (Silent) return IDNO;
return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2 | MB_SETFOREGROUND | MB_TOPMOST);
}
int AskWarnOkCancel (char *stringId, HWND hwnd)
{
if (Silent) return IDCANCEL;
return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONWARNING | MB_OKCANCEL | MB_DEFBUTTON1);
}
int AskWarnCancelOk (char *stringId, HWND hwnd)
{
if (Silent) return IDCANCEL;
return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONWARNING | MB_OKCANCEL | MB_DEFBUTTON2);
}
int AskErrYesNo (char *stringId, HWND hwnd)
{
if (Silent) return IDNO;
return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONERROR | MB_YESNO | MB_DEFBUTTON1);
}
int AskErrNoYes (char *stringId, HWND hwnd)
{
if (Silent) return IDNO;
return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONERROR | MB_YESNO | MB_DEFBUTTON2);
}
// The function accepts two input formats:
// Input format 1: {0, "MESSAGE_STRING_ID", "BUTTON_1_STRING_ID", ... "LAST_BUTTON_STRING_ID", 0};
// Input format 2: {L"", L"Message text", L"Button caption 1", ... L"Last button caption", 0};
// The second format is to be used if any of the strings contains format specification (e.g. %s, %d) or
// in any other cases where a string needs to be resolved before calling this function.
// The returned value is the ordinal number of the choice the user selected (1..MAX_MULTI_CHOICES)
int AskMultiChoice (void *strings[], BOOL bBold, HWND hwnd)
{
MULTI_CHOICE_DLGPROC_PARAMS params;
params.strings = &strings[0];
params.bold = bBold;
return (int) DialogBoxParamW (hInst,
MAKEINTRESOURCEW (IDD_MULTI_CHOICE_DLG), hwnd,
(DLGPROC) MultiChoiceDialogProc, (LPARAM) &params);
}
BOOL ConfigWriteBegin ()
{
DWORD size;
if (ConfigFileHandle != NULL)
return FALSE;
if (ConfigBuffer == NULL)
ConfigBuffer = LoadFile (GetConfigPath (TC_APPD_FILENAME_CONFIGURATION), &size);
ConfigFileHandle = _wfopen (GetConfigPath (TC_APPD_FILENAME_CONFIGURATION), L"w,ccs=UTF-8");
if (ConfigFileHandle == NULL)
{
free (ConfigBuffer);
ConfigBuffer = NULL;
return FALSE;
}
XmlWriteHeader (ConfigFileHandle);
fputws (L"\n\t<configuration>", ConfigFileHandle);
return TRUE;
}
BOOL ConfigWriteEnd (HWND hwnd)
{
char *xml = ConfigBuffer;
char key[128], value[2048];
if (ConfigFileHandle == NULL) return FALSE;
// Write unmodified values
while (xml && (xml = XmlFindElement (xml, "config")))
{
XmlGetAttributeText (xml, "key", key, sizeof (key));
XmlGetNodeText (xml, value, sizeof (value));
fwprintf (ConfigFileHandle, L"\n\t\t<config key=\"%hs\">%hs</config>", key, value);
xml++;
}
fputws (L"\n\t</configuration>", ConfigFileHandle);
XmlWriteFooter (ConfigFileHandle);
TCFlushFile (ConfigFileHandle);
CheckFileStreamWriteErrors (hwnd, ConfigFileHandle, TC_APPD_FILENAME_CONFIGURATION);
fclose (ConfigFileHandle);
ConfigFileHandle = NULL;
if (ConfigBuffer != NULL)
{
DWORD size;
free (ConfigBuffer);
ConfigBuffer = LoadFile (GetConfigPath (TC_APPD_FILENAME_CONFIGURATION), &size);
}
return TRUE;
}
BOOL ConfigWriteString (char *configKey, char *configValue)
{
char *c;
if (ConfigFileHandle == NULL)
return FALSE;
// Mark previous config value as updated
if (ConfigBuffer != NULL)
{
c = XmlFindElementByAttributeValue (ConfigBuffer, "config", "key", configKey);
if (c != NULL)
c[1] = '!';
}
return 0 != fwprintf (
ConfigFileHandle, L"\n\t\t<config key=\"%hs\">%hs</config>",
configKey, configValue);
}
BOOL ConfigWriteStringW (char *configKey, wchar_t *configValue)
{
char *c;
if (ConfigFileHandle == NULL)
return FALSE;
// Mark previous config value as updated
if (ConfigBuffer != NULL)
{
c = XmlFindElementByAttributeValue (ConfigBuffer, "config", "key", configKey);
if (c != NULL)
c[1] = '!';
}
return 0 != fwprintf (
ConfigFileHandle, L"\n\t\t<config key=\"%hs\">%ls</config>",
configKey, configValue);
}
BOOL ConfigWriteInt (char *configKey, int configValue)
{
char val[32];
StringCbPrintfA (val, sizeof(val), "%d", configValue);
return ConfigWriteString (configKey, val);
}
static BOOL ConfigRead (char *configKey, char *configValue, int maxValueSize)
{
DWORD size;
char *xml;
if (ConfigBuffer == NULL)
ConfigBuffer = LoadFile (GetConfigPath (TC_APPD_FILENAME_CONFIGURATION), &size);
xml = ConfigBuffer;
if (xml != NULL)
{
xml = XmlFindElementByAttributeValue (xml, "config", "key", configKey);
if (xml != NULL)
{
XmlGetNodeText (xml, configValue, maxValueSize);
return TRUE;
}
}
return FALSE;
}
int ConfigReadInt (char *configKey, int defaultValue)
{
char s[32];
if (ConfigRead (configKey, s, sizeof (s)))
return atoi (s);
else
return defaultValue;
}
char *ConfigReadString (char *configKey, char *defaultValue, char *str, int maxLen)
{
if (ConfigRead (configKey, str, maxLen))
return str;
else
{
StringCbCopyA (str, maxLen, defaultValue);
return defaultValue;
}
}
void ConfigReadCompareInt(char *configKey, int defaultValue, int* pOutputValue, BOOL bOnlyCheckModified, BOOL* pbModified)
{
int intValue = ConfigReadInt (configKey, defaultValue);
if (pOutputValue)
{
if (pbModified && (*pOutputValue != intValue))
*pbModified = TRUE;
if (!bOnlyCheckModified)
*pOutputValue = intValue;
}
}
void ConfigReadCompareString (char *configKey, char *defaultValue, char *str, int maxLen, BOOL bOnlyCheckModified, BOOL *pbModified)
{
char *strValue = (char*) malloc (maxLen);
if (strValue)
{
memcpy (strValue, str, maxLen);
ConfigReadString (configKey, defaultValue, strValue, maxLen);
if (pbModified && strcmp (str, strValue))
*pbModified = TRUE;
if (!bOnlyCheckModified)
memcpy(str, strValue, maxLen);
free (strValue);
}
else
{
/* allocation failed. Suppose that value changed */
if (pbModified)
*pbModified = TRUE;
if (!bOnlyCheckModified)
ConfigReadString (configKey, defaultValue, str, maxLen);
}
}
void OpenPageHelp (HWND hwndDlg, int nPage)
{
if (IsAdmin ())
{
if (FileExists (szHelpFile))
SafeOpenURL (szHelpFile);
else if (FileExists (szHelpFile2))
SafeOpenURL (szHelpFile2);
else
Applink ("help");
}
else
{
int r = (int)ShellExecuteW (NULL, L"open", szHelpFile, NULL, NULL, SW_SHOWNORMAL);
if (r == ERROR_FILE_NOT_FOUND)
{
// Try the secondary help file
r = (int)ShellExecuteW (NULL, L"open", szHelpFile2, NULL, NULL, SW_SHOWNORMAL);
if (r == ERROR_FILE_NOT_FOUND)
{
// Open local HTML help. It will fallback to online help if not found.
Applink ("help");
return;
}
}
if (r == SE_ERR_NOASSOC)
{
if (AskYesNo ("HELP_READER_ERROR", MainDlg) == IDYES)
OpenOnlineHelp ();
}
}
}
void OpenOnlineHelp ()
{
Applink ("onlinehelp");
}
#ifndef SETUP
void RestoreDefaultKeyFilesParam (void)
{
KeyFileRemoveAll (&FirstKeyFile);
if (defaultKeyFilesParam.FirstKeyFile != NULL)
{
KeyFileCloneAll (defaultKeyFilesParam.FirstKeyFile, &FirstKeyFile);
KeyFilesEnable = defaultKeyFilesParam.EnableKeyFiles;
}
else
KeyFilesEnable = FALSE;
}
BOOL LoadDefaultKeyFilesParam (void)
{
BOOL status = TRUE;
DWORD size;
char *defaultKeyfilesFile = LoadFile (GetConfigPath (TC_APPD_FILENAME_DEFAULT_KEYFILES), &size);
char *xml = defaultKeyfilesFile;
KeyFile *kf;
if (xml == NULL)
return FALSE;
KeyFileRemoveAll (&defaultKeyFilesParam.FirstKeyFile);
while (xml = XmlFindElement (xml, "keyfile"))
{
kf = (KeyFile *) malloc (sizeof (KeyFile));
if (kf)
{
char fileName [MAX_PATH + 1];
if (XmlGetNodeText (xml, fileName, sizeof (fileName)) != NULL)
{
std::wstring wszFileName = Utf8StringToWide(fileName);
StringCbCopyW (kf->FileName, sizeof (kf->FileName), wszFileName.c_str ());
defaultKeyFilesParam.FirstKeyFile = KeyFileAdd (defaultKeyFilesParam.FirstKeyFile, kf);
}
else
free (kf);
}
else
{
KeyFileRemoveAll (&defaultKeyFilesParam.FirstKeyFile);
status = FALSE;
break;
}
xml++;
}
free (defaultKeyfilesFile);
if (status)
KeyFilesEnable = defaultKeyFilesParam.EnableKeyFiles;
return status;
}
#endif /* #ifndef SETUP */
void Debug (char *format, ...)
{
char buf[1024];
va_list val;
va_start(val, format);
StringCbVPrintfA (buf, sizeof (buf), format, val);
va_end(val);
OutputDebugStringA (buf);
}
void DebugMsgBox (char *format, ...)
{
char buf[1024];
va_list val;
va_start(val, format);
StringCbVPrintfA (buf, sizeof (buf), format, val);
va_end(val);
MessageBoxA (MainDlg, buf, "VeraCrypt debug", 0);
}
BOOL IsSupportedOS ()
{
BOOL bRet = FALSE;
#ifdef SETUP
static const wchar_t* szWin7KBs[] = {L"KB3033929", L"KB4474419"};
static const wchar_t* szWinVistaKBs[] = {L"KB4039648", L"KB4474419"};
if (IsOSAtLeast(WIN_8))
bRet = TRUE;
else if (IsOSAtLeast(WIN_7))
{
if (OneOfKBsInstalled(szWin7KBs, 2))
bRet = TRUE;
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))
bRet = TRUE;
#endif
return bRet;
}
BOOL Is64BitOs()
{
#ifdef _WIN64
return TRUE;
#else
static BOOL isWow64 = FALSE;
static BOOL valid = FALSE;
typedef BOOL(__stdcall* LPFN_ISWOW64PROCESS) (HANDLE hProcess, PBOOL Wow64Process);
typedef BOOL(__stdcall* LPFN_ISWOW64PROCESS2)(
HANDLE hProcess,
USHORT* pProcessMachine,
USHORT* pNativeMachine
);
LPFN_ISWOW64PROCESS fnIsWow64Process;
LPFN_ISWOW64PROCESS2 fnIsWow64Process2;
if (valid)
return isWow64;
fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandle(L"kernel32"), "IsWow64Process");
fnIsWow64Process2 = (LPFN_ISWOW64PROCESS2)GetProcAddress(GetModuleHandle(L"kernel32"), "IsWow64Process2");
if (fnIsWow64Process2)
{
USHORT processMachine, nativeMachine;
if (!fnIsWow64Process2(GetCurrentProcess(), &processMachine, &nativeMachine))
isWow64 = FALSE;
else
{
if (IMAGE_FILE_MACHINE_ARM64 == nativeMachine || IMAGE_FILE_MACHINE_AMD64 == nativeMachine || IMAGE_FILE_MACHINE_IA64 == nativeMachine || IMAGE_FILE_MACHINE_ALPHA64 == nativeMachine)
isWow64 = TRUE;
}
}
else if (fnIsWow64Process != NULL)
{
if (!fnIsWow64Process(GetCurrentProcess(), &isWow64))
isWow64 = FALSE;
}
valid = TRUE;
return isWow64;
#endif
}
BOOL IsARM()
{
#if defined(_M_ARM) || defined(_M_ARM64)
return TRUE;
#else
static BOOL isARM = FALSE;
static BOOL valid = FALSE;
typedef BOOL(__stdcall* LPFN_ISWOW64PROCESS2)(
HANDLE hProcess,
USHORT* pProcessMachine,
USHORT* pNativeMachine
);
LPFN_ISWOW64PROCESS2 fnIsWow64Process2;
if (valid)
return isARM;
fnIsWow64Process2 = (LPFN_ISWOW64PROCESS2)GetProcAddress(GetModuleHandle(L"kernel32"), "IsWow64Process2");
if (fnIsWow64Process2)
{
USHORT processMachine, nativeMachine;
if (fnIsWow64Process2(GetCurrentProcess(), &processMachine, &nativeMachine))
{
if (IMAGE_FILE_MACHINE_ARM64 == nativeMachine || IMAGE_FILE_MACHINE_ARM == nativeMachine)
isARM = TRUE;
else
isARM = FALSE;
valid = TRUE;
}
}
if (!valid)
{
SYSTEM_INFO systemInfo;
GetNativeSystemInfo(&systemInfo);
if (systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_ARM || systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_ARM64)
isARM = TRUE;
else
isARM = FALSE;
}
valid = TRUE;
return isARM;
#endif
}
BOOL IsServerOS ()
{
OSVERSIONINFOEXW osVer;
osVer.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEXW);
GetVersionExW ((LPOSVERSIONINFOW) &osVer);
return (osVer.wProductType == VER_NT_SERVER || osVer.wProductType == VER_NT_DOMAIN_CONTROLLER);
}
// Returns TRUE, if the currently running operating system is installed in a hidden volume. If it's not, or if
// there's an error, returns FALSE.
BOOL IsHiddenOSRunning (void)
{
static BOOL statusCached = FALSE;
static BOOL hiddenOSRunning;
if (!statusCached)
{
try
{
hiddenOSRunning = BootEncryption (MainDlg).IsHiddenSystemRunning();
}
catch (...)
{
hiddenOSRunning = FALSE;
}
statusCached = TRUE;
}
return hiddenOSRunning;
}
BOOL EnableWow64FsRedirection (BOOL enable)
{
typedef BOOLEAN (__stdcall *Wow64EnableWow64FsRedirection_t) (BOOL enable);
Wow64EnableWow64FsRedirection_t wow64EnableWow64FsRedirection = (Wow64EnableWow64FsRedirection_t) GetProcAddress (GetModuleHandle (L"kernel32"), "Wow64EnableWow64FsRedirection");
if (!wow64EnableWow64FsRedirection)
return FALSE;
return wow64EnableWow64FsRedirection (enable);
}
BOOL RestartComputer (BOOL bShutdown)
{
TOKEN_PRIVILEGES tokenPrivil;
HANDLE hTkn;
if (!OpenProcessToken (GetCurrentProcess (), TOKEN_QUERY|TOKEN_ADJUST_PRIVILEGES, &hTkn))
{
return false;
}
LookupPrivilegeValue (NULL, SE_SHUTDOWN_NAME, &tokenPrivil.Privileges[0].Luid);
tokenPrivil.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
tokenPrivil.PrivilegeCount = 1;
AdjustTokenPrivileges (hTkn, false, &tokenPrivil, 0, (PTOKEN_PRIVILEGES) NULL, 0);
if (GetLastError() != ERROR_SUCCESS)
{
CloseHandle(hTkn);
return false;
}
if (!ExitWindowsEx (bShutdown? EWX_POWEROFF: EWX_REBOOT,
SHTDN_REASON_MAJOR_OTHER | SHTDN_REASON_MINOR_OTHER | SHTDN_REASON_FLAG_PLANNED))
{
CloseHandle(hTkn);
return false;
}
CloseHandle(hTkn);
return true;
}
std::wstring GetWindowsEdition ()
{
wstring osname = L"win";
OSVERSIONINFOEXW osVer;
osVer.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEXW);
GetVersionExW ((LPOSVERSIONINFOW) &osVer);
BOOL home = (osVer.wSuiteMask & VER_SUITE_PERSONAL);
BOOL server = (osVer.wProductType == VER_NT_SERVER || osVer.wProductType == VER_NT_DOMAIN_CONTROLLER);
HKEY hkey;
wchar_t productName[300] = {0};
DWORD productNameSize = sizeof (productName);
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", 0, KEY_QUERY_VALUE, &hkey) == ERROR_SUCCESS)
{
if (RegQueryValueEx (hkey, L"ProductName", 0, 0, (LPBYTE) &productName, &productNameSize) != ERROR_SUCCESS || productNameSize < 1)
productName[0] = 0;
RegCloseKey (hkey);
}
switch (nCurrentOS)
{
case WIN_2000:
osname += L"2000";
break;
case WIN_XP:
case WIN_XP64:
osname += L"xp";
osname += home ? L"-home" : L"-pro";
break;
case WIN_SERVER_2003:
osname += L"2003";
break;
case WIN_VISTA:
osname += L"vista";
break;
case WIN_SERVER_2008:
osname += L"2008";
break;
case WIN_7:
osname += L"7";
break;
case WIN_SERVER_2008_R2:
osname += L"2008r2";
break;
default:
wstringstream s;
s << CurrentOSMajor << L"." << CurrentOSMinor;
osname += s.str();
break;
}
if (server)
osname += L"-server";
if (IsOSAtLeast (WIN_VISTA))
{
if (home)
osname += L"-home";
else if (wcsstr (productName, L"Standard") != 0)
osname += L"-standard";
else if (wcsstr (productName, L"Professional") != 0)
osname += L"-pro";
else if (wcsstr (productName, L"Business") != 0)
osname += L"-business";
else if (wcsstr (productName, L"Enterprise") != 0)
osname += L"-enterprise";
else if (wcsstr (productName, L"Datacenter") != 0)
osname += L"-datacenter";
else if (wcsstr (productName, L"Ultimate") != 0)
osname += L"-ultimate";
}
if (GetSystemMetrics (SM_STARTER))
osname += L"-starter";
else if (wcsstr (productName, L"Basic") != 0)
osname += L"-basic";
if (Is64BitOs())
osname += IsARM()? L"-arm64" : L"-x64";
if (CurrentOSServicePack > 0)
{
wstringstream s;
s << L"-sp" << CurrentOSServicePack;
osname += s.str();
}
return osname;
}
#ifdef SETUP
extern wchar_t InstallationPath[TC_MAX_PATH];
#endif
void Applink (const char *dest)
{
wchar_t url [MAX_URL_LENGTH] = {0};
wchar_t page[TC_MAX_PATH] = {0};
wchar_t installDir[TC_MAX_PATH] = {0};
BOOL buildUrl = TRUE;
int r;
ArrowWaitCursor ();
#ifdef SETUP
StringCbCopyW (installDir, sizeof (installDir), InstallationPath);
#else
GetModPath (installDir, TC_MAX_PATH);
#endif
if (strcmp(dest, "donate") == 0)
{
StringCbCopyW (page, sizeof (page),L"Donation.html");
}
else if (strcmp(dest, "main") == 0)
{
StringCbCopyW (url, sizeof (url), TC_HOMEPAGE);
buildUrl = FALSE;
}
else if (strcmp(dest,"localizations") == 0)
{
StringCbCopyW (page, sizeof (page),L"Language%20Packs.html");
}
else if (strcmp(dest, "beginnerstutorial") == 0 || strcmp(dest,"tutorial") == 0)
{
StringCbCopyW (page, sizeof (page),L"Beginner%27s%20Tutorial.html");
}
else if (strcmp(dest, "releasenotes") == 0 || strcmp(dest, "history") == 0)
{
StringCbCopyW (page, sizeof (page),L"Release%20Notes.html");
}
else if (strcmp(dest, "hwacceleration") == 0)
{
StringCbCopyW (page, sizeof (page),L"Hardware%20Acceleration.html");
}
else if (strcmp(dest, "parallelization") == 0)
{
StringCbCopyW (page, sizeof (page),L"Parallelization.html");
}
else if (strcmp(dest, "help") == 0)
{
StringCbCopyW (page, sizeof (page),L"Documentation.html");
}
else if (strcmp(dest, "onlinehelp") == 0)
{
StringCbCopyW (url, sizeof (url),L"https://www.veracrypt.fr/en/Documentation.html");
buildUrl = FALSE;
}
else if (strcmp(dest, "keyfiles") == 0)
{
StringCbCopyW (page, sizeof (page),L"Keyfiles.html");
}
else if (strcmp(dest, "introcontainer") == 0)
{
StringCbCopyW (page, sizeof (page),L"Creating%20New%20Volumes.html");
}
else if (strcmp(dest, "introsysenc") == 0)
{
StringCbCopyW (page, sizeof (page),L"System%20Encryption.html");
}
else if (strcmp(dest, "hiddensysenc") == 0)
{
StringCbCopyW (page, sizeof (page),L"VeraCrypt%20Hidden%20Operating%20System.html");
}
else if (strcmp(dest, "sysencprogressinfo") == 0)
{
StringCbCopyW (page, sizeof (page),L"System%20Encryption.html");
}
else if (strcmp(dest, "hiddenvolume") == 0)
{
StringCbCopyW (page, sizeof (page),L"Hidden%20Volume.html");
}
else if (strcmp(dest, "aes") == 0)
{
StringCbCopyW (page, sizeof (page),L"AES.html");
}
else if (strcmp(dest, "serpent") == 0)
{
StringCbCopyW (page, sizeof (page),L"Serpent.html");
}
else if (strcmp(dest, "twofish") == 0)
{
StringCbCopyW (page, sizeof (page),L"Twofish.html");
}
else if (strcmp(dest, "kuznyechik") == 0)
{
StringCbCopyW (page, sizeof (page),L"Kuznyechik.html");
}
else if (strcmp(dest, "camellia") == 0)
{
StringCbCopyW (page, sizeof (page),L"Camellia.html");
}
else if (strcmp(dest, "cascades") == 0)
{
StringCbCopyW (page, sizeof (page),L"Cascades.html");
}
else if (strcmp(dest, "hashalgorithms") == 0)
{
StringCbCopyW (page, sizeof (page),L"Hash%20Algorithms.html");
}
else if (strcmp(dest, "isoburning") == 0)
{
StringCbCopyW (url, sizeof (url),L"https://cdburnerxp.se/en/home");
buildUrl = FALSE;
}
else if (strcmp(dest, "sysfavorites") == 0)
{
StringCbCopyW (page, sizeof (page),L"System%20Favorite%20Volumes.html");
}
else if (strcmp(dest, "favorites") == 0)
{
StringCbCopyW (page, sizeof (page),L"Favorite%20Volumes.html");
}
else if (strcmp(dest, "hiddenvolprotection") == 0)
{
StringCbCopyW (page, sizeof (page),L"Protection%20of%20Hidden%20Volumes.html");
}
else if (strcmp(dest, "faq") == 0)
{
StringCbCopyW (page, sizeof (page),L"FAQ.html");
}
else if (strcmp(dest, "downloads") == 0)
{
StringCbCopyW (page, sizeof (page),L"Downloads.html");
}
else if (strcmp(dest, "news") == 0)
{
StringCbCopyW (page, sizeof (page),L"News.html");
}
else if (strcmp(dest, "contact") == 0)
{
StringCbCopyW (page, sizeof (page),L"Contact.html");
}
else if (strcmp(dest, "pim") == 0)
{
StringCbCopyW (page, sizeof (page),L"Personal%20Iterations%20Multiplier%20%28PIM%29.html");
}
else
{
StringCbCopyW (url, sizeof (url),TC_APPLINK);
buildUrl = FALSE;
}
if (buildUrl)
{
StringCbPrintfW (url, sizeof (url), L"file:///%sdocs/html/en/%s", installDir, page);
CorrectURL (url);
}
if (IsOSAtLeast (WIN_VISTA) && IsAdmin ())
{
int openDone = 0;
if (buildUrl)
{
wchar_t pageFileName [TC_MAX_PATH] = {0};
DWORD cchUnescaped = ARRAYSIZE(pageFileName);
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))
{
std::wstring pageFullPath = installDir;
pageFullPath += L"docs\\html\\en\\";
pageFullPath += pageFileName;
if (!FileExists (pageFullPath.c_str()))
{
// fallback to online resources
StringCbPrintfW (url, sizeof (url), L"https://www.veracrypt.fr/en/%s", page);
SafeOpenURL (url);
openDone = 1;
}
}
}
if (!openDone)
{
SafeOpenURL (url);
}
}
else
{
r = (int) ShellExecuteW (NULL, L"open", url, NULL, NULL, SW_SHOWNORMAL);
if (((r == ERROR_FILE_NOT_FOUND) || (r == ERROR_PATH_NOT_FOUND)) && buildUrl)
{
// fallback to online resources
StringCbPrintfW (url, sizeof (url), L"https://www.veracrypt.fr/en/%s", page);
ShellExecuteW (NULL, L"open", url, NULL, NULL, SW_SHOWNORMAL);
}
}
Sleep (200);
NormalCursor ();
}
wchar_t *RelativePath2Absolute (wchar_t *szFileName)
{
if (szFileName[0] != L'\\'
&& wcschr (szFileName, L':') == 0
&& wcsstr (szFileName, L"Volume{") != szFileName)
{
wchar_t path[MAX_PATH*2];
GetCurrentDirectory (MAX_PATH, path);
if (path[wcslen (path) - 1] != L'\\')
StringCbCatW (path, (MAX_PATH * 2), L"\\");
StringCbCatW (path, (MAX_PATH * 2), szFileName);
StringCbCopyW (szFileName, MAX_PATH + 1, path); // szFileName size is always at least (MAX_PATH + 1)
}
return szFileName;
}
void HandleDriveNotReadyError (HWND hwnd)
{
HKEY hkey = 0;
DWORD value = 0, size = sizeof (DWORD);
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Services\\MountMgr",
0, KEY_READ, &hkey) != ERROR_SUCCESS)
return;
if (RegQueryValueEx (hkey, L"NoAutoMount", 0, 0, (LPBYTE) &value, &size) == ERROR_SUCCESS
&& value != 0)
{
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);
RegCloseKey (hkey);
}
BOOL CALLBACK CloseTCWindowsEnum (HWND hwnd, LPARAM lParam)
{
LONG_PTR userDataVal = GetWindowLongPtrW (hwnd, GWLP_USERDATA);
if ((userDataVal == (LONG_PTR) 'VERA') || (userDataVal == (LONG_PTR) 'TRUE')) // Prior to 1.0e, 'TRUE' was used for VeraCrypt dialogs
{
wchar_t name[1024] = { 0 };
GetWindowText (hwnd, name, ARRAYSIZE (name) - 1);
if (hwnd != MainDlg && wcsstr (name, L"VeraCrypt"))
{
PostMessage (hwnd, TC_APPMSG_CLOSE_BKG_TASK, 0, 0);
PostMessage (hwnd, WM_CLOSE, 0, 0);
if (lParam != 0)
*((BOOL *)lParam) = TRUE;
}
}
return TRUE;
}
BOOL CALLBACK FindTCWindowEnum (HWND hwnd, LPARAM lParam)
{
if (*(HWND *)lParam == hwnd)
return TRUE;
LONG_PTR userDataVal = GetWindowLongPtrW (hwnd, GWLP_USERDATA);
if ((userDataVal == (LONG_PTR) 'VERA') || (userDataVal == (LONG_PTR) 'TRUE')) // Prior to 1.0e, 'TRUE' was used for VeraCrypt dialogs
{
wchar_t name[32] = { 0 };
GetWindowText (hwnd, name, ARRAYSIZE (name) - 1);
if (hwnd != MainDlg && wcscmp (name, L"VeraCrypt") == 0)
{
if (lParam != 0)
*((HWND *)lParam) = hwnd;
}
}
return TRUE;
}
BYTE *MapResource (wchar_t *resourceType, int resourceId, PDWORD size)
{
HGLOBAL hResL;
HRSRC hRes;
- HINSTANCE hResInst = NULL;
+ HINSTANCE hResInst = NULL;
#ifdef SETUP_DLL
// In case we're being called from the SetupDLL project, FindResource()
// and LoadResource() with NULL will fail since we're in a DLL. We need
// to call them with the HINSTANCE of the DLL instead, which we set in
// Setup.c of SetupDLL, DllMain() function.
hResInst = hInst;
#endif
hRes = FindResource (hResInst, MAKEINTRESOURCE(resourceId), resourceType);
hResL = LoadResource (hResInst, hRes);
-
+
if (size != NULL)
*size = SizeofResource (hResInst, hRes);
return (BYTE *) LockResource (hResL);
}
void InconsistencyResolved (char *techInfo)
{
wchar_t finalMsg[8024];
StringCbPrintfW (finalMsg, sizeof(finalMsg), GetString ("INCONSISTENCY_RESOLVED"), techInfo);
MessageBoxW (MainDlg, finalMsg, lpszTitle, MB_ICONWARNING | MB_SETFOREGROUND | MB_TOPMOST);
}
void ReportUnexpectedState (const char *techInfo)
{
wchar_t finalMsg[8024];
StringCbPrintfW (finalMsg, sizeof(finalMsg), GetString ("UNEXPECTED_STATE"), techInfo);
MessageBoxW (MainDlg, finalMsg, lpszTitle, MB_ICONERROR | MB_SETFOREGROUND | MB_TOPMOST);
}
#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 status = ERR_PARAMETER_INCORRECT;
int volumeType;
wchar_t szDiskFile[TC_MAX_PATH], szCFDevice[TC_MAX_PATH];
wchar_t szDosDevice[TC_MAX_PATH];
char buffer[TC_VOLUME_HEADER_EFFECTIVE_SIZE];
LARGE_INTEGER headerOffset;
DWORD dwResult;
DISK_GEOMETRY_EX deviceGeometry;
context->VolumeIsOpen = FALSE;
context->CryptoInfo = NULL;
context->HostFileHandle = INVALID_HANDLE_VALUE;
context->TimestampsValid = FALSE;
CreateFullVolumePath (szDiskFile, sizeof(szDiskFile), volumePath, &context->IsDevice);
if (context->IsDevice)
{
status = FakeDosNameForDevice (szDiskFile, szDosDevice, sizeof(szDosDevice), szCFDevice, sizeof(szCFDevice), FALSE);
if (status != 0)
return status;
preserveTimestamps = FALSE;
if (!GetDriveGeometry (volumePath, &deviceGeometry))
{
status = ERR_OS_ERROR;
goto error;
}
}
else
StringCbCopyW (szCFDevice, sizeof(szCFDevice), szDiskFile);
context->HostFileHandle = CreateFile (szCFDevice, GENERIC_READ | (write ? GENERIC_WRITE : (!context->IsDevice && preserveTimestamps? FILE_WRITE_ATTRIBUTES : 0)), FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (context->HostFileHandle == INVALID_HANDLE_VALUE)
{
status = ERR_OS_ERROR;
goto error;
}
if (context->IsDevice)
{
// Try to gain "raw" access to the partition in case there is a live filesystem on it (otherwise,
// the NTFS driver guards hidden sectors and prevents e.g. header backup restore after the user
// accidentally quick-formats a dismounted partition-hosted TrueCrypt volume as NTFS, etc.)
DeviceIoControl (context->HostFileHandle, FSCTL_ALLOW_EXTENDED_DASD_IO, NULL, 0, NULL, 0, &dwResult, NULL);
}
context->VolumeIsOpen = TRUE;
// Remember the container modification/creation date and time
if (!context->IsDevice && preserveTimestamps)
{
// ensure that Last Access and Last Write timestamps are not modified
FILETIME ftLastAccessTime;
ftLastAccessTime.dwHighDateTime = 0xFFFFFFFF;
ftLastAccessTime.dwLowDateTime = 0xFFFFFFFF;
SetFileTime (context->HostFileHandle, NULL, &ftLastAccessTime, NULL);
if (GetFileTime (context->HostFileHandle, &context->CreationTime, &context->LastAccessTime, &context->LastWriteTime) == 0)
context->TimestampsValid = FALSE;
else
context->TimestampsValid = TRUE;
}
// Determine host size
if (context->IsDevice)
{
PARTITION_INFORMATION diskInfo;
if (GetPartitionInfo (volumePath, &diskInfo))
{
context->HostSize = diskInfo.PartitionLength.QuadPart;
}
else
{
BYTE dgBuffer[256];
if (!DeviceIoControl (context->HostFileHandle, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, NULL, 0, dgBuffer, sizeof (dgBuffer), &dwResult, NULL))
{
DISK_GEOMETRY geo;
if (DeviceIoControl (context->HostFileHandle, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, (LPVOID) &geo, sizeof (geo), &dwResult, NULL))
{
((PDISK_GEOMETRY_EX) dgBuffer)->DiskSize.QuadPart = geo.Cylinders.QuadPart * geo.SectorsPerTrack * geo.TracksPerCylinder * geo.BytesPerSector;
if (CurrentOSMajor >= 6)
{
STORAGE_READ_CAPACITY storage = {0};
storage.Version = sizeof (STORAGE_READ_CAPACITY);
storage.Size = sizeof (STORAGE_READ_CAPACITY);
if (DeviceIoControl (context->HostFileHandle, IOCTL_STORAGE_READ_CAPACITY, NULL, 0, (LPVOID) &storage, sizeof (storage), &dwResult, NULL))
{
((PDISK_GEOMETRY_EX) dgBuffer)->DiskSize.QuadPart = storage.DiskLength.QuadPart;
}
}
}
else
{
status = ERR_OS_ERROR;
goto error;
}
}
context->HostSize = ((PDISK_GEOMETRY_EX) dgBuffer)->DiskSize.QuadPart;
}
if (context->HostSize == 0)
{
status = ERR_VOL_SIZE_WRONG;
goto error;
}
}
else
{
LARGE_INTEGER fileSize;
if (!GetFileSizeEx (context->HostFileHandle, &fileSize))
{
status = ERR_OS_ERROR;
goto error;
}
context->HostSize = fileSize.QuadPart;
}
for (volumeType = TC_VOLUME_TYPE_NORMAL; volumeType < TC_VOLUME_TYPE_COUNT; volumeType++)
{
// Seek the volume header
switch (volumeType)
{
case TC_VOLUME_TYPE_NORMAL:
headerOffset.QuadPart = useBackupHeader ? context->HostSize - TC_VOLUME_HEADER_GROUP_SIZE : TC_VOLUME_HEADER_OFFSET;
break;
case TC_VOLUME_TYPE_HIDDEN:
if (TC_HIDDEN_VOLUME_HEADER_OFFSET + TC_VOLUME_HEADER_SIZE > context->HostSize)
continue;
headerOffset.QuadPart = useBackupHeader ? context->HostSize - TC_VOLUME_HEADER_SIZE : TC_HIDDEN_VOLUME_HEADER_OFFSET;
break;
}
if (!SetFilePointerEx ((HANDLE) context->HostFileHandle, headerOffset, NULL, FILE_BEGIN))
{
status = ERR_OS_ERROR;
goto error;
}
// Read volume header
DWORD bytesRead;
if (!ReadEffectiveVolumeHeader (context->IsDevice, context->HostFileHandle, (byte *) buffer, &bytesRead))
{
status = ERR_OS_ERROR;
goto error;
}
if (bytesRead != sizeof (buffer)
&& context->IsDevice)
{
// If FSCTL_ALLOW_EXTENDED_DASD_IO failed and there is a live filesystem on the partition, then the
// filesystem driver may report EOF when we are reading hidden sectors (when the filesystem is
// shorter than the partition). This can happen for example after the user quick-formats a dismounted
// partition-hosted TrueCrypt volume and then tries to read the embedded backup header.
memset (buffer, 0, sizeof (buffer));
}
// Decrypt volume header
status = ReadVolumeHeader (FALSE, buffer, password, pkcs5_prf, pim, truecryptMode, &context->CryptoInfo, NULL);
if (status == ERR_PASSWORD_WRONG)
continue; // Try next volume type
break;
}
if (status == ERR_SUCCESS)
return status;
error:
DWORD sysError = GetLastError ();
CloseVolume (context);
SetLastError (sysError);
return status;
}
void CloseVolume (OpenVolumeContext *context)
{
if (!context->VolumeIsOpen)
return;
if (context->HostFileHandle != INVALID_HANDLE_VALUE)
{
if (context->TimestampsValid)
SetFileTime (context->HostFileHandle, &context->CreationTime, &context->LastAccessTime, &context->LastWriteTime);
CloseHandle (context->HostFileHandle);
context->HostFileHandle = INVALID_HANDLE_VALUE;
}
if (context->CryptoInfo)
{
crypto_close (context->CryptoInfo);
context->CryptoInfo = NULL;
}
context->VolumeIsOpen = FALSE;
}
int ReEncryptVolumeHeader (HWND hwndDlg, char *buffer, BOOL bBoot, CRYPTO_INFO *cryptoInfo, Password *password, int pim, BOOL wipeMode)
{
CRYPTO_INFO *newCryptoInfo = NULL;
RandSetHashFunction (cryptoInfo->pkcs5);
if (Randinit() != ERR_SUCCESS)
{
if (CryptoAPILastError == ERROR_SUCCESS)
return ERR_RAND_INIT_FAILED;
else
return ERR_CAPI_INIT_FAILED;
}
UserEnrichRandomPool (NULL);
int status = CreateVolumeHeaderInMemory (hwndDlg, bBoot,
buffer,
cryptoInfo->ea,
cryptoInfo->mode,
password,
cryptoInfo->pkcs5,
pim,
(char *) cryptoInfo->master_keydata,
&newCryptoInfo,
cryptoInfo->VolumeSize.Value,
cryptoInfo->hiddenVolume ? cryptoInfo->hiddenVolumeSize : 0,
cryptoInfo->EncryptedAreaStart.Value,
cryptoInfo->EncryptedAreaLength.Value,
cryptoInfo->RequiredProgramVersion,
cryptoInfo->HeaderFlags,
cryptoInfo->SectorSize,
wipeMode);
if (newCryptoInfo != NULL)
crypto_close (newCryptoInfo);
return status;
}
#endif // !SETUP
BOOL IsPagingFileActive (BOOL checkNonWindowsPartitionsOnly)
{
// GlobalMemoryStatusEx() cannot be used to determine if a paging file is active
wchar_t data[65536];
DWORD size = sizeof (data);
if (IsPagingFileWildcardActive())
return TRUE;
if (ReadLocalMachineRegistryMultiString (L"System\\CurrentControlSet\\Control\\Session Manager\\Memory Management", L"PagingFiles", data, &size)
&& size > 24 && !checkNonWindowsPartitionsOnly)
return TRUE;
if (!IsAdmin())
AbortProcess ("UAC_INIT_ERROR");
for (wchar_t drive = L'C'; drive <= L'Z'; ++drive)
{
// Query geometry of the drive first to prevent "no medium" pop-ups
wstring drivePath = L"\\\\.\\X:";
drivePath[4] = drive;
if (checkNonWindowsPartitionsOnly)
{
wchar_t sysDir[MAX_PATH];
if (GetSystemDirectory (sysDir, ARRAYSIZE (sysDir)) != 0 && towupper (sysDir[0]) == drive)
continue;
}
HANDLE handle = CreateFile (drivePath.c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (handle == INVALID_HANDLE_VALUE)
continue;
BYTE dgBuffer[256];
DWORD dwResult;
if (!DeviceIoControl (handle, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, NULL, 0, dgBuffer, sizeof (dgBuffer), &dwResult, NULL)
&& !DeviceIoControl (handle, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, dgBuffer, sizeof (dgBuffer), &dwResult, NULL))
{
CloseHandle (handle);
continue;
}
CloseHandle (handle);
// Test if a paging file exists and is locked by another process
wstring path = L"X:\\pagefile.sys";
path[0] = drive;
handle = CreateFile (path.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
if (handle != INVALID_HANDLE_VALUE)
CloseHandle (handle);
else if (GetLastError() == ERROR_SHARING_VIOLATION)
return TRUE;
}
return FALSE;
}
BOOL IsPagingFileWildcardActive ()
{
wchar_t pagingFiles[65536];
DWORD size = sizeof (pagingFiles);
wchar_t *mmKey = L"System\\CurrentControlSet\\Control\\Session Manager\\Memory Management";
if (!ReadLocalMachineRegistryString (mmKey, L"PagingFiles", pagingFiles, &size))
{
size = sizeof (pagingFiles);
if (!ReadLocalMachineRegistryMultiString (mmKey, L"PagingFiles", pagingFiles, &size))
size = 0;
}
return size > 0 && wcsstr (pagingFiles, L"?:\\") == pagingFiles;
}
BOOL DisablePagingFile ()
{
wchar_t empty[] = { 0, 0 };
return WriteLocalMachineRegistryMultiString (L"System\\CurrentControlSet\\Control\\Session Manager\\Memory Management", L"PagingFiles", empty, sizeof (empty));
}
std::wstring SingleStringToWide (const std::string &singleString)
{
if (singleString.empty())
return std::wstring();
WCHAR wbuf[65536];
int wideLen = MultiByteToWideChar (CP_ACP, 0, singleString.c_str(), -1, wbuf, array_capacity (wbuf) - 1);
// We don't throw exception here and only return empty string.
// All calls to this function use valid strings.
// throw_sys_if (wideLen == 0);
wbuf[wideLen] = 0;
return wbuf;
}
std::wstring Utf8StringToWide (const std::string &utf8String)
{
if (utf8String.empty())
return std::wstring();
WCHAR wbuf[65536];
int wideLen = MultiByteToWideChar (CP_UTF8, 0, utf8String.c_str(), -1, wbuf, array_capacity (wbuf) - 1);
throw_sys_if (wideLen == 0);
wbuf[wideLen] = 0;
return wbuf;
}
std::string WideToUtf8String (const std::wstring &wideString)
{
if (wideString.empty())
return std::string();
char buf[65536];
int len = WideCharToMultiByte (CP_UTF8, 0, wideString.c_str(), -1, buf, array_capacity (buf) - 1, NULL, NULL);
throw_sys_if (len == 0);
buf[len] = 0;
return buf;
}
#ifndef SETUP
BOOL CALLBACK SecurityTokenPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
WORD lw = LOWORD (wParam);
static string *password;
switch (msg)
{
case WM_INITDIALOG:
{
password = (string *) lParam;
LocalizeDialog (hwndDlg, "IDD_TOKEN_PASSWORD");
wchar_t s[1024];
StringCbPrintfW (s, sizeof(s), GetString ("ENTER_TOKEN_PASSWORD"), Utf8StringToWide (password->c_str()).c_str());
SetWindowTextW (GetDlgItem (hwndDlg, IDT_TOKEN_PASSWORD_INFO), s);
SendMessage (GetDlgItem (hwndDlg, IDC_TOKEN_PASSWORD), EM_LIMITTEXT, SecurityToken::MaxPasswordLength, 0);
SetForegroundWindow (hwndDlg);
SetFocus (GetDlgItem (hwndDlg, IDC_TOKEN_PASSWORD));
if (!bSecureDesktopOngoing)
{
PasswordEditDropTarget* pTarget = new PasswordEditDropTarget ();
if (pTarget->Register (hwndDlg))
{
SetWindowLongPtr (hwndDlg, DWLP_USER, (LONG_PTR) pTarget);
}
else
delete pTarget;
}
}
return 0;
case WM_COMMAND:
if (lw == IDCANCEL || lw == IDOK)
{
if (lw == IDOK)
{
wchar_t passwordWide[SecurityToken::MaxPasswordLength + 1];
if (GetWindowTextW (GetDlgItem (hwndDlg, IDC_TOKEN_PASSWORD), passwordWide, SecurityToken::MaxPasswordLength + 1) == 0)
{
handleWin32Error (hwndDlg, SRC_POS);
break;
}
char passwordUtf8[SecurityToken::MaxPasswordLength + 1];
int len = WideCharToMultiByte (CP_UTF8, 0, passwordWide, -1, passwordUtf8, array_capacity (passwordUtf8) - 1, nullptr, nullptr);
passwordUtf8[len] = 0;
*password = passwordUtf8;
burn (passwordWide, sizeof (passwordWide));
burn (passwordUtf8, sizeof (passwordUtf8));
}
// Attempt to wipe password stored in the input field buffer
wchar_t tmp[SecurityToken::MaxPasswordLength+1];
wmemset (tmp, 'X', SecurityToken::MaxPasswordLength);
tmp[SecurityToken::MaxPasswordLength] = 0;
SetWindowText (GetDlgItem (hwndDlg, IDC_TOKEN_PASSWORD), tmp);
EndDialog (hwndDlg, lw);
}
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;
}
struct NewSecurityTokenKeyfileDlgProcParams
{
CK_SLOT_ID SlotId;
string Name;
};
static BOOL CALLBACK NewSecurityTokenKeyfileDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static NewSecurityTokenKeyfileDlgProcParams *newParams;
WORD lw = LOWORD (wParam);
switch (msg)
{
case WM_INITDIALOG:
{
LocalizeDialog (hwndDlg, "IDD_NEW_TOKEN_KEYFILE");
newParams = (NewSecurityTokenKeyfileDlgProcParams *) lParam;
WaitCursor();
finally_do ({ NormalCursor(); });
list <SecurityTokenInfo> tokens;
try
{
tokens = SecurityToken::GetAvailableTokens();
}
catch (Exception &e)
{
e.Show (hwndDlg);
}
if (tokens.empty())
{
Error ("NO_TOKENS_FOUND", hwndDlg);
EndDialog (hwndDlg, IDCANCEL);
return 1;
}
foreach (const SecurityTokenInfo &token, tokens)
{
wstringstream tokenLabel;
tokenLabel << L"[" << token.SlotId << L"] " << token.Label;
AddComboPair (GetDlgItem (hwndDlg, IDC_SELECTED_TOKEN), tokenLabel.str().c_str(), token.SlotId);
}
ComboBox_SetCurSel (GetDlgItem (hwndDlg, IDC_SELECTED_TOKEN), 0);
SetWindowTextW (GetDlgItem (hwndDlg, IDC_TOKEN_KEYFILE_NAME), Utf8StringToWide (newParams->Name).c_str());
return 1;
}
case WM_COMMAND:
switch (lw)
{
case IDOK:
{
int selectedToken = ComboBox_GetCurSel (GetDlgItem (hwndDlg, IDC_SELECTED_TOKEN));
if (selectedToken == CB_ERR)
{
EndDialog (hwndDlg, IDCANCEL);
return 1;
}
newParams->SlotId = (CK_SLOT_ID) ComboBox_GetItemData (GetDlgItem (hwndDlg, IDC_SELECTED_TOKEN), selectedToken);
wchar_t name[1024];
if (GetWindowTextW (GetDlgItem (hwndDlg, IDC_TOKEN_KEYFILE_NAME), name, array_capacity (name)) != 0)
{
try
{
newParams->Name = WideToUtf8String (name);
}
catch (...) { }
}
EndDialog (hwndDlg, IDOK);
return 1;
}
case IDCANCEL:
EndDialog (hwndDlg, IDCANCEL);
return 1;
}
if (HIWORD (wParam) == EN_CHANGE)
{
wchar_t name[2];
EnableWindow (GetDlgItem (hwndDlg, IDOK), (GetWindowTextW (GetDlgItem (hwndDlg, IDC_TOKEN_KEYFILE_NAME), name, array_capacity (name)) != 0));
return 1;
}
}
return 0;
}
static void SecurityTokenKeyfileDlgFillList (HWND hwndDlg, const vector <SecurityTokenKeyfile> &keyfiles)
{
HWND tokenListControl = GetDlgItem (hwndDlg, IDC_TOKEN_FILE_LIST);
LVITEMW lvItem;
int line = 0;
ListView_DeleteAllItems (tokenListControl);
foreach (const SecurityTokenKeyfile &keyfile, keyfiles)
{
memset (&lvItem, 0, sizeof(lvItem));
lvItem.mask = LVIF_TEXT;
lvItem.iItem = line++;
wstringstream s;
s << keyfile.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());
}
BOOL selected = (ListView_GetNextItem (GetDlgItem (hwndDlg, IDC_TOKEN_FILE_LIST), -1, LVIS_SELECTED) != -1);
EnableWindow (GetDlgItem (hwndDlg, IDC_EXPORT), selected);
EnableWindow (GetDlgItem (hwndDlg, IDC_DELETE), selected);
}
static list <SecurityTokenKeyfile> SecurityTokenKeyfileDlgGetSelected (HWND hwndDlg, const vector <SecurityTokenKeyfile> &keyfiles)
{
HWND tokenListControl = GetDlgItem (hwndDlg, IDC_TOKEN_FILE_LIST);
list <SecurityTokenKeyfile> selectedKeyfiles;
int itemId = -1;
while ((itemId = ListView_GetNextItem (tokenListControl, itemId, LVIS_SELECTED)) != -1)
{
selectedKeyfiles.push_back (keyfiles[itemId]);
}
return selectedKeyfiles;
}
BOOL CALLBACK SecurityTokenKeyfileDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static list <SecurityTokenKeyfilePath> *selectedTokenKeyfiles;
static vector <SecurityTokenKeyfile> keyfiles;
WORD lw = LOWORD (wParam);
switch (msg)
{
case WM_INITDIALOG:
{
selectedTokenKeyfiles = (list <SecurityTokenKeyfilePath> *) lParam;
LVCOLUMNW LvCol;
HWND tokenListControl = GetDlgItem (hwndDlg, IDC_TOKEN_FILE_LIST);
LocalizeDialog (hwndDlg, selectedTokenKeyfiles ? "SELECT_TOKEN_KEYFILES" : "IDD_TOKEN_KEYFILES");
SendMessage (tokenListControl,LVM_SETEXTENDEDLISTVIEWSTYLE, 0,
LVS_EX_FULLROWSELECT|LVS_EX_HEADERDRAGDROP|LVS_EX_TWOCLICKACTIVATE|LVS_EX_LABELTIP
);
memset (&LvCol, 0, sizeof(LvCol));
LvCol.mask = LVCF_TEXT|LVCF_WIDTH|LVCF_SUBITEM|LVCF_FMT;
LvCol.pszText = GetString ("TOKEN_SLOT_ID");
LvCol.cx = CompensateXDPI (40);
LvCol.fmt = LVCFMT_CENTER;
SendMessage (tokenListControl, LVM_INSERTCOLUMNW, 1, (LPARAM)&LvCol);
LvCol.pszText = GetString ("TOKEN_NAME");
LvCol.cx = CompensateXDPI (128);
LvCol.fmt = LVCFMT_LEFT;
SendMessage (tokenListControl, LVM_INSERTCOLUMNW, 2, (LPARAM)&LvCol);
LvCol.pszText = GetString ("TOKEN_DATA_OBJECT_LABEL");
LvCol.cx = CompensateXDPI (195);
LvCol.fmt = LVCFMT_LEFT;
SendMessage (tokenListControl, LVM_INSERTCOLUMNW, 3, (LPARAM)&LvCol);
keyfiles.clear();
try
{
WaitCursor();
finally_do ({ NormalCursor(); });
keyfiles = SecurityToken::GetAvailableKeyfiles();
}
catch (UserAbort&)
{
EndDialog (hwndDlg, IDCANCEL);
return 1;
}
catch (Exception &e)
{
e.Show (hwndDlg);
if (keyfiles.empty())
{
EndDialog (hwndDlg, IDCANCEL);
return 1;
}
}
SecurityTokenKeyfileDlgFillList (hwndDlg, keyfiles);
return 1;
}
case WM_COMMAND:
case WM_NOTIFY:
if (msg == WM_COMMAND && lw == IDOK || msg == WM_NOTIFY && ((NMHDR *)lParam)->code == LVN_ITEMACTIVATE)
{
if (selectedTokenKeyfiles)
{
foreach (const SecurityTokenKeyfile &keyfile, SecurityTokenKeyfileDlgGetSelected (hwndDlg, keyfiles))
{
selectedTokenKeyfiles->push_back (SecurityTokenKeyfilePath (keyfile));
}
}
EndDialog (hwndDlg, IDOK);
return 1;
}
if (msg == WM_NOTIFY && ((LPNMHDR) lParam)->code == LVN_ITEMCHANGED)
{
BOOL selected = (ListView_GetNextItem (GetDlgItem (hwndDlg, IDC_TOKEN_FILE_LIST), -1, LVIS_SELECTED) != -1);
EnableWindow (GetDlgItem (hwndDlg, IDC_EXPORT), selected);
EnableWindow (GetDlgItem (hwndDlg, IDC_DELETE), selected);
return 1;
}
if (msg == WM_COMMAND)
{
switch (lw)
{
case IDCANCEL:
EndDialog (hwndDlg, IDCANCEL);
return 1;
case IDC_IMPORT_KEYFILE:
{
wchar_t keyfilePath[TC_MAX_PATH];
if (BrowseFiles (hwndDlg, "SELECT_KEYFILE", keyfilePath, bHistory, FALSE, NULL))
{
DWORD keyfileSize;
byte *keyfileData = (byte *) LoadFile (keyfilePath, &keyfileSize);
if (!keyfileData)
{
handleWin32Error (hwndDlg, SRC_POS);
return 1;
}
if (keyfileSize != 0)
{
NewSecurityTokenKeyfileDlgProcParams newParams;
newParams.Name = WideToUtf8String (keyfilePath);
size_t lastBackSlash = newParams.Name.find_last_of ('\\');
if (lastBackSlash != string::npos)
newParams.Name = newParams.Name.substr (lastBackSlash + 1);
if (DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_NEW_TOKEN_KEYFILE), hwndDlg, (DLGPROC) NewSecurityTokenKeyfileDlgProc, (LPARAM) &newParams) == IDOK)
{
vector <byte> keyfileDataVector (keyfileSize);
memcpy (&keyfileDataVector.front(), keyfileData, keyfileSize);
try
{
WaitCursor();
finally_do ({ NormalCursor(); });
SecurityToken::CreateKeyfile (newParams.SlotId, keyfileDataVector, newParams.Name);
keyfiles = SecurityToken::GetAvailableKeyfiles();
SecurityTokenKeyfileDlgFillList (hwndDlg, keyfiles);
}
catch (Exception &e)
{
e.Show (hwndDlg);
}
burn (&keyfileDataVector.front(), keyfileSize);
}
}
else
{
SetLastError (ERROR_HANDLE_EOF);
handleWin32Error (hwndDlg, SRC_POS);
}
burn (keyfileData, keyfileSize);
TCfree (keyfileData);
}
return 1;
}
case IDC_EXPORT:
{
try
{
foreach (const SecurityTokenKeyfile &keyfile, SecurityTokenKeyfileDlgGetSelected (hwndDlg, keyfiles))
{
wchar_t keyfilePath[TC_MAX_PATH];
if (!BrowseFiles (hwndDlg, "OPEN_TITLE", keyfilePath, bHistory, TRUE, NULL))
break;
{
WaitCursor();
finally_do ({ NormalCursor(); });
vector <byte> keyfileData;
SecurityToken::GetKeyfileData (keyfile, keyfileData);
if (keyfileData.empty())
{
SetLastError (ERROR_HANDLE_EOF);
handleWin32Error (hwndDlg, SRC_POS);
return 1;
}
finally_do_arg (vector <byte> *, &keyfileData, { burn (&finally_arg->front(), finally_arg->size()); });
if (!SaveBufferToFile ((char *) &keyfileData.front(), keyfilePath, (DWORD) keyfileData.size(), FALSE, FALSE))
throw SystemException (SRC_POS);
}
Info ("KEYFILE_EXPORTED", hwndDlg);
}
}
catch (Exception &e)
{
e.Show (hwndDlg);
}
return 1;
}
case IDC_DELETE:
{
if (AskNoYes ("CONFIRM_SEL_FILES_DELETE", hwndDlg) == IDNO)
return 1;
try
{
WaitCursor();
finally_do ({ NormalCursor(); });
foreach (const SecurityTokenKeyfile &keyfile, SecurityTokenKeyfileDlgGetSelected (hwndDlg, keyfiles))
{
SecurityToken::DeleteKeyfile (keyfile);
}
keyfiles = SecurityToken::GetAvailableKeyfiles();
SecurityTokenKeyfileDlgFillList (hwndDlg, keyfiles);
}
catch (Exception &e)
{
e.Show (hwndDlg);
}
return 1;
}
}
}
return 0;
}
return 0;
}
extern "C" BOOL IsThreadInSecureDesktop(DWORD dwThreadID)
{
BOOL bRet = FALSE;
if (bSecureDesktopOngoing)
{
HDESK currentDesk = GetThreadDesktop (dwThreadID);
if (currentDesk)
{
LPWSTR szName = NULL;
DWORD dwLen = 0;
if (!GetUserObjectInformation (currentDesk, UOI_NAME, NULL, 0, &dwLen))
{
szName = (LPWSTR) malloc (dwLen);
if (szName)
{
if (GetUserObjectInformation (currentDesk, UOI_NAME, szName, dwLen, &dwLen))
{
if (0 == _wcsicmp (szName, SecureDesktopName))
bRet = TRUE;
}
free (szName);
}
}
}
}
return bRet;
}
BOOL InitSecurityTokenLibrary (HWND hwndDlg)
{
if (SecurityTokenLibraryPath[0] == 0)
{
Error ("NO_PKCS11_MODULE_SPECIFIED", hwndDlg);
return FALSE;
}
struct PinRequestHandler : public GetPinFunctor
{
HWND m_hwnd;
PinRequestHandler(HWND hwnd) : m_hwnd(hwnd) {}
virtual void operator() (string &str)
{
if (CmdTokenPin[0])
{
str = CmdTokenPin;
}
else
{
HWND hParent = IsWindow (m_hwnd)? m_hwnd : GetActiveWindow();
if (!hParent)
hParent = GetForegroundWindow ();
if (IsThreadInSecureDesktop(GetCurrentThreadId()) && !IsThreadInSecureDesktop(GetWindowThreadProcessId(hParent, NULL)))
hParent = GetActiveWindow ();
if (SecureDesktopDialogBoxParam (hInst, MAKEINTRESOURCEW (IDD_TOKEN_PASSWORD), hParent, (DLGPROC) SecurityTokenPasswordDlgProc, (LPARAM) &str) == IDCANCEL)
throw UserAbort (SRC_POS);
}
if (hCursor != NULL)
SetCursor (hCursor);
}
virtual void notifyIncorrectPin ()
{
// clear wrong PIN
burn (&CmdTokenPin, sizeof (CmdTokenPin));
}
};
struct WarningHandler : public SendExceptionFunctor
{
HWND m_hwnd;
WarningHandler(HWND hwnd) : m_hwnd(hwnd) {}
virtual void operator() (const Exception &e)
{
HWND hParent = IsWindow (m_hwnd)? m_hwnd : GetActiveWindow();
if (!hParent)
hParent = GetForegroundWindow ();
e.Show (hParent);
}
};
try
{
SecurityToken::InitLibrary (SecurityTokenLibraryPath, unique_ptr <GetPinFunctor> (new PinRequestHandler(MainDlg)), unique_ptr <SendExceptionFunctor> (new WarningHandler(MainDlg)));
}
catch (Exception &e)
{
e.Show (hwndDlg);
Error ("PKCS11_MODULE_INIT_FAILED", hwndDlg);
return FALSE;
}
return TRUE;
}
std::vector <HostDevice> GetAvailableHostDevices (bool noDeviceProperties, bool singleList, bool noFloppy, bool detectUnencryptedFilesystems)
{
vector <HostDevice> devices;
size_t dev0;
for (int devNumber = 0; devNumber < MAX_HOST_DRIVE_NUMBER; devNumber++)
{
for (int partNumber = 0; partNumber < MAX_HOST_PARTITION_NUMBER; partNumber++)
{
WCHAR devPath[32];
StringCbPrintfW (devPath, sizeof (devPath), L"\\Device\\Harddisk%d\\Partition%d", devNumber, partNumber);
OPEN_TEST_STRUCT openTest = {0};
if (!OpenDevice (devPath, &openTest, detectUnencryptedFilesystems && partNumber != 0, FALSE))
{
if (partNumber == 0)
break;
continue;
}
HostDevice device;
device.SystemNumber = devNumber;
device.Path = devPath;
PARTITION_INFORMATION partInfo;
if (GetPartitionInfo (devPath, &partInfo))
{
device.Bootable = partInfo.BootIndicator ? true : false;
device.Size = partInfo.PartitionLength.QuadPart;
}
else
{
// retrieve size using DISK_GEOMETRY_EX
DISK_GEOMETRY_EX deviceGeometry = {0};
if ( GetDriveGeometry (devPath, &deviceGeometry)
|| ((partNumber == 0) && GetPhysicalDriveGeometry (devNumber, &deviceGeometry))
)
{
device.Size = (uint64) deviceGeometry.DiskSize.QuadPart;
}
}
device.HasUnencryptedFilesystem = (detectUnencryptedFilesystems && openTest.FilesystemDetected) ? true : false;
if (!noDeviceProperties)
{
DISK_GEOMETRY_EX geometry;
int driveNumber = GetDiskDeviceDriveLetter (devPath);
if (driveNumber >= 0)
{
device.MountPoint += (wchar_t) (driveNumber + L'A');
device.MountPoint += L":";
wchar_t name[64];
if (GetDriveLabel (driveNumber, name, sizeof (name)))
device.Name = name;
if (GetSystemDriveLetter() == L'A' + driveNumber)
device.ContainsSystem = true;
}
if (partNumber == 0 && GetDriveGeometry (devPath, &geometry))
device.Removable = (geometry.Geometry.MediaType == RemovableMedia);
}
if (partNumber == 0)
{
devices.push_back (device);
dev0 = devices.size() - 1;
}
else
{
// System creates a virtual partition1 for some storage devices without
// partition table. We try to detect this case by comparing sizes of
// partition0 and partition1. If they match, no partition of the device
// is displayed to the user to avoid confusion. Drive letter assigned by
// system to partition1 is assigned partition0
if (partNumber == 1 && devices[dev0].Size == device.Size)
{
devices[dev0].IsVirtualPartition = true;
devices[dev0].MountPoint = device.MountPoint;
devices[dev0].Name = device.Name;
devices[dev0].Path = device.Path;
devices[dev0].HasUnencryptedFilesystem = device.HasUnencryptedFilesystem;
break;
}
device.IsPartition = true;
device.SystemNumber = partNumber;
device.Removable = devices[dev0].Removable;
if (device.ContainsSystem)
devices[dev0].ContainsSystem = true;
if (singleList)
devices.push_back (device);
devices[dev0].Partitions.push_back (device);
}
}
}
// Vista does not create partition links for dynamic volumes so it is necessary to scan \\Device\\HarddiskVolumeX devices
if (CurrentOSMajor >= 6)
{
for (int devNumber = 0; devNumber < 256; devNumber++)
{
WCHAR devPath[32];
StringCbPrintfW (devPath, sizeof (devPath), L"\\Device\\HarddiskVolume%d", devNumber);
OPEN_TEST_STRUCT openTest = {0};
if (!OpenDevice (devPath, &openTest, detectUnencryptedFilesystems, FALSE))
continue;
DISK_PARTITION_INFO_STRUCT info;
if (GetDeviceInfo (devPath, &info) && info.IsDynamic)
{
HostDevice device;
device.DynamicVolume = true;
device.IsPartition = true;
device.SystemNumber = devNumber;
device.Path = devPath;
device.Size = info.partInfo.PartitionLength.QuadPart;
device.HasUnencryptedFilesystem = (detectUnencryptedFilesystems && openTest.FilesystemDetected) ? true : false;
if (!noDeviceProperties)
{
int driveNumber = GetDiskDeviceDriveLetter (devPath);
if (driveNumber >= 0)
{
device.MountPoint += (wchar_t) (driveNumber + L'A');
device.MountPoint += L":";
wchar_t name[64];
if (GetDriveLabel (driveNumber, name, sizeof (name)))
device.Name = name;
if (GetSystemDriveLetter() == L'A' + driveNumber)
device.ContainsSystem = true;
}
}
devices.push_back (device);
}
}
}
return devices;
}
void AddDeviceToList (std::vector<HostDevice>& devices, int devNumber, int partNumber)
{
WCHAR devPath[64];
StringCbPrintfW (devPath, sizeof (devPath), L"\\Device\\Harddisk%d\\Partition%d", devNumber, partNumber);
HostDevice device;
device.SystemNumber = devNumber;
device.Path = devPath;
devices.push_back (device);
}
std::vector <HostDevice> GetHostRawDeviceList ()
{
std::vector <HostDevice> list;
HDEVINFO diskClassDevices;
GUID diskClassDeviceInterfaceGuid = GUID_DEVINTERFACE_DISK;
SP_DEVICE_INTERFACE_DATA deviceInterfaceData;
PSP_DEVICE_INTERFACE_DETAIL_DATA deviceInterfaceDetailData;
DWORD requiredSize;
DWORD deviceIndex;
STORAGE_DEVICE_NUMBER diskNumber;
DWORD bytesReturned;
diskClassDevices = SetupDiGetClassDevs( &diskClassDeviceInterfaceGuid,
NULL,
NULL,
DIGCF_PRESENT |
DIGCF_DEVICEINTERFACE );
if ( INVALID_HANDLE_VALUE != diskClassDevices)
{
ZeroMemory( &deviceInterfaceData, sizeof( SP_DEVICE_INTERFACE_DATA ) );
deviceInterfaceData.cbSize = sizeof( SP_DEVICE_INTERFACE_DATA );
deviceIndex = 0;
while ( SetupDiEnumDeviceInterfaces( diskClassDevices,
NULL,
&diskClassDeviceInterfaceGuid,
deviceIndex,
&deviceInterfaceData ) )
{
++deviceIndex;
if (!SetupDiGetDeviceInterfaceDetail( diskClassDevices,
&deviceInterfaceData,
NULL,
0,
&requiredSize,
NULL ) && ( ERROR_INSUFFICIENT_BUFFER == GetLastError()))
{
deviceInterfaceDetailData = ( PSP_DEVICE_INTERFACE_DETAIL_DATA ) malloc( requiredSize );
if (deviceInterfaceDetailData)
{
ZeroMemory( deviceInterfaceDetailData, requiredSize );
deviceInterfaceDetailData->cbSize = sizeof( SP_DEVICE_INTERFACE_DETAIL_DATA );
if (SetupDiGetDeviceInterfaceDetail( diskClassDevices,
&deviceInterfaceData,
deviceInterfaceDetailData,
requiredSize,
NULL,
NULL ))
{
HANDLE disk = CreateFile( deviceInterfaceDetailData->DevicePath,
0,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
0,
NULL );
if ( INVALID_HANDLE_VALUE != disk)
{
if (DeviceIoControl( disk,
IOCTL_STORAGE_GET_DEVICE_NUMBER,
NULL,
0,
&diskNumber,
sizeof( STORAGE_DEVICE_NUMBER ),
&bytesReturned,
NULL ))
{
HostDevice device;
device.Path = deviceInterfaceDetailData->DevicePath;
device.SystemNumber = diskNumber.DeviceNumber;
list.push_back (device);
}
CloseHandle( disk );
}
}
free (deviceInterfaceDetailData);
}
}
}
SetupDiDestroyDeviceInfoList( diskClassDevices );
}
return list;
}
bool CompareDeviceList (const std::vector<HostDevice>& list1, const std::vector<HostDevice>& list2)
{
if (list1.size() != list2.size())
return false;
for (std::vector<HostDevice>::const_iterator It1 = list1.begin(); It1 != list1.end(); It1++)
{
bool bFound = false;
for (std::vector<HostDevice>::const_iterator It2 = list2.begin(); It2 != list2.end(); It2++)
{
if (It1->Path == It2->Path && It1->SystemNumber == It2->SystemNumber)
{
bFound = true;
break;
}
}
if (!bFound)
return false;
}
return true;
}
void UpdateMountableHostDeviceList ()
{
ByteArray buffer(4096);
DWORD bytesReturned;
bool dynamicVolumesPresent = false;
EnterCriticalSection (&csMountableDevices);
finally_do ({ LeaveCriticalSection (&csMountableDevices); });
std::vector<HostDevice> newList = GetHostRawDeviceList ();
std::map<DWORD, bool> existingDevicesMap;
if (CompareDeviceList (newList, rawHostDeviceList))
return; //no change, return
// remove raw devices that don't exist anymore
for (std::vector<HostDevice>::iterator It = rawHostDeviceList.begin();
It != rawHostDeviceList.end();)
{
for (std::vector<HostDevice>::iterator newIt = newList.begin(); newIt != newList.end(); newIt++)
{
if (newIt->SystemNumber == It->SystemNumber)
{
existingDevicesMap[It->SystemNumber] = true;
break;
}
}
if (existingDevicesMap[It->SystemNumber])
It++;
else
{
It = rawHostDeviceList.erase (It);
}
}
// remove mountable devices that don't exist anymore
for (std::vector<HostDevice>::iterator It = mountableDevices.begin();
It != mountableDevices.end();)
{
if (existingDevicesMap[It->SystemNumber])
It++;
else
It = mountableDevices.erase (It);
}
// add new devices
for (std::vector<HostDevice>::iterator It = newList.begin(); It != newList.end(); It++)
{
if (existingDevicesMap[It->SystemNumber])
continue;
HANDLE disk = CreateFile( It->Path.c_str(),
0,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
0,
NULL );
if ( INVALID_HANDLE_VALUE != disk)
{
bool bIsDynamic = false;
bool bHasPartition = false;
if (DeviceIoControl(
disk,
IOCTL_DISK_GET_DRIVE_LAYOUT_EX,
NULL,
0,
(LPVOID) buffer.data(),
(DWORD) buffer.size(),
(LPDWORD) &bytesReturned,
NULL) && (bytesReturned >= sizeof (DRIVE_LAYOUT_INFORMATION_EX)))
{
PDRIVE_LAYOUT_INFORMATION_EX layout = (PDRIVE_LAYOUT_INFORMATION_EX) buffer.data();
// sanity checks
if (layout->PartitionCount <= 256)
{
for (DWORD i = 0; i < layout->PartitionCount; i++)
{
if (layout->PartitionEntry[i].PartitionStyle == PARTITION_STYLE_MBR)
{
if (layout->PartitionEntry[i].Mbr.PartitionType == 0)
continue;
bHasPartition = true;
/* skip dynamic volume */
if (layout->PartitionEntry[i].Mbr.PartitionType == PARTITION_LDM)
{
bIsDynamic = true;
/* remove any partition that may have been added */
while (!mountableDevices.empty() && (mountableDevices.back().SystemNumber == It->SystemNumber))
mountableDevices.pop_back ();
break;
}
}
if (layout->PartitionEntry[i].PartitionStyle == PARTITION_STYLE_GPT)
{
if (IsEqualGUID(layout->PartitionEntry[i].Gpt.PartitionType, PARTITION_ENTRY_UNUSED_GUID))
continue;
bHasPartition = true;
/* skip dynamic volume */
if ( IsEqualGUID(layout->PartitionEntry[i].Gpt.PartitionType, PARTITION_LDM_METADATA_GUID)
|| IsEqualGUID(layout->PartitionEntry[i].Gpt.PartitionType, PARTITION_LDM_DATA_GUID)
)
{
bIsDynamic = true;
/* remove any partition that may have been added */
while (!mountableDevices.empty() && (mountableDevices.back().SystemNumber == It->SystemNumber))
mountableDevices.pop_back ();
break;
}
}
WCHAR path[MAX_PATH];
StringCbPrintfW (path, sizeof(path), L"\\\\?\\GLOBALROOT\\Device\\Harddisk%d\\Partition%d", It->SystemNumber, layout->PartitionEntry[i].PartitionNumber);
HANDLE handle = CreateFile( path,
0,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
0,
NULL );
if ((handle != INVALID_HANDLE_VALUE) || (GetLastError () == ERROR_ACCESS_DENIED))
{
AddDeviceToList (mountableDevices, It->SystemNumber, layout->PartitionEntry[i].PartitionNumber);
if (handle != INVALID_HANDLE_VALUE)
CloseHandle (handle);
}
}
}
}
if (bIsDynamic)
dynamicVolumesPresent = true;
if (!bHasPartition)
AddDeviceToList (mountableDevices, It->SystemNumber, 0);
CloseHandle (disk);
}
}
rawHostDeviceList = newList;
// Starting from Vista, Windows does not create partition links for dynamic volumes so it is necessary to scan \\Device\\HarddiskVolumeX devices
if (dynamicVolumesPresent && (CurrentOSMajor >= 6))
{
for (int devNumber = 0; devNumber < 256; devNumber++)
{
WCHAR devPath[32];
StringCbPrintfW (devPath, sizeof (devPath), L"\\Device\\HarddiskVolume%d", devNumber);
OPEN_TEST_STRUCT openTest = {0};
if (!OpenDevice (devPath, &openTest, FALSE, FALSE))
continue;
DISK_PARTITION_INFO_STRUCT info;
if (GetDeviceInfo (devPath, &info) && info.IsDynamic)
{
HostDevice device;
device.SystemNumber = devNumber;
device.Path = devPath;
mountableDevices.push_back (device);
}
}
}
}
wstring FindDeviceByVolumeID (const BYTE volumeID [VOLUME_ID_SIZE], BOOL bFromService)
{
/* if it is already mounted, get the real path name used for mounting */
MOUNT_LIST_STRUCT mlist;
DWORD dwResult;
memset (&mlist, 0, sizeof (mlist));
if ( !DeviceIoControl (hDriver, TC_IOCTL_GET_MOUNTED_VOLUMES, &mlist,
sizeof (mlist), &mlist, sizeof (mlist), &dwResult,
NULL)
|| (mlist.ulMountedDrives >= (1 << 26))
)
{
return L"";
}
if (mlist.ulMountedDrives)
{
for (int i=0 ; i < 26; i++)
{
if ((mlist.ulMountedDrives & (1 << i)) && (0 == memcmp (mlist.volumeID[i], volumeID, VOLUME_ID_SIZE)))
{
if (IsNullTerminateString (mlist.wszVolume[i], TC_MAX_PATH))
return mlist.wszVolume[i];
else
return L"";
}
}
}
/* not mounted. Look for it in the local drives*/
if (bFromService)
{
for (int devNumber = 0; devNumber < MAX_HOST_DRIVE_NUMBER; devNumber++)
{
for (int partNumber = 0; partNumber < MAX_HOST_PARTITION_NUMBER; partNumber++)
{
WCHAR devPath[32];
StringCbPrintfW (devPath, sizeof (devPath), L"\\Device\\Harddisk%d\\Partition%d", devNumber, partNumber);
OPEN_TEST_STRUCT openTest = {0};
if (OpenDevice (devPath, &openTest, TRUE, TRUE)
&& (openTest.VolumeIDComputed[TC_VOLUME_TYPE_NORMAL] && openTest.VolumeIDComputed[TC_VOLUME_TYPE_HIDDEN])
)
{
if ( (0 == memcmp (volumeID, openTest.volumeIDs[TC_VOLUME_TYPE_NORMAL], VOLUME_ID_SIZE))
|| (0 == memcmp (volumeID, openTest.volumeIDs[TC_VOLUME_TYPE_HIDDEN], VOLUME_ID_SIZE))
)
{
return devPath;
}
}
}
}
}
else
{
static std::vector<HostDevice> volumeIdCandidates;
EnterCriticalSection (&csMountableDevices);
if (!NeedPeriodicDeviceListUpdate)
UpdateMountableHostDeviceList ();
std::vector<HostDevice> newDevices = mountableDevices;
LeaveCriticalSection (&csMountableDevices);
EnterCriticalSection (&csVolumeIdCandidates);
finally_do ({ LeaveCriticalSection (&csVolumeIdCandidates); });
/* remove any devices that don't exist anymore */
for (std::vector<HostDevice>::iterator It = volumeIdCandidates.begin();
It != volumeIdCandidates.end();)
{
bool bFound = false;
for (std::vector<HostDevice>::iterator newIt = newDevices.begin();
newIt != newDevices.end(); newIt++)
{
if (It->Path == newIt->Path)
{
bFound = true;
break;
}
}
if (bFound)
It++;
else
It = volumeIdCandidates.erase (It);
}
/* Add newly inserted devices and compute their VolumeID */
for (std::vector<HostDevice>::iterator newIt = newDevices.begin();
newIt != newDevices.end(); newIt++)
{
bool bFound = false;
for (std::vector<HostDevice>::iterator It = volumeIdCandidates.begin();
It != volumeIdCandidates.end(); It++)
{
if (It->Path == newIt->Path)
{
bFound = true;
break;
}
}
if (!bFound)
{
/* new device/partition. Compute its Volume IDs */
OPEN_TEST_STRUCT openTest = {0};
if (OpenDevice (newIt->Path.c_str(), &openTest, TRUE, TRUE)
&& (openTest.VolumeIDComputed[TC_VOLUME_TYPE_NORMAL] && openTest.VolumeIDComputed[TC_VOLUME_TYPE_HIDDEN])
)
{
memcpy (newIt->VolumeIDs, openTest.volumeIDs, sizeof (newIt->VolumeIDs));
newIt->HasVolumeIDs = true;
}
else
newIt->HasVolumeIDs = false;
volumeIdCandidates.push_back (*newIt);
}
}
for (std::vector<HostDevice>::iterator It = volumeIdCandidates.begin();
It != volumeIdCandidates.end(); It++)
{
if ( It->HasVolumeIDs &&
( (0 == memcmp (volumeID, It->VolumeIDs[TC_VOLUME_TYPE_NORMAL], VOLUME_ID_SIZE))
|| (0 == memcmp (volumeID, It->VolumeIDs[TC_VOLUME_TYPE_HIDDEN], VOLUME_ID_SIZE))
)
)
{
return It->Path;
}
}
}
return L"";
}
#endif // !SETUP
BOOL FileHasReadOnlyAttribute (const wchar_t *path)
{
DWORD attributes = GetFileAttributes (path);
return attributes != INVALID_FILE_ATTRIBUTES && (attributes & FILE_ATTRIBUTE_READONLY) != 0;
}
BOOL IsFileOnReadOnlyFilesystem (const wchar_t *path)
{
wchar_t root[MAX_PATH];
if (!GetVolumePathName (path, root, ARRAYSIZE (root)))
return FALSE;
DWORD flags, d;
if (!GetVolumeInformation (root, NULL, 0, NULL, &d, &flags, NULL, 0))
return FALSE;
return (flags & FILE_READ_ONLY_VOLUME) ? TRUE : FALSE;
}
void CheckFilesystem (HWND hwndDlg, int driveNo, BOOL fixErrors)
{
wchar_t msg[1024], param[1024], cmdPath[MAX_PATH];
wchar_t driveRoot[] = { L'A' + (wchar_t) driveNo, L':', 0 };
if (fixErrors && AskWarnYesNo ("FILESYS_REPAIR_CONFIRM_BACKUP", hwndDlg) == IDNO)
return;
StringCbPrintfW (msg, sizeof(msg), GetString (fixErrors ? "REPAIRING_FS" : "CHECKING_FS"), driveRoot);
StringCbPrintfW (param, sizeof(param), fixErrors ? L"/C echo %s & chkdsk %s /F /X & pause" : L"/C echo %s & chkdsk %s & pause", msg, driveRoot);
if (GetSystemDirectoryW(cmdPath, MAX_PATH))
{
StringCbCatW(cmdPath, sizeof(cmdPath), L"\\cmd.exe");
}
else
StringCbCopyW(cmdPath, sizeof(cmdPath), L"C:\\Windows\\System32\\cmd.exe");
ShellExecuteW (NULL, (!IsAdmin() && IsUacSupported()) ? L"runas" : L"open", cmdPath, param, NULL, SW_SHOW);
}
BOOL BufferContainsPattern (const byte *buffer, size_t bufferSize, const byte *pattern, size_t patternSize)
{
if (bufferSize < patternSize)
return FALSE;
bufferSize -= patternSize;
for (size_t i = 0; i < bufferSize; ++i)
{
if (memcmp (buffer + i, pattern, patternSize) == 0)
return TRUE;
}
return FALSE;
}
BOOL BufferContainsString (const byte *buffer, size_t bufferSize, const char *str)
{
return BufferContainsPattern (buffer, bufferSize, (const byte*) str, strlen (str));
}
BOOL BufferContainsWideString (const byte *buffer, size_t bufferSize, const wchar_t *str)
{
return BufferContainsPattern (buffer, bufferSize, (const byte*) str, 2 * wcslen (str));
}
#ifndef SETUP
int AskNonSysInPlaceEncryptionResume (HWND hwndDlg, BOOL *pbDecrypt)
{
if (AskWarnYesNo ("NONSYS_INPLACE_ENC_RESUME_PROMPT", hwndDlg) == IDYES)
{
char *tmpStr[] = {0,
"CHOOSE_ENCRYPT_OR_DECRYPT",
"ENCRYPT",
"DECRYPT",
"IDCANCEL",
0};
switch (AskMultiChoice ((void **) tmpStr, FALSE, hwndDlg))
{
case 1:
*pbDecrypt = FALSE;
return IDYES;
case 2:
*pbDecrypt = TRUE;
return IDYES;
default:
break;
}
}
char *multiChoiceStr[] = { 0, "ASK_NONSYS_INPLACE_ENC_NOTIFICATION_REMOVAL", "DO_NOT_PROMPT_ME", "KEEP_PROMPTING_ME", 0 };
switch (AskMultiChoice ((void **) multiChoiceStr, FALSE, hwndDlg))
{
case 1:
RemoveNonSysInPlaceEncNotifications();
Warning ("NONSYS_INPLACE_ENC_NOTIFICATION_REMOVAL_NOTE", hwndDlg);
break;
default:
// NOP
break;
}
return IDNO;
}
#endif // !SETUP
BOOL RemoveDeviceWriteProtection (HWND hwndDlg, wchar_t *devicePath)
{
int driveNumber;
int partitionNumber;
wchar_t temp[MAX_PATH*2];
wchar_t cmdBatch[MAX_PATH*2];
wchar_t diskpartScript[MAX_PATH*2];
if (swscanf (devicePath, L"\\Device\\Harddisk%d\\Partition%d", &driveNumber, &partitionNumber) != 2)
return FALSE;
if (GetTempPath (ARRAYSIZE (temp), temp) == 0)
return FALSE;
StringCbPrintfW (cmdBatch, sizeof (cmdBatch), L"%s\\VeraCrypt_Write_Protection_Removal.cmd", temp);
StringCbPrintfW (diskpartScript, sizeof (diskpartScript), L"%s\\VeraCrypt_Write_Protection_Removal.diskpart", temp);
FILE *f = _wfopen (cmdBatch, L"w");
if (!f)
{
handleWin32Error (hwndDlg, SRC_POS);
return FALSE;
}
fwprintf (f, L"@diskpart /s \"%s\"\n@pause\n@del \"%s\" \"%s\"", diskpartScript, diskpartScript, cmdBatch);
CheckFileStreamWriteErrors (hwndDlg, f, cmdBatch);
fclose (f);
f = _wfopen (diskpartScript, L"w");
if (!f)
{
handleWin32Error (hwndDlg, SRC_POS);
DeleteFile (cmdBatch);
return FALSE;
}
fwprintf (f, L"select disk %d\nattributes disk clear readonly\n", driveNumber);
if (partitionNumber != 0)
fwprintf (f, L"select partition %d\nattributes volume clear readonly\n", partitionNumber);
fwprintf (f, L"exit\n");
CheckFileStreamWriteErrors (hwndDlg, f, diskpartScript);
fclose (f);
ShellExecute (NULL, (!IsAdmin() && IsUacSupported()) ? L"runas" : L"open", cmdBatch, NULL, NULL, SW_SHOW);
return TRUE;
}
static LRESULT CALLBACK EnableElevatedCursorChangeWndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
return DefWindowProcW (hWnd, message, wParam, lParam);
}
void EnableElevatedCursorChange (HWND parent)
{
// Create a transparent window to work around a UAC issue preventing change of the cursor
if (UacElevated)
{
const wchar_t *className = L"VeraCryptEnableElevatedCursorChange";
WNDCLASSEXW winClass;
HWND hWnd;
memset (&winClass, 0, sizeof (winClass));
winClass.cbSize = sizeof (WNDCLASSEX);
winClass.lpfnWndProc = (WNDPROC) EnableElevatedCursorChangeWndProc;
winClass.hInstance = hInst;
winClass.lpszClassName = className;
RegisterClassExW (&winClass);
hWnd = CreateWindowExW (WS_EX_TOOLWINDOW | WS_EX_LAYERED, className, L"VeraCrypt UAC", 0, 0, 0, GetSystemMetrics (SM_CXSCREEN), GetSystemMetrics (SM_CYSCREEN), parent, NULL, hInst, NULL);
if (hWnd)
{
SetLayeredWindowAttributes (hWnd, 0, 1, LWA_ALPHA);
ShowWindow (hWnd, SW_SHOWNORMAL);
DestroyWindow (hWnd);
}
UnregisterClassW (className, hInst);
}
}
BOOL DisableFileCompression (HANDLE file)
{
USHORT format;
DWORD bytesOut;
if (!DeviceIoControl (file, FSCTL_GET_COMPRESSION, NULL, 0, &format, sizeof (format), &bytesOut, NULL))
return FALSE;
if (format == COMPRESSION_FORMAT_NONE)
return TRUE;
format = COMPRESSION_FORMAT_NONE;
return DeviceIoControl (file, FSCTL_SET_COMPRESSION, &format, sizeof (format), NULL, 0, &bytesOut, NULL);
}
#ifndef SETUP
BOOL VolumePathExists (const wchar_t *volumePath)
{
OPEN_TEST_STRUCT openTest = {0};
wchar_t upperCasePath[TC_MAX_PATH + 1];
UpperCaseCopy (upperCasePath, sizeof(upperCasePath), volumePath);
if (wcsstr (upperCasePath, L"\\DEVICE\\") == upperCasePath)
return OpenDevice (volumePath, &openTest, FALSE, FALSE);
wstring path = volumePath;
if (path.find (L"\\\\?\\Volume{") == 0 && path.rfind (L"}\\") == path.size() - 2)
{
wchar_t devicePath[TC_MAX_PATH];
if (QueryDosDevice (path.substr (4, path.size() - 5).c_str(), devicePath, TC_MAX_PATH) != 0)
return TRUE;
}
if (_waccess (volumePath, 0) == 0)
return TRUE;
else
{
DWORD dwResult = GetLastError ();
if (dwResult == ERROR_SHARING_VIOLATION)
return TRUE;
else
return FALSE;
}
}
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);
return (FileExists (path));
}
return FALSE;
}
BOOL LaunchWindowsIsoBurner (HWND hwnd, const wchar_t *isoPath)
{
wchar_t path[MAX_PATH*2] = { 0 };
int r;
if (SUCCEEDED(SHGetFolderPath (NULL, CSIDL_SYSTEM, NULL, 0, path)))
StringCbCatW (path, MAX_PATH*2, L"\\" ISO_BURNER_TOOL);
else
StringCbCopyW (path, MAX_PATH*2, L"C:\\Windows\\System32\\" ISO_BURNER_TOOL);
r = (int) ShellExecute (hwnd, L"open", path, (wstring (L"\"") + isoPath + L"\"").c_str(), NULL, SW_SHOWNORMAL);
if (r <= 32)
{
SetLastError (r);
handleWin32Error (hwnd, SRC_POS);
return FALSE;
}
return TRUE;
}
std::wstring VolumeGuidPathToDevicePath (std::wstring volumeGuidPath)
{
if (volumeGuidPath.find (L"\\\\?\\") == 0)
volumeGuidPath = volumeGuidPath.substr (4);
if (volumeGuidPath.find (L"Volume{") != 0 || volumeGuidPath.rfind (L"}\\") != volumeGuidPath.size() - 2)
return wstring();
wchar_t volDevPath[TC_MAX_PATH];
if (QueryDosDevice (volumeGuidPath.substr (0, volumeGuidPath.size() - 1).c_str(), volDevPath, TC_MAX_PATH) == 0)
return wstring();
wstring partitionPath = HarddiskVolumePathToPartitionPath (volDevPath);
return partitionPath.empty() ? volDevPath : partitionPath;
}
std::wstring HarddiskVolumePathToPartitionPath (const std::wstring &harddiskVolumePath)
{
for (int driveNumber = 0; driveNumber < MAX_HOST_DRIVE_NUMBER; driveNumber++)
{
for (int partNumber = 0; partNumber < MAX_HOST_PARTITION_NUMBER; partNumber++)
{
wchar_t partitionPath[TC_MAX_PATH];
StringCchPrintfW (partitionPath, ARRAYSIZE (partitionPath), L"\\Device\\Harddisk%d\\Partition%d", driveNumber, partNumber);
wchar_t resolvedPath[TC_MAX_PATH];
if (ResolveSymbolicLink (partitionPath, resolvedPath, sizeof(resolvedPath)))
{
if (harddiskVolumePath == resolvedPath)
return partitionPath;
}
else if (partNumber == 0)
break;
}
}
return wstring();
}
#endif
BOOL IsApplicationInstalled (const wchar_t *appName, BOOL b32bitApp)
{
const wchar_t *uninstallRegName = L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
BOOL installed = FALSE;
HKEY unistallKey;
LONG res = RegOpenKeyEx (HKEY_LOCAL_MACHINE, uninstallRegName, 0, KEY_READ | (b32bitApp? KEY_WOW64_32KEY: KEY_WOW64_64KEY), &unistallKey);
if (res != ERROR_SUCCESS)
{
SetLastError (res);
return FALSE;
}
wchar_t regName[1024];
DWORD regNameSize = ARRAYSIZE (regName);
DWORD index = 0;
while (RegEnumKeyEx (unistallKey, index++, regName, &regNameSize, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
{
if (wcsstr (regName, L"{") == regName)
{
regNameSize = sizeof (regName);
if (!ReadLocalMachineRegistryStringNonReflected ((wstring (uninstallRegName) + L"\\" + regName).c_str(), L"DisplayName", regName, &regNameSize, b32bitApp))
regName[0] = 0;
}
if (_wcsicmp (regName, appName) == 0)
{
installed = TRUE;
break;
}
regNameSize = sizeof (regName);
}
RegCloseKey (unistallKey);
return installed;
}
std::wstring FindLatestFileOrDirectory (const std::wstring &directory, const wchar_t *namePattern, bool findDirectory, bool findFile)
{
wstring name;
ULARGE_INTEGER latestTime;
latestTime.QuadPart = 0;
WIN32_FIND_DATA findData;
HANDLE find = FindFirstFile ((directory + L"\\" + namePattern).c_str(), &findData);
if (find != INVALID_HANDLE_VALUE)
{
do
{
if (wcscmp (findData.cFileName, L".") == 0 || wcscmp (findData.cFileName, L"..") == 0)
continue;
ULARGE_INTEGER writeTime;
writeTime.LowPart = findData.ftLastWriteTime.dwLowDateTime;
writeTime.HighPart = findData.ftLastWriteTime.dwHighDateTime;
if ((!findFile && !(findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
|| (!findDirectory && (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)))
continue;
if (latestTime.QuadPart < writeTime.QuadPart)
{
latestTime = writeTime;
name = findData.cFileName;
}
}
while (FindNextFile (find, &findData));
FindClose (find);
}
if (name.empty())
return name;
return wstring (directory) + L"\\" + name;
}
int GetPim (HWND hwndDlg, UINT ctrlId, int defaultPim)
{
int pim = defaultPim;
HWND hCtrl = GetDlgItem (hwndDlg, ctrlId);
if (IsWindowEnabled (hCtrl) && IsWindowVisible (hCtrl))
{
wchar_t szTmp[MAX_PIM + 1] = {0};
if (GetDlgItemText (hwndDlg, ctrlId, szTmp, MAX_PIM + 1) > 0)
{
wchar_t* endPtr = NULL;
pim = wcstol(szTmp, &endPtr, 10);
if (pim < 0 || endPtr == szTmp || !endPtr || *endPtr != L'\0')
pim = defaultPim;
}
}
return pim;
}
void SetPim (HWND hwndDlg, UINT ctrlId, int pim)
{
if (pim > 0)
{
wchar_t szTmp[MAX_PIM + 1];
StringCbPrintfW (szTmp, sizeof(szTmp), L"%d", pim);
SetDlgItemText (hwndDlg, ctrlId, szTmp);
}
else
SetDlgItemText (hwndDlg, ctrlId, L"");
}
BOOL GetPassword (HWND hwndDlg, UINT ctrlID, char* passValue, int bufSize, BOOL bLegacyPassword, BOOL bShowError)
{
wchar_t tmp [MAX_PASSWORD + 1];
int utf8Len;
BOOL bRet = FALSE;
GetWindowText (GetDlgItem (hwndDlg, ctrlID), tmp, ARRAYSIZE (tmp));
if ((bLegacyPassword || bUseLegacyMaxPasswordLength) && (lstrlen (tmp) > MAX_LEGACY_PASSWORD))
wmemset (&tmp[MAX_LEGACY_PASSWORD], 0, MAX_PASSWORD + 1 - MAX_LEGACY_PASSWORD);
utf8Len = WideCharToMultiByte (CP_UTF8, 0, tmp, -1, passValue, bufSize, NULL, NULL);
burn (tmp, sizeof (tmp));
if (utf8Len > 0)
{
bRet = TRUE;
}
else
{
passValue [0] = 0;
if (bShowError)
{
if (GetLastError () == ERROR_INSUFFICIENT_BUFFER)
{
DWORD dwTextSize = (DWORD) wcslen (GetString ("PASSWORD_UTF8_TOO_LONG")) + 16;
WCHAR* szErrorText = (WCHAR*) malloc (dwTextSize * sizeof (WCHAR));
// bufSize is equal to maximum password length plus one
StringCchPrintf (szErrorText, dwTextSize, GetString ("PASSWORD_UTF8_TOO_LONG"), (bufSize - 1));
ErrorDirect (szErrorText, hwndDlg);
free (szErrorText);
}
else
Error ("PASSWORD_UTF8_INVALID", hwndDlg);
SetFocus (GetDlgItem(hwndDlg, ctrlID));
}
}
return bRet;
}
void SetPassword (HWND hwndDlg, UINT ctrlID, char* passValue)
{
wchar_t tmp [MAX_PASSWORD + 1] = {0};
MultiByteToWideChar (CP_UTF8, 0, passValue, -1, tmp, MAX_PASSWORD + 1);
SetWindowText ( GetDlgItem (hwndDlg, ctrlID), tmp);
burn (tmp, sizeof (tmp));
}
void HandleShowPasswordFieldAction (HWND hwndDlg, UINT checkBoxId, UINT edit1Id, UINT edit2Id)
{
if ((EditPasswordChar == 0) && GetCheckBox (hwndDlg, checkBoxId))
{
EditPasswordChar = (WCHAR) SendMessageW (GetDlgItem (hwndDlg, edit1Id), EM_GETPASSWORDCHAR, 0, 0);
}
SendMessageW (GetDlgItem (hwndDlg, edit1Id),
EM_SETPASSWORDCHAR,
GetCheckBox (hwndDlg, checkBoxId) ? 0 : EditPasswordChar,
0);
InvalidateRect (GetDlgItem (hwndDlg, edit1Id), NULL, TRUE);
if (edit2Id)
{
SendMessageW (GetDlgItem (hwndDlg, edit2Id),
EM_SETPASSWORDCHAR,
GetCheckBox (hwndDlg, checkBoxId) ? 0 : EditPasswordChar,
0);
InvalidateRect (GetDlgItem (hwndDlg, edit2Id), NULL, TRUE);
}
}
void RegisterDriverInf (bool registerFilter, const string& filter, const string& filterReg, HWND ParentWindow, HKEY regKey)
{
wstring infFileName = GetTempPathString() + L"\\veracrypt_driver_setup.inf";
File infFile (infFileName, false, true);
finally_do_arg (wstring, infFileName, { DeleteFile (finally_arg.c_str()); });
string infTxt = "[veracrypt]\r\n"
+ string (registerFilter ? "Add" : "Del") + "Reg=veracrypt_reg\r\n\r\n"
"[veracrypt_reg]\r\n"
"HKR,,\"" + filterReg + "\",0x0001" + string (registerFilter ? "0008" : "8002") + ",\"" + filter + "\"\r\n";
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);
throw_sys_if (hInf == INVALID_HANDLE_VALUE);
finally_do_arg (HINF, hInf, { SetupCloseInfFileFn (finally_arg); });
throw_sys_if (!SetupInstallFromInfSectionWFn (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);
}
LSTATUS DeleteRegistryKey (HKEY hKey, LPCTSTR keyName)
{
return SHDeleteKeyWFn(hKey, keyName);
}
HIMAGELIST CreateImageList(int cx, int cy, UINT flags, int cInitial, int cGrow)
{
return ImageList_CreateFn(cx, cy, flags, cInitial, cGrow);
}
int AddBitmapToImageList(HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask)
{
return ImageList_AddFn(himl, hbmImage, hbmMask);
}
HRESULT VCStrDupW(LPCWSTR psz, LPWSTR *ppwsz)
{
return SHStrDupWFn (psz, ppwsz);
}
void ProcessEntropyEstimate (HWND hProgress, DWORD* pdwInitialValue, DWORD dwCounter, DWORD dwMaxLevel, DWORD* pdwEntropy)
{
/* conservative estimate: 1 mouse move event brings 1 bit of entropy
* https://security.stackexchange.com/questions/32844/for-how-much-time-should-i-randomly-move-the-mouse-for-generating-encryption-key/32848#32848
*/
if (*pdwEntropy == 0xFFFFFFFF)
{
*pdwInitialValue = dwCounter;
*pdwEntropy = 0;
}
else
{
if ( *pdwEntropy < dwMaxLevel
&& (dwCounter >= *pdwInitialValue)
&& (dwCounter - *pdwInitialValue) <= dwMaxLevel)
*pdwEntropy = dwCounter - *pdwInitialValue;
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;
SendMessage (hProgress, PBM_SETSTATE, state, 0);
}
SendMessage (hProgress, PBM_SETPOS,
(WPARAM) (*pdwEntropy),
0);
}
}
void AllowMessageInUIPI (UINT msg)
{
if (ChangeWindowMessageFilterFn)
{
ChangeWindowMessageFilterFn (msg, MSGFLT_ADD);
}
}
BOOL IsRepeatedByteArray (byte value, const byte* buffer, size_t bufferSize)
{
if (buffer && bufferSize)
{
size_t i;
for (i = 0; i < bufferSize; i++)
{
if (*buffer++ != value)
return FALSE;
}
return TRUE;
}
else
return FALSE;
}
#ifndef SETUP
BOOL TranslateVolumeID (HWND hwndDlg, wchar_t* pathValue, size_t cchPathValue)
{
BOOL bRet = TRUE;
size_t pathLen = pathValue? wcslen (pathValue) : 0;
if ((pathLen >= 3) && (_wcsnicmp (pathValue, L"ID:", 3) == 0))
{
std::vector<byte> arr;
if ( (pathLen == (3 + 2*VOLUME_ID_SIZE))
&& HexWideStringToArray (pathValue + 3, arr)
&& (arr.size() == VOLUME_ID_SIZE)
)
{
std::wstring devicePath = FindDeviceByVolumeID (&arr[0], FALSE);
if (devicePath.length() > 0)
StringCchCopyW (pathValue, cchPathValue, devicePath.c_str());
else
{
if (!Silent && !MultipleMountOperationInProgress)
Error ("VOLUME_ID_NOT_FOUND", hwndDlg);
SetLastError (ERROR_PATH_NOT_FOUND);
bRet = FALSE;
}
}
else
{
if (!Silent)
Error ("VOLUME_ID_INVALID", hwndDlg);
SetLastError (ERROR_INVALID_PARAMETER);
bRet = FALSE;
}
}
return bRet;
}
#endif
BOOL CopyTextToClipboard (LPCWSTR txtValue)
{
size_t txtLen = wcslen(txtValue);
HGLOBAL hdst;
LPWSTR dst;
BOOL bRet = FALSE;
// Allocate string for cwd
hdst = GlobalAlloc(GMEM_MOVEABLE, (txtLen + 1) * sizeof(WCHAR));
if (hdst)
{
dst = (LPWSTR)GlobalLock(hdst);
wmemcpy(dst, txtValue, txtLen + 1);
GlobalUnlock(hdst);
if (OpenClipboard(NULL))
{
EmptyClipboard();
SetClipboardData(CF_UNICODETEXT, hdst);
CloseClipboard();
}
}
return bRet;
}
BOOL GetFreeDriveLetter(WCHAR* pCh) {
DWORD dwUsedDrives = GetLogicalDrives();
WCHAR l;
for (l = L'A'; l <= L'Z'; l++) {
if ((dwUsedDrives & 1) == 0) {
*pCh = l;
return TRUE;
}
dwUsedDrives = dwUsedDrives >> 1;
}
return FALSE;
}
BOOL SetPrivilege(LPTSTR szPrivilegeName, BOOL bEnable)
{
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))
{
tkp.PrivilegeCount = 1;
tkp.Privileges[0].Attributes = bEnable? SE_PRIVILEGE_ENABLED : SE_PRIVILEGE_REMOVED;
bRet = AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, NULL, NULL);
if (!bRet)
dwLastError = GetLastError ();
}
else
dwLastError = GetLastError ();
CloseHandle(hToken);
}
else
dwLastError = GetLastError ();
SetLastError (dwLastError);
return bRet;
}
BOOL DeleteDirectory (const wchar_t* szDirName)
{
BOOL bStatus = RemoveDirectory (szDirName);
if (!bStatus)
{
/* force removal of the non empty directory */
wchar_t szOpPath[TC_MAX_PATH + 1] = {0};
SHFILEOPSTRUCTW op;
StringCchCopyW(szOpPath, ARRAYSIZE(szOpPath)-1, szDirName);
ZeroMemory(&op, sizeof(op));
op.wFunc = FO_DELETE;
op.pFrom = szOpPath;
op.fFlags = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_NOCONFIRMMKDIR;
if ((0 == SHFileOperation(&op)) && (!op.fAnyOperationsAborted))
bStatus = TRUE;
}
return bStatus;
}
#if defined (TCMOUNT) || defined (VOLFORMAT)
/*********************************************************************/
static BOOL GenerateRandomString (HWND hwndDlg, LPTSTR szName, DWORD maxCharsCount)
{
BOOL bRet = FALSE;
int alreadyInitialized = 0;
if (RandinitWithCheck (&alreadyInitialized) != ERR_SUCCESS)
{
handleError (hwndDlg, (CryptoAPILastError == ERROR_SUCCESS)? ERR_RAND_INIT_FAILED : ERR_CAPI_INIT_FAILED, SRC_POS);
}
else
{
BYTE* indexes = (BYTE*) malloc (maxCharsCount + 1);
bRet = RandgetBytesFull (hwndDlg, indexes, maxCharsCount + 1, TRUE, TRUE);
if (bRet)
{
static LPCTSTR chars = _T("0123456789@#$%^&_-*abcdefghijklmnopqrstuvwxyz");
DWORD i, charsLen = (DWORD) _tcslen (chars);
DWORD effectiveLen = (indexes[0] % (64 - 16)) + 16; // random length between 16 to 64
effectiveLen = (effectiveLen > maxCharsCount)? maxCharsCount : effectiveLen;
for (i = 0; i < effectiveLen; i++)
{
szName[i] = chars[indexes[i + 1] % charsLen];
}
szName[effectiveLen] = 0;
}
burn (indexes, maxCharsCount + 1);
free (indexes);
/* If RNG was not initialized before us, then stop it in order to
* stop the fast poll thread which consumes CPU. Next time a critical operation
* that requires RNG is performed, it will be initialized again.
*
* We do this because since the addition of secure desktop support, every time
* secure desktop is displayed, the RNG fast poll thread was started even if the
* user will never perform any critical operation that requires random bytes.
*/
if (!alreadyInitialized)
{
RandStop (FALSE);
}
}
return bRet;
}
typedef struct
{
HDESK hDesk;
LPCWSTR szDesktopName;
HINSTANCE hInstance;
LPCWSTR lpTemplateName;
DLGPROC lpDialogFunc;
LPARAM dwInitParam;
INT_PTR retValue;
} SecureDesktopThreadParam;
typedef struct
{
LPCWSTR szVCDesktopName;
HDESK hVcDesktop;
volatile BOOL* pbStopMonitoring;
} SecureDesktopMonitoringThreadParam;
#define SECUREDESKTOP_MONOTIR_PERIOD 500
// This thread checks if VeraCrypt secure desktop is the one that has user input
// and if it is not then it will call SwitchDesktop to make it the input desktop
static unsigned int __stdcall SecureDesktopMonitoringThread( LPVOID lpThreadParameter )
{
SecureDesktopMonitoringThreadParam* pMonitorParam = (SecureDesktopMonitoringThreadParam*) lpThreadParameter;
if (pMonitorParam)
{
volatile BOOL* pbStopMonitoring = pMonitorParam->pbStopMonitoring;
LPCWSTR szVCDesktopName = pMonitorParam->szVCDesktopName;
HDESK hVcDesktop = pMonitorParam->hVcDesktop;
while (!*pbStopMonitoring)
{
// check that our secure desktop is still the input desktop
// otherwise, switch to it
BOOL bPerformSwitch = FALSE;
HDESK currentDesk = OpenInputDesktop (0, FALSE, GENERIC_READ);
if (currentDesk)
{
LPWSTR szName = NULL;
DWORD dwLen = 0;
if (!GetUserObjectInformation (currentDesk, UOI_NAME, NULL, 0, &dwLen))
{
szName = (LPWSTR) malloc (dwLen);
if (szName)
{
if (GetUserObjectInformation (currentDesk, UOI_NAME, szName, dwLen, &dwLen))
{
if (0 != _wcsicmp (szName, szVCDesktopName))
bPerformSwitch = TRUE;
}
free (szName);
}
}
CloseDesktop (currentDesk);
}
if (bPerformSwitch)
SwitchDesktop (hVcDesktop);
Sleep (SECUREDESKTOP_MONOTIR_PERIOD);
}
}
return 0;
}
static DWORD WINAPI 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;
// wait for SwitchDesktop to succeed before using it for current thread
while (true)
{
if (SwitchDesktop (pParam->hDesk))
{
bNewDesktopSet = TRUE;
break;
}
Sleep (SECUREDESKTOP_MONOTIR_PERIOD);
}
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);
}
pParam->retValue = DialogBoxParamW (pParam->hInstance, pParam->lpTemplateName,
NULL, pParam->lpDialogFunc, pParam->dwInitParam);
if (hMonitoringThread)
{
bStopMonitoring = TRUE;
WaitForSingleObject (hMonitoringThread, INFINITE);
CloseHandle (hMonitoringThread);
}
if (bNewDesktopSet)
{
SetThreadDesktop (hOriginalDesk);
SwitchDesktop (hOriginalDesk);
}
return 0;
}
static void GetCtfMonProcessIdList (map<DWORD, BOOL>& processIdList)
{
HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
PROCESSENTRY32 pEntry;
BOOL hRes;
pEntry.dwSize = sizeof (pEntry);
processIdList.clear();
hRes = Process32First(hSnapShot, &pEntry);
while (hRes)
{
LPTSTR szFileName = PathFindFileName (pEntry.szExeFile);
if (_wcsicmp(szFileName, L"ctfmon.exe") == 0)
{
processIdList[pEntry.th32ProcessID] = TRUE;
}
hRes = Process32Next(hSnapShot, &pEntry);
}
CloseHandle(hSnapShot);
}
static void KillProcess (DWORD dwProcessId)
{
HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, 0, dwProcessId);
if (hProcess != NULL)
{
TerminateProcess(hProcess, (UINT) -1);
CloseHandle(hProcess);
}
}
INT_PTR SecureDesktopDialogBoxParam(
HINSTANCE hInstance,
LPCWSTR lpTemplateName,
HWND hWndParent,
DLGPROC lpDialogFunc,
LPARAM dwInitParam)
{
TCHAR szDesktopName[65] = {0};
BOOL bSuccess = FALSE;
INT_PTR retValue = 0;
BOOL bEffectiveUseSecureDesktop = bCmdUseSecureDesktopValid? bCmdUseSecureDesktop : bUseSecureDesktop;
if (bEffectiveUseSecureDesktop && !IsThreadInSecureDesktop(GetCurrentThreadId()))
{
EnterCriticalSection (&csSecureDesktop);
bSecureDesktopOngoing = TRUE;
finally_do ({ bSecureDesktopOngoing = FALSE; LeaveCriticalSection (&csSecureDesktop); });
if (GenerateRandomString (hWndParent, szDesktopName, 64))
{
map<DWORD, BOOL> ctfmonBeforeList, ctfmonAfterList;
DWORD desktopAccess = DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | DESKTOP_READOBJECTS | DESKTOP_SWITCHDESKTOP | DESKTOP_WRITEOBJECTS;
HDESK hSecureDesk;
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
// in the background even before the user has authenticated and in this
// case, we wait for the user to be really authenticated before starting
// secure desktop mechanism
while (!(hInputDesk = OpenInputDesktop (0, TRUE, GENERIC_READ)))
{
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);
WaitForSingleObject (hThread, INFINITE);
CloseHandle (hThread);
retValue = param.retValue;
bSuccess = TRUE;
}
CloseDesktop (hSecureDesk);
// 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++)
{
if (ctfmonBeforeList[It->first] != TRUE)
{
// Kill process
KillProcess (It->first);
}
}
}
burn (szDesktopName, sizeof (szDesktopName));
}
}
if (!bSuccess)
{
// fallback to displaying in normal desktop
retValue = DialogBoxParamW (hInstance, lpTemplateName, hWndParent, lpDialogFunc, dwInitParam);
}
return retValue;
}
#endif
void GetInstallationPath (HWND hwndDlg, wchar_t* szInstallPath, DWORD cchSize, BOOL* pbInstallPathDetermined)
{
HKEY hkey;
BOOL bInstallPathDetermined = FALSE;
wchar_t path[MAX_PATH+20];
ITEMIDLIST *itemList;
memset (szInstallPath, 0, cchSize * sizeof (wchar_t));
// Determine if VeraCrypt is already installed and try to determine its "Program Files" location
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\VeraCrypt", 0, KEY_READ | KEY_WOW64_32KEY, &hkey) == ERROR_SUCCESS)
{
/* Default 'UninstallString' registry strings written by VeraCrypt:
------------------------------------------------------------------------------------
5.0+ "C:\Program Files\VeraCrypt\VeraCrypt Setup.exe" /u
*/
wchar_t rv[MAX_PATH*4];
DWORD size = sizeof (rv);
if (RegQueryValueEx (hkey, L"UninstallString", 0, 0, (LPBYTE) &rv, &size) == ERROR_SUCCESS && wcsrchr (rv, L'/'))
{
size_t len = 0;
// Cut and paste the location (path) where VeraCrypt is installed to InstallationPath
if (rv[0] == L'"')
{
len = wcsrchr (rv, L'/') - rv - 2;
StringCchCopyNW (szInstallPath, cchSize, rv + 1, len);
szInstallPath [len] = 0;
bInstallPathDetermined = TRUE;
if (szInstallPath [wcslen (szInstallPath) - 1] != L'\\')
{
len = wcsrchr (szInstallPath, L'\\') - szInstallPath;
szInstallPath [len] = 0;
}
}
}
RegCloseKey (hkey);
}
if (!bInstallPathDetermined)
{
/* VeraCrypt is not installed or it wasn't possible to determine where it is installed. */
// Default "Program Files" path.
SHGetSpecialFolderLocation (hwndDlg, CSIDL_PROGRAM_FILES, &itemList);
SHGetPathFromIDList (itemList, path);
if (Is64BitOs())
{
// Use a unified default installation path (registry redirection of %ProgramFiles% does not work if the installation path is user-selectable)
wstring s = path;
size_t p = s.find (L" (x86)");
if (p != wstring::npos)
{
s = s.substr (0, p);
if (_waccess (s.c_str(), 0) != -1)
StringCbCopyW (path, sizeof (path), s.c_str());
}
}
StringCbCatW (path, sizeof(path), L"\\VeraCrypt\\");
StringCbCopyW (szInstallPath, cchSize, path);
}
// Make sure the path ends with a backslash
if (szInstallPath [wcslen (szInstallPath) - 1] != L'\\')
{
StringCbCatW (szInstallPath, cchSize, L"\\");
}
if (pbInstallPathDetermined)
*pbInstallPathDetermined = bInstallPathDetermined;
}
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)
{
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);
}
if (!bResult && CurrentOSMajor >= 10)
{
StringCchPrintfW (path, cchSize, L"%c:\\Users\\Default\\AppData\\Local\\Microsoft\\Windows\\WSUS\\", szShell32Path[0]);
bResult = TRUE;
}
return bResult;
}
BOOL BufferHasPattern (const unsigned char* buffer, size_t bufferLen, const void* pattern, size_t patternLen)
{
BOOL bRet = FALSE;
if (patternLen <= bufferLen)
{
size_t i;
for (i = 0; i <= (bufferLen - patternLen); ++i)
{
if (memcmp (&buffer[i], pattern, patternLen) == 0)
{
bRet = TRUE;
break;
}
}
}
return bRet;
}
/* Implementation borrowed from KeePassXC source code (https://github.com/keepassxreboot/keepassxc/blob/release/2.4.0/src/core/Bootstrap.cpp#L150)
*
* 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 bSuccess = FALSE;
// Process token and user
HANDLE hToken = NULL;
PTOKEN_USER pTokenUser = NULL;
DWORD cbBufferSize = 0;
// Access control list
PACL pACL = NULL;
DWORD cbACL = 0;
// Acces mask
DWORD dwAccessMask = SYNCHRONIZE | PROCESS_QUERY_LIMITED_INFORMATION | PROCESS_TERMINATE; // same as protected process
if (IsAdmin ())
{
// if we are running elevated, we allow CreateProcessXXX calls alongside PROCESS_DUP_HANDLE and PROCESS_QUERY_INFORMATION in order to be able
// to implement secure way to open URLs (cf RunAsDesktopUser)
// we are still protecting against memory access from non-admon processes
dwAccessMask |= PROCESS_CREATE_PROCESS | PROCESS_DUP_HANDLE | PROCESS_QUERY_INFORMATION;
}
// Open the access token associated with the calling process
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken)) {
goto Cleanup;
}
// Retrieve the token information in a TOKEN_USER structure
GetTokenInformation(hToken, TokenUser, NULL, 0, &cbBufferSize);
pTokenUser = (PTOKEN_USER) HeapAlloc(GetProcessHeap(), 0, cbBufferSize);
if (pTokenUser == NULL) {
goto Cleanup;
}
if (!GetTokenInformation(hToken, TokenUser, pTokenUser, cbBufferSize, &cbBufferSize)) {
goto Cleanup;
}
if (!IsValidSid(pTokenUser->User.Sid)) {
goto Cleanup;
}
// Calculate the amount of memory that must be allocated for the DACL
cbACL = sizeof(ACL) + sizeof(ACCESS_ALLOWED_ACE) + GetLengthSid(pTokenUser->User.Sid);
// Create and initialize an ACL
pACL = (PACL) HeapAlloc(GetProcessHeap(), 0, cbACL);
if (pACL == NULL) {
goto Cleanup;
}
if (!InitializeAcl(pACL, cbACL, ACL_REVISION)) {
goto Cleanup;
}
// Add allowed access control entries, everything else is denied
if (!AddAccessAllowedAce(
pACL,
ACL_REVISION,
dwAccessMask,
pTokenUser->User.Sid // pointer to the trustee's SID
)) {
goto Cleanup;
}
// Set discretionary access control list
bSuccess = (ERROR_SUCCESS == SetSecurityInfo(GetCurrentProcess(), // object handle
SE_KERNEL_OBJECT, // type of object
DACL_SECURITY_INFORMATION, // change only the objects DACL
NULL,
NULL, // do not change owner or group
pACL, // DACL specified
NULL // do not change SACL
))? TRUE: FALSE;
Cleanup:
if (pACL != NULL) {
HeapFree(GetProcessHeap(), 0, pACL);
}
if (pTokenUser != NULL) {
HeapFree(GetProcessHeap(), 0, pTokenUser);
}
if (hToken != NULL) {
CloseHandle(hToken);
}
return bSuccess;
}
// 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
static bool RunAsDesktopUser(
__in const wchar_t * szApp,
__in wchar_t * szCmdLine)
{
HANDLE hThreadToken = NULL, hShellProcess = NULL, hShellProcessToken = NULL, hPrimaryToken = NULL;
HWND hwnd = NULL;
DWORD dwPID = 0;
BOOL ret;
DWORD dwLastErr;
STARTUPINFOW si;
PROCESS_INFORMATION pi;
bool retval = false;
SecureZeroMemory(&si, sizeof(si));
SecureZeroMemory(&pi, sizeof(pi));
si.cb = sizeof(si);
// locate CreateProcessWithTokenW in Advapi32.dll
if (!CreateProcessWithTokenWPtr)
{
return false;
}
if (!ImpersonateSelf (SecurityImpersonation))
{
return false;
}
if (!OpenThreadToken (GetCurrentThread(), TOKEN_ADJUST_PRIVILEGES, TRUE, &hThreadToken))
{
return false;
}
else
{
TOKEN_PRIVILEGES tkp;
tkp.PrivilegeCount = 1;
LookupPrivilegeValueW(NULL, SE_INCREASE_QUOTA_NAME, &tkp.Privileges[0].Luid);
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
if (!SetThreadToken(NULL, NULL))
{
goto cleanup;
}
AdjustTokenPrivileges(hThreadToken, FALSE, &tkp, 0, NULL, NULL);
dwLastErr = GetLastError();
if (ERROR_SUCCESS != dwLastErr)
{
goto cleanup;
}
}
// From this point down, we have handles to close, so make sure to clean up.
// Get an HWND representing the desktop shell.
// CAVEATS: This will fail if the shell is not running (crashed or terminated), or the default shell has been
// replaced with a custom shell. This also won't return what you probably want if Explorer has been terminated and
// restarted elevated.
hwnd = GetShellWindow();
if (NULL == hwnd)
{
dwLastErr = GetLastError();
goto cleanup;
}
// Get the PID of the desktop shell process.
GetWindowThreadProcessId(hwnd, &dwPID);
if (0 == dwPID)
{
dwLastErr = GetLastError();
goto cleanup;
}
// Open the desktop shell process in order to query it (get the token)
hShellProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, dwPID);
if (!hShellProcess)
{
dwLastErr = GetLastError();
goto cleanup;
}
// Get the process token of the desktop shell.
ret = OpenProcessToken(hShellProcess, TOKEN_DUPLICATE, &hShellProcessToken);
if (!ret)
{
dwLastErr = GetLastError();
goto cleanup;
}
// Duplicate the shell's process token to get a primary token.
// Based on experimentation, this is the minimal set of rights required for CreateProcessWithTokenW (contrary to current documentation).
const DWORD dwTokenRights = TOKEN_QUERY | TOKEN_ASSIGN_PRIMARY | TOKEN_DUPLICATE | TOKEN_ADJUST_DEFAULT | TOKEN_ADJUST_SESSIONID;
ret = DuplicateTokenEx(hShellProcessToken, dwTokenRights, NULL, SecurityImpersonation, TokenPrimary, &hPrimaryToken);
if (!ret)
{
dwLastErr = GetLastError();
goto cleanup;
}
// Start the target process with the new token.
ret = CreateProcessWithTokenWPtr(
hPrimaryToken,
0,
szApp,
szCmdLine,
0,
NULL,
NULL,
&si,
&pi);
if (!ret)
{
dwLastErr = GetLastError();
goto cleanup;
}
// Make sure to close HANDLEs return in the PROCESS_INFORMATION.
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
retval = true;
cleanup:
// Clean up resources
if (hShellProcessToken) CloseHandle(hShellProcessToken);
if (hPrimaryToken) CloseHandle(hPrimaryToken);
if (hShellProcess) CloseHandle(hShellProcess);
if (hThreadToken) CloseHandle(hThreadToken);
if (!RevertToSelf())
return false;
if (!retval)
SetLastError (dwLastErr);
return retval;
}
// This function checks if the process is running with elevated privileges or not
BOOL IsElevated()
{
DWORD dwSize = 0;
HANDLE hToken = NULL;
TOKEN_ELEVATION tokenInformation;
BOOL bReturn = FALSE;
if(OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken))
{
if(GetTokenInformation(hToken, TokenElevation, &tokenInformation, sizeof(TOKEN_ELEVATION), &dwSize))
{
if (tokenInformation.TokenIsElevated)
bReturn = TRUE;
}
CloseHandle(hToken);
}
return bReturn;
}
// Based on code from:
// https://github.com/microsoft/Windows-classic-samples/blob/main/Samples/Win7Samples/winui/shell/appplatform/ExecInExplorer/ExecInExplorer.cpp
HRESULT GetShellViewForDesktop(REFIID riid, void **ppv)
{
*ppv = NULL;
IShellWindows *psw;
HRESULT hr = CoCreateInstance(CLSID_ShellWindows, NULL, CLSCTX_LOCAL_SERVER, IID_PPV_ARGS(&psw));
if (SUCCEEDED(hr))
{
HWND hwnd;
IDispatch* pdisp;
VARIANT vEmpty = {}; // VT_EMPTY
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));
if (SUCCEEDED(hr))
{
IShellView *psv;
hr = psb->QueryActiveShellView(&psv);
if (SUCCEEDED(hr))
{
hr = psv->QueryInterface(riid, ppv);
psv->Release();
}
psb->Release();
}
pdisp->Release();
}
else
{
hr = E_FAIL;
}
psw->Release();
}
return hr;
}
HRESULT GetShellDispatchFromView(IShellView *psv, REFIID riid, void **ppv)
{
*ppv = NULL;
IDispatch *pdispBackground;
HRESULT hr = psv->GetItemObject(SVGIO_BACKGROUND, IID_PPV_ARGS(&pdispBackground));
if (SUCCEEDED(hr))
{
IShellFolderViewDual *psfvd;
hr = pdispBackground->QueryInterface(IID_PPV_ARGS(&psfvd));
if (SUCCEEDED(hr))
{
IDispatch *pdisp;
hr = psfvd->get_Application(&pdisp);
if (SUCCEEDED(hr))
{
hr = pdisp->QueryInterface(riid, ppv);
pdisp->Release();
}
psfvd->Release();
}
pdispBackground->Release();
}
return hr;
}
HRESULT ShellExecInExplorerProcess(PCWSTR pszFile)
{
IShellView *psv;
CoInitialize(NULL);
HRESULT hr = GetShellViewForDesktop(IID_PPV_ARGS(&psv));
if (SUCCEEDED(hr))
{
IShellDispatch2 *psd;
hr = GetShellDispatchFromView(psv, IID_PPV_ARGS(&psd));
if (SUCCEEDED(hr))
{
BSTR bstrFile = SysAllocString(pszFile);
hr = bstrFile ? S_OK : E_OUTOFMEMORY;
if (SUCCEEDED(hr))
{
VARIANT vtEmpty = {}; // VT_EMPTY
hr = psd->ShellExecuteW(bstrFile, vtEmpty, vtEmpty, vtEmpty, vtEmpty);
SysFreeString(bstrFile);
}
psd->Release();
}
psv->Release();
}
CoUninitialize();
return hr;
}
// This function always loads a URL in a non-privileged mode
// If current process has admin privileges, we execute the command "rundll32 url.dll,FileProtocolHandler URL" as non-elevated
// Use this security mechanism only starting from Windows Vista and only if we can get the window of the Shell's desktop since
// we rely on the Shell to be already running in a non-privileges mode. If the Shell is not running or if it has been modified,
// then we can't protect the user in such non standard environment
void SafeOpenURL (LPCWSTR szUrl)
{
BOOL bFallback = TRUE;
if (IsOSAtLeast (WIN_VISTA) && IsUacSupported() && IsAdmin () && IsElevated() && GetShellWindow())
{
WCHAR szRunDllPath[TC_MAX_PATH];
WCHAR szUrlDllPath[TC_MAX_PATH];
WCHAR szSystemPath[TC_MAX_PATH];
LPWSTR szCommandLine = new WCHAR[1024];
if (!GetSystemDirectory(szSystemPath, MAX_PATH))
StringCbCopyW(szSystemPath, sizeof(szSystemPath), L"C:\\Windows\\System32");
StringCbPrintfW(szRunDllPath, sizeof(szRunDllPath), L"%s\\%s", szSystemPath, L"rundll32.exe");
StringCbPrintfW(szUrlDllPath, sizeof(szUrlDllPath), L"%s\\%s", szSystemPath, L"url.dll");
StringCchPrintfW(szCommandLine, 1024, L"%s %s,FileProtocolHandler %s", szRunDllPath, szUrlDllPath, szUrl);
if (RunAsDesktopUser (NULL, szCommandLine))
{
bFallback = FALSE;
}
else
{
// fallback to IShellDispatch2::ShellExecuteW
if (SUCCEEDED(ShellExecInExplorerProcess(szUrl)))
{
bFallback = FALSE;
}
}
delete [] szCommandLine;
}
if (bFallback)
{
ShellExecuteW (NULL, L"open", szUrl, NULL, NULL, SW_SHOWNORMAL);
}
}
#if !defined(SETUP) && defined(_WIN64)
#define RtlGenRandom SystemFunction036
extern "C" BOOLEAN NTAPI RtlGenRandom(PVOID RandomBuffer, ULONG RandomBufferLength);
void GetAppRandomSeed (unsigned char* pbRandSeed, size_t cbRandSeed)
{
LARGE_INTEGER iSeed;
SYSTEMTIME sysTime;
byte digest[WHIRLPOOL_DIGESTSIZE];
WHIRLPOOL_CTX tctx;
size_t count;
while (cbRandSeed)
{
WHIRLPOOL_init (&tctx);
// we hash current content of digest buffer which is uninitialized the first time
WHIRLPOOL_add (digest, WHIRLPOOL_DIGESTSIZE, &tctx);
// we use various time information as source of entropy
GetSystemTime (&sysTime);
WHIRLPOOL_add ((unsigned char *) &sysTime, sizeof(sysTime), &tctx);
if (QueryPerformanceCounter (&iSeed))
WHIRLPOOL_add ((unsigned char *) &(iSeed.QuadPart), sizeof(iSeed.QuadPart), &tctx);
if (QueryPerformanceFrequency (&iSeed))
WHIRLPOOL_add ((unsigned char *) &(iSeed.QuadPart), sizeof(iSeed.QuadPart), &tctx);
/* use Windows random generator as entropy source */
if (RtlGenRandom (digest, sizeof (digest)))
WHIRLPOOL_add (digest, sizeof(digest), &tctx);
/* use JitterEntropy library to get good quality random bytes based on CPU timing jitter */
if (0 == jent_entropy_init ())
{
struct rand_data *ec = jent_entropy_collector_alloc (1, 0);
if (ec)
{
ssize_t rndLen = jent_read_entropy (ec, (char*) digest, sizeof (digest));
if (rndLen > 0)
WHIRLPOOL_add (digest, (unsigned int) rndLen, &tctx);
jent_entropy_collector_free (ec);
}
}
// use RDSEED or RDRAND from CPU as source of entropy if enabled
if ( IsCpuRngEnabled() &&
( (HasRDSEED() && RDSEED_getBytes (digest, sizeof (digest)))
|| (HasRDRAND() && RDRAND_getBytes (digest, sizeof (digest)))
))
{
WHIRLPOOL_add (digest, sizeof(digest), &tctx);
}
WHIRLPOOL_finalize (&tctx, digest);
count = VC_MIN (cbRandSeed, sizeof (digest));
// copy digest value to seed buffer
memcpy (pbRandSeed, digest, count);
cbRandSeed -= count;
pbRandSeed += count;
}
FAST_ERASE64 (digest, sizeof (digest));
FAST_ERASE64 (&iSeed.QuadPart, 8);
burn (&sysTime, sizeof(sysTime));
burn (&tctx, sizeof(tctx));
}
#endif
/*
* GetBitLockerEncryptionStatus: retuns the BitLocker encryption status of a given drive.
*/
typedef enum BitLockerProtectionState
{
BL_State_FullyDecrypted = 0,
BL_State_FullyEncrypted = 1,
BL_State_EncryptionInProgress = 2,
BL_State_DecryptionInProgress = 3,
BL_State_EncryptionSuspended = 4,
BL_State_DecryptionSuspended = 5,
BL_State_FullyEncryptedWipeInProgress = 6,
BL_State_FullyEncryptedWipeSuspended = 7
} BitLockerProtectionState;
typedef HRESULT (WINAPI *SHCreateItemFromParsingNameFn)(
PCWSTR pszPath,
IBindCtx* pbc,
REFIID riid,
void** ppv
);
typedef HRESULT (WINAPI *PSGetPropertyKeyFromNameFn)(
_In_ PCWSTR pszName,
_Out_ PROPERTYKEY* ppropkey);
/*
Code derived from https://stackoverflow.com/questions/23841973/how-to-tell-if-drive-is-bitlocker-encrypted-without-admin-privilege/47192128#47192128
*/
BitLockerEncryptionStatus GetBitLockerEncryptionStatus(WCHAR driveLetter)
{
HRESULT hr;
BitLockerEncryptionStatus blStatus = BL_Status_Unknown;
wchar_t szDllPath[MAX_PATH] = { 0 };
HMODULE hShell32 = NULL;
CoInitialize(NULL);
if (GetSystemDirectory(szDllPath, MAX_PATH))
StringCchCatW(szDllPath, MAX_PATH, L"\\Shell32.dll");
else
StringCchCopyW(szDllPath, MAX_PATH, L"C:\\Windows\\System32\\Shell32.dll");
hShell32 = LoadLibrary(szDllPath);
if (hShell32)
{
SHCreateItemFromParsingNameFn SHCreateItemFromParsingNamePtr = (SHCreateItemFromParsingNameFn)GetProcAddress(hShell32, "SHCreateItemFromParsingName");
if (SHCreateItemFromParsingNamePtr)
{
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));
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;
}
}
}
if (drive)
drive->Release();
}
FreeLibrary(hPropsys);
}
}
else
{
blStatus = BL_Status_Unprotected; // before Vista, there was no Bitlocker
}
FreeLibrary(hShell32);
}
CoUninitialize();
return blStatus;
}
////////////////////////////////////////////////////////////////////////////////////////
static CLIPFORMAT g_supportedFormats[] = { CF_UNICODETEXT, CF_TEXT, CF_OEMTEXT};
//*************************************************************
// GenericDropTarget
//*************************************************************
GenericDropTarget::GenericDropTarget(CLIPFORMAT* pFormats, size_t count)
: m_DropTargetWnd(NULL),
m_dwRefCount(1),
m_KeyState(0L),
m_Data(NULL)
{
m_DropPoint.x = 0;
m_DropPoint.y = 0;
if (pFormats && count)
{
for (size_t i = 0; i < count; i++)
{
m_SupportedFormat.push_back (pFormats[i]);
}
}
}
GenericDropTarget::~GenericDropTarget()
{
}
HRESULT GenericDropTarget::QueryInterface(REFIID iid, void **ppvObject)
{
if(ppvObject == NULL)
return E_FAIL;
if (iid == IID_IUnknown)
{
AddRef();
(*ppvObject) = this;
return S_OK;
}
// compare guids fast and dirty
if (IsEqualGUID (iid, IID_IDropTarget))
{
AddRef();
(*ppvObject) = this;
return S_OK;
}
return E_FAIL;
}
ULONG GenericDropTarget::AddRef(void)
{
return (ULONG) InterlockedIncrement (&m_dwRefCount);
}
ULONG GenericDropTarget::Release(void)
{
if (InterlockedDecrement (&m_dwRefCount) == 0)
{
delete this;
return 0;
}
else
return (ULONG) m_dwRefCount;
}
//*************************************************************
// Register
// Called by whom implements us so we can serve
//*************************************************************
BOOL GenericDropTarget::Register(HWND hWnd)
{
if(NULL == hWnd)
return FALSE;
OleInitialize(NULL);
// required: these MUST be strong locked
CoLockObjectExternal(this, TRUE, 0);
// this is ok, we have it
DWORD hRes = ::RegisterDragDrop(hWnd, this);
if(SUCCEEDED(hRes))
{
// keep
m_DropTargetWnd = hWnd;
return TRUE;
}
// unlock
CoLockObjectExternal(this, FALSE, 0);
// bye bye COM
OleUninitialize();
// wont accept data now
return FALSE;
}
//*************************************************************
// Revoke
// Unregister us as a target
//*************************************************************
void GenericDropTarget::Revoke()
{
if(NULL == m_DropTargetWnd)
return;
RevokeDragDrop(m_DropTargetWnd);
m_DropTargetWnd = NULL;
// unlock
CoLockObjectExternal(this, FALSE, 0);
// bye bye COM
OleUninitialize();
}
//*************************************************************
// DragEnter
//*************************************************************
HRESULT GenericDropTarget::DragEnter(struct IDataObject *pDataObject, unsigned long grfKeyState, struct _POINTL pMouse, unsigned long * pDropEffect)
{
if(pDataObject == NULL)
return E_FAIL; // must have data
// keep point
m_DropPoint.x = pMouse.x;
m_DropPoint.y = pMouse.y;
// keep key
m_KeyState = grfKeyState;
// call top
*pDropEffect = GotEnter();
return S_OK;
}
//*************************************************************
// DragOver
// Coming over!
//*************************************************************
HRESULT GenericDropTarget::DragOver(unsigned long grfKeyState, struct _POINTL pMouse, unsigned long *pEffect)
{
// keep point
m_DropPoint.x = pMouse.x;
m_DropPoint.y = pMouse.y;
// keep key
m_KeyState = grfKeyState;
// call top
*pEffect = GotDrag();
return S_OK;
}
//*************************************************************
// DragLeave
// Free! At last!
//*************************************************************
HRESULT GenericDropTarget::DragLeave(void)
{
GotLeave();
return S_OK;
}
//*************************************************************
// Drop
//*************************************************************
HRESULT GenericDropTarget::Drop(struct IDataObject *pDataObject, unsigned long grfKeyState, struct _POINTL pMouse, unsigned long *pdwEffect)
{
if(NULL == pDataObject)
return E_FAIL;
// do final effect
*pdwEffect = DROPEFFECT_COPY;
// Check the data
FORMATETC iFormat;
ZeroMemory(&iFormat, sizeof(FORMATETC));
STGMEDIUM iMedium;
ZeroMemory(&iMedium, sizeof(STGMEDIUM));
HRESULT hRes;
size_t i;
bool bFound = false;
for (i = 0; i < m_SupportedFormat.size(); i++)
{
// data
iFormat.cfFormat = m_SupportedFormat[i];
iFormat.dwAspect = DVASPECT_CONTENT;
iFormat.lindex = -1; // give me all baby
iFormat.tymed = TYMED_HGLOBAL; // want mem
hRes = pDataObject->GetData(&iFormat, &iMedium);
if(SUCCEEDED(hRes))
{
bFound = true;
break;
}
}
if (!bFound)
return hRes;
// we have the data, get it
BYTE *iMem = (BYTE *)::GlobalLock(iMedium.hGlobal);
// pass over
m_Data = iMem;
// keep point
m_DropPoint.x = pMouse.x;
m_DropPoint.y = pMouse.y;
// keep key
m_KeyState = grfKeyState;
// notify parent of drop
GotDrop(m_SupportedFormat[i]);
::GlobalUnlock(iMedium.hGlobal);
// free data
if(iMedium.pUnkForRelease != NULL)
iMedium.pUnkForRelease->Release();
return S_OK;
}
//*************************************************************
// Stub implementation
// Real stuff would be done in parent
//*************************************************************
void GenericDropTarget::GotDrop(CLIPFORMAT format)
{
}
DWORD GenericDropTarget::GotDrag(void)
{
return DROPEFFECT_LINK;
}
void GenericDropTarget::GotLeave(void)
{
}
DWORD GenericDropTarget::GotEnter(void)
{
return DROPEFFECT_LINK;
}
// ************************************************************
// PasswordEditDropTarget
// Constructor
// ************************************************************
PasswordEditDropTarget::PasswordEditDropTarget() : GenericDropTarget (g_supportedFormats, ARRAYSIZE (g_supportedFormats))
{
}
// ************************************************************
// GotDrag
// ************************************************************
DWORD PasswordEditDropTarget::GotDrag(void)
{
return GotEnter();
}
// ************************************************************
// GotLeave
// ************************************************************
void PasswordEditDropTarget::GotLeave(void)
{
}
// ************************************************************
// GotEnter
// ************************************************************
DWORD PasswordEditDropTarget::GotEnter(void)
{
TCHAR szClassName[64];
DWORD dwStyles;
int maxLen;
HWND hChild = WindowFromPoint (m_DropPoint);
// check that we are on password edit control (we use maximum length to correctly identify password fields since they don't always have ES_PASSWORD style (if the the user checked show password)
if (hChild && GetClassName (hChild, szClassName, ARRAYSIZE (szClassName)) && (0 == _tcsicmp (szClassName, _T("EDIT")))
&& (dwStyles = GetWindowLongPtr (hChild, GWL_STYLE)) && !(dwStyles & ES_NUMBER)
&& (maxLen = (int) SendMessage (hChild, EM_GETLIMITTEXT, 0, 0)) && (maxLen == MAX_PASSWORD || maxLen == MAX_LEGACY_PASSWORD)
)
{
return DROPEFFECT_COPY;
}
return DROPEFFECT_LINK;
}
// ************************************************************
// GotDrop
// Called if we have a drop text drop here.
//
// ************************************************************
void PasswordEditDropTarget::GotDrop(CLIPFORMAT format)
{
// value contains the material itself
if(m_Data)
{
TCHAR szClassName[64];
DWORD dwStyles;
int maxLen;
HWND hChild = WindowFromPoint (m_DropPoint);
if (hChild && GetClassName (hChild, szClassName, ARRAYSIZE (szClassName)) && (0 == _tcsicmp (szClassName, _T("EDIT")))
&& (dwStyles = GetWindowLongPtr (hChild, GWL_STYLE)) && !(dwStyles & ES_NUMBER)
&& (maxLen = (int) SendMessage (hChild, EM_GETLIMITTEXT, 0, 0)) && (maxLen == MAX_PASSWORD || maxLen == MAX_LEGACY_PASSWORD)
)
{
WCHAR* wszText;
int wlen;
bool bFree = false;
// get the text
if (format == CF_UNICODETEXT)
{
wszText = (WCHAR *)m_Data;
}
else
{
char *iText = (char *)m_Data;
wlen = MultiByteToWideChar ((format == CF_OEMTEXT)? CP_OEMCP : CP_ACP, 0, iText, -1, NULL, 0);
wszText = new WCHAR[wlen];
if (wszText)
{
wlen = MultiByteToWideChar (CP_ACP, 0, iText, -1, wszText, wlen);
bFree = true;
}
}
WCHAR* pchData = wszText;
int txtlen = 0;
bool bTruncated = false;
// remove any appended \r or \n
while (*pchData)
{
if (*pchData == '\r' || *pchData == '\n')
break;
else
{
txtlen++;
pchData++;
}
}
if (txtlen)
{
if (txtlen > maxLen)
{
bTruncated = true;
txtlen = maxLen;
}
SetFocus (hChild);
wszText[txtlen] = 0;
SetWindowText(hChild , wszText);
if (bTruncated)
{
EDITBALLOONTIP ebt;
DWORD dwTextSize = (DWORD) wcslen (GetString ("PASSWORD_PASTED_TRUNCATED")) + 16;
WCHAR* szErrorText = (WCHAR*) malloc (dwTextSize * sizeof (WCHAR));
StringCchPrintf (szErrorText, dwTextSize, GetString ("PASSWORD_PASTED_TRUNCATED"), maxLen);
ebt.cbStruct = sizeof( EDITBALLOONTIP );
ebt.pszText = szErrorText;
ebt.pszTitle = lpszTitle;
ebt.ttiIcon = TTI_WARNING_LARGE; // tooltip warning icon
SendMessage(hChild, EM_SHOWBALLOONTIP, 0, (LPARAM)&ebt);
MessageBeep (0xFFFFFFFF);
free (szErrorText);
}
}
if (bFree)
{
burn (wszText, wlen * sizeof (WCHAR));
delete [] wszText;
}
}
}
}
/*
* Query the status of Hibernate and Fast Startup
*/
typedef BOOLEAN (WINAPI *GetPwrCapabilitiesFn)(
PSYSTEM_POWER_CAPABILITIES lpspc
);
BOOL GetHibernateStatus (BOOL& bHibernateEnabled, BOOL& bHiberbootEnabled)
{
wchar_t szPowrProfPath[MAX_PATH] = {0};
HMODULE hPowrProf = NULL;
BOOL bResult = FALSE;
bHibernateEnabled = bHiberbootEnabled = FALSE;
if (GetSystemDirectory(szPowrProfPath, MAX_PATH))
StringCchCatW (szPowrProfPath, MAX_PATH, L"\\PowrProf.dll");
else
StringCchCopyW (szPowrProfPath, MAX_PATH, L"C:\\Windows\\System32\\PowrProf.dll");
hPowrProf = LoadLibrary (szPowrProfPath);
if (hPowrProf)
{
GetPwrCapabilitiesFn GetPwrCapabilitiesPtr = (GetPwrCapabilitiesFn) GetProcAddress (hPowrProf, "GetPwrCapabilities");
if ( GetPwrCapabilitiesPtr)
{
SYSTEM_POWER_CAPABILITIES spc;
BOOLEAN bRet = GetPwrCapabilitiesPtr (&spc);
if (bRet)
{
DWORD dwHibernateEnabled = 0;
DWORD dwHiberbootEnabled = 0;
if (spc.SystemS4)
{
dwHibernateEnabled = 1;
if(!ReadLocalMachineRegistryDword (L"SYSTEM\\CurrentControlSet\\Control\\Power", L"HibernateEnabled", &dwHibernateEnabled))
{
// starting from Windows 10 1809 (Build 17763), HibernateEnabledDefault is used when HibernateEnabled is absent
if (IsOSVersionAtLeast (WIN_10, 0) && CurrentOSBuildNumber >= 17763)
ReadLocalMachineRegistryDword (L"SYSTEM\\CurrentControlSet\\Control\\Power", L"HibernateEnabledDefault", &dwHibernateEnabled);
}
}
// check if Fast Startup / Hybrid Boot is enabled
#if _MSC_VER >= 1900
if (IsOSVersionAtLeast (WIN_8, 0) && spc.Hiberboot)
#else
if (IsOSVersionAtLeast(WIN_8, 0) && spc.spare2[0])
#endif
{
dwHiberbootEnabled = 1;
ReadLocalMachineRegistryDword (L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Power", L"HiberbootEnabled", &dwHiberbootEnabled);
}
if (dwHibernateEnabled)
bHibernateEnabled = TRUE;
else
bHibernateEnabled = FALSE;
if (dwHiberbootEnabled)
bHiberbootEnabled = TRUE;
else
bHiberbootEnabled = FALSE;
bResult = TRUE;
}
}
FreeLibrary (hPowrProf);
}
return bResult;
}
/* return TRUE if Windows is in Test Signing mode */
/* ref: https://social.msdn.microsoft.com/Forums/Windowsapps/en-US/e6c1be93-7003-4594-b8e4-18ab4a75d273/detecting-testsigning-onoff-via-api */
BOOL IsTestSigningModeEnabled ()
{
BOOL bEnabled = FALSE;
NtQuerySystemInformationFn NtQuerySystemInformationPtr = (NtQuerySystemInformationFn) GetProcAddress (GetModuleHandle (L"ntdll.dll"), "NtQuerySystemInformation");
if(NtQuerySystemInformationPtr)
{
SYSTEM_CODEINTEGRITY_INFORMATION info = {0};
ULONG cbReturnedData = 0;
info.Length = sizeof(info);
if ( (NtQuerySystemInformationPtr((SYSTEM_INFORMATION_CLASS) SYSTEMCODEINTEGRITYINFORMATION, &info, sizeof(info), &cbReturnedData) >= 0)
&& (cbReturnedData == sizeof(info))
)
{
if ((info.CodeIntegrityOptions & (CODEINTEGRITY_OPTION_TESTSIGN | CODEINTEGRITY_OPTION_ENABLED)) == (CODEINTEGRITY_OPTION_TESTSIGN | CODEINTEGRITY_OPTION_ENABLED))
{
bEnabled = TRUE;
}
}
}
return bEnabled;
}
// Adapted from https://docs.microsoft.com/en-us/windows/win32/wmisdk/example-creating-a-wmi-application
bool GetKbList (std::vector<std::wstring>& kbList)
{
HRESULT hres;
kbList.clear();
// Initialize COM.
hres = CoInitialize(NULL);
if (FAILED(hres))
{
return false;
}
// Initialize
hres = CoInitializeSecurity(
NULL,
-1, // COM negotiates service
NULL, // Authentication services
NULL, // Reserved
RPC_C_AUTHN_LEVEL_DEFAULT, // authentication
RPC_C_IMP_LEVEL_IMPERSONATE, // Impersonation
NULL, // Authentication info
EOAC_NONE, // Additional capabilities
NULL // Reserved
);
if (FAILED(hres))
{
CoUninitialize();
return false;
}
// Obtain the initial locator to Windows Management
// on a particular host computer.
IWbemLocator *pLoc = 0;
hres = CoCreateInstance(
CLSID_WbemLocator,
0,
CLSCTX_INPROC_SERVER,
IID_IWbemLocator, (LPVOID *) &pLoc);
if (FAILED(hres))
{
CoUninitialize();
return false;
}
IWbemServices *pSvc = 0;
// Connect to the root\cimv2 namespace with the
// current user and obtain pointer pSvc
// to make IWbemServices calls.
hres = pLoc->ConnectServer(
_bstr_t(L"ROOT\\CIMV2"), // WMI namespace
NULL, // User name
NULL, // User password
0, // Locale
NULL, // Security flags
0, // Authority
0, // Context object
&pSvc // IWbemServices proxy
);
if (FAILED(hres))
{
pLoc->Release();
CoUninitialize();
return false;
}
// Set the IWbemServices proxy so that impersonation
// of the user (client) occurs.
hres = CoSetProxyBlanket(
pSvc, // the proxy to set
RPC_C_AUTHN_WINNT, // authentication service
RPC_C_AUTHZ_NONE, // authorization service
NULL, // Server principal name
RPC_C_AUTHN_LEVEL_CALL, // authentication level
RPC_C_IMP_LEVEL_IMPERSONATE, // impersonation level
NULL, // client identity
EOAC_NONE // proxy capabilities
);
if (FAILED(hres))
{
pSvc->Release();
pLoc->Release();
CoUninitialize();
return false;
}
// Use the IWbemServices pointer to make requests of WMI.
// Make requests here:
// query for all installed KBs
IEnumWbemClassObject* pEnumerator = NULL;
hres = pSvc->ExecQuery(
bstr_t("WQL"),
bstr_t("SELECT * FROM Win32_QuickFixEngineering"),
WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,
NULL,
&pEnumerator);
if (FAILED(hres))
{
pSvc->Release();
pLoc->Release();
CoUninitialize();
return false;
}
else
{
IWbemClassObject *pclsObj;
ULONG uReturn = 0;
while (pEnumerator)
{
hres = pEnumerator->Next(WBEM_INFINITE, 1,
&pclsObj, &uReturn);
if(0 == uReturn)
{
break;
}
VARIANT vtProp;
// Get the value of the "hotfixid" property
hres = pclsObj->Get(L"hotfixid", 0, &vtProp, 0, 0);
if (SUCCEEDED(hres) && (V_VT(&vtProp) == VT_BSTR))
{
kbList.push_back(vtProp.bstrVal);
}
VariantClear(&vtProp);
pclsObj->Release();
pclsObj = NULL;
}
}
// Cleanup
// ========
pSvc->Release();
pLoc->Release();
pEnumerator->Release();
CoUninitialize();
return true;
}
bool OneOfKBsInstalled (const wchar_t* szKBs[], int count)
{
std::vector<std::wstring> kbList;
bool bRet = GetKbList(kbList);
if (bRet)
{
// at least one of the given KBs must be present
bool bFound = false;
for (size_t j = 0; j < kbList.size(); j++)
{
for (int i = 0; i < count; i++)
{
if (_wcsicmp(szKBs[i], kbList[j].c_str()) == 0)
{
bFound = true;
break;
}
}
if (bFound)
{
break;
}
}
bRet = bFound;
}
return bRet;
}
#endif // VC_COMREG \ No newline at end of file
diff --git a/src/Common/Dlgcode.h b/src/Common/Dlgcode.h
index d9bc3374..362b2d6d 100644
--- a/src/Common/Dlgcode.h
+++ b/src/Common/Dlgcode.h
@@ -1,787 +1,783 @@
/*
Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses'
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_DLGCODE
#define TC_HEADER_DLGCODE
#include "Common.h"
#include "Apidrvr.h"
#include "Keyfiles.h"
#include "Wipe.h"
#include <Winternl.h>
#ifdef __cplusplus
extern "C" {
#endif
/* IDs for dynamically generated GUI elements */
enum dynamic_gui_element_ids
{
IDPM_CHECK_FILESYS = 500001,
IDPM_REPAIR_FILESYS,
IDPM_OPEN_VOLUME,
IDPM_SELECT_FILE_AND_MOUNT,
IDPM_SELECT_DEVICE_AND_MOUNT,
IDPM_ADD_TO_FAVORITES,
IDPM_ADD_TO_SYSTEM_FAVORITES,
IDM_SHOW_HIDE,
IDM_HOMEPAGE_SYSTRAY,
IDPM_COPY_VALUE_TO_CLIPBOARD
};
enum
{
TC_TBXID_LEGAL_NOTICES,
TC_TBXID_SYS_ENCRYPTION_PRETEST,
TC_TBXID_SYS_ENC_RESCUE_DISK,
TC_TBXID_DECOY_OS_INSTRUCTIONS,
TC_TBXID_EXTRA_BOOT_PARTITION_REMOVAL_INSTRUCTIONS
};
#define TC_APPLICATION_ID L"IDRIX.VeraCrypt"
#define TC_MUTEX_NAME_SYSENC L"Global\\VeraCrypt System Encryption Wizard"
#define TC_MUTEX_NAME_NONSYS_INPLACE_ENC L"Global\\VeraCrypt In-Place Encryption Wizard"
#define TC_MUTEX_NAME_APP_SETUP L"Global\\VeraCrypt Setup"
#define TC_MUTEX_NAME_DRIVER_SETUP L"Global\\VeraCrypt Driver Setup"
#define IDC_ABOUT 0x7fff /* ID for AboutBox on system menu in wm_user range */
#define EXCL_ACCESS_MAX_AUTO_RETRIES 500
#define EXCL_ACCESS_AUTO_RETRY_DELAY 10
#define UNMOUNT_MAX_AUTO_RETRIES 30
#define UNMOUNT_AUTO_RETRY_DELAY 50
// After the user receives the "Incorrect password" error this number of times in a row, we should automatically
// try using the embedded header backup (if any). This ensures that the "Incorrect password" message is reported faster
// initially (most such errors are really caused by supplying an incorrect password, not by header corruption).
#define TC_TRY_HEADER_BAK_AFTER_NBR_WRONG_PWD_TRIES 2
#define MAX_MULTI_CHOICES 10 /* Maximum number of options for mutliple-choice dialog */
#define TC_APPD_FILENAME_CONFIGURATION L"Configuration.xml"
#define TC_APPD_FILENAME_SYSTEM_ENCRYPTION L"System Encryption.xml"
#define TC_APPD_FILENAME_DEFAULT_KEYFILES L"Default Keyfiles.xml"
#define TC_APPD_FILENAME_HISTORY L"History.xml"
#define TC_APPD_FILENAME_FAVORITE_VOLUMES L"Favorite Volumes.xml"
#define TC_APPD_FILENAME_SYSTEM_FAVORITE_VOLUMES _T(TC_APP_NAME) L" System Favorite Volumes.xml"
#define TC_APPD_FILENAME_NONSYS_INPLACE_ENC L"In-Place Encryption"
#define TC_APPD_FILENAME_NONSYS_INPLACE_ENC_WIPE L"In-Place Encryption Wipe Algo"
#define TC_APPD_FILENAME_POST_INSTALL_TASK_TUTORIAL L"Post-Install Task - Tutorial"
#define TC_APPD_FILENAME_POST_INSTALL_TASK_RELEASE_NOTES L"Post-Install Task - Release Notes"
#define TC_APPD_FILENAME_POST_INSTALL_TASK_RESCUE_DISK L"Post-Install Task - Rescue Disk"
#define VC_FILENAME_RENAMED_SUFFIX L"_old"
#ifndef USER_DEFAULT_SCREEN_DPI
#define USER_DEFAULT_SCREEN_DPI 96
#endif
#if (USER_DEFAULT_SCREEN_DPI != 96)
# error Revision of GUI and graphics necessary, since everything assumes default screen DPI as 96 (note that 96 is the default on Windows 2000, XP, and Vista).
#endif
enum
{
TC_POST_INSTALL_CFG_REMOVE_ALL = 0,
TC_POST_INSTALL_CFG_TUTORIAL,
TC_POST_INSTALL_CFG_RELEASE_NOTES,
TC_POST_INSTALL_CFG_RESCUE_DISK,
};
extern char *LastDialogId;
extern char *ConfigBuffer;
extern wchar_t szHelpFile[TC_MAX_PATH];
extern wchar_t szHelpFile2[TC_MAX_PATH];
extern wchar_t SecurityTokenLibraryPath[TC_MAX_PATH];
extern char CmdTokenPin [TC_MAX_PATH];
extern HFONT hFixedDigitFont;
extern HFONT hBoldFont;
extern HFONT hTitleFont;
extern HFONT hFixedFont;
extern HFONT hUserFont;
extern HFONT hUserUnderlineFont;
extern HFONT hUserBoldFont;
extern HFONT WindowTitleBarFont;
extern int ScreenDPI;
extern double DlgAspectRatio;
extern HWND MainDlg;
extern BOOL Silent;
extern BOOL bHistory;
extern BOOL bPreserveTimestamp;
extern BOOL bShowDisconnectedNetworkDrives;
extern BOOL bHideWaitingDialog;
extern BOOL bCmdHideWaitingDialog;
extern BOOL bCmdHideWaitingDialogValid;
extern BOOL bUseSecureDesktop;
extern volatile BOOL bSecureDesktopOngoing;
extern TCHAR SecureDesktopName[65];
extern BOOL bUseLegacyMaxPasswordLength;
extern BOOL bCmdUseSecureDesktop;
extern BOOL bCmdUseSecureDesktopValid;
extern BOOL bStartOnLogon;
extern BOOL bMountDevicesOnLogon;
extern BOOL bMountFavoritesOnLogon;
extern int HiddenSectorDetectionStatus;
extern wchar_t *lpszTitle;
extern OSVersionEnum nCurrentOS;
extern int CurrentOSMajor;
extern int CurrentOSMinor;
extern int CurrentOSServicePack;
extern int CurrentOSBuildNumber;
extern BOOL RemoteSession;
extern HANDLE hDriver;
extern HINSTANCE hInst;
extern int SystemEncryptionStatus;
extern WipeAlgorithmId nWipeMode;
extern BOOL bSysPartitionSelected;
extern BOOL bSysDriveSelected;
extern wchar_t SysPartitionDevicePath [TC_MAX_PATH];
extern wchar_t SysDriveDevicePath [TC_MAX_PATH];
extern char bCachedSysDevicePathsValid;
extern BOOL bHyperLinkBeingTracked;
extern BOOL bInPlaceEncNonSysPending;
extern BOOL PimEnable;
extern BOOL KeyFilesEnable;
extern KeyFile *FirstKeyFile;
extern KeyFilesDlgParam defaultKeyFilesParam;
extern BOOL UacElevated;
extern BOOL IgnoreWmDeviceChange;
extern BOOL DeviceChangeBroadcastDisabled;
extern BOOL LastMountedVolumeDirty;
extern BOOL MountVolumesAsSystemFavorite;
extern BOOL FavoriteMountOnArrivalInProgress;
extern BOOL MultipleMountOperationInProgress;
extern volatile BOOL NeedPeriodicDeviceListUpdate;
extern BOOL DisablePeriodicDeviceListUpdate;
extern BOOL EnableMemoryProtection;
#ifndef SETUP
extern BOOL bLanguageSetInSetup;
#endif
enum tc_app_msg_ids
{
/* WARNING: Changing these values or their meanings may cause incompatibility with other versions
(for example, if a new version of the TrueCrypt installer needed to shut down this version of
TrueCrypt during upgrade, it could fail or do something unwanted because the signal value would
be incorrect). When adding a new constant, verify that the value is unique within this block and
that it is less than WM_APP+16383. */
// Common (inter-app)
TC_APPMSG_CLOSE_BKG_TASK = WM_APP + 4, // Changing this value will prevent smooth upgrades from pre-5.x versions
TC_APPMSG_SYSENC_CONFIG_UPDATE = WM_APP + 101,
TC_APPMSG_TASKBAR_ICON = WM_APP + 102,
TC_APPMSG_LOAD_TEXT_BOX_CONTENT = WM_APP + 103,
// Mount
TC_APPMSG_MOUNT_ENABLE_DISABLE_CONTROLS = WM_APP + 201,
TC_APPMSG_MOUNT_SHOW_WINDOW = WM_APP + 202,
TC_APPMSG_PREBOOT_PASSWORD_MODE = WM_APP + 203,
VC_APPMSG_CREATE_RESCUE_DISK = WM_APP + 204,
// Format
TC_APPMSG_VOL_TRANSFORM_THREAD_ENDED = WM_APP + 301,
TC_APPMSG_FORMAT_FINISHED = WM_APP + 302,
TC_APPMSG_FORMAT_USER_QUIT = WM_APP + 303,
TC_APPMSG_PERFORM_POST_WMINIT_TASKS = WM_APP + 304,
TC_APPMSG_PERFORM_POST_SYSENC_WMINIT_TASKS = WM_APP + 305,
TC_APPMSG_NONSYS_INPLACE_ENC_FINISHED = WM_APP + 306,
// Setup
TC_APPMSG_INSTALL_SUCCESS = WM_APP + 401,
TC_APPMSG_UNINSTALL_SUCCESS = WM_APP + 402,
TC_APPMSG_EXTRACTION_SUCCESS = WM_APP + 403,
TC_APPMSG_INSTALL_FAILURE = WM_APP + 404,
TC_APPMSG_UNINSTALL_FAILURE = WM_APP + 405,
TC_APPMSG_EXTRACTION_FAILURE = WM_APP + 406
};
enum system_encryption_status
{
/* WARNING: As these values are written to config files, if they or their meanings
are changed, incompatiblity with other versions may arise (upgrade, downgrade, etc.).
When adding a new constant, verify that the value is unique within this block. */
SYSENC_STATUS_NONE = 0,
SYSENC_STATUS_PRETEST = 200, // This may also mean that the OS is to be (or has been) copied to a hidden volume (to create a hidden OS).
SYSENC_STATUS_ENCRYPTING = 400,
SYSENC_STATUS_DECRYPTING = 600
};
enum vol_creation_wizard_modes
{
WIZARD_MODE_FILE_CONTAINER = 0,
WIZARD_MODE_NONSYS_DEVICE,
WIZARD_MODE_SYS_DEVICE
};
typedef struct
{
BOOL VolumeIsOpen;
CRYPTO_INFO *CryptoInfo;
BOOL IsDevice;
HANDLE HostFileHandle;
uint64 HostSize;
BOOL TimestampsValid;
FILETIME CreationTime;
FILETIME LastWriteTime;
FILETIME LastAccessTime;
} OpenVolumeContext;
typedef enum BitLockerEncryptionStatus
{
BL_Status_Unknown = 0,
BL_Status_Unprotected,
BL_Status_Protected
} BitLockerEncryptionStatus;
#ifndef CODEINTEGRITY_OPTION_ENABLED
#define CODEINTEGRITY_OPTION_ENABLED 0x01
#define CODEINTEGRITY_OPTION_TESTSIGN 0x02
typedef struct _SYSTEM_CODEINTEGRITY_INFORMATION {
ULONG Length;
ULONG CodeIntegrityOptions;
} SYSTEM_CODEINTEGRITY_INFORMATION, *PSYSTEM_CODEINTEGRITY_INFORMATION;
#endif
#define SYSPARTITIONINFORMATION 0x62
#define SYSTEMCODEINTEGRITYINFORMATION 0x67
typedef NTSTATUS (WINAPI *NtQuerySystemInformationFn)(
SYSTEM_INFORMATION_CLASS SystemInformationClass,
PVOID SystemInformation,
ULONG SystemInformationLength,
PULONG ReturnLength
);
#define DEFAULT_VOL_CREATION_WIZARD_MODE WIZARD_MODE_FILE_CONTAINER
#define ICON_HAND MB_ICONHAND
#define YES_NO MB_YESNO
#define ISO_BURNER_TOOL L"isoburn.exe"
#define PRINT_TOOL L"notepad.exe"
-
-BOOL CheckIsIMESupported ();
-
void InitGlobalLocks ();
void FinalizeGlobalLocks ();
void cleanup ( void );
void LowerCaseCopy ( wchar_t *lpszDest , const wchar_t *lpszSource );
void UpperCaseCopy ( wchar_t *lpszDest , size_t cbDest, const wchar_t *lpszSource );
BOOL IsNullTerminateString (const wchar_t* str, size_t cbSize);
void CreateFullVolumePath ( wchar_t *lpszDiskFile , size_t cbDiskFile, const wchar_t *lpszFileName , BOOL *bDevice );
int FakeDosNameForDevice ( const wchar_t *lpszDiskFile , wchar_t *lpszDosDevice , size_t cbDosDevice, wchar_t *lpszCFDevice , size_t cbCFDevice, BOOL bNameOnly );
int RemoveFakeDosName ( wchar_t *lpszDiskFile , wchar_t *lpszDosDevice );
void AbortProcessDirect ( wchar_t *abortMsg );
void AbortProcess ( char *stringId );
void AbortProcessSilent ( void );
void *err_malloc ( size_t size );
char *err_strdup ( char *lpszText );
DWORD handleWin32Error ( HWND hwndDlg, const char* srcPos );
BOOL IsDiskReadError (DWORD error);
BOOL IsDiskWriteError (DWORD error);
BOOL IsDiskError (DWORD error);
BOOL translateWin32Error ( wchar_t *lpszMsgBuf , int nWSizeOfBuf );
BOOL CALLBACK AboutDlgProc ( HWND hwndDlg , UINT msg , WPARAM wParam , LPARAM lParam );
static BOOL CALLBACK StaticModelessWaitDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
void DisplayStaticModelessWaitDlg (HWND parent);
void CloseStaticModelessWaitDlg (void);
BOOL IsButtonChecked ( HWND hButton );
void CheckButton ( HWND hButton );
void LeftPadString (wchar_t *szTmp, int len, int targetLen, wchar_t filler);
void InitDialog ( HWND hwndDlg );
void ProcessPaintMessages (HWND hwnd, int maxMessagesToProcess);
HDC CreateMemBitmap ( HINSTANCE hInstance , HWND hwnd , wchar_t *resource );
HBITMAP RenderBitmap ( wchar_t *resource , HWND hwndDest , int x , int y , int nWidth , int nHeight , BOOL bDirectRender , BOOL bKeepAspectRatio);
LRESULT CALLBACK RedTick ( HWND hwnd , UINT uMsg , WPARAM wParam , LPARAM lParam );
BOOL RegisterRedTick ( HINSTANCE hInstance );
BOOL UnregisterRedTick ( HINSTANCE hInstance );
LRESULT CALLBACK SplashDlgProc ( HWND hwnd , UINT uMsg , WPARAM wParam , LPARAM lParam );
void WaitCursor ( void );
void NormalCursor ( void );
void ArrowWaitCursor ( void );
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);
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 );
BOOL TCCreateMutex (volatile HANDLE *hMutex, wchar_t *name);
void TCCloseMutex (volatile HANDLE *hMutex);
BOOL MutexExistsOnSystem (wchar_t *name);
BOOL CreateSysEncMutex (void);
BOOL InstanceHasSysEncMutex (void);
void CloseSysEncMutex (void);
BOOL CreateNonSysInplaceEncMutex (void);
BOOL InstanceHasNonSysInplaceEncMutex (void);
void CloseNonSysInplaceEncMutex (void);
BOOL NonSysInplaceEncInProgressElsewhere (void);
BOOL CreateDriverSetupMutex (void);
void CloseDriverSetupMutex (void);
BOOL CreateAppSetupMutex (void);
BOOL InstanceHasAppSetupMutex (void);
void CloseAppSetupMutex (void);
BOOL IsTrueCryptInstallerRunning (void);
uint32 ReadDriverConfigurationFlags ();
uint32 ReadServiceConfigurationFlags ();
uint32 ReadEncryptionThreadPoolFreeCpuCountLimit ();
BOOL LoadSysEncSettings ();
int LoadNonSysInPlaceEncSettings (WipeAlgorithmId *wipeAlgorithm);
void RemoveNonSysInPlaceEncNotifications (void);
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);
int GetAvailableFixedDisks ( HWND hComboBox , char *lpszRootPath );
int GetAvailableRemovables ( HWND hComboBox , char *lpszRootPath );
int IsSystemDevicePath (const wchar_t *path, HWND hwndDlg, BOOL bReliableRequired);
int IsNonSysPartitionOnSysDrive (const wchar_t *path);
BOOL CALLBACK RawDevicesDlgProc ( HWND hwndDlg , UINT msg , WPARAM wParam , LPARAM lParam );
BOOL CALLBACK TextEditDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR TextInfoDialogBox (int nID);
BOOL CALLBACK TextInfoDialogBoxDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
char * GetLegalNotices ();
BOOL CALLBACK BenchmarkDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
void UserEnrichRandomPool (HWND hwndDlg);
BOOL CALLBACK KeyfileGeneratorDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
BOOL CALLBACK MultiChoiceDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
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 BrowseFile (HWND hwndDlg, char *stringId, wchar_t *initialDir);
BOOL BrowseDirectories (HWND hWnd, char *lpszTitle, wchar_t *dirName);
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 );
void OpenVolumeExplorerWindow (int driveNo);
static BOOL CALLBACK CloseVolumeExplorerWindowsEnum( HWND hwnd, LPARAM driveNo);
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);
void ResetWrongPwdRetryCount (void);
BOOL WrongPwdRetryCountOverLimit (void);
DWORD GetUsedLogicalDrives (void);
int GetFirstAvailableDrive ();
int GetLastAvailableDrive ();
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);
BOOL UnmountVolume (HWND hwndDlg , int nDosDriveNo, BOOL forceUnmount);
BOOL UnmountVolumeAfterFormatExCall (HWND hwndDlg, int nDosDriveNo);
BOOL IsPasswordCacheEmpty (void);
BOOL IsMountedVolumeID (BYTE volumeID[VOLUME_ID_SIZE]);
BOOL IsMountedVolume (const wchar_t *volname);
int GetMountedVolumeDriveNo (wchar_t *volname);
BOOL IsAdmin (void);
BOOL IsBuiltInAdmin ();
BOOL IsUacSupported ();
BOOL ResolveSymbolicLink (const wchar_t *symLinkName, PWSTR targetName, size_t cbTargetName);
int GetDiskDeviceDriveLetter (PWSTR deviceName);
int FileSystemAppearsEmpty (const wchar_t *devicePath);
__int64 GetStatsFreeSpaceOnPartition (const wchar_t *devicePath, float *percent, __int64 *occupiedBytes, BOOL silent);
__int64 GetDeviceSize (const wchar_t *devicePath);
HANDLE DismountDrive (wchar_t *devName, wchar_t *devicePath);
int64 FindString (const char *buf, const char *str, int64 bufLen, int64 strLen, int64 startOffset);
BOOL FileExists (const wchar_t *filePathPtr);
__int64 FindStringInFile (const wchar_t *filePath, const char *str, int strLen);
BOOL TCCopyFile (wchar_t *sourceFileName, wchar_t *destinationFile);
BOOL SaveBufferToFile (const char *inputBuffer, const wchar_t *destinationFile, DWORD inputLength, BOOL bAppend, BOOL bRenameIfFailed);
typedef void (_cdecl *ProgressFn) ( HWND hwndDlg , const wchar_t *txt );
BOOL DecompressZipToDir (const unsigned char *inputBuffer, DWORD inputLength, const wchar_t *destinationFile, ProgressFn progressFnPtr, HWND hwndDlg);
BOOL TCFlushFile (FILE *f);
BOOL PrintHardCopyTextUTF16 (wchar_t *text, wchar_t *title, size_t byteLen);
void GetSpeedString (unsigned __int64 speed, wchar_t *str, size_t cbStr);
BOOL IsNonInstallMode ();
BOOL DriverUnload ();
LRESULT SetCheckBox (HWND hwndDlg, int dlgItem, BOOL state);
BOOL GetCheckBox (HWND hwndDlg, int dlgItem);
void SetListScrollHPos (HWND hList, int topMostVisibleItem);
void ManageStartupSeq (void);
void ManageStartupSeqWiz (BOOL bRemove, const wchar_t *arg);
void CleanLastVisitedMRU (void);
void ClearHistory (HWND hwndDlgItem);
LRESULT ListItemAdd (HWND list, int index, const wchar_t *string);
LRESULT ListSubItemSet (HWND list, int index, int subIndex, const wchar_t *string);
BOOL GetMountList (MOUNT_LIST_STRUCT *list);
int GetDriverRefCount ();
void GetSizeString (unsigned __int64 size, wchar_t *str, size_t cbStr);
__int64 GetFileSize64 (const wchar_t *path);
BOOL LoadInt16 (const wchar_t *filePath, int *result, __int64 fileOffset);
BOOL LoadInt32 (const wchar_t *filePath, unsigned __int32 *result, __int64 fileOffset);
char *LoadFile (const wchar_t *fileName, DWORD *size);
char *LoadFileBlock (const wchar_t *fileName, __int64 fileOffset, DWORD count);
wchar_t *GetModPath (wchar_t *path, int maxSize);
wchar_t *GetConfigPath (wchar_t *fileName);
wchar_t *GetProgramConfigPath (wchar_t *fileName);
wchar_t GetSystemDriveLetter (void);
void OpenPageHelp (HWND hwndDlg, int nPage);
void TaskBarIconDisplayBalloonTooltip (HWND hwnd, wchar_t *headline, wchar_t *text, BOOL warning);
void InfoBalloon (char *headingStringId, char *textStringId, HWND hwnd);
void InfoBalloonDirect (wchar_t *headingString, wchar_t *textString, HWND hwnd);
void WarningBalloon (char *headingStringId, char *textStringId, HWND hwnd);
void WarningBalloonDirect (wchar_t *headingString, wchar_t *textString, HWND hwnd);
int Info (char *stringId, HWND hwnd);
int InfoTopMost (char *stringId, HWND hwnd);
int InfoDirect (const wchar_t *msg, HWND hwnd);
int Warning (char *stringId, HWND hwnd);
int WarningTopMost (char *stringId, HWND hwnd);
int WarningDirect (const wchar_t *warnMsg, HWND hwnd);
int Error (char *stringId, HWND hwnd);
int ErrorRetryCancel (char *stringId, HWND hwnd);
int ErrorDirect (const wchar_t *errMsg, HWND hwnd);
int ErrorTopMost (char *stringId, HWND hwnd);
int AskYesNo (char *stringId, HWND hwnd);
int AskYesNoString (const wchar_t *str, HWND hwnd);
int AskYesNoTopmost (char *stringId, HWND hwnd);
int AskNoYes (char *stringId, HWND hwnd);
int AskNoYesString (const wchar_t *string, HWND hwnd);
int AskOkCancel (char *stringId, HWND hwnd);
int AskWarnYesNo (char *stringId, HWND hwnd);
int AskWarnYesNoString (const wchar_t *string, HWND hwnd);
int AskWarnYesNoTopmost (char *stringId, HWND hwnd);
int AskWarnYesNoStringTopmost (const wchar_t *string, HWND hwnd);
int AskWarnNoYes (char *stringId, HWND hwnd);
int AskWarnNoYesString (const wchar_t *string, HWND hwnd);
int AskWarnNoYesTopmost (char *stringId, HWND hwnd);
int AskWarnOkCancel (char *stringId, HWND hwnd);
int AskWarnCancelOk (char *stringId, HWND hwnd);
int AskErrYesNo (char *stringId, HWND hwnd);
int AskErrNoYes (char *stringId, HWND hwnd);
int AskMultiChoice (void *strings[], BOOL bBold, HWND hwnd);
BOOL ConfigWriteBegin ();
BOOL ConfigWriteEnd (HWND hwnd);
BOOL ConfigWriteString (char *configKey, char *configValue);
BOOL ConfigWriteStringW (char *configKey, wchar_t *configValue);
BOOL ConfigWriteInt (char *configKey, int configValue);
int ConfigReadInt (char *configKey, int defaultValue);
char *ConfigReadString (char *configKey, char *defaultValue, char *str, int maxLen);
void ConfigReadCompareInt(char *configKey, int defaultValue, int* pOutputValue, BOOL bOnlyCheckModified, BOOL* pbModified);
void ConfigReadCompareString (char *configKey, char *defaultValue, char *str, int maxLen, BOOL bOnlyCheckModified, BOOL *pbModified);
void RestoreDefaultKeyFilesParam (void);
BOOL LoadDefaultKeyFilesParam (void);
void Debug (char *format, ...);
void DebugMsgBox (char *format, ...);
BOOL IsOSAtLeast (OSVersionEnum reqMinOS);
BOOL IsOSVersionAtLeast (OSVersionEnum reqMinOS, int reqMinServicePack);
BOOL IsSupportedOS ();
BOOL Is64BitOs ();
BOOL IsARM();
BOOL IsServerOS ();
BOOL IsHiddenOSRunning (void);
BOOL EnableWow64FsRedirection (BOOL enable);
BOOL RestartComputer (BOOL bShutdown);
void Applink (const char *dest);
wchar_t *RelativePath2Absolute (wchar_t *szFileName);
void HandleDriveNotReadyError (HWND hwnd);
BOOL CALLBACK CloseTCWindowsEnum( HWND hwnd, LPARAM lParam);
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);
BOOL GetDriveGeometry (const wchar_t *deviceName, PDISK_GEOMETRY_EX diskGeometry);
BOOL GetPhysicalDriveGeometry (int driveNumber, PDISK_GEOMETRY diskGeometry);
BOOL IsVolumeDeviceHosted (const wchar_t *lpszDiskFile);
int CompensateXDPI (int val);
int CompensateYDPI (int val);
int CompensateDPIFont (int val);
int GetTextGfxWidth (HWND hwndDlgItem, const wchar_t *text, HFONT hFont);
int GetTextGfxHeight (HWND hwndDlgItem, const wchar_t *text, HFONT hFont);
BOOL ToHyperlink (HWND hwndDlg, UINT ctrlId);
BOOL ToCustHyperlink (HWND hwndDlg, UINT ctrlId, HFONT hFont);
void DisableCloseButton (HWND hwndDlg);
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);
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);
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);
BOOL IsPagingFileWildcardActive ();
BOOL DisablePagingFile ();
BOOL CALLBACK SecurityTokenPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
BOOL CALLBACK SecurityTokenKeyfileDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
BOOL InitSecurityTokenLibrary (HWND hwndDlg);
BOOL FileHasReadOnlyAttribute (const wchar_t *path);
BOOL IsFileOnReadOnlyFilesystem (const wchar_t *path);
void CheckFilesystem (HWND hwndDlg, int driveNo, BOOL fixErrors);
BOOL BufferContainsPattern (const byte *buffer, size_t bufferSize, const byte *pattern, size_t patternSize);
BOOL BufferContainsString (const byte *buffer, size_t bufferSize, const char *str);
BOOL BufferContainsWideString (const byte *buffer, size_t bufferSize, const wchar_t *str);
int AskNonSysInPlaceEncryptionResume (HWND hwndDlg, BOOL* pbDecrypt);
BOOL RemoveDeviceWriteProtection (HWND hwndDlg, wchar_t *devicePath);
void EnableElevatedCursorChange (HWND parent);
BOOL DisableFileCompression (HANDLE file);
BOOL VolumePathExists (const wchar_t *volumePath);
BOOL IsWindowsIsoBurnerAvailable ();
BOOL LaunchWindowsIsoBurner (HWND hwnd, const wchar_t *isoPath);
BOOL IsApplicationInstalled (const wchar_t *appName);
int GetPim (HWND hwndDlg, UINT ctrlId, int defaultPim);
void SetPim (HWND hwndDlg, UINT ctrlId, int pim);
BOOL GetPassword (HWND hwndDlg, UINT ctrlID, char* passValue, int bufSize, BOOL bLegacyPassword, BOOL bShowError);
void SetPassword (HWND hwndDlg, UINT ctrlID, char* passValue);
void HandleShowPasswordFieldAction (HWND hwndDlg, UINT checkBoxId, UINT edit1Id, UINT edit2Id);
HKEY OpenDeviceClassRegKey (const GUID *deviceClassGuid);
LSTATUS DeleteRegistryKey (HKEY, LPCTSTR);
HIMAGELIST CreateImageList(int cx, int cy, UINT flags, int cInitial, int cGrow);
int AddBitmapToImageList(HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask);
HRESULT VCStrDupW(LPCWSTR psz, LPWSTR *ppwsz);
void ProcessEntropyEstimate (HWND hProgress, DWORD* pdwInitialValue, DWORD dwCounter, DWORD dwMaxLevel, DWORD* pdwEntropy);
void AllowMessageInUIPI (UINT msg);
BOOL IsRepeatedByteArray (byte value, const byte* buffer, size_t bufferSize);
BOOL TranslateVolumeID (HWND hwndDlg, wchar_t* pathValue, size_t cchPathValue);
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 DeleteDirectory (const wchar_t* szDirName);
BOOL IsThreadInSecureDesktop(DWORD dwThreadID);
INT_PTR SecureDesktopDialogBoxParam (HINSTANCE, LPCWSTR, HWND, DLGPROC, LPARAM);
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 SafeOpenURL (LPCWSTR szUrl);
BitLockerEncryptionStatus GetBitLockerEncryptionStatus(WCHAR driveLetter);
BOOL IsTestSigningModeEnabled ();
#ifdef _WIN64
void GetAppRandomSeed (unsigned char* pbRandSeed, size_t cbRandSeed);
#endif
#ifdef __cplusplus
}
#include <vector>
#include <string>
typedef std::vector<unsigned char> ByteArray;
struct HostDevice
{
HostDevice ()
:
Bootable (false),
ContainsSystem (false),
DynamicVolume (false),
Floppy (false),
IsPartition (false),
IsVirtualPartition (false),
HasUnencryptedFilesystem (false),
Removable (false),
Size (0),
SystemNumber((uint32) -1),
HasVolumeIDs (false)
{
ZeroMemory (VolumeIDs, sizeof (VolumeIDs));
}
HostDevice (const HostDevice& device)
:
Bootable (device.Bootable),
ContainsSystem (device.ContainsSystem),
DynamicVolume (device.DynamicVolume),
Floppy (device.Floppy),
IsPartition (device.IsPartition),
IsVirtualPartition (device.IsVirtualPartition),
HasUnencryptedFilesystem (device.HasUnencryptedFilesystem),
MountPoint (device.MountPoint),
Name (device.Name),
Path (device.Path),
Removable (device.Removable),
Size (device.Size),
SystemNumber (device.SystemNumber),
HasVolumeIDs (device.HasVolumeIDs),
Partitions (device.Partitions)
{
memcpy (VolumeIDs, device.VolumeIDs, sizeof (VolumeIDs));
}
~HostDevice () {}
HostDevice& operator= (const HostDevice& device)
{
if (this != &device)
{
Bootable = device.Bootable;
ContainsSystem = device.ContainsSystem;
DynamicVolume = device.DynamicVolume;
Floppy = device.Floppy;
IsPartition = device.IsPartition;
IsVirtualPartition = device.IsVirtualPartition;
HasUnencryptedFilesystem = device.HasUnencryptedFilesystem;
MountPoint = device.MountPoint;
Name = device.Name;
Path = device.Path;
Removable = device.Removable;
Size = device.Size;
SystemNumber = device.SystemNumber;
HasVolumeIDs = device.HasVolumeIDs;
Partitions = device.Partitions;
memcpy (VolumeIDs, device.VolumeIDs, sizeof (VolumeIDs));
}
return *this;
}
bool Bootable;
bool ContainsSystem;
bool DynamicVolume;
bool Floppy;
bool IsPartition;
bool IsVirtualPartition;
bool HasUnencryptedFilesystem;
std::wstring MountPoint;
std::wstring Name;
std::wstring Path;
bool Removable;
uint64 Size;
uint32 SystemNumber;
BYTE VolumeIDs[TC_VOLUME_TYPE_COUNT][VOLUME_ID_SIZE];
bool HasVolumeIDs;
std::vector <HostDevice> Partitions;
};
struct RawDevicesDlgParam
{
std::vector <HostDevice> devices;
wchar_t *pszFileName;
};
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);
std::string WideToUtf8String (const std::wstring &wideString);
std::vector <HostDevice> GetAvailableHostDevices (bool noDeviceProperties = false, bool singleList = false, bool noFloppy = true, bool detectUnencryptedFilesystems = false);
std::wstring ToUpperCase (const std::wstring &str);
std::wstring GetWrongPasswordErrorMessage (HWND hwndDlg);
std::wstring GetWindowsEdition ();
std::wstring FitPathInGfxWidth (HWND hwnd, HFONT hFont, LONG width, const std::wstring &path);
std::wstring GetServiceConfigPath (const wchar_t *fileName, bool useLegacy);
std::wstring VolumeGuidPathToDevicePath (std::wstring volumeGuidPath);
std::wstring HarddiskVolumePathToPartitionPath (const std::wstring &harddiskVolumePath);
std::wstring FindLatestFileOrDirectory (const std::wstring &directory, const wchar_t *namePattern, bool findDirectory, bool findFile);
std::wstring GetUserFriendlyVersionString (int version);
std::wstring IntToWideString (int val);
std::wstring ArrayToHexWideString (const unsigned char* pbData, int cbData);
bool HexWideStringToArray (const wchar_t* hexStr, std::vector<byte>& arr);
std::wstring FindDeviceByVolumeID (const BYTE volumeID [VOLUME_ID_SIZE], BOOL bFromService);
void RegisterDriverInf (bool registerFilter, const std::string& filter, const std::string& filterReg, HWND ParentWindow, HKEY regKey);
std::wstring GetTempPathString ();
void CorrectFileName (std::wstring& fileName);
inline std::wstring AppendSrcPos (const wchar_t* msg, const char* srcPos)
{
return std::wstring (msg? msg : L"") + L"\n\nSource: " + SingleStringToWide (srcPos);
}
void UpdateMountableHostDeviceList ();
INT_PTR TextEditDialogBox (BOOL readOnly, HWND parent, const WCHAR* Title, std::string& text);
// Display a wait dialog while calling the provided callback with the given parameter
typedef void (CALLBACK* WaitThreadProc)(void* pArg, HWND hWaitDlg);
void BringToForeground(HWND hWnd);
void ShowWaitDialog(HWND hwnd, BOOL bUseHwndAsParent, WaitThreadProc callback, void* pArg);
// classes used to implement support for password drag-n-drop from KeePass Password Safe
// Implementation based the following source code with many modifications to fix isses and add features
// URL: https://www.codeguru.com/cpp/misc/misc/draganddrop/article.php/c349/Drag-And-Drop-between-Window-Controls.htm
interface GenericDropTarget : public IDropTarget
{
public:
GenericDropTarget(CLIPFORMAT* pFormats, size_t count);
~GenericDropTarget();
// basic IUnknown stuff
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void ** ppvObject);
ULONG STDMETHODCALLTYPE AddRef(void);
ULONG STDMETHODCALLTYPE Release(void);
HRESULT STDMETHODCALLTYPE DragEnter(struct IDataObject *,unsigned long,struct _POINTL,unsigned long *);
HRESULT STDMETHODCALLTYPE DragOver(unsigned long,struct _POINTL,unsigned long *);
HRESULT STDMETHODCALLTYPE DragLeave(void);
HRESULT STDMETHODCALLTYPE Drop(struct IDataObject *,unsigned long,struct _POINTL,unsigned long *);
// called by parents
BOOL Register(HWND hWnd);
void Revoke();
// call parent we have goodies
virtual void GotDrop(CLIPFORMAT format);
virtual DWORD GotDrag(void);
virtual void GotLeave(void);
virtual DWORD GotEnter(void);
public:
BYTE *m_Data;
POINT m_DropPoint;
DWORD m_KeyState;
protected:
HWND m_DropTargetWnd;
std::vector<CLIPFORMAT> m_SupportedFormat;
volatile LONG m_dwRefCount;
};
class PasswordEditDropTarget : public GenericDropTarget
{
public:
PasswordEditDropTarget();
// called by child we have drop
void GotDrop(CLIPFORMAT format);
DWORD GotDrag(void);
void GotLeave(void);
DWORD GotEnter(void);
};
BOOL GetHibernateStatus (BOOL& bHibernateEnabled, BOOL& bHiberbootEnabled);
bool GetKbList (std::vector<std::wstring>& kbList);
bool OneOfKBsInstalled (const wchar_t* szKBs[], int count);
#endif // __cplusplus
#endif // TC_HEADER_DLGCODE
diff --git a/src/Common/Language.xml b/src/Common/Language.xml
index 9ac6ce1b..e4ceac7a 100644
--- a/src/Common/Language.xml
+++ b/src/Common/Language.xml
@@ -1,1662 +1,1614 @@
<?xml version="1.0" encoding="utf-8"?>
<VeraCrypt>
<localization prog-version="1.24-Update8">
<language langid="en" name="English" en-name="English" version="0.0.0" translators="TrueCrypt/VeraCrypt Teams" />
<font lang="en" class="normal" size="11" face="default" />
<font lang="en" class="bold" size="13" face="Arial" />
<font lang="en" class="fixed" size="12" face="Lucida Console" />
<font lang="en" class="title" size="21" face="Times New Roman" />
-
<entry lang="en" key="IDCANCEL">Cancel</entry>
<entry lang="en" key="IDC_ALL_USERS">Install &amp;for all users</entry>
<entry lang="en" key="IDC_BROWSE">Bro&amp;wse...</entry>
<entry lang="en" key="IDC_DESKTOP_ICON">Add VeraCrypt icon to &amp;desktop</entry>
<entry lang="en" key="IDC_DONATE">Donate now...</entry>
<entry lang="en" key="IDC_FILE_TYPE">Associate the .hc file &amp;extension with VeraCrypt</entry>
<entry lang="en" key="IDC_OPEN_CONTAINING_FOLDER">&amp;Open the destination location when finished</entry>
<entry lang="en" key="IDC_PROG_GROUP">Add VeraCrypt to &amp;Start menu</entry>
<entry lang="en" key="IDC_SYSTEM_RESTORE">Create System &amp;Restore point</entry>
<entry lang="en" key="IDC_UNINSTALL">&amp;Uninstall</entry>
<entry lang="en" key="IDC_WIZARD_MODE_EXTRACT_ONLY">&amp;Extract</entry>
<entry lang="en" key="IDC_WIZARD_MODE_INSTALL">&amp;Install</entry>
<entry lang="en" key="IDD_INSTL_DLG">VeraCrypt Setup Wizard</entry>
<entry lang="en" key="IDD_UNINSTALL">Uninstall VeraCrypt</entry>
<entry lang="en" key="IDHELP">&amp;Help</entry>
<entry lang="en" key="IDT_EXTRACT_DESTINATION">Please select or type the location where you want to place the extracted files:</entry>
<entry lang="en" key="IDT_INSTALL_DESTINATION">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.</entry>
<entry lang="en" key="IDT_UNINSTALL_DIR">Click Uninstall to remove VeraCrypt from this system.</entry>
<entry lang="en" key="IDC_ABORT_BUTTON">Abort</entry>
<entry lang="en" key="IDC_BENCHMARK">&amp;Benchmark</entry>
<entry lang="en" key="IDC_CIPHER_TEST">&amp;Test</entry>
<entry lang="en" key="IDC_DEVICE_TRANSFORM_MODE_FORMAT">Create encrypted volume and format it</entry>
<entry lang="en" key="IDC_DEVICE_TRANSFORM_MODE_INPLACE">Encrypt partition in place</entry>
<entry lang="en" key="IDC_DISPLAY_KEYS">Display generated keys (their portions)</entry>
<entry lang="en" key="IDC_DISPLAY_POOL_CONTENTS">Display pool content</entry>
<entry lang="en" key="IDC_DOWNLOAD_CD_BURN_SOFTWARE">Download CD/DVD recording software</entry>
<entry lang="en" key="IDC_FILE_CONTAINER">Create an encrypted file container</entry>
<entry lang="en" key="IDC_GB">&amp;GiB</entry>
<entry lang="en" key="IDC_TB">&amp;TiB</entry>
<entry lang="en" key="IDC_HIDDEN_SYSENC_INFO_LINK">More information</entry>
<entry lang="en" key="IDC_HIDDEN_VOL">Hi&amp;dden VeraCrypt volume </entry>
<entry lang="en" key="IDC_HIDDEN_VOL_HELP">More information about hidden volumes</entry>
<entry lang="en" key="IDC_HIDVOL_WIZ_MODE_DIRECT">Direct mode</entry>
<entry lang="en" key="IDC_HIDVOL_WIZ_MODE_FULL">Normal mode</entry>
<entry lang="en" key="IDC_KB">&amp;KiB</entry>
<entry lang="en" key="IDC_KEYFILES_ENABLE">U&amp;se keyfiles</entry>
<entry lang="en" key="IDC_KEYFILES_TRY_EMPTY_PASSWORD">Try first to mount with an empty password</entry>
<entry lang="en" key="IDC_KEYFILES_RANDOM_SIZE">Random size ( 64 &lt;-&gt; 1048576 )</entry>
<entry lang="en" key="IDC_KEY_FILES">&amp;Keyfiles...</entry>
<entry lang="en" key="IDC_LINK_HASH_INFO">Information on hash algorithms</entry>
<entry lang="en" key="IDC_LINK_MORE_INFO_ABOUT_CIPHER">More information</entry>
<entry lang="en" key="IDC_LINK_PIM_INFO">Information on PIM</entry>
<entry lang="en" key="IDC_MB">&amp;MiB</entry>
<entry lang="en" key="IDC_MORE_INFO_ON_CONTAINERS">More information</entry>
<entry lang="en" key="IDC_MORE_INFO_ON_SYS_ENCRYPTION">More information about system encryption</entry>
<entry lang="en" key="IDC_MORE_INFO_SYS_ENCRYPTION">More information</entry>
<entry lang="en" key="IDC_MULTI_BOOT">Multi-Boot</entry>
<entry lang="en" key="IDC_NONSYS_DEVICE">Encrypt a non-system partition/drive</entry>
<entry lang="en" key="IDC_NO_HISTORY">&amp;Never save history</entry>
<entry lang="en" key="IDC_OPEN_OUTER_VOLUME">Open Outer Volume</entry>
<entry lang="en" key="IDC_PAUSE">&amp;Pause</entry>
<entry lang="en" key="IDC_PIM_ENABLE">Use P&amp;IM</entry>
- <entry lang="en" key="IDC_NEW_PIM_ENABLE">Modify PIM</entry>
+ <entry lang="en" key="IDC_NEW_PIM_ENABLE">Use PIM</entry>
<entry lang="en" key="IDC_QUICKFORMAT">Quick Format</entry>
<entry lang="en" key="IDC_SHOW_PASSWORD">&amp;Display password</entry>
<entry lang="en" key="IDC_SHOW_PASSWORD_SINGLE">&amp;Display password</entry>
<entry lang="en" key="IDC_SHOW_PIM">&amp;Display PIM</entry>
<entry lang="en" key="IDC_SINGLE_BOOT">Single-boot</entry>
<entry lang="en" key="IDC_STD_VOL">Standard VeraCrypt volume</entry>
<entry lang="en" key="IDC_SYSENC_HIDDEN">Hi&amp;dden</entry>
<entry lang="en" key="IDC_SYSENC_NORMAL">Normal</entry>
<entry lang="en" key="IDC_SYS_DEVICE">Encrypt the system partition or entire system drive</entry>
<entry lang="en" key="IDC_SYS_PARTITION">Encrypt the Windows system partition</entry>
<entry lang="en" key="IDC_WHOLE_SYS_DRIVE">Encrypt the whole drive</entry>
- <entry lang="en" key="IDD_VOL_CREATION_WIZARD_DLG">VeraCrypt Wizard</entry>
+ <entry lang="en" key="IDD_VOL_CREATION_WIZARD_DLG">VeraCrypt Volume Creation Wizard</entry>
<entry lang="en" key="IDT_CLUSTER">Cluster </entry>
<entry lang="en" key="IDT_COLLECTING_RANDOM_DATA_NOTE">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 Next to continue.</entry>
<entry lang="en" key="IDT_CONFIRM">&amp;Confirm:</entry>
<entry lang="en" key="IDT_DONE">Done</entry>
<entry lang="en" key="IDT_DRIVE_LETTER">Drive letter:</entry>
<entry lang="en" key="IDT_ENCRYPTION_ALGO">Encryption Algorithm</entry>
<entry lang="en" key="IDT_FILESYSTEM">Filesystem </entry>
<entry lang="en" key="IDT_FILE_CONTAINER">Creates a virtual encrypted disk within a file. Recommended for inexperienced users.</entry>
<entry lang="en" key="IDT_FORMAT_OPTIONS">Options</entry>
<entry lang="en" key="IDT_HASH_ALGO">Hash Algorithm</entry>
<entry lang="en" key="IDT_HEADER_KEY">Header Key: </entry>
<entry lang="en" key="IDT_LEFT">Left</entry>
<entry lang="en" key="IDT_MASTER_KEY">Master Key: </entry>
<entry lang="en" key="IDT_MULTI_BOOT">Select this option if there are two or more operating systems installed on this computer.\n\nFor example:\n- Windows XP and Windows XP\n- Windows XP and Windows Vista\n- Windows and Mac OS X\n- Windows and Linux\n- Windows, Linux and Mac OS X</entry>
<entry lang="en" key="IDT_NON_SYS_DEVICE">Encrypts a non-system partition on any internal or external drive (e.g. a flash drive). Optionally, creates a hidden volume.</entry>
<entry lang="en" key="IDT_PARTIAL_POOL_CONTENTS">Current pool content (partial)</entry>
<entry lang="en" key="IDT_PASS">Pass</entry>
<entry lang="en" key="IDT_PASSWORD">Password:</entry>
<entry lang="en" key="IDT_PIM">Volume PIM:</entry>
<entry lang="en" key="IDT_OLD_PIM">Volume PIM:</entry>
<entry lang="en" key="IDT_PROGRESS">Progress:</entry>
<entry lang="en" key="IDT_RANDOM_POOL">Random Pool: </entry>
<entry lang="en" key="IDT_SINGLE_BOOT">Select this option if there is only one operating system installed on this computer (even if it has multiple users).</entry>
<entry lang="en" key="IDT_SPEED">Speed</entry>
<entry lang="en" key="IDT_STATUS">Status</entry>
<entry lang="en" key="IDT_SYSENC_KEYS_GEN_INFO">The keys, salt, and other data have been successfully generated. If you want to generate new keys, click Back and then Next. Otherwise, click Next to continue.</entry>
<entry lang="en" key="IDT_SYS_DEVICE">Encrypts the partition/drive where Windows is installed. Anyone who wants to gain access and use the system, read and write files, etc., will need to enter the correct password each time before Windows boots. Optionally, creates a hidden system.</entry>
<entry lang="en" key="IDT_SYS_PARTITION">Select this option to encrypt the partition where the currently running Windows operating system is installed.</entry>
<entry lang="en" key="IDT_VOLUME_LABEL">Volume Label in Windows:</entry>
- <entry lang="en" key="IDT_WIPE_MODE">Wipe Mode</entry>
+ <entry lang="en" key="IDT_WIPE_MODE">Wipe mode:</entry>
<entry lang="en" key="IDCLOSE">Close</entry>
<entry lang="en" key="IDC_ALLOW_ESC_PBA_BYPASS">Allow pre-boot &amp;authentication to be bypassed by pressing the Esc key (enables boot manager)</entry>
<entry lang="en" key="IDC_AUTORUN_DISABLE">Do nothing</entry>
<entry lang="en" key="IDC_AUTORUN_MOUNT">&amp;Auto-mount VeraCrypt volume (specified below)</entry>
<entry lang="en" key="IDC_AUTORUN_START">&amp;Start VeraCrypt</entry>
<entry lang="en" key="IDC_AUTO_DETECT_PKCS11_MODULE">Auto-&amp;Detect Library</entry>
<entry lang="en" key="IDC_BOOT_LOADER_CACHE_PASSWORD">&amp;Cache pre-boot authentication password in driver memory (for mounting of non-system volumes)</entry>
<entry lang="en" key="IDC_BROWSE_DIRS">Browse...</entry>
<entry lang="en" key="IDC_BROWSE_FILES">Browse...</entry>
<entry lang="en" key="IDC_CACHE">Cache passwords and keyfil&amp;es in memory</entry>
<entry lang="en" key="IDC_CLOSE_BKG_TASK_WHEN_NOVOL">Exit when there are no mounted volumes</entry>
<entry lang="en" key="IDC_CLOSE_TOKEN_SESSION_AFTER_MOUNT">&amp;Close token session (log out) after a volume is successfully mounted</entry>
<entry lang="en" key="IDC_COPY_EXPANDER">Include VeraCrypt Volume Expander</entry>
<entry lang="en" key="IDC_COPY_WIZARD">Include VeraCrypt Volume Creation Wizard</entry>
<entry lang="en" key="IDC_CREATE">Create</entry>
<entry lang="en" key="IDC_CREATE_VOLUME">&amp;Create Volume</entry>
<entry lang="en" key="IDC_DISABLE_BOOT_LOADER_OUTPUT">Do not &amp;show any texts in the pre-boot authentication screen (except the below custom message)</entry>
<entry lang="en" key="IDC_DISABLE_EVIL_MAID_ATTACK_DETECTION">Disable "Evil Maid" attack detection</entry>
<entry lang="en" key="IDC_ENABLE_HARDWARE_ENCRYPTION">Accelerate AES encryption/decryption by using the AES instructions of the processor (if available)</entry>
<entry lang="en" key="IDC_ENABLE_KEYFILES">Use keyfiles</entry>
<entry lang="en" key="IDC_ENABLE_NEW_KEYFILES">Use keyfiles</entry>
<entry lang="en" key="IDC_EXIT">E&amp;xit</entry>
<entry lang="en" key="IDC_FAVORITES_HELP_LINK">Help on favorite volumes</entry>
<entry lang="en" key="IDC_FAVORITE_DISABLE_HOTKEY">Do not mount selected volume when 'Mount Favorite Volumes' &amp;hot key is pressed</entry>
<entry lang="en" key="IDC_FAVORITE_MOUNT_ON_ARRIVAL">Mount selected volume when its host device gets &amp;connected</entry>
<entry lang="en" key="IDC_FAVORITE_MOUNT_ON_LOGON">Mount selected volume upon log&amp;on</entry>
<entry lang="en" key="IDC_FAVORITE_MOUNT_READONLY">Mount selected volume as read-o&amp;nly</entry>
<entry lang="en" key="IDC_FAVORITE_MOUNT_REMOVABLE">Mount selected volume as remo&amp;vable medium</entry>
<entry lang="en" key="IDC_FAVORITE_MOVE_DOWN">Move &amp;Down</entry>
<entry lang="en" key="IDC_FAVORITE_MOVE_UP">Move &amp;Up</entry>
<entry lang="en" key="IDC_FAVORITE_OPEN_EXPLORER_WIN_ON_MOUNT">Open &amp;Explorer window for selected volume when successfully mounted</entry>
<entry lang="en" key="IDC_FAVORITE_REMOVE">&amp;Remove</entry>
<entry lang="en" key="IDC_FAVORITE_USE_LABEL_IN_EXPLORER">Use favorite label as Explorer drive label</entry>
<entry lang="en" key="IDC_FAV_VOL_OPTIONS_GLOBAL_SETTINGS_BOX">Global Settings</entry>
<entry lang="en" key="IDC_HK_DISMOUNT_BALLOON_TOOLTIP">Display balloon tooltip after successful hot-key dismount</entry>
<entry lang="en" key="IDC_HK_DISMOUNT_PLAY_SOUND">Play system notification sound after successful hot-key dismount</entry>
<entry lang="en" key="IDC_HK_MOD_ALT">Alt</entry>
<entry lang="en" key="IDC_HK_MOD_CTRL">Ctrl</entry>
<entry lang="en" key="IDC_HK_MOD_SHIFT">Shift</entry>
<entry lang="en" key="IDC_HK_MOD_WIN">Win</entry>
<entry lang="en" key="IDC_HOTKEY_ASSIGN">Assign</entry>
<entry lang="en" key="IDC_HOTKEY_REMOVE">Remove</entry>
<entry lang="en" key="IDC_KEYFILES">Keyfiles...</entry>
<entry lang="en" key="IDC_LIMIT_ENC_THREAD_POOL">Do not use the following number of logical processors for encryption/decryption:</entry>
<entry lang="en" key="IDC_MORE_INFO_ON_HW_ACCELERATION">More information</entry>
<entry lang="en" key="IDC_MORE_INFO_ON_THREAD_BASED_PARALLELIZATION">More information</entry>
<entry lang="en" key="IDC_MORE_SETTINGS">More Settings...</entry>
<entry lang="en" key="IDC_MOUNTALL">&amp;Auto-Mount Devices</entry>
<entry lang="en" key="IDC_MOUNT_OPTIONS">Mount Opti&amp;ons...</entry>
<entry lang="en" key="IDC_MOUNT_READONLY">Mount volume as read-&amp;only</entry>
<entry lang="en" key="IDC_NEW_KEYFILES">Keyfiles...</entry>
<entry lang="en" key="IDC_OLD_PIM_HELP">(Empty or 0 for default iterations)</entry>
<entry lang="en" key="IDC_PIM_HELP">(Empty or 0 for default iterations)</entry>
<entry lang="en" key="IDC_PREF_BKG_TASK_ENABLE">Enabled</entry>
<entry lang="en" key="IDC_PREF_CACHE_PASSWORDS">Cache passwords in driver memory</entry>
<entry lang="en" key="IDC_PREF_DISMOUNT_INACTIVE">Auto-dismount volume after no data has been read/written to it for</entry>
<entry lang="en" key="IDC_PREF_DISMOUNT_LOGOFF">User logs off</entry>
<entry lang="en" key="IDC_PREF_DISMOUNT_SESSION_LOCKED">User session locked</entry>
<entry lang="en" key="IDC_PREF_DISMOUNT_POWERSAVING">Entering power saving mode</entry>
<entry lang="en" key="IDC_PREF_DISMOUNT_SCREENSAVER">Screen saver is launched</entry>
<entry lang="en" key="IDC_PREF_FORCE_AUTO_DISMOUNT">Force auto-dismount even if volume contains open files or directories</entry>
<entry lang="en" key="IDC_PREF_LOGON_MOUNT_DEVICES">Mount all device-hosted VeraCrypt volumes</entry>
<entry lang="en" key="IDC_PREF_LOGON_START">Start VeraCrypt Background Task</entry>
<entry lang="en" key="IDC_PREF_MOUNT_READONLY">Mount volumes as read-only</entry>
<entry lang="en" key="IDC_PREF_MOUNT_REMOVABLE">Mount volumes as removable media</entry>
<entry lang="en" key="IDC_PREF_OPEN_EXPLORER">Open Explorer window for successfully mounted volume</entry>
<entry lang="en" key="IDC_PREF_TEMP_CACHE_ON_MULTIPLE_MOUNT">Temporarily cache password during "Mount Favorite Volumes" operations</entry>
<entry lang="en" key="IDC_PREF_USE_DIFF_TRAY_ICON_IF_VOL_MOUNTED">Use a different taskbar icon when there are mounted volumes</entry>
<entry lang="en" key="IDC_PREF_WIPE_CACHE_ON_AUTODISMOUNT">Wipe cached passwords on auto-dismount</entry>
<entry lang="en" key="IDC_PREF_WIPE_CACHE_ON_EXIT">Wipe cached passwords on exit</entry>
<entry lang="en" key="IDC_PRESERVE_TIMESTAMPS">Preserve modification timestamp of file containers</entry>
<entry lang="en" key="IDC_RESET_HOTKEYS">Reset</entry>
<entry lang="en" key="IDC_SELECT_DEVICE">Select D&amp;evice...</entry>
<entry lang="en" key="IDC_SELECT_FILE">Select &amp;File...</entry>
<entry lang="en" key="IDC_SELECT_PKCS11_MODULE">Select &amp;Library...</entry>
<entry lang="en" key="IDC_SHOW_PASSWORD_CHPWD_NEW">Display password</entry>
<entry lang="en" key="IDC_SHOW_PASSWORD_CHPWD_ORI">Display password</entry>
<entry lang="en" key="IDC_TRAVEL_OPEN_EXPLORER">Open &amp;Explorer window for mounted volume</entry>
<entry lang="en" key="IDC_TRAV_CACHE_PASSWORDS">&amp;Cache password in driver memory</entry>
<entry lang="en" key="IDC_TRUECRYPT_MODE">&amp;TrueCrypt Mode</entry>
<entry lang="en" key="IDC_UNMOUNTALL">Di&amp;smount All</entry>
<entry lang="en" key="IDC_VOLUME_PROPERTIES">&amp;Volume Properties...</entry>
<entry lang="en" key="IDC_VOLUME_TOOLS">Volume &amp;Tools...</entry>
<entry lang="en" key="IDC_WIPE_CACHE">&amp;Wipe Cache</entry>
<entry lang="en" key="IDD_DEFAULT_MOUNT_PARAMETERS">VeraCrypt - Mount Parameters</entry>
<entry lang="en" key="IDD_FAVORITE_VOLUMES">VeraCrypt - Favorite Volumes</entry>
<entry lang="en" key="IDD_HOTKEYS_DLG">VeraCrypt - System-Wide Hot Keys</entry>
<entry lang="en" key="IDD_MOUNT_DLG">VeraCrypt</entry>
<entry lang="en" key="IDD_PASSWORDCHANGE_DLG">Change Password or Keyfiles</entry>
<entry lang="en" key="IDD_PASSWORD_DLG">Enter VeraCrypt Volume Password</entry>
<entry lang="en" key="IDD_PERFORMANCE_SETTINGS">VeraCrypt - Performance and Driver Options</entry>
<entry lang="en" key="IDD_PREFERENCES_DLG">VeraCrypt - Preferences</entry>
<entry lang="en" key="IDD_SYSENC_SETTINGS">VeraCrypt - System Encryption Settings</entry>
<entry lang="en" key="IDD_TOKEN_PREFERENCES">VeraCrypt - Security Token Preferences</entry>
<entry lang="en" key="IDD_TRAVELER_DLG">VeraCrypt Traveler Disk Setup</entry>
<entry lang="en" key="IDD_VOLUME_PROPERTIES">VeraCrypt Volume Properties</entry>
<entry lang="en" key="IDM_ABOUT">About</entry>
<entry lang="en" key="IDM_ADD_REMOVE_VOL_KEYFILES">Add/Remove Keyfiles to/from Volume...</entry>
<entry lang="en" key="IDM_ADD_VOLUME_TO_FAVORITES">Add Mounted Volume to Favorites...</entry>
<entry lang="en" key="IDM_ADD_VOLUME_TO_SYSTEM_FAVORITES">Add Mounted Volume to System Favorites...</entry>
<entry lang="en" key="IDM_ANALYZE_SYSTEM_CRASH">Analyze a System Crash...</entry>
<entry lang="en" key="IDM_BACKUP_VOL_HEADER">Backup Volume Header...</entry>
<entry lang="en" key="IDM_BENCHMARK">Benchmark...</entry>
<entry lang="en" key="IDM_CHANGE_HEADER_KEY_DERIV_ALGO">Set Header Key Derivation Algorithm...</entry>
<entry lang="en" key="IDM_CHANGE_PASSWORD">Change Volume Password...</entry>
<entry lang="en" key="IDM_CHANGE_SYS_HEADER_KEY_DERIV_ALGO">Set Header Key Derivation Algorithm...</entry>
<entry lang="en" key="IDM_CHANGE_SYS_PASSWORD">Change Password...</entry>
<entry lang="en" key="IDM_CLEAR_HISTORY">Clear Volume History</entry>
<entry lang="en" key="IDM_CLOSE_ALL_TOKEN_SESSIONS">Close All Security Token Sessions</entry>
<entry lang="en" key="IDM_CONTACT">Contact</entry>
<entry lang="en" key="IDM_CREATE_HIDDEN_OS">Create Hidden Operating System...</entry>
<entry lang="en" key="IDM_CREATE_RESCUE_DISK">Create Rescue Disk...</entry>
<entry lang="en" key="IDM_CREATE_VOLUME">Create New Volume...</entry>
<entry lang="en" key="IDM_DECRYPT_NONSYS_VOL">Permanently Decrypt...</entry>
<entry lang="en" key="IDM_DEFAULT_KEYFILES">Default Keyfiles...</entry>
<entry lang="en" key="IDM_DEFAULT_MOUNT_PARAMETERS">Default Mount Parameters...</entry>
<entry lang="en" key="IDM_DONATE">Donate now...</entry>
<entry lang="en" key="IDM_ENCRYPT_SYSTEM_DEVICE">Encrypt System Partition/Drive...</entry>
<entry lang="en" key="IDM_FAQ">Frequently Asked Questions</entry>
<entry lang="en" key="IDM_HELP">User's Guide</entry>
<entry lang="en" key="IDM_HOMEPAGE">&amp;Homepage </entry>
<entry lang="en" key="IDM_HOTKEY_SETTINGS">Hot Keys...</entry>
<entry lang="en" key="IDM_KEYFILE_GENERATOR">Keyfile Generator</entry>
<entry lang="en" key="IDM_LANGUAGE">Language...</entry>
<entry lang="en" key="IDM_LICENSE">Legal Notices</entry>
<entry lang="en" key="IDM_MANAGE_TOKEN_KEYFILES">Manage Security Token Keyfiles...</entry>
<entry lang="en" key="IDM_MOUNTALL">Auto-Mount All Device-Hosted Volumes</entry>
<entry lang="en" key="IDM_MOUNT_FAVORITE_VOLUMES">Mount Favorite Volumes</entry>
<entry lang="en" key="IDM_MOUNT_SYSENC_PART_WITHOUT_PBA">Mount Without Pre-Boot &amp;Authentication...</entry>
<entry lang="en" key="IDM_MOUNT_VOLUME">Mount Volume</entry>
<entry lang="en" key="IDM_MOUNT_VOLUME_OPTIONS">Mount Volume with Options</entry>
<entry lang="en" key="IDM_NEWS">News</entry>
<entry lang="en" key="IDM_ONLINE_HELP">Online Help</entry>
<entry lang="en" key="IDM_ONLINE_TUTORIAL">Beginner's Tutorial</entry>
<entry lang="en" key="IDM_ORGANIZE_FAVORITES">Organize Favorite Volumes...</entry>
<entry lang="en" key="IDM_ORGANIZE_SYSTEM_FAVORITES">Organize System Favorite Volumes...</entry>
<entry lang="en" key="IDM_PERFORMANCE_SETTINGS">Performance/Driver Configuration</entry>
<entry lang="en" key="IDM_PERMANENTLY_DECRYPT_SYS">Permanently Decrypt System Partition/Drive</entry>
<entry lang="en" key="IDM_PREFERENCES">Preferences...</entry>
<entry lang="en" key="IDM_REFRESH_DRIVE_LETTERS">Refresh Drive Letters</entry>
<entry lang="en" key="IDM_REMOVE_ALL_KEYFILES_FROM_VOL">Remove All Keyfiles from Volume...</entry>
<entry lang="en" key="IDM_RESTORE_VOL_HEADER">Restore Volume Header...</entry>
<entry lang="en" key="IDM_RESUME_INTERRUPTED_PROC">Resume Interrupted Process</entry>
<entry lang="en" key="IDM_SELECT_DEVICE">Select Device...</entry>
<entry lang="en" key="IDM_SELECT_FILE">Select File...</entry>
<entry lang="en" key="IDM_SYSENC_RESUME">Resume Interrupted Process</entry>
<entry lang="en" key="IDM_SYSENC_SETTINGS">System Encryption...</entry>
<entry lang="en" key="IDM_SYSTEM_ENCRYPTION_STATUS">Properties...</entry>
<entry lang="en" key="IDM_SYS_ENC_SETTINGS">Settings...</entry>
<entry lang="en" key="IDM_SYS_FAVORITES_SETTINGS">System Favorite Volumes...</entry>
<entry lang="en" key="IDM_TC_DOWNLOADS">Downloads</entry>
<entry lang="en" key="IDM_TEST_VECTORS">Test Vectors...</entry>
<entry lang="en" key="IDM_TOKEN_PREFERENCES">Security Tokens...</entry>
<entry lang="en" key="IDM_TRAVELER">Traveler Disk Setup...</entry>
<entry lang="en" key="IDM_UNMOUNTALL">Dismount All Mounted Volumes</entry>
<entry lang="en" key="IDM_UNMOUNT_VOLUME">Dismount Volume</entry>
<entry lang="en" key="IDM_VERIFY_RESCUE_DISK">Verify Rescue Disk</entry>
<entry lang="en" key="IDM_VERIFY_RESCUE_DISK_ISO">Verify Rescue Disk Image</entry>
<entry lang="en" key="IDM_VERSION_HISTORY">Version History</entry>
<entry lang="en" key="IDM_VOLUME_EXPANDER">Volume Expander</entry>
<entry lang="en" key="IDM_VOLUME_PROPERTIES">Volume Properties</entry>
<entry lang="en" key="IDM_VOLUME_WIZARD">Volume Creation Wizard</entry>
<entry lang="en" key="IDM_WEBSITE">VeraCrypt Website</entry>
<entry lang="en" key="IDM_WIPE_CACHE">Wipe Cached Passwords</entry>
<entry lang="en" key="IDOK">OK</entry>
<entry lang="en" key="IDT_ACCELERATION_OPTIONS">Hardware Acceleration</entry>
<entry lang="en" key="IDT_ASSIGN_HOTKEY">Shortcut</entry>
<entry lang="en" key="IDT_AUTORUN">AutoRun Configuration (autorun.inf)</entry>
<entry lang="en" key="IDT_AUTO_DISMOUNT">Auto-Dismount</entry>
<entry lang="en" key="IDT_AUTO_DISMOUNT_ON">Dismount all when:</entry>
<entry lang="en" key="IDT_BOOT_LOADER_SCREEN_OPTIONS">Boot Loader Screen Options</entry>
<entry lang="en" key="IDT_CONFIRM_PASSWORD">Confirm Password:</entry>
<entry lang="en" key="IDT_CURRENT">Current</entry>
<entry lang="en" key="IDT_CUSTOM_BOOT_LOADER_MESSAGE">Display this custom message in the pre-boot authentication screen (24 characters maximum):</entry>
<entry lang="en" key="IDT_DEFAULT_MOUNT_OPTIONS">Default Mount Options</entry>
<entry lang="en" key="IDT_DISMOUNT_ACTION">Hot Key Options</entry>
<entry lang="en" key="IDT_DRIVER_OPTIONS">Driver Configuration</entry>
<entry lang="en" key="IDC_ENABLE_EXTENDED_IOCTL_SUPPORT">Enable extended disk control codes support</entry>
<entry lang="en" key="IDT_FAVORITE_LABEL">Label of selected favorite volume:</entry>
<entry lang="en" key="IDT_FILE_SETTINGS">File Settings</entry>
<entry lang="en" key="IDT_HOTKEY_KEY">Key to assign:</entry>
<entry lang="en" key="IDT_HW_AES_SUPPORTED_BY_CPU">Processor (CPU) in this computer supports hardware acceleration for AES:</entry>
<entry lang="en" key="IDT_LOGON">Actions to perform upon logon to Windows</entry>
<entry lang="en" key="IDT_MINUTES">minutes</entry>
<entry lang="en" key="IDT_MOUNT_LETTER">Mount volume as drive letter:</entry>
<entry lang="en" key="IDT_MOUNT_SETTINGS">Mount Settings</entry>
<entry lang="en" key="IDT_NEW">New</entry>
<entry lang="en" key="IDT_NEW_PASSWORD">Password:</entry>
<entry lang="en" key="IDT_PARALLELIZATION_OPTIONS">Thread-Based Parallelization</entry>
<entry lang="en" key="IDT_PKCS11_LIB_PATH">PKCS #11 Library Path</entry>
<entry lang="en" key="IDT_PKCS5_PRF">PKCS-5 PRF:</entry>
<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_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>
<entry lang="en" key="IDT_TRAVEL_ROOT">Create traveler disk files at (traveler disk root directory):</entry>
<entry lang="en" key="IDT_VOLUME">Volume</entry>
<entry lang="en" key="IDT_WINDOWS_RELATED_SETTING">Windows</entry>
<entry lang="en" key="IDC_ADD_KEYFILE_PATH">Add &amp;Path...</entry>
<entry lang="en" key="IDC_AUTO">&amp;Auto-Test All</entry>
<entry lang="en" key="IDC_CONTINUE">&amp;Continue</entry>
<entry lang="en" key="IDC_DECRYPT">&amp;Decrypt</entry>
<entry lang="en" key="IDC_DELETE">&amp;Delete</entry>
<entry lang="en" key="IDC_ENCRYPT">&amp;Encrypt</entry>
<entry lang="en" key="IDC_EXPORT">&amp;Export...</entry>
<entry lang="en" key="IDC_GENERATE_AND_SAVE_KEYFILE">Generate and Save Keyfile...</entry>
<entry lang="en" key="IDC_GENERATE_KEYFILE">&amp;Generate Random Keyfile...</entry>
<entry lang="en" key="IDC_GET_LANG_PACKS">Download language pack</entry>
<entry lang="en" key="IDC_HW_AES_LABEL_LINK">Hardware-accelerated AES:</entry>
<entry lang="en" key="IDC_IMPORT_KEYFILE">&amp;Import Keyfile to Token...</entry>
<entry lang="en" key="IDC_KEYADD">Add &amp;Files...</entry>
<entry lang="en" key="IDC_KEYFILES_ENABLE_HIDVOL_PROT">U&amp;se keyfiles</entry>
<entry lang="en" key="IDC_KEYFILES_HIDVOL_PROT">&amp;Keyfiles...</entry>
<entry lang="en" key="IDC_KEYREMOVE">&amp;Remove</entry>
<entry lang="en" key="IDC_KEYREMOVEALL">Remove &amp;All</entry>
<entry lang="en" key="IDC_LINK_HIDVOL_PROTECTION_INFO">What is hidden volume protection?</entry>
<entry lang="en" key="IDC_LINK_KEYFILES_INFO">More information on keyfiles</entry>
<entry lang="en" key="IDC_MOUNT_REMOVABLE">Mount volume as removable &amp;medium</entry>
<entry lang="en" key="IDC_MOUNT_SYSENC_PART_WITHOUT_PBA">Mount partition &amp;using system encryption without pre-boot authentication</entry>
<entry lang="en" key="IDC_PARALLELIZATION_LABEL_LINK">Parallelization:</entry>
<entry lang="en" key="IDC_PERFORM_BENCHMARK">Benchmark</entry>
<entry lang="en" key="IDC_PRINT">&amp;Print</entry>
<entry lang="en" key="IDC_PROTECT_HIDDEN_VOL">&amp;Protect hidden volume against damage caused by writing to outer volume</entry>
<entry lang="en" key="IDC_RESET">&amp;Reset</entry>
<entry lang="en" key="IDC_SHOW_PASSWORD_MO">&amp;Display password</entry>
<entry lang="en" key="IDC_TOKEN_FILES_ADD">Add &amp;Token Files...</entry>
<entry lang="en" key="IDC_USE_EMBEDDED_HEADER_BAK">Use backup header embedded in &amp;volume if available</entry>
<entry lang="en" key="IDC_XTS_MODE_ENABLED">XTS mode</entry>
<entry lang="en" key="IDD_ABOUT_DLG">About VeraCrypt</entry>
<entry lang="en" key="IDD_BENCHMARK_DLG">VeraCrypt - Algorithms Benchmark</entry>
<entry lang="en" key="IDD_CIPHER_TEST_DLG">VeraCrypt - Test Vectors</entry>
<entry lang="en" key="IDD_COMMANDHELP_DLG">Command Line Help</entry>
<entry lang="en" key="IDD_KEYFILES">VeraCrypt - Keyfiles</entry>
<entry lang="en" key="IDD_KEYFILE_GENERATOR">VeraCrypt - Keyfile Generator</entry>
<entry lang="en" key="IDD_LANGUAGE">VeraCrypt - Language</entry>
<entry lang="en" key="IDD_MOUNT_OPTIONS">VeraCrypt - Mount Options</entry>
<entry lang="en" key="IDD_NEW_TOKEN_KEYFILE">New Security Token Keyfile Properties</entry>
<entry lang="en" key="IDD_RANDOM_POOL_ENRICHMENT">VeraCrypt - Random Pool Enrichment</entry>
<entry lang="en" key="IDD_RAWDEVICES_DLG">Select a Partition or Device</entry>
<entry lang="en" key="IDD_STATIC_MODELESS_WAIT_DLG">VeraCrypt</entry>
<entry lang="en" key="IDD_TOKEN_KEYFILES">Security Token Keyfiles</entry>
<entry lang="en" key="IDD_TOKEN_PASSWORD">Security token password/PIN required</entry>
<entry lang="en" key="IDT_ACTIVE_LANG_PACK">Active language pack</entry>
<entry lang="en" key="IDT_BOX_BENCHMARK_INFO">Speed is affected by CPU load and storage device characteristics.\n\nThese tests take place in RAM.</entry>
<entry lang="en" key="IDT_BUFFER_SIZE">Buffer Size:</entry>
<entry lang="en" key="IDT_CIPHER">Cipher:</entry>
<entry lang="en" key="IDT_HIDDEN_PROT_PASSWD">P&amp;assword to hidden volume:\n(if empty, cache is used)</entry>
<entry lang="en" key="IDT_HIDDEN_VOL_PROTECTION">Hidden Volume Protection</entry>
<entry lang="en" key="IDT_KEY">Key size:</entry>
<entry lang="en" key="IDT_KEYFILE_GENERATOR_NOTE">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.</entry>
<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_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>
<entry lang="en" key="IDT_PLAINTEXT_SIZE_UNIT">bits</entry>
<entry lang="en" key="IDT_POOL_CONTENTS">Current Pool Content</entry>
<entry lang="en" key="IDT_PRF">Mixing PRF:</entry>
<entry lang="en" key="IDT_RANDOM_POOL_ENRICHMENT_NOTE">IMPORTANT: Move your mouse as randomly as possible within this window. The longer you move it, the better. This significantly increases security. When done, click 'Continue'.</entry>
<entry lang="en" key="IDT_SECONDARY_KEY">Secondary key (hexadecimal)</entry>
<entry lang="en" key="IDT_SECURITY_TOKEN">Security token:</entry>
<entry lang="en" key="IDT_SORT_METHOD">Sort Method:</entry>
<entry lang="en" key="IDT_STATIC_MODELESS_WAIT_DLG_INFO">Please wait. This process may take a long time...</entry>
<entry lang="en" key="IDT_STATIC_MODAL_WAIT_DLG_INFO">Please wait...\nThis process may take a long time and VeraCrypt may seem unresponsive.</entry>
<entry lang="en" key="IDT_TEST_BLOCK_NUMBER">Block number:</entry>
<entry lang="en" key="IDT_TEST_CIPHERTEXT">Ciphertext (hexadecimal)</entry>
<entry lang="en" key="IDT_TEST_DATA_UNIT_NUMBER">Data unit number (64-bit hexadecimal, data unit size is 512 bytes)</entry>
<entry lang="en" key="IDT_TEST_KEY">Key (hexadecimal)</entry>
<entry lang="en" key="IDT_TEST_PLAINTEXT">Plaintext (hexadecimal)</entry>
<entry lang="en" key="IDT_TOKEN_KEYFILE_NAME">Keyfile name:</entry>
<entry lang="en" key="IDT_XTS_MODE">XTS mode</entry>
<entry lang="en" key="MENU_SYSTEM_ENCRYPTION">S&amp;ystem</entry>
<entry lang="en" key="MENU_VOLUMES">&amp;Volumes</entry>
<entry lang="en" key="MENU_FAVORITES">Favor&amp;ites</entry>
<entry lang="en" key="MENU_TOOLS">T&amp;ools</entry>
<entry lang="en" key="MENU_SETTINGS">Settin&amp;gs</entry>
<entry lang="en" key="MENU_HELP">&amp;Help</entry>
<entry lang="en" key="MENU_WEBSITE"> Home&amp;page </entry>
<entry lang="en" key="ABOUTBOX">&amp;About...</entry>
<entry lang="en" key="ACCESSMODEFAIL">The read-only attribute on your old volume could not be changed. Please check the file access permissions.</entry>
<entry lang="en" key="ACCESS_DENIED">Error: Access denied.\n\nThe partition you are trying to access is either 0 sectors long, or it is the boot device.</entry>
<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_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>
<entry lang="en" key="ALREADY_MOUNTED">Volume is already mounted.</entry>
<entry lang="en" key="ERR_SELF_TESTS_FAILED">CAUTION: At least one encryption or hash algorithm failed the built-in automatic self-tests!\n\nVeraCrypt installation may be corrupted.</entry>
<entry lang="en" key="ERR_NOT_ENOUGH_RANDOM_DATA">CAUTION: There is not enough data in the Random Number Generator pool to provide the requested amount of random data.\n\nYou should not proceed any further. Please select 'Report a Bug' from the Help menu, and report this error.</entry>
<entry lang="en" key="ERR_HARDWARE_ERROR">The drive is damaged (there is a physical defect on it) or a cable is damaged, or the memory is malfunctioning.\n\nPlease note that this is a problem with your hardware, not with VeraCrypt. Therefore, please do NOT report this as a bug/problem in VeraCrypt and please do NOT ask for help with this in the VeraCrypt Forums. Please contact your computer vendor's technical support team for assistance. Thank you.\n\nNote: If the error occurs repeatedly at the same place, it is very likely caused by a bad disk block, which should be possible to correct using third-party software (note that, in many cases, the 'chkdsk /r' command cannot correct it because it works only at the filesystem level; in some cases, the 'chkdsk' tool cannot even detect it).</entry>
<entry lang="en" key="DEVICE_NOT_READY_ERROR">If you are accessing a drive for removable media, please make sure that a medium is inserted in the drive. The drive/medium may also be damaged (there may be a physical defect on it) or a cable may be damaged/disconnected.</entry>
<entry lang="en" key="WHOLE_DRIVE_ENCRYPTION_PREVENTED_BY_DRIVERS">Your system appears to be using custom chipset drivers containing a bug that prevents encryption of the whole system drive.\n\nPlease try updating or uninstalling any custom (non-Microsoft) chipset drivers before proceeding. If it does not help, try encrypting the system partition only.</entry>
<entry lang="en" key="BAD_DRIVE_LETTER">Invalid drive letter.</entry>
<entry lang="en" key="INVALID_PATH">Invalid path.</entry>
<entry lang="en" key="CANCEL">Cancel</entry>
<entry lang="en" key="CANNOT_CALC_SPACE">Cannot access device. Make sure the selected device exists and is not used by system.</entry>
<entry lang="en" key="CAPSLOCK_ON">Warning: Caps Lock is on. This may cause you to enter your password incorrectly.</entry>
<entry lang="en" key="VOLUME_TYPE_TITLE">Volume Type</entry>
<entry lang="en" key="HIDDEN_VOLUME_TYPE_HELP">It may happen that you are forced by somebody to reveal the password to an encrypted volume. There are many situations where you cannot refuse to reveal the password (for example, due to extortion). Using a so-called hidden volume allows you to solve such situations without revealing the password to your volume.</entry>
<entry lang="en" key="NORMAL_VOLUME_TYPE_HELP">Select this option if you want to create a normal VeraCrypt volume.</entry>
<entry lang="en" key="HIDDEN_OS_PRECLUDES_SINGLE_KEY_WDE">Please note that if you wish an operating system to be installed in a hidden partition-hosted volume, then the entire system drive cannot be encrypted using a single key.</entry>
<entry lang="en" key="CIPHER_HIDVOL_HOST_TITLE">Outer Volume Encryption Options</entry>
<entry lang="en" key="CIPHER_HIDVOL_TITLE">Hidden Volume Encryption Options</entry>
<entry lang="en" key="CIPHER_TITLE">Encryption Options</entry>
<entry lang="en" key="CLEAN_WINMRU_FAILED">WARNING: Failed to clear the path of the last selected volume/keyfile (remembered by file selector)!</entry>
<entry lang="en" key="COMPRESSION_NOT_SUPPORTED">Error: The container has been compressed at the filesystem level. VeraCrypt does not support compressed containers (note that compression of encrypted data is ineffective and redundant).\n\nPlease disable compression for the container by following these steps:\n1) Right-click the container in Windows Explorer (not in VeraCrypt).\n2) Select 'Properties'.\n3) In the 'Properties' dialog box, click 'Advanced'.\n4) In the 'Advanced Attributes' dialog box, disable the option 'Compress contents to save disk space' and click 'OK'.\n5) In the 'Properties' dialog box, click 'OK'.</entry>
<entry lang="en" key="CREATE_FAILED">Failed to create volume %s</entry>
<entry lang="en" key="DEVICE_FREE_BYTES">Size of %s is %.2f bytes</entry>
<entry lang="en" key="DEVICE_FREE_KB">Size of %s is %.2f KiB</entry>
<entry lang="en" key="DEVICE_FREE_MB">Size of %s is %.2f MiB</entry>
<entry lang="en" key="DEVICE_FREE_GB">Size of %s is %.2f GiB</entry>
<entry lang="en" key="DEVICE_FREE_TB">Size of %s is %.2f TiB</entry>
<entry lang="en" key="DEVICE_FREE_PB">Size of %s is %.2f PiB</entry>
<entry lang="en" key="DEVICE_IN_USE_FORMAT">WARNING: The device/partition is in use by the operating system or applications. Formatting the device/partition might cause data corruption and system instability.\n\nContinue?</entry>
<entry lang="en" key="DEVICE_IN_USE_INPLACE_ENC">Warning: The partition is in use by the operating system or applications. You should close any applications that might be using the partition (including antivirus software).\n\nContinue?</entry>
<entry lang="en" key="FORMAT_CANT_DISMOUNT_FILESYS">Error: The device/partition contains a file system that could not be dismounted. The file system may be in use by the operating system. Formatting the device/partition would very likely cause data corruption and system instability.\n\nTo solve this issue, we recommend that you first delete the partition and then recreate it without formatting. To do so, follow these steps:\n1) Right-click the 'Computer' (or 'My Computer') icon in the 'Start Menu' and select 'Manage'. The 'Computer Management' window should appear.\n2) In the 'Computer Management' window, select 'Storage' > 'Disk Management'.\n3) Right-click the partition you want to encrypt and select either 'Delete Partition', or 'Delete Volume', or 'Delete Logical Drive'.\n4) Click 'Yes'. If Windows asks you to restart the computer, do so. Then repeat the steps 1 and 2 and continue from the step 5.\n5) Right-click the unallocated/free space area and select either 'New Partition', or 'New Simple Volume', or 'New Logical Drive'.\n6) The 'New Partition Wizard' or 'New Simple Volume Wizard' window should appear now; follow its instructions. On the wizard page entitled 'Format Partition', select either 'Do not format this partition' or 'Do not format this volume'. In the same wizard, click 'Next' and then 'Finish'.\n7) Note that the device path you have selected in VeraCrypt may be wrong now. Therefore, exit the VeraCrypt Volume Creation Wizard (if it is still running) and then start it again.\n8) Try encrypting the device/partition again.\n\nIf VeraCrypt repeatedly fails to encrypt the device/partition, you may want to consider creating a file container instead.</entry>
<entry lang="en" key="INPLACE_ENC_CANT_LOCK_OR_DISMOUNT_FILESYS">Error: The filesystem could not be locked and/or dismounted. It may be in use by the operating system or applications (for example, antivirus software). Encrypting the partition might cause data corruption and system instability.\n\nPlease close any applications that might be using the filesystem (including antivirus software) and try again. If it does not help, please follow the below steps.</entry>
<entry lang="en" key="DEVICE_IN_USE_INFO">WARNING: Some of the mounted devices/partitions were already in use!\n\nIgnoring this can cause undesired results including system instability.\n\nWe strongly recommend that you close any application that might be using the devices/partitions.</entry>
<entry lang="en" key="DEVICE_PARTITIONS_ERR">The selected device contains partitions.\n\nFormatting the device might cause system instability and/or data corruption. Please either select a partition on the device, or remove all partitions on the device to enable VeraCrypt to format it safely.</entry>
<entry lang="en" key="DEVICE_PARTITIONS_ERR_W_INPLACE_ENC_NOTE">The selected non-system device contains partitions.\n\nEncrypted device-hosted VeraCrypt volumes can be created within devices that do not contain any partitions (including hard disks and solid-state drives). A device that contains partitions can be entirely encrypted in place (using a single master key) only if it is the drive where Windows is installed and from which it boots.\n\nIf you want to encrypt the selected non-system device using a single master key, you will need to remove all partitions on the device first to enable VeraCrypt to format it safely (formatting a device that contains partitions might cause system instability and/or data corruption). Alternatively, you can encrypt each partition on the drive individually (each partition will be encrypted using a different master key).\n\nNote: If you want to remove all partitions from a GPT disk, you may need to convert it to a MBR disk (using e.g. the Computer Management tool) in order to remove hidden partitions.</entry>
<entry lang="en" key="WHOLE_NONSYS_DEVICE_ENC_CONFIRM">Warning: If you encrypt the entire device (as opposed to encrypting only a partition on it), operating systems will consider the device as new, empty, and unformatted (as it will contain no partition table) and may spontaneously initialize the device (or ask you if you want to do so), which may damage the volume. Furthermore, it will not be possible to consistently mount the volume as favorite (e.g. when the drive number changes) or to assign a favorite-volume label to it.\n\nTo avoid that you may want to consider creating a partition on the device and encrypting the partition instead.\n\nAre you sure want to encrypt the entire device?</entry>
<entry lang="en" key="AFTER_FORMAT_DRIVE_LETTER_WARN">IMPORTANT: Please keep in mind that this volume can NOT be mounted/accessed using the drive letter %c:, which is currently assigned to it!\n\nTo mount this volume, click 'Auto-Mount Devices' in the main VeraCrypt window (alternatively, in the main VeraCrypt window, click 'Select Device', then select this partition/device, and click 'Mount'). The volume will be mounted to a different drive letter, which you select from the list in the main VeraCrypt window.\n\nThe original drive letter %c: should be used only in case you need to remove encryption from the partition/device (e.g., if you no longer need encryption). In such a case, right-click the drive letter %c: in the 'Computer' (or 'My Computer') list and select 'Format'. Otherwise, the drive letter %c: should never be used (unless you remove it, as described e.g. in the VeraCrypt FAQ, and assign it to another partition/device).</entry>
<entry lang="en" key="OS_NOT_SUPPORTED_FOR_NONSYS_INPLACE_ENC">In-place encryption of non-system volumes is not supported on the version of the operating system you are currently using (it is supported only on Windows Vista and later versions of Windows).\n\nThe reason is that this version of Windows does not support shrinking of a filesystem (the filesystem needs to be shrunk to make space for the volume header and backup header).</entry>
<entry lang="en" key="ONLY_NTFS_SUPPORTED_FOR_NONSYS_INPLACE_ENC">The selected partition does not appear to contain an NTFS filesystem. Only partitions that contain an NTFS filesystem can be encrypted in place.\n\nNote: The reason is that Windows does not support shrinking of other types of filesystems (the filesystem needs to be shrunk to make space for the volume header and backup header).</entry>
<entry lang="en" key="ONLY_MOUNTED_VOL_SUPPORTED_FOR_NONSYS_INPLACE_ENC">The selected partition does not appear to contain an NTFS filesystem. Only partitions that contain an NTFS filesystem can be encrypted in place.\n\nIf you want to create an encrypted VeraCrypt volume within this partition, choose the option "Create encrypted volume and format it" (instead of the option "Encrypt partition in place").</entry>
<entry lang="en" key="PARTITION_TOO_SMALL_FOR_NONSYS_INPLACE_ENC">Error: The partition is too small. VeraCrypt cannot encrypt it in place.</entry>
<entry lang="en" key="INPLACE_ENC_ALTERNATIVE_STEPS">To encrypt the data on this partition, please follow these steps:\n\n1) Create a VeraCrypt volume on an empty partition/device and then mount it.\n\n2) Copy all files from the partition that you originally wanted to encrypt to the mounted VeraCrypt volume (that has been created and mounted in step 1). That way, you will create a VeraCrypt-encrypted backup of the data.\n\n3) Create a VeraCrypt volume on the partition that you originally wanted to encrypt and make sure that (in the VeraCrypt wizard) you choose the option "Create encrypted volume and format it" (instead of the option "Encrypt partition in place"). Note that all data stored on the partition will be erased. After the volume is created, mount it.\n\n4) Copy all files from the mounted backup VeraCrypt volume (created and mounted in step 1) to the mounted VeraCrypt volume that has been created (and mounted) in step 3.\n\nAfter you complete these steps, the data will be encrypted and, in addition, there will be an encrypted backup of the data.</entry>
<entry lang="en" key="RAW_DEV_NOT_SUPPORTED_FOR_INPLACE_ENC">VeraCrypt can in-place encrypt only a partition, a dynamic volume, or an entire system drive.\n\nIf you want to create an encrypted VeraCrypt volume within the selected non-system device, choose the option "Create encrypted volume and format it" (instead of the option "Encrypt partition in place").</entry>
<entry lang="en" key="INPLACE_ENC_INVALID_PATH">Error: VeraCrypt can in-place encrypt only a partition, a dynamic volume, or an entire system drive. Please make sure the specified path is valid.</entry>
<entry lang="en" key="CANNOT_RESIZE_FILESYS">Error: Cannot shrink the filesystem (the filesystem needs to be shrunk to make space for the volume header and backup header).\n\nPossible causes and solutions:\n\n- Not enough free space on the volume. Please make sure no other application is writing to the filesystem.\n\n- Corrupted file system. Try to check it and fix any errors (right-click the corresponding drive letter in the 'Computer' list, then select Properties > Tools > 'Check Now', make sure the option 'Automatically fix file system errors' is enabled and click Start).\n\nIf the above steps do not help, please follow the below steps.</entry>
<entry lang="en" key="NOT_ENOUGH_FREE_FILESYS_SPACE_FOR_SHRINK">Error: There is not enough free space on the volume and so the filesystem cannot be shrunk (the filesystem needs to be shrunk to make space for the volume header and backup header).\n\nPlease delete any redundant files and empty the Recycle Bin so as to free at least 256 KiB of space and then try again. Note that due to a Windows issue, the amount of free space reported by the Windows Explorer may be incorrect until the operating system is restarted. If restarting the system does not help, the file system may be corrupted. Try to check it and fix any errors (right-click the corresponding drive letter in the 'Computer' list, then select Properties > Tools > 'Check Now', make sure the option 'Automatically fix file system errors' is enabled and click Start).\n\nIf the above steps do not help, please follow the below steps.</entry>
<entry lang="en" key="DISK_FREE_BYTES">Free space on drive %s is %.2f bytes.</entry>
<entry lang="en" key="DISK_FREE_KB">Free space on drive %s is %.2f KiB</entry>
<entry lang="en" key="DISK_FREE_MB">Free space on drive %s is %.2f MiB</entry>
<entry lang="en" key="DISK_FREE_GB">Free space on drive %s is %.2f GiB</entry>
<entry lang="en" key="DISK_FREE_TB">Free space on drive %s is %.2f TiB</entry>
<entry lang="en" key="DISK_FREE_PB">Free space on drive %s is %.2f PiB</entry>
<entry lang="en" key="DRIVELETTERS">Could not get available drive letters.</entry>
<entry lang="en" key="DRIVER_NOT_FOUND">Error: VeraCrypt driver not found.\n\nPlease copy the files 'veracrypt.sys' and 'veracrypt-x64.sys' to the directory where the main VeraCrypt application (VeraCrypt.exe) is located.</entry>
<entry lang="en" key="DRIVER_VERSION">Error: An incompatible version of the VeraCrypt driver is currently running.\n\nIf you are trying to run VeraCrypt in portable mode (i.e. without installing it) and a different version of VeraCrypt is already installed, you must uninstall it first (or upgrade it using the VeraCrypt installer). To uninstall it, follow these steps: On Windows Vista or later, select 'Start Menu' > Computer > 'Uninstall or change a program' > VeraCrypt > Uninstall; on Windows XP, select 'Start Menu' > Settings > 'Control Panel' > 'Add Or Remove Programs' > VeraCrypt > Remove.\n\nSimilarly, if you are trying to run VeraCrypt in portable mode (i.e. without installing it) and a different version of VeraCrypt is already running in portable mode, you must restart the system first and then run only this new version.</entry>
<entry lang="en" key="ERR_CIPHER_INIT_FAILURE">Error: Cipher initialization failure.</entry>
<entry lang="en" key="ERR_CIPHER_INIT_WEAK_KEY">Error: A weak or a potentially weak key has been detected. The key will be discarded. Please try again.</entry>
<entry lang="en" key="EXCEPTION_REPORT">A critical error has occurred and VeraCrypt must be terminated. If this is caused by a bug in VeraCrypt, we would like to fix it. To help us, you can send us an automatically generated error report containing the following items:\n\n- Program version\n- Operating system version\n- Type of CPU\n- VeraCrypt component name\n- Checksum of VeraCrypt executable\n- Symbolic name of dialog window\n- Error category\n- Error address\n- VeraCrypt call stack\n\nIf you select 'Yes', the following URL (which contains the entire error report) will be opened in your default Internet browser.\n\n%hs\n\nDo you want to send us the above error report?</entry>
<entry lang="en" key="EXCEPTION_REPORT_EXT">A critical error has occurred in your system, which requires VeraCrypt to be terminated.\n\nNote that this error has not been caused by VeraCrypt (so the VeraCrypt developers cannot fix it). Please, check your system for possible problems (e.g., system configuration, network connection, failing hardware components).</entry>
<entry lang="en" key="EXCEPTION_REPORT_EXT_FILESEL">A critical error has occurred in your system, which requires VeraCrypt to be terminated.\n\nIf this problem persists, you may want to try disabling or uninstalling applications that could potentially be causing this issue, such as antivirus or Internet security software, system "enhancers", "optimizers" or "tweakers", etc. If it does not help, you may want to try reinstalling your operating system (this problem may also be caused by malware).</entry>
<entry lang="en" key="EXCEPTION_REPORT_TITLE">VeraCrypt Critical Error</entry>
<entry lang="en" key="SYSTEM_CRASHED_ASK_REPORT">VeraCrypt detected that the operating system recently crashed. There are many potential reasons why the system could have crashed (for example, a failing hardware component, a bug in a device driver, etc.)\n\nDo you want VeraCrypt to check whether a bug in VeraCrypt could have caused the system crash?</entry>
<entry lang="en" key="ASK_KEEP_DETECTING_SYSTEM_CRASH">Do you want VeraCrypt to continue detecting system crashes?</entry>
<entry lang="en" key="NO_MINIDUMP_FOUND">VeraCrypt found no system crash minidump file.</entry>
<entry lang="en" key="ASK_DELETE_KERNEL_CRASH_DUMP">Do you want to delete the Windows crash dump file to free up disk space?</entry>
<entry lang="en" key="ASK_DEBUGGER_INSTALL">In order to analyze the system crash, VeraCrypt needs to install Microsoft Debugging Tools for Windows first.\n\nAfter you click OK, the Windows installer will download the Microsoft Debugging Tools installation package (16 MiB) from a Microsoft server and install it (the Windows installer will be forwarded to the Microsoft server URL from the veracrypt.org server, which ensures that this feature works even if Microsoft changes the location of the installation package).</entry>
<entry lang="en" key="SYSTEM_CRASH_ANALYSIS_INFO">After you click OK, VeraCrypt will analyze the system crash. This may take up to several minutes.</entry>
<entry lang="en" key="DEBUGGER_NOT_FOUND">Please make sure the environment variable 'PATH' includes the path to 'kd.exe' (Kernel Debugger).</entry>
<entry lang="en" key="SYSTEM_CRASH_NO_VERACRYPT">It appears that VeraCrypt most likely did not cause the system crash. There are many potential reasons why the system could have crashed (for example, a failing hardware component, a bug in a device driver, etc.)</entry>
<entry lang="en" key="SYSTEM_CRASH_UPDATE_DRIVER">Results of the analysis indicate that updating the following driver might solve this issue: </entry>
<entry lang="en" key="SYSTEM_CRASH_REPORT">To help us determine whether there is a bug in VeraCrypt, you can send us an automatically generated error report containing the following items:\n- Program version\n- Operating system version\n- Type of CPU\n- Error category\n- Driver name and version\n- System call stack\n\nIf you select 'Yes', the following URL (which contains the entire error report) will be opened in your default Internet browser.</entry>
<entry lang="en" key="ASK_SEND_ERROR_REPORT">Do you want to send us the above error report?</entry>
<entry lang="en" key="ENCRYPT">&amp;Encrypt</entry>
<entry lang="en" key="DECRYPT">&amp;Decrypt</entry>
<entry lang="en" key="PERMANENTLY_DECRYPT">&amp;Permanently Decrypt</entry>
<entry lang="en" key="EXIT">Exit</entry>
<entry lang="en" key="EXT_PARTITION">Please create a logical drive for this extended partition, and then try again.</entry>
<entry lang="en" key="FILE_HELP">A VeraCrypt volume can reside in a file (called VeraCrypt container), which can reside on a hard disk, on a USB flash drive, etc. A VeraCrypt container is just like any normal file (it can be, for example, moved or deleted as any normal file). Click 'Select File' to choose a filename for the container and to select the location where you wish the container to be created.\n\nWARNING: If you select an existing file, VeraCrypt will NOT encrypt it; the file will be deleted and replaced with the newly created VeraCrypt container. You will be able to encrypt existing files (later on) by moving them to the VeraCrypt container that you are about to create now.</entry>
<entry lang="en" key="FILE_HELP_HIDDEN_HOST_VOL">Select the location of the outer volume to be created (within this volume the hidden volume will be created later on).\n\nA VeraCrypt volume can reside in a file (called VeraCrypt container), which can reside on a hard disk, on a USB flash drive, etc. A VeraCrypt container can be moved or deleted as any normal file. Click 'Select File' to choose a filename for the container and to select the location where you wish the container to be created. If you select an existing file, VeraCrypt will NOT encrypt it; it will be deleted and replaced with the newly created container. You will be able to encrypt existing files (later on) by moving them to the VeraCrypt container you are about to create now.</entry>
<entry lang="en" key="DEVICE_HELP">Encrypted device-hosted VeraCrypt volumes can be created within partitions on hard disks, solid-state drives, USB memory sticks, and on any other supported storage devices. Partitions can also be encrypted in place.\n\nIn addition, encrypted device-hosted VeraCrypt volumes can be created within devices that do not contain any partitions (including hard disks and solid-state drives).\n\nNote: A device that contains partitions can be entirely encrypted in place (using a single key) only if it is the drive where Windows is installed and from which it boots.</entry>
<entry lang="en" key="DEVICE_HELP_NO_INPLACE">A device-hosted VeraCrypt volume can be created within a hard disk partition, solid-state drive, USB memory stick, and other storage devices.\n\nWARNING: Note that the partition/device will be formatted and all data currently stored on it will be lost.</entry>
<entry lang="en" key="DEVICE_HELP_HIDDEN_HOST_VOL">\nSelect the location of the outer volume to be created (within this volume the hidden volume will be created later on).\n\nOuter volumes can be created within partitions on hard disks, solid-state drives, USB memory sticks, and on any other supported storage devices. Outer volumes can also be created within devices that do not contain any partitions (including hard disks and solid-state drives).\n\nWARNING: Note that the partition/device will be formatted and all data currently stored on it will be lost.</entry>
<entry lang="en" key="FILE_HELP_HIDDEN_HOST_VOL_DIRECT">\nSelect the location of the VeraCrypt volume within which you wish to create a hidden volume.</entry>
<entry lang="en" key="FILE_IN_USE">WARNING: The host file/device is already in use!\n\nIgnoring this can cause undesired results including system instability. All applications that might be using the host file/device (for example, antivirus or backup applications) should be closed before mounting the volume.\n\nContinue mounting?</entry>
<entry lang="en" key="FILE_IN_USE_FAILED">Error: Cannot mount volume. The host file/device is already in use. Attempt to mount without exclusive access failed as well.</entry>
<entry lang="en" key="FILE_OPEN_FAILED">The file could not be opened.</entry>
<entry lang="en" key="FILE_TITLE">Volume Location</entry>
<entry lang="en" key="FILESYS_PAGE_TITLE">Large Files</entry>
<entry lang="en" key="FILESYS_PAGE_HELP_QUESTION">Do you intend to store files larger than 4 GiB in this VeraCrypt volume?</entry>
<entry lang="en" key="FILESYS_PAGE_HELP_EXPLANATION">Depending on your choice above, VeraCrypt will choose a suitable default file system for the VeraCrypt volume (you will be able to select a file system in the next step).</entry>
<entry lang="en" key="FILESYS_PAGE_HELP_EXPLANATION_HIDVOL">As you are creating an outer volume, you should consider choosing 'No'. If you choose 'Yes', the default filesystem will be NTFS, which is not as suitable for outer volumes as FAT/exFAT (for example, the maximum possible size of the hidden volume will be significantly greater if the outer volume is formatted as FAT/exFAT). Normally, FAT is the default for both hidden and normal volumes (so FAT volumes are not suspicious). However, if the user indicates intent to store files larger than 4 GiB (which the FAT file system does not allow), then FAT is not the default.</entry>
<entry lang="en" key="FILESYS_PAGE_HELP_EXPLANATION_HIDVOL_CONFIRM">Are you sure you want to choose 'Yes'?</entry>
<entry lang="en" key="DEVICE_TRANSFORM_MODE_PAGE_TITLE">Volume Creation Mode</entry>
<entry lang="en" key="DEVICE_TRANSFORM_MODE_PAGE_FORMAT_HELP">This is the fastest way to create a partition-hosted or device-hosted VeraCrypt volume (in-place encryption, which is the other option, is slower because content of each sector has to be first read, encrypted, and then written). Any data currently stored on the selected partition/device will be lost (the data will NOT be encrypted; it will be overwritten with random data). If you want to encrypt existing data on a partition, choose the other option.</entry>
<entry lang="en" key="DEVICE_TRANSFORM_MODE_PAGE_INPLACE_HELP">The entire selected partition and all data stored on it will be encrypted in place. If the partition is empty, you should choose the other option (the volume will be created much faster).</entry>
<entry lang="en" key="NOTE_BEGINNING">Note: </entry>
<entry lang="en" key="RESUME">&amp;Resume</entry>
- <entry lang="en" key="DEFER">&amp;Cancel</entry>
+ <entry lang="en" key="DEFER">&amp;Defer</entry>
<entry lang="en" key="START">&amp;Start</entry>
<entry lang="en" key="CONTINUE">&amp;Continue</entry>
<entry lang="en" key="FORMAT">&amp;Format</entry>
<entry lang="en" key="WIPE">&amp;Wipe</entry>
<entry lang="en" key="FORMAT_ABORT">Abort format?</entry>
<entry lang="en" key="SHOW_MORE_INFORMATION">Show more information</entry>
<entry lang="en" key="DO_NOT_SHOW_THIS_AGAIN">Do not show this again</entry>
<entry lang="en" key="WIPE_FINISHED">The content of the partition/device has been successfully erased.</entry>
<entry lang="en" key="WIPE_FINISHED_DECOY_SYSTEM_PARTITION">The content of the partition where the original system (of which the hidden system is a clone) resided has been successfully erased.</entry>
<entry lang="en" key="DECOY_OS_VERSION_WARNING">Please make sure the version of Windows you are going to install (on the wiped partition) is the same as the version of Windows you are currently running. This is required due to the fact that both systems will share a common boot partition.</entry>
<entry lang="en" key="SYSTEM_ENCRYPTION_FINISHED">The system partition/drive has been successfully encrypted.\n\nNote: If there are non-system VeraCrypt volumes that you need to have mounted automatically every time Windows starts, you can set it up by mounting each of them and selecting 'Favorites' > 'Add Mounted Volume to System Favorites').</entry>
<entry lang="en" key="SYSTEM_DECRYPTION_FINISHED">The system partition/drive has been successfully decrypted.</entry>
<entry lang="en" key="FORMAT_FINISHED_HELP">\n\nThe VeraCrypt volume has been created and is ready for use. If you wish to create another VeraCrypt volume, click Next. Otherwise, click Exit.</entry>
<entry lang="en" key="SYSENC_HIDDEN_VOL_FORMAT_FINISHED_HELP">\n\nThe hidden VeraCrypt volume has been successfully created (the hidden operating system will reside within this hidden volume).\n\nClick Next to continue.</entry>
<entry lang="en" key="NONSYS_INPLACE_ENC_FINISHED_TITLE">Volume Fully Encrypted</entry>
<entry lang="en" key="NONSYS_INPLACE_DEC_FINISHED_TITLE">Volume Fully Decrypted</entry>
<entry lang="en" key="NONSYS_INPLACE_ENC_FINISHED_INFO">IMPORTANT: TO MOUNT THIS NEWLY CREATED VERACRYPT VOLUME AND TO ACCESS DATA STORED IN IT, CLICK 'Auto-Mount Devices' IN THE MAIN VERACRYPT WINDOW. After you enter the correct password (and/or supply correct keyfiles), the volume will be mounted to the drive letter you select from the list in the main VeraCrypt window (and you will be able to access the encrypted data via the selected drive letter).\n\nPLEASE REMEMBER OR WRITE DOWN THE ABOVE STEPS. YOU MUST FOLLOW THEM WHENEVER YOU WANT TO MOUNT THE VOLUME AND ACCESS DATA STORED IN IT. Alternatively, in the main VeraCrypt window, click 'Select Device', then select this partition/volume, and click 'Mount'.\n\nThe partition/volume has been successfully encrypted (it contains a fully encrypted VeraCrypt volume now) and is ready for use.</entry>
<entry lang="en" key="NONSYS_INPLACE_DEC_FINISHED_INFO">The VeraCrypt volume has been successfully decrypted.</entry>
<entry lang="en" key="NONSYS_INPLACE_DEC_FINISHED_DRIVE_LETTER_SEL_INFO">The VeraCrypt volume has been successfully decrypted.\n\nPlease select a drive letter that you wish to assign to the decrypted volume and then click Finish.\n\nIMPORTANT: Until a drive letter is assigned to the decrypted volume, you will not be able to access data stored on the volume.</entry>
<entry lang="en" key="NONSYS_INPLACE_DEC_FINISHED_NO_DRIVE_LETTER_AVAILABLE">Warning: To be able to access the decrypted data, a drive letter needs to be assigned to the decrypted volume. However, no drive letter is currently available.\n\nPlease vacate a drive letter (for example, by disconnecting a USB flash drive or external hard drive, etc.) and then click OK.</entry>
<entry lang="en" key="FORMAT_FINISHED_INFO">The VeraCrypt volume has been successfully created.</entry>
<entry lang="en" key="FORMAT_FINISHED_TITLE">Volume Created</entry>
<entry lang="en" key="FORMAT_HELP">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 Format to create the volume.</entry>
<entry lang="en" key="FORMAT_HIDVOL_HOST_HELP">Click Format to create the outer volume. For more information, please refer to the documentation.</entry>
<entry lang="en" key="FORMAT_HIDVOL_HOST_TITLE">Outer Volume Format</entry>
<entry lang="en" key="FORMAT_HIDVOL_TITLE">Hidden Volume Format</entry>
<entry lang="en" key="FORMAT_TITLE">Volume Format</entry>
<entry lang="en" key="HELP_READER_ERROR">Adobe Reader (or a compatible tool) is necessary to view or print the VeraCrypt User's Guide. Adobe Reader (freeware) can be downloaded at: www.adobe.com\n\nDo you want to view the online documentation instead?</entry>
<entry lang="en" key="HIDDEN_VOL_WIZARD_MODE_NORMAL_HELP">If you select this option, the wizard will first help you create a normal VeraCrypt volume and then a hidden VeraCrypt volume within it. Inexperienced users should always select this option.</entry>
<entry lang="en" key="HIDDEN_VOL_WIZARD_MODE_DIRECT_HELP">If you select this option, you will create a hidden volume within an existing VeraCrypt volume. It will be assumed that you have already created a VeraCrypt volume that is suitable to host the hidden volume.</entry>
<entry lang="en" key="HIDDEN_VOL_WIZARD_MODE_TITLE">Volume Creation Mode</entry>
<entry lang="en" key="HIDVOL_FORMAT_FINISHED_TITLE">Hidden Volume Created</entry>
<entry lang="en" key="HIDVOL_FORMAT_FINISHED_HELP">The hidden VeraCrypt volume has been successfully created and is ready for use. If all the instructions have been followed and if the precautions and requirements listed in the section "Security Requirements and Precautions Pertaining to Hidden Volumes" in the VeraCrypt User's Guide are followed, it should be impossible to prove that the hidden volume exists, even when the outer volume is mounted.\n\nWARNING: IF YOU DO NOT PROTECT THE HIDDEN VOLUME (FOR INFORMATION ON HOW TO DO SO, REFER TO THE SECTION "PROTECTION OF HIDDEN VOLUMES AGAINST DAMAGE" IN THE VERACRYPT USER'S GUIDE), DO NOT WRITE TO THE OUTER VOLUME. OTHERWISE, YOU MAY OVERWRITE AND DAMAGE THE HIDDEN VOLUME!</entry>
<entry lang="en" key="FIRST_HIDDEN_OS_BOOT_INFO">You have started the hidden operating system. As you may have noticed, the hidden operating system appears to be installed on the same partition as the original operating system. However, in reality, it is installed within the partition behind it (in the hidden volume). All read and write operations are being transparently redirected from the original system partition to the hidden volume.\n\nNeither the operating system nor applications will know that data written to and read from the system partition are actually written to and read from the partition behind it (from/to a hidden volume). Any such data is encrypted and decrypted on the fly as usual (with an encryption key different from the one that will be used for the decoy operating system).\n\n\nPlease click Next to continue.</entry>
<entry lang="en" key="HIDVOL_HOST_FILLING_HELP_SYSENC">The outer volume has been created and mounted as drive %hc:. To this outer volume you should now copy some sensitive-looking files that you actually do NOT want to hide. They will be there for anyone forcing you to disclose the password for the first partition behind the system partition, where both the outer volume and the hidden volume (containing the hidden operating system) will reside. You will be able to reveal the password for this outer volume, and the existence of the hidden volume (and of the hidden operating system) will remain secret.\n\nIMPORTANT: The files you copy to the outer volume should not occupy more than %s. Otherwise, there may not be enough free space on the outer volume for the hidden volume (and you will not be able to continue). After you finish copying, click Next (do not dismount the volume).</entry>
<entry lang="en" key="HIDVOL_HOST_FILLING_HELP">Outer volume has been successfully created and mounted as drive %hc:. To this volume you should now copy some sensitive-looking files that you actually do NOT want to hide. The files will be there for anyone forcing you to disclose your password. You will reveal only the password for this outer volume, not for the hidden one. The files that you really care about will be stored in the hidden volume, which will be created later on. When you finish copying, click Next. Do not dismount the volume.\n\nNote: After you click Next, cluster bitmap of the outer volume will be scanned to determine the size of uninterrupted area of free space whose end is aligned with the end of the volume. This area will accommodate the hidden volume, so it will limit its maximum possible size. Cluster bitmap scanning ensures that no data on the outer volume are overwritten by the hidden volume.</entry>
<entry lang="en" key="HIDVOL_HOST_FILLING_TITLE">Outer Volume Contents</entry>
<entry lang="en" key="HIDVOL_HOST_PRE_CIPHER_HELP">\n\nIn the next steps, you will set the options for the outer volume (within which the hidden volume will be created later on).</entry>
<entry lang="en" key="HIDVOL_HOST_PRE_CIPHER_HELP_SYSENC">\n\nIn the next steps, you will create a so-called outer VeraCrypt volume within the first partition behind the system partition (as was explained in one of the previous steps).</entry>
<entry lang="en" key="HIDVOL_HOST_PRE_CIPHER_TITLE">Outer Volume</entry>
<entry lang="en" key="HIDDEN_OS_PRE_CIPHER_HELP">In the following steps, you will set the options and password for the hidden volume, which will contain the hidden operating system.\n\nRemark: The cluster bitmap of the outer volume has been scanned in order to determine the size of uninterrupted area of free space whose end is aligned with the end of the outer volume. This area will accommodate the hidden volume, so it limits its maximum possible size. The maximum possible size of the hidden volume has been determined and confirmed to be greater than the size of the system partition (which is required, because the entire content of the system partition will need to be copied to the hidden volume). This ensures that no data currently stored on the outer volume will be overwritten by data written to the area of the hidden volume.</entry>
<entry lang="en" key="HIDDEN_OS_PRE_CIPHER_WARNING">IMPORTANT: Please remember the algorithms that you select in this step. You will have to select the same algorithms for the decoy system. Otherwise, the hidden system will be inaccessible! (The decoy system must be encrypted with the same encryption algorithm as the hidden system.)\n\nNote: The reason is that the decoy system and the hidden system will share a single boot loader, which supports only a single algorithm, selected by the user (for each algorithm, there is a special version of the VeraCrypt Boot Loader).</entry>
<entry lang="en" key="HIDVOL_PRE_CIPHER_HELP">\n\nThe volume cluster bitmap has been scanned and the maximum possible size of the hidden volume has been determined. In the next steps you will set the options, the size, and the password for the hidden volume.</entry>
<entry lang="en" key="HIDVOL_PRE_CIPHER_TITLE">Hidden Volume</entry>
<entry lang="en" key="HIDVOL_PROT_WARN_AFTER_MOUNT">The hidden volume is now protected against damage until the outer volume is dismounted.\n\nWARNING: If any data is attempted to be saved to the hidden volume area, VeraCrypt will start write-protecting the entire volume (both the outer and the hidden part) until it is dismounted. This may cause filesystem corruption on the outer volume, which (if repeated) might adversely affect plausible deniability of the hidden volume. Therefore, you should make every effort to avoid writing to the hidden volume area. Any data being saved to the hidden volume area will not be saved and will be lost. Windows may report this as a write error ("Delayed Write Failed" or "The parameter is incorrect").</entry>
<entry lang="en" key="HIDVOL_PROT_WARN_AFTER_MOUNT_PLURAL">Each of the hidden volumes within the newly mounted volumes is now protected against damage until dismounted.\n\nWARNING: If any data is attempted to be saved to protected hidden volume area of any of these volumes, VeraCrypt will start write-protecting the entire volume (both the outer and the hidden part) until it is dismounted. This may cause filesystem corruption on the outer volume, which (if repeated) might adversely affect plausible deniability of the hidden volume. Therefore, you should make every effort to avoid writing to the hidden volume area. Any data being saved to protected hidden volume areas will not be saved and will be lost. Windows may report this as a write error ("Delayed Write Failed" or "The parameter is incorrect").</entry>
<entry lang="en" key="DAMAGE_TO_HIDDEN_VOLUME_PREVENTED">WARNING: Data were attempted to be saved to the hidden volume area of the volume mounted as %c:! VeraCrypt prevented these data from being saved in order to protect the hidden volume. This may have caused filesystem corruption on the outer volume and Windows may have reported a write error ("Delayed Write Failed" or "The parameter is incorrect"). The entire volume (both the outer and the hidden part) will be write-protected until it is dismounted. If this is not the first time VeraCrypt has prevented data from being saved to the hidden volume area of this volume, plausible deniability of this hidden volume might be adversely affected (due to possible unusual correlated inconsistencies within the outer volume file system). Therefore, you should consider creating a new VeraCrypt volume (with Quick Format disabled) and moving files from this volume to the new volume; this volume should be securely erased (both the outer and the hidden part). We strongly recommend that you restart the operating system now.</entry>
<entry lang="en" key="CANNOT_SATISFY_OVER_4G_FILE_SIZE_REQ">You have indicated intent to store files larger than 4 GiB on the volume. This requires the volume to be formatted as NTFS/exFAT/ReFS, which, however, will not be possible.</entry>
<entry lang="en" key="CANNOT_CREATE_NON_HIDDEN_NTFS_VOLUMES_UNDER_HIDDEN_OS">Please note that when a hidden operating system is running, non-hidden VeraCrypt volumes cannot be formatted as NTFS/exFAT/ReFS. The reason is that the volume would need to be temporarily mounted without write protection in order to allow the operating system to format it as NTFS (whereas formatting as FAT is performed by VeraCrypt, not by the operating system, and without mounting the volume). For further technical details, see below. You can create a non-hidden NTFS/exFAT/ReFS volume from within the decoy operating system.</entry>
<entry lang="en" key="HIDDEN_VOL_CREATION_UNDER_HIDDEN_OS_HOWTO">For security reasons, when a hidden operating system is running, hidden volumes can be created only in the 'direct' mode (because outer volumes must always be mounted as read-only). To create a hidden volume securely, follow these steps:\n\n1) Boot the decoy system.\n\n2) Create a normal VeraCrypt volume and, to this volume, copy some sensitive-looking files that you actually do NOT want to hide (the volume will become the outer volume).\n\n3) Boot the hidden system and start the VeraCrypt Volume Creation Wizard. If the volume is file-hosted, move it to the system partition or to another hidden volume (otherwise, the newly created hidden volume would be mounted as read-only and could not be formatted). Follow the instructions in the wizard so as to select the 'direct' hidden volume creation mode.\n\n4) In the wizard, select the volume you created in step 2 and then follow the instructions to create a hidden volume within it.</entry>
<entry lang="en" key="HIDDEN_OS_WRITE_PROTECTION_BRIEF_INFO">For security reasons, when a hidden operating system is running, local unencrypted filesystems and non-hidden VeraCrypt volumes are mounted as read-only (no data can be written to such filesystems or VeraCrypt volumes).\n\nData is allowed to be written to any filesystem that resides within a hidden VeraCrypt volume (provided that the hidden volume is not located in a container stored on an unencrypted filesystem or on any other read-only filesystem).</entry>
<entry lang="en" key="HIDDEN_OS_WRITE_PROTECTION_EXPLANATION">There are three main reasons why such countermeasures have been implemented:\n\n- It enables the creation of a secure platform for mounting of hidden VeraCrypt volumes. Note that we officially recommend that hidden volumes are mounted only when a hidden operating system is running. (For more information, see the subsection 'Security Requirements and Precautions Pertaining to Hidden Volumes' in the documentation.)\n\n- In some cases, it is possible to determine that, at a certain time, a particular filesystem was not mounted under (or that a particular file on the filesystem was not saved or accessed from within) a particular instance of an operating system (e.g. by analyzing and comparing filesystem journals, file timestamps, application logs, error logs, etc). This might indicate that a hidden operating system is installed on the computer. The countermeasures prevent these issues.\n\n- It prevents data corruption and allows safe hibernation. When Windows resumes from hibernation, it assumes that all mounted filesystems are in the same state as when the system entered hibernation. VeraCrypt ensures this by write-protecting any filesystem accessible both from within the decoy and hidden systems. Without such protection, the filesystem could become corrupted when mounted by one system while the other system is hibernated.</entry>
<entry lang="en" key="DECOY_TO_HIDDEN_OS_DATA_TRANSFER_HOWTO">Note: If you need to securely transfer files from the decoy system to the hidden system, follow these steps:\n1) Start the decoy system.\n2) Save the files to an unencrypted volume or to an outer/normal VeraCrypt volume.\n3) Start the hidden system.\n4) If you saved the files to a VeraCrypt volume, mount it (it will be automatically mounted as read-only).\n5) Copy the files to the hidden system partition or to another hidden volume.</entry>
<entry lang="en" key="CONFIRM_RESTART">Your computer must be restarted.\n\nDo you want to restart it now?</entry>
<entry lang="en" key="ERR_GETTING_SYSTEM_ENCRYPTION_STATUS">An error occurred when obtaining the system encryption status.</entry>
<entry lang="en" key="ERR_PASSWORD_MISSING">No password specified in the command line. The volume can't be created.</entry>
<entry lang="en" key="ERR_SIZE_MISSING">No volume size specified in the command line. The volume can't be created.</entry>
<entry lang="en" key="ERR_NTFS_INVALID_VOLUME_SIZE">The volume file size specified in the command line is incompatible with selected NTFS filesystem.</entry>
<entry lang="en" key="ERR_FAT_INVALID_VOLUME_SIZE">The volume file size specified in the command line is incompatible with selected FAT32 filesystem.</entry>
<entry lang="en" key="ERR_DYNAMIC_NOT_SUPPORTED">The filesystem on the target drive doesn't support creating sparse files which is required for dynamic volumes.</entry>
<entry lang="en" key="ERR_DEVICE_CLI_CREATE_NOT_SUPPORTED">Only container files can be created through the command line.</entry>
<entry lang="en" key="ERR_CONTAINER_SIZE_TOO_BIG">The container file size specified in the command line is greater than the available disk free space. Volume can't be created.</entry>
<entry lang="en" key="ERR_VOLUME_SIZE_TOO_SMALL">The volume size specified in the command line is too small. The volume can't be created.</entry>
<entry lang="en" key="ERR_VOLUME_SIZE_TOO_BIG">The volume size specified in the command line is too big. The volume can't be created.</entry>
<entry lang="en" key="INIT_SYS_ENC">Cannot initialize application components for system encryption.</entry>
<entry lang="en" key="INIT_RAND">Failed to initialize the random number generator!\n\n\n(If you report a bug in connection with this, please include the following technical information in the bug report:\n%hs, Last Error = 0x%.8X)</entry>
<entry lang="en" key="CAPI_RAND">Windows Crypto API failed!\n\n\n(If you report a bug in connection with this, please include the following technical information in the bug report:\n%hs, Last Error = 0x%.8X)</entry>
<entry lang="en" key="INIT_REGISTER">Unable to initialize the application. Failed to register the Dialog class.</entry>
<entry lang="en" key="INIT_RICHEDIT">Error: Failed to load the Rich Edit system library.</entry>
<entry lang="en" key="INTRO_TITLE">VeraCrypt Volume Creation Wizard</entry>
<entry lang="en" key="MAX_HIDVOL_SIZE_BYTES">Maximum possible hidden volume size for this volume is %.2f bytes.</entry>
<entry lang="en" key="MAX_HIDVOL_SIZE_KB">Maximum possible hidden volume size for this volume is %.2f KiB.</entry>
<entry lang="en" key="MAX_HIDVOL_SIZE_MB">Maximum possible hidden volume size for this volume is %.2f MiB.</entry>
<entry lang="en" key="MAX_HIDVOL_SIZE_GB">Maximum possible hidden volume size for this volume is %.2f GiB.</entry>
<entry lang="en" key="MAX_HIDVOL_SIZE_TB">Maximum possible hidden volume size for this volume is %.2f TiB.</entry>
<entry lang="en" key="MOUNTED_NOPWCHANGE">Volume password/keyfiles cannot be changed while the volume is mounted. Please dismount the volume first.</entry>
<entry lang="en" key="MOUNTED_NO_PKCS5_PRF_CHANGE">The header key derivation algorithm cannot be changed while the volume is mounted. Please dismount the volume first.</entry>
<entry lang="en" key="MOUNT_BUTTON">&amp;Mount</entry>
<entry lang="en" key="NEW_VERSION_REQUIRED">A newer version of VeraCrypt is required to mount this volume.</entry>
<entry lang="en" key="VOL_CREATION_WIZARD_NOT_FOUND">Error: Volume Creation Wizard not found.\n\nPlease make sure that the file 'VeraCrypt Format.exe' is in the folder from which 'VeraCrypt.exe' was launched. If it is not, please reinstall VeraCrypt, or locate 'VeraCrypt Format.exe' on your disk and run it.</entry>
<entry lang="en" key="VOL_EXPANDER_NOT_FOUND">Error: Volume Expander not found.\n\nPlease make sure that the file 'VeraCryptExpander.exe' is in the folder from which 'VeraCrypt.exe' was launched. If it is not, please reinstall VeraCrypt, or locate 'VeraCryptExpander.exe' on your disk and run it.</entry>
<entry lang="en" key="NEXT">&amp;Next &gt;</entry>
<entry lang="en" key="FINALIZE">&amp;Finish</entry>
<entry lang="en" key="INSTALL">&amp;Install</entry>
<entry lang="en" key="EXTRACT">E&amp;xtract</entry>
<entry lang="en" key="NODRIVER">Unable to connect to the VeraCrypt device driver. VeraCrypt cannot work if the device driver is not running.\n\nPlease note that, due to a Windows issue, it may be necessary to log off or restart the system before the device driver can be loaded.</entry>
<entry lang="en" key="NOFONT">Error occurred when loading/preparing fonts.</entry>
<entry lang="en" key="NOT_FOUND">The drive letter was not found or no drive letter was specified.</entry>
<entry lang="en" key="ERR_CANNOT_ASSIGN_DRIVE_LETTER_NONSYS_DEC">Error: Cannot assign drive letter.\n\nUntil a drive letter is assigned to the decrypted volume, you will not be able to access data stored on the volume.\n\nRetry?</entry>
<entry lang="en" key="DRIVE_LETTER_UNAVAILABLE">Drive letter not available.</entry>
<entry lang="en" key="NO_FILE_SELECTED">No file selected!</entry>
<entry lang="en" key="NO_FREE_DRIVES">No drive letters available.</entry>
<entry lang="en" key="NO_FREE_DRIVE_FOR_OUTER_VOL">No free drive letter for the outer volume! Volume creation cannot continue.</entry>
<entry lang="en" key="NO_OS_VER">Could not determine your operating system version or you are using an unsupported operating system.</entry>
<entry lang="en" key="NO_PATH_SELECTED">No path selected!</entry>
<entry lang="en" key="NO_SPACE_FOR_HIDDEN_VOL">Not enough free space for the hidden volume! Volume creation cannot continue.</entry>
<entry lang="en" key="HIDDEN_VOLUME_TOO_SMALL_FOR_OS_CLONE">Error: The files you copied to the outer volume occupy too much space. Therefore, there is not enough free space on the outer volume for the hidden volume.\n\nNote that the hidden volume must be as large as the system partition (the partition where the currently running operating system is installed). The reason is that the hidden operating system needs to be created by copying the content of the system partition to the hidden volume.\n\n\nThe process of creation of the hidden operating system cannot continue.</entry>
<entry lang="en" key="OPENFILES_DRIVER">The driver is unable to dismount the volume. Some files located on the volume are probably still open.</entry>
<entry lang="en" key="OPENFILES_LOCK">Unable to lock the volume. There are still open files on the volume. Therefore, it cannot be dismounted.</entry>
<entry lang="en" key="VOL_LOCK_FAILED_OFFER_FORCED_DISMOUNT">VeraCrypt cannot lock the volume because it is in use by the system or applications (there may be open files on the volume).\n\nDo you want to force dismount on the volume?</entry>
<entry lang="en" key="OPEN_VOL_TITLE">Select a VeraCrypt Volume</entry>
<entry lang="en" key="OPEN_TITLE">Specify Path and File Name</entry>
<entry lang="en" key="SELECT_PKCS11_MODULE">Select PKCS #11 Library</entry>
<entry lang="en" key="OUTOFMEMORY">Out of Memory</entry>
<entry lang="en" key="FORMAT_DEVICE_FOR_ADVANCED_ONLY">IMPORTANT: We strongly recommend that inexperienced users create a VeraCrypt file container on the selected device/partition, instead of attempting to encrypt the entire device/partition.\n\nWhen you create a VeraCrypt file container (as opposed to encrypting a device or partition) there is, for example, no risk of destroying a large number of files. Note that a VeraCrypt file container (even though it contains a virtual encrypted disk) is actually just like any normal file. For more information, see the chapter Beginner's Tutorial in the VeraCrypt User Guide.\n\nAre you sure you want to encrypt the entire device/partition?</entry>
<entry lang="en" key="OVERWRITEPROMPT">WARNING: The file '%s' already exists!\n\nIMPORTANT: VERACRYPT WILL NOT ENCRYPT THE FILE, BUT IT WILL DELETE IT. Are you sure you want to delete the file and replace it with a new VeraCrypt container?</entry>
<entry lang="en" key="OVERWRITEPROMPT_DEVICE">CAUTION: ALL FILES CURRENTLY STORED ON THE SELECTED %s '%s'%s WILL BE ERASED AND LOST (THEY WILL NOT BE ENCRYPTED)!\n\nAre you sure you want to proceed with format?</entry>
<entry lang="en" key="NONSYS_INPLACE_ENC_CONFIRM">WARNING: You will not be able to mount the volume or access any files stored on it until it has been fully encrypted.\n\nAre you sure you want to start encrypting the selected %s '%s'%s?</entry>
<entry lang="en" key="NONSYS_INPLACE_DEC_CONFIRM">WARNING: You will not be able to mount the volume or access any files stored on it until it has been fully decrypted.\n\nAre you sure you want to start decrypting the selected %s '%s'%s?</entry>
<entry lang="en" key="NONSYS_INPLACE_ENC_CONFIRM_BACKUP">WARNING: Please note that if power supply is suddenly interrupted while encrypting/decrypting existing data in place, or when the operating system crashes due to a software error or hardware malfunction while VeraCrypt is encrypting/decrypting existing data in place, portions of the data will be corrupted or lost. Therefore, before you start encrypting/decrypting, please make sure that you have backup copies of the files you want to encrypt/decrypt.\n\nDo you have such a backup?</entry>
<entry lang="en" key="OVERWRITEPROMPT_DEVICE_HIDDEN_OS_PARTITION">CAUTION: ANY FILES CURRENTLY STORED ON THE PARTITION '%s'%s (I.E. ON THE FIRST PARTITION BEHIND THE SYSTEM PARTITION) WILL BE ERASED AND LOST (THEY WILL NOT BE ENCRYPTED)!\n\nAre you sure you want to proceed with format?</entry>
<entry lang="en" key="OVERWRITEPROMPT_DEVICE_SECOND_WARNING_LOTS_OF_DATA">WARNING: THE SELECTED PARTITION CONTAINS A LARGE AMOUNT OF DATA! Any files stored on the partition will be erased and lost (they will NOT be encrypted)!</entry>
<entry lang="en" key="ERASE_FILES_BY_CREATING_VOLUME">Erase any files stored on the partition by creating a VeraCrypt volume within it</entry>
<entry lang="en" key="PASSWORD">Password</entry>
<entry lang="en" key="PIM">PIM</entry>
<entry lang="en" key="IDD_PCDM_CHANGE_PKCS5_PRF">Set Header Key Derivation Algorithm</entry>
<entry lang="en" key="IDD_PCDM_ADD_REMOVE_VOL_KEYFILES">Add/Remove Keyfiles to/from Volume</entry>
<entry lang="en" key="IDD_PCDM_REMOVE_ALL_KEYFILES_FROM_VOL">Remove All Keyfiles from Volume</entry>
<entry lang="en" key="PASSWORD_CHANGED">Password, PIM and/or keyfile(s) successfully changed.\n\nIMPORTANT: Please make sure you have read the section 'Changing Passwords and Keyfiles' in the chapter 'Security Requirements and Precautions' in the VeraCrypt User Guide.</entry>
<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="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>
<entry lang="en" key="NONSYS_INPLACE_ENC_RESUME_PASSWORD_PAGE_HELP">Please enter the password and/or keyfile(s) for the non-system volume where you want to resume the process of in-place encryption/decryption.\n\nRemark: After you click Next, VeraCrypt will attempt to find all non-system volumes where the process of encryption/decryption has been interrupted and where the VeraCrypt volume header can be deciphered using the supplied password and/or keyfile(s). If more than one such volume is found, you will need to select one of them in the next step.</entry>
<entry lang="en" key="NONSYS_INPLACE_ENC_RESUME_VOL_SELECT_HELP">Please select one of the listed volumes. The list contains each accessible non-system volume where the process of encryption/decryption has been interrupted and where the volume header was successfully deciphered using the supplied password and/or keyfile(s).</entry>
<entry lang="en" key="NONSYS_INPLACE_DEC_PASSWORD_PAGE_HELP">Please enter the password and/or keyfile(s) for the non-system VeraCrypt volume that you want to decrypt.</entry>
<entry lang="en" key="PASSWORD_HELP">It is very important that you choose a good password. You should avoid choosing one that contains only a single word that can be found in a dictionary (or a combination of 2, 3, or 4 such words). It should not contain any names or dates of birth. It should not be easy to guess. A good password is a random combination of upper and lower case letters, numbers, and special characters, such as @ ^ = $ * + etc. We recommend choosing a password consisting of 20 or more characters (the longer, the better). The maximum possible length is 128 characters.</entry>
<entry lang="en" key="PASSWORD_HIDDENVOL_HELP">Please choose a password for the hidden volume. </entry>
<entry lang="en" key="PASSWORD_HIDDEN_OS_HELP">Please choose a password for the hidden operating system (i.e. for the hidden volume). </entry>
<entry lang="en" key="PASSWORD_HIDDEN_OS_NOTE">IMPORTANT: The password that you choose for the hidden operating system in this step must be substantially different from the other two passwords (i.e. from the password for the outer volume and from the password for the decoy operating system).</entry>
<entry lang="en" key="PASSWORD_HIDDENVOL_HOST_DIRECT_HELP">Please enter the password for the volume within which you wish to create a hidden volume.\n\nAfter you click Next, VeraCrypt will attempt to mount the volume. As soon as the volume is mounted, its cluster bitmap will be scanned to determine the size of the uninterrupted area of free space (if there is any) whose end is aligned with the end of the volume. This area will accommodate the hidden volume and therefore will limit its maximum possible size. Cluster map scanning is necessary to ensure that no data on the outer volume will be overwritten by the hidden volume.</entry>
<entry lang="en" key="PASSWORD_HIDDENVOL_HOST_HELP">\nPlease choose a password for the outer volume. This will be the password that you will be able to reveal to an adversary if you are asked or forced to do so.\n\nIMPORTANT: The password must be substantially different from the one you will choose for the hidden volume.\n\nNote: The maximum possible password length is 128 characters.</entry>
<entry lang="en" key="PASSWORD_SYSENC_OUTERVOL_HELP">Please choose a password for the outer volume. This will be the password you will be able to reveal to anyone forcing you to disclose the password for the first partition behind the system partition, where both the outer volume and the hidden volume (containing the hidden operating system) will reside. The existence of the hidden volume (and of the hidden operating system) will remain secret. Note that this password is not for the decoy operating system.\n\nIMPORTANT: The password must be substantially different from the one you will choose for the hidden volume (i.e. for the hidden operating system).</entry>
<entry lang="en" key="PASSWORD_HIDVOL_HOST_TITLE">Outer Volume Password</entry>
<entry lang="en" key="PASSWORD_HIDVOL_TITLE">Hidden Volume Password</entry>
<entry lang="en" key="PASSWORD_HIDDEN_OS_TITLE">Password for Hidden Operating System</entry>
<entry lang="en" key="PASSWORD_LENGTH_WARNING">WARNING: Short passwords are easy to crack using brute force techniques!\n\nWe recommend choosing a password consisting of 20 or more characters. Are you sure you want to use a short password?</entry>
<entry lang="en" key="PASSWORD_TITLE">Volume Password</entry>
<entry lang="en" key="PASSWORD_WRONG">Operation failed due to one or more of the following:\n - Incorrect password.\n - Incorrect Volume PIM number.\n - Incorrect PRF (hash).\n - Not a valid volume.</entry>
<entry lang="en" key="PASSWORD_OR_KEYFILE_WRONG">Operation failed due to one or more of the following:\n - Incorrect keyfile(s).\n - Incorrect password.\n - Incorrect Volume PIM number.\n - Incorrect PRF (hash).\n - Not a valid volume.</entry>
<entry lang="en" key="PASSWORD_OR_MODE_WRONG">Operation failed due to one or more of the following:\n - Wrong mount mode.\n - Incorrect password.\n - Incorrect Volume PIM number.\n - Incorrect PRF (hash).\n - Not a valid volume.</entry>
<entry lang="en" key="PASSWORD_OR_KEYFILE_OR_MODE_WRONG">Operation failed due to one or more of the following:\n - Wrong mount mode.\n - Incorrect keyfile(s).\n - Incorrect password.\n - Incorrect Volume PIM number.\n - Incorrect PRF (hash).\n - Not a valid volume.</entry>
<entry lang="en" key="PASSWORD_WRONG_AUTOMOUNT">Auto-mount failed due to one or more of the following:\n - Incorrect password.\n - Incorrect Volume PIM number.\n - Incorrect PRF (hash).\n - No valid volume found.</entry>
<entry lang="en" key="PASSWORD_OR_KEYFILE_WRONG_AUTOMOUNT">Auto-mount failed due to one or more of the following:\n - Incorrect keyfile(s).\n - Incorrect password.\n - Incorrect Volume PIM number.\n - Incorrect PRF (hash).\n - No valid volume found.</entry>
<entry lang="en" key="PASSWORD_WRONG_CAPSLOCK_ON">\n\nWarning: Caps Lock is on. This may cause you to enter your password incorrectly.</entry>
<entry lang="en" key="PIM_CHANGE_WARNING">Remember Number to Mount Volume</entry>
<entry lang="en" key="PIM_HIDVOL_HOST_TITLE">Outer Volume PIM</entry>
<entry lang="en" key="PIM_HIDVOL_TITLE">Hidden Volume PIM</entry>
<entry lang="en" key="PIM_HIDDEN_OS_TITLE">PIM for Hidden Operating System</entry>
<entry lang="en" key="PIM_HELP">PIM (Personal Iterations Multiplier) is a value that controls the number of iterations used by the header key derivation as follows:\n Iterations = 15000 + (PIM x 1000).\n\nWhen left empty or set to 0, VeraCrypt will use a default value (485) that ensures a high security.\n\nWhen the password is less than 20 characters, PIM can't be smaller than 485 in order to maintain a minimal security level.\nWhen the password is 20 characters or more, PIM can be set to any value.\n\nA PIM value larger than 485 will lead to slower mount. A small PIM value (less than 485) will lead to a quicker mount but it can reduce security if the password is not strong enough.</entry>
<entry lang="en" key="PIM_SYSENC_HELP">PIM (Personal Iterations Multiplier) is a value that controls the number of iterations used by the header key derivation as follows:\n Iterations = PIM x 2048.\n\nWhen left empty or set to 0, VeraCrypt will use a default value that ensures a high security.\n\nWhen the password is less than 20 characters, PIM can't be smaller than 98 in order to maintain a minimal security level.\nWhen the password is 20 characters or more, PIM can be set to any value.\n\nA PIM value larger than 98 will lead to slower boot. A small PIM value (less than 98) will lead to a quicker boot but it can reduce security if the password is not strong enough.</entry>
<entry lang="en" key="PIM_SYSENC_CHANGE_WARNING">Remember Number to Boot System</entry>
<entry lang="en" key="PIM_LARGE_WARNING">You have chosen a PIM value that is larger than VeraCrypt default value.\nPlease note that this will lead to much slower mount/boot.</entry>
<entry lang="en" key="PIM_SMALL_WARNING">You have chosen a Personal Iterations Multiplier (PIM) that is smaller than the default VeraCrypt value. Please note that if your password is not strong enough, this could lead to a weaker security.\n\nDo you confirm that you are using a strong password?</entry>
<entry lang="en" key="PIM_SYSENC_TOO_BIG">Personal Iterations Multiplier (PIM) maximum value for system encryption is 65535.</entry>
<entry lang="en" key="PIM_TITLE">Volume PIM</entry>
<entry lang="en" key="HIDDEN_FILES_PRESENT_IN_KEYFILE_PATH">\n\nWARNING: Hidden file(s) have been found in a keyfile search path. Such hidden files cannot be used as keyfiles. If you need to use them as keyfiles, remove their 'Hidden' attribute (right-click each of them, select 'Properties', uncheck 'Hidden' and click OK). Note: Hidden files are visible only if the corresponding option is enabled (Computer > Organize > 'Folder and search options' > View).</entry>
<entry lang="en" key="HIDDEN_VOL_PROT_PASSWORD_US_KEYB_LAYOUT">If you are attempting to protect a hidden volume containing a hidden system, please make sure you are using the standard US keyboard layout when typing the password for the hidden volume. This is required due to the fact that the password needs to be typed in the pre-boot environment (before Windows starts) where non-US Windows keyboard layouts are not available.</entry>
<entry lang="en" key="FOUND_NO_PARTITION_W_DEFERRED_INPLACE_ENC">VeraCrypt has not found any volume where the process of encryption/decryption of a non-system volume has been interrupted and where the volume header can be deciphered using the supplied password and/or keyfile(s).\n\nPlease make sure the password and/or keyfile(s) are correct and that the partition/volume is not being used by the system or applications (including antivirus software).</entry>
<entry lang="en" key="SELECTED_PARTITION_ALREADY_INPLACE_ENC">The selected partition/device is already fully encrypted.\nHeader Flags = 0x%.8X</entry>
<entry lang="en" key="SELECTED_PARTITION_NOT_INPLACE_ENC">The selected partition/device is not using in-place encryption.\nHeader Flags = 0x%.8X</entry>
<entry lang="en" key="SYSENC_MOUNT_WITHOUT_PBA_NOTE">\n\nNote: If you are attempting to mount a partition located on an encrypted system drive without pre-boot authentication or to mount the encrypted system partition of an operating system that is not running, you can do so by selecting 'System' > 'Mount Without Pre-Boot Authentication'.</entry>
<entry lang="en" key="MOUNT_WITHOUT_PBA_VOL_ON_ACTIVE_SYSENC_DRIVE">In this mode, you cannot mount a partition located on a drive whose portion is within the key scope of active system encryption.\n\nBefore you can mount this partition in this mode, you need to either boot an operating system installed on a different drive (encrypted or unencrypted) or boot an unencrypted operating system.</entry>
<entry lang="en" key="CANT_DECRYPT_PARTITION_ON_ENTIRELY_ENCRYPTED_SYS_DRIVE">VeraCrypt cannot decrypt an individual partition on an entirely encrypted system drive (you can decrypt only the entire system drive).</entry>
<entry lang="en" key="CANT_DECRYPT_PARTITION_ON_ENTIRELY_ENCRYPTED_SYS_DRIVE_UNSURE">Warning: As the drive contains the VeraCrypt Boot Loader, it may be an entirely encrypted system drive. If it is, please note that VeraCrypt cannot decrypt an individual partition on an entirely encrypted system drive (you can decrypt only the entire system drive). If that is the case, you will be able to continue now but you will receive the 'Incorrect password' error message later.</entry>
<entry lang="en" key="PREV">&lt; &amp;Back</entry>
<entry lang="en" key="RAWDEVICES">Unable to list raw devices installed on your system!</entry>
<entry lang="en" key="READONLYPROMPT">The volume '%s' exists, and is read-only. Are you sure you want to replace it?</entry>
<entry lang="en" key="SELECT_DEST_DIR">Select destination directory</entry>
<entry lang="en" key="SELECT_KEYFILE">Select Keyfile</entry>
<entry lang="en" key="SELECT_KEYFILE_PATH">Select a keyfile search path. WARNING: Note that only the path will be remembered, not the filenames!</entry>
<entry lang="en" key="SELECT_KEYFILE_GENERATION_DIRECTORY">Select a directory where to store the keyfiles.</entry>
<entry lang="en" key="SELECTED_KEYFILE_IS_CONTAINER_FILE">The current container file was selected as a keyfile. It will be skipped.</entry>
<entry lang="en" key="SERPENT_HELP">Designed by Ross Anderson, Eli Biham, and Lars Knudsen. Published in 1998. 256-bit key, 128-bit block. Mode of operation is XTS. Serpent was one of the AES finalists.</entry>
<entry lang="en" key="SIZE_HELP">Please specify the size of the container you want to create.\n\nIf you create a dynamic (sparse-file) container, this parameter will specify its maximum possible size.\n\nNote that the minimum possible size of a FAT volume is 292 KiB. The minimum possible size of an exFAT volume is 424 KiB. The minimum possible size of an NTFS volume is 3792 KiB. The minimum possible size of an ReFS volume is 642 MiB.</entry>
<entry lang="en" key="SIZE_HELP_HIDDEN_HOST_VOL">Please specify the size of the outer volume to be created (you will first create the outer volume and then a hidden volume within it). The minimum possible size of a volume within which a hidden volume is intended to be created is 340 KiB.</entry>
<entry lang="en" key="SIZE_HELP_HIDDEN_VOL">Please specify the size of the hidden volume to create. The minimum possible size of a hidden volume is 40 KiB (or 3664 KiB if it is formatted as NTFS). The maximum possible size you can specify for the hidden volume is displayed above.</entry>
<entry lang="en" key="SIZE_HIDVOL_HOST_TITLE">Outer Volume Size</entry>
<entry lang="en" key="SIZE_HIDVOL_TITLE">Hidden Volume Size</entry>
<entry lang="en" key="SIZE_PARTITION_HELP">Please verify that the size of the selected device/partition shown above is correct and click Next.</entry>
<entry lang="en" key="SIZE_PARTITION_HIDDEN_SYSENC_HELP">The outer volume and the hidden volume (containing the hidden operating system) will reside within the above partition. It should be the first partition behind the system partition.\n\nPlease verify that the size of the partition and its number shown above are correct, and if they are, click Next.</entry>
<entry lang="en" key="SIZE_PARTITION_HIDDEN_VOL_HELP">\n\nNote that the minimum possible size of a volume within which a hidden volume is intended to be created is 340 KiB.</entry>
<entry lang="en" key="SIZE_TITLE">Volume Size</entry>
<entry lang="en" key="SPARSE_FILE">Dynamic</entry>
<entry lang="en" key="TESTS_FAILED">CAUTION: SELF-TEST FAILED!</entry>
<entry lang="en" key="TESTS_PASSED">Self-tests of all algorithms passed</entry>
<entry lang="en" key="TEST_INCORRECT_TEST_DATA_UNIT_SIZE">The data unit number that you supplied is too long or short.</entry>
<entry lang="en" key="TEST_INCORRECT_SECONDARY_KEY_SIZE">The secondary key that you supplied is too long or short.</entry>
<entry lang="en" key="TEST_CIPHERTEXT_SIZE">The test ciphertext you have supplied is too long or short.</entry>
<entry lang="en" key="TEST_KEY_SIZE">The test key you have supplied is too long or short.</entry>
<entry lang="en" key="TEST_PLAINTEXT_SIZE">The test plaintext you have supplied is too long or short.</entry>
<entry lang="en" key="TWO_LAYER_CASCADE_HELP">Two ciphers in a cascade operating in XTS mode. Each block is first encrypted with %s (%d-bit key) and then with %s (%d-bit key). Each cipher uses its own key. All keys are mutually independent.</entry>
<entry lang="en" key="THREE_LAYER_CASCADE_HELP">Three ciphers in a cascade operating in XTS mode. Each block is first encrypted with %s (%d-bit key), then with %s (%d-bit key), and finally with %s (%d-bit key). Each cipher uses its own key. All keys are mutually independent.</entry>
<entry lang="en" key="AUTORUN_MAY_NOT_ALWAYS_WORK">Note that, depending on the operating system configuration, these auto-run and auto-mount features may work only when the traveler disk files are created on a non-writable CD/DVD-like medium. Also note that this is not a bug in VeraCrypt (it is a limitation of Windows).</entry>
<entry lang="en" key="TRAVELER_DISK_CREATED">VeraCrypt traveler disk has been successfully created.\n\nNote that you need administrator privileges to run VeraCrypt in portable mode. Also note that, after examining the registry file, it may be possible to tell that VeraCrypt was run on a Windows system even if it is run in portable mode.</entry>
<entry lang="en" key="TC_TRAVELER_DISK">VeraCrypt Traveler Disk</entry>
<entry lang="en" key="TWOFISH_HELP">Designed by Bruce Schneier, John Kelsey, Doug Whiting, David Wagner, Chris Hall, and Niels Ferguson. Published in 1998. 256-bit key, 128-bit block. Mode of operation is XTS. Twofish was one of the AES finalists.</entry>
<entry lang="en" key="MORE_INFO_ABOUT">More information on %s</entry>
<entry lang="en" key="UNKNOWN">Unknown</entry>
<entry lang="en" key="ERR_UNKNOWN">An unspecified or unknown error occurred (%d).</entry>
<entry lang="en" key="UNMOUNTALL_LOCK_FAILED">Some volumes contain files or folders being used by applications or system.\n\nForce dismount?</entry>
<entry lang="en" key="UNMOUNT_BUTTON">&amp;Dismount</entry>
<entry lang="en" key="UNMOUNT_FAILED">Dismount failed!</entry>
<entry lang="en" key="UNMOUNT_LOCK_FAILED">Volume contains files or folders being used by applications or system.\n\nForce dismount?</entry>
<entry lang="en" key="NO_VOLUME_MOUNTED_TO_DRIVE">No volume is mounted to the specified drive letter.</entry>
<entry lang="en" key="VOL_ALREADY_MOUNTED">The volume you are trying to mount is already mounted. </entry>
<entry lang="en" key="VOL_MOUNT_FAILED">An error occurred when attempting to mount volume.</entry>
<entry lang="en" key="VOL_SEEKING">Error seeking location within volume.</entry>
<entry lang="en" key="VOL_SIZE_WRONG">Error: Incorrect volume size.</entry>
<entry lang="en" key="WARN_QUICK_FORMAT">WARNING: You should use Quick Format 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 Quick Format?</entry>
<entry lang="en" key="CONFIRM_SPARSE_FILE">Dynamic container is a pre-allocated NTFS sparse file whose physical size (actual disk space used) grows as new data is added to it.\n\nWARNING: Performance of sparse-file-hosted volumes is significantly worse than performance of regular volumes. Sparse-file-hosted volumes are also less secure, because it is possible to tell which volume sectors are unused. Furthermore, sparse-file-hosted volumes cannot provide plausible deniability (host a hidden volume). Also note that if data is written to a sparse file container when there is not enough free space in the host file system, the encrypted file system may get corrupted.\n\nAre you sure you want to create a sparse-file-hosted volume?</entry>
<entry lang="en" key="SPARSE_FILE_SIZE_NOTE">Note that the size of the dynamic container reported by Windows and by VeraCrypt will always be equal to its maximum size. To find out current physical size of the container (actual disk space it uses), right-click the container file (in a Windows Explorer window, not in VeraCrypt), then select 'Properties' and see the 'Size on disk' value.\n\nAlso note that if you move a dynamic container to another volume or drive, the physical size of the container will be extended to the maximum. (You can prevent that by creating a new dynamic container in the destination location, mounting it and then moving the files from the old container to the new one.)</entry>
<entry lang="en" key="PASSWORD_CACHE_WIPED_SHORT">Password cache wiped</entry>
<entry lang="en" key="PASSWORD_CACHE_WIPED">Passwords (and/or processed keyfile contents) stored in the VeraCrypt driver cache have been wiped.</entry>
<entry lang="en" key="WRONG_VOL_TYPE">VeraCrypt cannot change the password for a foreign volume.</entry>
<entry lang="en" key="SELECT_FREE_DRIVE">Please select a free drive letter from the list.</entry>
<entry lang="en" key="SELECT_A_MOUNTED_VOLUME">Please select a mounted volume in the drive letter list.</entry>
<entry lang="en" key="AMBIGUOUS_VOL_SELECTION">Warning: Two different volumes/devices are currently selected (the first is selected in the drive letter list and the second is selected in the input field below the drive letter list).\n\nPlease confirm your choice:</entry>
<entry lang="en" key="CANT_CREATE_AUTORUN">Error: Cannot create autorun.inf</entry>
<entry lang="en" key="ERR_PROCESS_KEYFILE">Error while processing keyfile!</entry>
<entry lang="en" key="ERR_PROCESS_KEYFILE_PATH">Error processing keyfile path!</entry>
<entry lang="en" key="ERR_KEYFILE_PATH_EMPTY">The keyfile path contains no files.\n\nPlease note that folders (and files they contain) found in keyfile search paths are ignored.</entry>
<entry lang="en" key="UNSUPPORTED_OS">VeraCrypt does not support this operating system.</entry>
<entry lang="en" key="UNSUPPORTED_BETA_OS">Error: VeraCrypt supports only stable versions of this operating system (beta/RC versions are not supported).</entry>
<entry lang="en" key="ERR_MEM_ALLOC">Error: Cannot allocate memory.</entry>
<entry lang="en" key="ERR_PERF_COUNTER">Error: Could not retrieve value of performance counter.</entry>
<entry lang="en" key="ERR_VOL_FORMAT_BAD">Error: Bad volume format.</entry>
<entry lang="en" key="ERR_HIDDEN_NOT_NORMAL_VOLUME">Error: You supplied a password for a hidden volume (not for a normal volume).</entry>
<entry lang="en" key="ERR_HIDDEN_VOL_HOST_ENCRYPTED_INPLACE">For security reasons, a hidden volume cannot be created within a VeraCrypt volume containing a filesystem that has been encrypted in place (because the free space on the volume has not been filled with random data).</entry>
<entry lang="en" key="LEGAL_NOTICES_DLG_TITLE">VeraCrypt - Legal Notices</entry>
<entry lang="en" key="ALL_FILES">All Files</entry>
<entry lang="en" key="TC_VOLUMES">VeraCrypt Volumes</entry>
<entry lang="en" key="DLL_FILES">Library Modules</entry>
<entry lang="en" key="FORMAT_NTFS_STOP">NTFS/exFAT/ReFS formatting cannot continue.</entry>
<entry lang="en" key="CANT_MOUNT_VOLUME">Cannot mount volume.</entry>
<entry lang="en" key="CANT_DISMOUNT_VOLUME">Cannot dismount volume.</entry>
<entry lang="en" key="FORMAT_NTFS_FAILED">Windows failed to format the volume as NTFS/exFAT/ReFS.\n\nPlease select a different type of file system (if possible) and try again. Alternatively, you could leave the volume unformatted (select 'None' as the filesystem), exit this wizard, mount the volume, and then use either a system or a third-party tool to format the mounted volume (the volume will remain encrypted).</entry>
<entry lang="en" key="FORMAT_NTFS_FAILED_ASK_FAT">Windows failed to format the volume as NTFS/exFAT/ReFS.\n\nDo you want to format the volume as FAT instead?</entry>
<entry lang="en" key="DEFAULT">Default</entry>
<entry lang="en" key="PARTITION_LOWER_CASE">partition</entry>
<entry lang="en" key="PARTITION_UPPER_CASE">PARTITION</entry>
<entry lang="en" key="DEVICE">Device</entry>
<entry lang="en" key="DEVICE_LOWER_CASE">device</entry>
<entry lang="en" key="DEVICE_UPPER_CASE">DEVICE</entry>
<entry lang="en" key="VOLUME">Volume</entry>
<entry lang="en" key="VOLUME_LOWER_CASE">volume</entry>
<entry lang="en" key="VOLUME_UPPER_CASE">VOLUME</entry>
<entry lang="en" key="LABEL">Label</entry>
<entry lang="en" key="CLUSTER_TOO_SMALL">The selected cluster size is too small for this volume size. A greater cluster size will be used instead.</entry>
<entry lang="en" key="CANT_GET_VOLSIZE">Error: Cannot get volume size!\n\nMake sure the selected volume is not being used by the system or an application.</entry>
<entry lang="en" key="HIDDEN_VOL_HOST_SPARSE">Hidden volumes must not be created within dynamic (sparse file) containers. To achieve plausible deniability, the hidden volume needs to be created within a non-dynamic container.</entry>
<entry lang="en" key="HIDDEN_VOL_HOST_UNSUPPORTED_FILESYS">The VeraCrypt Volume Creation Wizard can create a hidden volume only within a FAT/exFAT or NTFS volume.</entry>
<entry lang="en" key="HIDDEN_VOL_HOST_UNSUPPORTED_FILESYS_WIN2000">Under Windows 2000, the VeraCrypt Volume Creation Wizard can create a hidden volume only within a FAT volume.</entry>
<entry lang="en" key="HIDDEN_VOL_HOST_NTFS">Note: The FAT/exFAT file system is more suitable for outer volumes than the NTFS file system (for example, the maximum possible size of the hidden volume would very likely have been significantly greater if the outer volume had been formatted as FAT/exFAT).</entry>
<entry lang="en" key="HIDDEN_VOL_HOST_NTFS_ASK">Note that the FAT/exFAT file system is more suitable for outer volumes than the NTFS file system. For example, the maximum possible size of the hidden volume will very likely be significantly greater if the outer volume is formatted as FAT/exFAT (the reason is that the NTFS file system always stores internal data exactly in the middle of the volume and, therefore, the hidden volume can reside only in the second half of the outer volume).\n\nAre you sure you want to format the outer volume as NTFS?</entry>
<entry lang="en" key="OFFER_FAT_FORMAT_ALTERNATIVE">Do you want to format the volume as FAT instead?</entry>
<entry lang="en" key="FAT_NOT_AVAILABLE_FOR_SO_LARGE_VOLUME">Note: This volume cannot be formatted as FAT, because it exceeds the maximum volume size supported by the FAT32 filesystem for the applicable sector size (2 TiB for 512-byte sectors and 16 TiB for 4096-byte sectors).</entry>
<entry lang="en" key="PARTITION_TOO_SMALL_FOR_HIDDEN_OS">Error: The partition for the hidden operating system (i.e. the first partition behind the system partition) must be at least 5% larger than the system partition (the system partition is the one where the currently running operating system is installed).</entry>
<entry lang="en" key="PARTITION_TOO_SMALL_FOR_HIDDEN_OS_NTFS">Error: The partition for the hidden operating system (i.e. the first partition behind the system partition) must be at least 110% (2.1 times) larger than the system partition (the system partition is the one where the currently running operating system is installed). The reason is that the NTFS file system always stores internal data exactly in the middle of the volume and, therefore, the hidden volume (which is to contain a clone of the system partition) can reside only in the second half of the partition.</entry>
<entry lang="en" key="OUTER_VOLUME_TOO_SMALL_FOR_HIDDEN_OS_NTFS">Error: If the outer volume is formatted as NTFS, it must be at least 110% (2.1 times) larger than the system partition. The reason is that the NTFS file system always stores internal data exactly in the middle of the volume and, therefore, the hidden volume (which is to contain a clone of the system partition) can reside only in the second half of the outer volume.\n\nNote: The outer volume needs to reside within the same partition as the hidden operating system (i.e. within the first partition behind the system partition).</entry>
<entry lang="en" key="NO_PARTITION_FOLLOWS_BOOT_PARTITION">Error: There is no partition behind the system partition.\n\nNote that before you can create a hidden operating system, you need to create a partition for it on the system drive. It must be the first partition behind the system partition and it must be at least 5% larger than the system partition (the system partition is the one where the currently running operating system is installed). However, if the outer volume (not to be confused with the system partition) is formatted as NTFS, the partition for the hidden operating system must be at least 110% (2.1 times) larger than the system partition (the reason is that the NTFS file system always stores internal data exactly in the middle of the volume and, therefore, the hidden volume, which is to contain a clone of the system partition, can reside only in the second half of the partition).</entry>
<entry lang="en" key="TWO_SYSTEMS_IN_ONE_PARTITION_REMARK">Remark: It is not practical (and therefore is not supported) to install operating systems in two VeraCrypt volumes that are embedded within a single partition, because using the outer operating system would often require data to be written to the area of the hidden operating system (and if such write operations were prevented using the hidden volume protection feature, it would inherently cause system crashes, i.e. 'Blue Screen' errors).</entry>
<entry lang="en" key="FOR_MORE_INFO_ON_PARTITIONS">For information on how to create and manage partitions, please refer to the documentation supplied with your operating system or contact your computer vendor's technical support team for assistance.</entry>
<entry lang="en" key="SYSTEM_PARTITION_NOT_ACTIVE">Error: The currently running operating system is not installed on the boot partition (first Active partition). This is not supported.</entry>
<entry lang="en" key="CONFIRM_FAT_FOR_FILES_OVER_4GB">You indicated that you intend to store files larger than 4 GiB in this VeraCrypt volume. However, you chose the FAT file system, on which files larger than 4 GiB cannot be stored.\n\nAre you sure you want to format the volume as FAT?</entry>
<entry lang="en" key="NONSYS_INPLACE_DECRYPTION_BAD_VOL_FORMAT">Error: VeraCrypt does not support in-place decryption of legacy non-system volumes created by VeraCrypt 1.0b or earlier.\n\nNote: You can still decrypt files stored on the volume by copying/moving them to any unencrypted volume.</entry>
<entry lang="en" key="NONSYS_INPLACE_DECRYPTION_CANT_DECRYPT_HID_VOL">Error: VeraCrypt cannot in-place decrypt a hidden VeraCrypt volume.\n\nNote: You can still decrypt files stored on the volume by copying/moving them to any unencrypted volume.</entry>
<entry lang="en" key="CONFIRM_VOL_CONTAINS_NO_HIDDEN_VOL">Warning: Note that VeraCrypt cannot in-place decrypt a volume that contains a hidden VeraCrypt volume (the hidden volume would be overwritten with pseudorandom data).\n\nPlease confirm that the volume you are about to decrypt contains no hidden volume.\n\nNote: If the volume contains a hidden volume but you do not mind losing the hidden volume, you can select Proceed (the outer volume will be safely decrypted).</entry>
<entry lang="en" key="VOL_CONTAINS_NO_HIDDEN_VOL">The volume does not contain any hidden volume. Proceed.</entry>
<entry lang="en" key="VOL_CONTAINS_A_HIDDEN_VOL">The volume contains a hidden volume. Cancel.</entry>
<entry lang="en" key="CANT_ACCESS_VOL">Error: Cannot access the volume!\n\nMake sure that the selected volume exists, that it is not mounted or being used by the system or an application, that you have read/write permission for the volume, and that it is not write-protected.</entry>
<entry lang="en" key="CANT_GET_VOL_INFO">Error: Cannot obtain volume properties.</entry>
<entry lang="en" key="INPLACE_ENC_CANT_ACCESS_OR_GET_INFO_ON_VOL">Error: Cannot access the volume and/or obtain information about the volume.\n\nMake sure that the selected volume exists, that it is not being used by the system or applications, that you have read/write permission for the volume, and that it is not write-protected.</entry>
<entry lang="en" key="INPLACE_ENC_CANT_ACCESS_OR_GET_INFO_ON_VOL_ALT">Error: Cannot access the volume and/or obtain information about the volume. Make sure that the selected volume exists, that it is not being used by the system or applications, that you have read/write permission for the volume, and that it is not write-protected.\n\nIf the problem persists, it might help to follow the below steps.</entry>
<entry lang="en" key="INPLACE_ENC_GENERIC_ERR_ALT_STEPS">An error prevented VeraCrypt from encrypting the partition. Please try fixing any previously reported problems and then try again. If the problems persist, it might help to follow the below steps.</entry>
<entry lang="en" key="INPLACE_ENC_GENERIC_ERR_RESUME">An error prevented VeraCrypt from resuming the process of encryption/decryption of the partition/volume.\n\nPlease try fixing any previously reported problems and then try resuming the process again if possible. Note that the volume cannot be mounted until it has been fully encrypted or fully decrypted.</entry>
<entry lang="en" key="INPLACE_DEC_GENERIC_ERR">An error prevented VeraCrypt from decrypting the volume. Please try fixing any previously reported problems and then try again if possible.</entry>
<entry lang="en" key="CANT_DISMOUNT_OUTER_VOL">Error: Cannot dismount the outer volume!\n\nVolume cannot be dismounted if it contains files or folders being used by a program or the system.\n\nPlease close any program that might be using files or directories on the volume and click Retry.</entry>
<entry lang="en" key="CANT_GET_OUTER_VOL_INFO">Error: Cannot obtain information about the outer volume!\nVolume creation cannot continue.</entry>
<entry lang="en" key="CANT_ACCESS_OUTER_VOL">Error: Cannot access the outer volume! Volume creation cannot continue.</entry>
<entry lang="en" key="CANT_MOUNT_OUTER_VOL">Error: Cannot mount the outer volume! Volume creation cannot continue.</entry>
<entry lang="en" key="CANT_GET_CLUSTER_BITMAP">Error: Cannot get volume cluster bitmap! Volume creation cannot continue.</entry>
<entry lang="en" key="ALPHABETICAL_CATEGORIZED">Alphabetical/Categorized</entry>
<entry lang="en" key="MEAN_SPEED">Mean Speed (Descending)</entry>
<entry lang="en" key="ALGORITHM">Algorithm</entry>
<entry lang="en" key="ENCRYPTION">Encryption</entry>
<entry lang="en" key="DECRYPTION">Decryption</entry>
<entry lang="en" key="MEAN">Mean</entry>
<entry lang="en" key="DRIVE">Drive</entry>
<entry lang="en" key="SIZE">Size</entry>
<entry lang="en" key="ENCRYPTION_ALGORITHM">Encryption Algorithm</entry>
<entry lang="en" key="ENCRYPTION_ALGORITHM_LV">Encryption Algorithm</entry>
<entry lang="en" key="TYPE">Type</entry>
<entry lang="en" key="VALUE">Value</entry>
<entry lang="en" key="PROPERTY">Property</entry>
<entry lang="en" key="LOCATION">Location</entry>
<entry lang="en" key="BYTES">bytes</entry>
<entry lang="en" key="HIDDEN">Hidden</entry>
<entry lang="en" key="OUTER">Outer</entry>
<entry lang="en" key="NORMAL">Normal</entry>
<entry lang="en" key="SYSTEM_VOLUME_TYPE_ADJECTIVE">System</entry>
<entry lang="en" key="TYPE_HIDDEN_SYSTEM_ADJECTIVE">Hidden (system)</entry>
<entry lang="en" key="READ_ONLY">Read-Only</entry>
<entry lang="en" key="SYSTEM_DRIVE">System drive</entry>
<entry lang="en" key="SYSTEM_DRIVE_ENCRYPTING">System drive (encrypting - %.2f%% done)</entry>
<entry lang="en" key="SYSTEM_DRIVE_DECRYPTING">System drive (decrypting - %.2f%% done)</entry>
<entry lang="en" key="SYSTEM_DRIVE_PARTIALLY_ENCRYPTED">System drive (%.2f%% encrypted)</entry>
<entry lang="en" key="SYSTEM_PARTITION">System partition</entry>
<entry lang="en" key="HIDDEN_SYSTEM_PARTITION">Hidden system partition</entry>
<entry lang="en" key="SYSTEM_PARTITION_ENCRYPTING">System partition (encrypting - %.2f%% done)</entry>
<entry lang="en" key="SYSTEM_PARTITION_DECRYPTING">System partition (decrypting - %.2f%% done)</entry>
<entry lang="en" key="SYSTEM_PARTITION_PARTIALLY_ENCRYPTED">System partition (%.2f%% encrypted)</entry>
<entry lang="en" key="HID_VOL_DAMAGE_PREVENTED">Yes (damage prevented!)</entry>
<entry lang="en" key="NONE">None</entry>
<entry lang="en" key="KEY_SIZE">Primary Key Size</entry>
<entry lang="en" key="SECONDARY_KEY_SIZE_XTS">Secondary Key Size (XTS Mode)</entry>
<entry lang="en" key="SECONDARY_KEY_SIZE_LRW">Tweak Key Size (LRW Mode)</entry>
<entry lang="en" key="BITS">bits</entry>
<entry lang="en" key="BLOCK_SIZE">Block Size</entry>
<entry lang="en" key="PKCS5_PRF">PKCS-5 PRF</entry>
<entry lang="en" key="PKCS5_ITERATIONS">PKCS-5 Iteration Count</entry>
<entry lang="en" key="VOLUME_CREATE_DATE">Volume Created</entry>
<entry lang="en" key="VOLUME_HEADER_DATE">Header Last Modified</entry>
<entry lang="en" key="VOLUME_HEADER_DAYS"> (%I64d days ago)</entry>
<entry lang="en" key="VOLUME_FORMAT_VERSION">Volume Format Version</entry>
<entry lang="en" key="BACKUP_HEADER">Embedded Backup Header</entry>
<entry lang="en" key="VC_BOOT_LOADER_VERSION">VeraCrypt Boot Loader Version</entry>
<entry lang="en" key="FIRST_AVAILABLE">First available</entry>
<entry lang="en" key="REMOVABLE_DISK">Removable Disk</entry>
<entry lang="en" key="HARDDISK">Harddisk</entry>
<entry lang="en" key="UNCHANGED">Unchanged</entry>
<entry lang="en" key="AUTODETECTION">Autodetection</entry>
<entry lang="en" key="SETUP_MODE_TITLE">Wizard Mode</entry>
<entry lang="en" key="SETUP_MODE_INFO">Select one of the modes. If you are not sure which to select, use the default mode.</entry>
<entry lang="en" key="SETUP_MODE_HELP_INSTALL">Select this option if you want to install VeraCrypt on this system.</entry>
<entry lang="en" key="SETUP_MODE_HELP_UPGRADE">Note: You can upgrade without decrypting even if the system partition/drive is encrypted or you use a hidden operating system.</entry>
<entry lang="en" key="SETUP_MODE_HELP_EXTRACT">If you select this option, all files will be extracted from this package but nothing will be installed on the system. Do not select it if you intend to encrypt the system partition or system drive. Selecting this option can be useful, for example, if you want to run VeraCrypt in so-called portable mode. VeraCrypt does not have to be installed on the operating system under which it is run. After all files are extracted, you can directly run the extracted file 'VeraCrypt.exe' (then VeraCrypt will run in portable mode).</entry>
<entry lang="en" key="SETUP_OPTIONS_TITLE">Setup Options</entry>
<entry lang="en" key="SETUP_OPTIONS_INFO">Here you can set various options to control the installation process.</entry>
<entry lang="en" key="SETUP_PROGRESS_TITLE">Installing</entry>
<entry lang="en" key="SETUP_PROGRESS_INFO">Please wait while VeraCrypt is being installed.</entry>
<entry lang="en" key="SETUP_FINISHED_TITLE_DON">VeraCrypt has been successfully installed</entry>
<entry lang="en" key="SETUP_FINISHED_UPGRADE_TITLE_DON">VeraCrypt has been successfully upgraded</entry>
<entry lang="en" key="SETUP_FINISHED_INFO_DON">Please consider making a donation. You can click Finish anytime to close the installer.</entry>
<entry lang="en" key="EXTRACTION_OPTIONS_TITLE">Extraction Options</entry>
<entry lang="en" key="EXTRACTION_OPTIONS_INFO">Here you can set various options to control the extraction process.</entry>
<entry lang="en" key="EXTRACTION_PROGRESS_INFO">Please wait while files are being extracted.</entry>
<entry lang="en" key="EXTRACTION_FINISHED_TITLE_DON">Files successfully extracted</entry>
<entry lang="en" key="EXTRACTION_FINISHED_INFO">All files have been successfully extracted to the destination location.</entry>
<entry lang="en" key="AUTO_FOLDER_CREATION">If the specified folder does not exist, it will be automatically created.</entry>
<entry lang="en" key="SETUP_UPGRADE_DESTINATION">The VeraCrypt program files will be upgraded in the location where VeraCrypt is installed. If you need to select a different location, please uninstall VeraCrypt first.</entry>
<entry lang="en" key="AFTER_UPGRADE_RELEASE_NOTES">Do you want to view release notes for the current (latest stable) version of VeraCrypt?</entry>
<entry lang="en" key="AFTER_INSTALL_TUTORIAL">If you have never used VeraCrypt before, we recommend that you read the chapter Beginner's Tutorial in the VeraCrypt User Guide. Do you want to view the tutorial?</entry>
<entry lang="en" key="SELECT_AN_ACTION">Please select an action to perform from the following:</entry>
<entry lang="en" key="REPAIR_REINSTALL">Repair/Reinstall</entry>
<entry lang="en" key="UPGRADE">Upgrade</entry>
<entry lang="en" key="UNINSTALL">Uninstall</entry>
<entry lang="en" key="SETUP_ADMIN">To successfully install/uninstall VeraCrypt, you must have administrator privileges. Do you want to continue?</entry>
<entry lang="en" key="TC_INSTALLER_IS_RUNNING">VeraCrypt Installer is currently running on this system and performing or preparing installation or update of VeraCrypt. Before you proceed, please wait for it to finish or close it. If you cannot close it, please restart your computer before proceeding.</entry>
<entry lang="en" key="INSTALL_FAILED">Installation failed.</entry>
<entry lang="en" key="UNINSTALL_FAILED">Uninstallation failed.</entry>
<entry lang="en" key="DIST_PACKAGE_CORRUPTED">This distribution package is damaged. Please try downloading it again (preferably from the official VeraCrypt website at https://www.veracrypt.fr).</entry>
<entry lang="en" key="CANNOT_WRITE_FILE_X">Cannot write file %s</entry>
<entry lang="en" key="EXTRACTING_VERB">Extracting</entry>
<entry lang="en" key="CANNOT_READ_FROM_PACKAGE">Cannot read data from the package.</entry>
<entry lang="en" key="CANT_VERIFY_PACKAGE_INTEGRITY">Cannot verify the integrity of this distribution package.</entry>
<entry lang="en" key="EXTRACTION_FAILED">Extraction failed.</entry>
<entry lang="en" key="ROLLBACK">The installation has been rolled back.</entry>
<entry lang="en" key="INSTALL_OK">VeraCrypt has been successfully installed.</entry>
<entry lang="en" key="SETUP_UPDATE_OK">VeraCrypt has been successfully updated.</entry>
<entry lang="en" key="UPGRADE_OK_REBOOT_REQUIRED">VeraCrypt has been successfully upgraded. However, before you can start using it, the computer must be restarted.\n\nDo you want to restart it now?</entry>
<entry lang="en" key="SYS_ENC_UPGRADE_FAILED">Failed to upgrade VeraCrypt!\n\nIMPORTANT: Before you shut down or restart the system, we strongly recommend that you use System Restore (Windows Start menu > All programs > Accessories > System Tools > System Restore) to restore your system to the restore point named 'VeraCrypt installation'. If System Restore is not available, you should try installing the original or the new version of VeraCrypt again before you shut down or restart the system.</entry>
<entry lang="en" key="UNINSTALL_OK">VeraCrypt has been successfully uninstalled.\n\nClick 'Finish' to remove the VeraCrypt installer and the folder %s. Note that the folder will not be removed if it contains any files that were not installed by the VeraCrypt installer or created by VeraCrypt.</entry>
<entry lang="en" key="REMOVING_REG">Removing VeraCrypt registry entries</entry>
<entry lang="en" key="ADDING_REG">Adding registry entry</entry>
<entry lang="en" key="REMOVING_APPDATA">Removing application-specific data</entry>
<entry lang="en" key="INSTALLING">Installing</entry>
<entry lang="en" key="STOPPING">Stopping</entry>
<entry lang="en" key="REMOVING">Removing</entry>
<entry lang="en" key="ADDING_ICON">Adding icon</entry>
<entry lang="en" key="CREATING_SYS_RESTORE">Creating System Restore point</entry>
<entry lang="en" key="FAILED_SYS_RESTORE">Failed to create System Restore point!</entry>
<entry lang="en" key="INSTALLER_UPDATING_BOOT_LOADER">Updating boot loader</entry>
<entry lang="en" key="INSTALL_OF_FAILED">Failed to install '%s'. %s\nDo you want to continue installing?</entry>
<entry lang="en" key="UNINSTALL_OF_FAILED">Failed to uninstall '%s'. %s\nDo you want to continue uninstalling?</entry>
<entry lang="en" key="INSTALL_COMPLETED">Installation completed.</entry>
<entry lang="en" key="CANT_CREATE_FOLDER">The folder '%s' could not be created</entry>
<entry lang="en" key="CLOSE_TC_FIRST">The VeraCrypt device driver cannot be unloaded.\n\nPlease close all open VeraCrypt windows first. If it does not help, please restart Windows and then try again.</entry>
<entry lang="en" key="DISMOUNT_ALL_FIRST">All VeraCrypt volumes must be dismounted before installing or uninstalling VeraCrypt.</entry>
<entry lang="en" key="UNINSTALL_OLD_VERSION_FIRST">An obsolete version of VeraCrypt is currently installed on this system. It needs to be uninstalled before you can install this new version of VeraCrypt.\n\nAs soon as you close this message box, the uninstaller of the old version will be launched. Note that no volume will be decrypted when you uninstall VeraCrypt. After you uninstall the old version of VeraCrypt, run the installer of the new version of VeraCrypt again.</entry>
<entry lang="en" key="REG_INSTALL_FAILED">The installation of the registry entries has failed</entry>
<entry lang="en" key="DRIVER_INSTALL_FAILED">The installation of the device driver has failed. Please restart Windows and then try installing VeraCrypt again.</entry>
<entry lang="en" key="STARTING_DRIVER">Starting VeraCrypt device driver</entry>
<entry lang="en" key="DRIVER_UINSTALL_FAILED">Uninstallation of the device driver has failed. Please note that, due to a Windows issue, it may be necessary to log off or restart the system before the device driver can be uninstalled (or reinstalled).</entry>
<entry lang="en" key="INSTALLING_DRIVER">Installing VeraCrypt device driver</entry>
<entry lang="en" key="STOPPING_DRIVER">Stopping VeraCrypt device driver</entry>
<entry lang="en" key="REMOVING_DRIVER">Uninstalling VeraCrypt device driver</entry>
<entry lang="en" key="COM_REG_FAILED">Registration of the User Account Control support library failed.</entry>
<entry lang="en" key="COM_DEREG_FAILED">Unregistration of the User Account Control support library failed.</entry>
<entry lang="en" key="TRAVELER_LIMITATIONS_NOTE">Note about portable mode:\n\nPlease note that the operating system requires drivers to be registered with it before they can be started. Hence, the VeraCrypt driver is not (and cannot be) fully portable (whereas the VeraCrypt applications are fully portable, i.e. they do not have to be installed or registered with the operating system). Also note that VeraCrypt needs a driver to provide transparent on-the-fly encryption/decryption.</entry>
<entry lang="en" key="TRAVELER_UAC_NOTE">Note that if you decide to run VeraCrypt in portable mode (as opposed to running an installed copy of VeraCrypt), the system will ask you for permission to run VeraCrypt (UAC prompt) every time you attempt to run it.\n\nThe reason is that when you run VeraCrypt in portable mode, VeraCrypt needs to load and start the VeraCrypt device driver. VeraCrypt needs a device driver to provide transparent on-the-fly encryption/decryption, and users without administrator privileges cannot start device drivers in Windows. Therefore, the system will ask you for permission to run VeraCrypt with administrator privileges (UAC prompt).\n\nNote that if you install VeraCrypt on the system (as opposed to running VeraCrypt in portable mode), the system will NOT ask you for permission to run VeraCrypt (UAC prompt) every time you attempt to run it.\n\nAre you sure you want to extract the files?</entry>
<entry lang="en" key="CONTAINER_ADMIN_WARNING">Warning: This instance of the Volume Creation Wizard has administrator privileges.\n\nYour new volume may be created with permissions that will not allow you to write to the volume when it is mounted. If you want to avoid that, close this instance of the Volume Creation Wizard and launch a new one without administrator privileges.\n\nDo you want to close this instance of the Volume Creation Wizard?</entry>
<entry lang="en" key="CANNOT_DISPLAY_LICENSE">Error: Cannot display license.</entry>
<entry lang="en" key="OUTER_VOL_WRITE_PREVENTED">Outer(!)</entry>
<entry lang="en" key="DAYS">days</entry>
<entry lang="en" key="HOURS">hours</entry>
<entry lang="en" key="MINUTES">minutes</entry>
<entry lang="en" key="SECONDS">s</entry>
<entry lang="en" key="OPEN">Open</entry>
<entry lang="en" key="DISMOUNT">Dismount</entry>
<entry lang="en" key="SHOW_TC">Show VeraCrypt</entry>
<entry lang="en" key="HIDE_TC">Hide VeraCrypt</entry>
<entry lang="en" key="TOTAL_DATA_READ">Data Read since Mount</entry>
<entry lang="en" key="TOTAL_DATA_WRITTEN">Data Written since Mount</entry>
<entry lang="en" key="ENCRYPTED_PORTION">Encrypted Portion</entry>
<entry lang="en" key="ENCRYPTED_PORTION_FULLY_ENCRYPTED">100% (fully encrypted)</entry>
<entry lang="en" key="ENCRYPTED_PORTION_NOT_ENCRYPTED">0% (not encrypted)</entry>
<entry lang="en" key="PROCESSED_PORTION_X_PERCENT">%.3f%%</entry>
<entry lang="en" key="PROCESSED_PORTION_100_PERCENT">100%</entry>
<entry lang="en" key="PROGRESS_STATUS_WAITING">Waiting</entry>
<entry lang="en" key="PROGRESS_STATUS_PREPARING">Preparing</entry>
<entry lang="en" key="PROGRESS_STATUS_RESIZING">Resizing</entry>
<entry lang="en" key="PROGRESS_STATUS_ENCRYPTING">Encrypting</entry>
<entry lang="en" key="PROGRESS_STATUS_DECRYPTING">Decrypting</entry>
<entry lang="en" key="PROGRESS_STATUS_FINALIZING">Finalizing</entry>
<entry lang="en" key="PROGRESS_STATUS_PAUSED">Paused</entry>
<entry lang="en" key="PROGRESS_STATUS_FINISHED">Finished</entry>
<entry lang="en" key="PROGRESS_STATUS_ERROR">Error</entry>
<entry lang="en" key="FAVORITE_DISCONNECTED_DEV">Device disconnected</entry>
<entry lang="en" key="SYS_FAVORITE_VOLUMES_SAVED">System favorite volumes saved.\n\nTo enable mounting of system favorite volumes when the system starts, please select 'Settings' > 'System Favorite Volumes' > 'Mount system favorite volumes when Windows starts'.</entry>
<entry lang="en" key="FAVORITE_ADD_DRIVE_DEV_WARNING">The volume you are adding to favorites is neither a partition nor a dynamic volume. Therefore, VeraCrypt will be unable to mount this favorite volume if the device number changes.</entry>
<entry lang="en" key="FAVORITE_ADD_PARTITION_TYPE_WARNING">The volume you are adding to favorites is a partition not recognized by Windows.\n\nVeraCrypt will be unable to mount this favorite volume if the device number changes. Please set the type of the partition to a type recognized by Windows (use the SETID command of the Windows 'diskpart' tool). Then add the partition to favorites again.</entry>
<entry lang="en" key="FAVORITE_ARRIVAL_MOUNT_BACKGROUND_TASK_ERR">VeraCrypt Background Task is disabled or it is configured to exit when there are no mounted volumes (or VeraCrypt is running in portable mode). This may prevent your favorite volumes from being automatically mounted when devices hosting them get connected.\n\nNote: To enable the VeraCrypt Background Task, select Settings > Preferences and check the 'Enabled' checkbox in the section 'VeraCrypt Background Task'.</entry>
<entry lang="en" key="FAVORITE_ARRIVAL_MOUNT_NETWORK_PATH_ERR">A container stored in a remote filesystem shared over a network cannot be automatically mounted when its host device gets connected.</entry>
<entry lang="en" key="FAVORITE_ARRIVAL_MOUNT_DEVICE_PATH_ERR">The device displayed below is neither a partition nor a dynamic volume. Therefore, the volume hosted on the device cannot be automatically mounted when the device gets connected.</entry>
<entry lang="en" key="FAVORITE_ARRIVAL_MOUNT_PARTITION_TYPE_ERR">Please set the type of the partition displayed below to a type recognized by Windows (use the SETID command of the Windows 'diskpart' tool). Then remove the partition from favorites and add it again. This will enable the volume hosted on the device to be automatically mounted when the device gets connected.</entry>
<entry lang="en" key="FAVORITE_LABEL_DEVICE_PATH_ERR">The device displayed below is neither a partition nor a dynamic volume. Therefore, no label can be assigned to it.</entry>
<entry lang="en" key="FAVORITE_LABEL_PARTITION_TYPE_ERR">Please set the type of the partition displayed below to a type recognized by Windows (use the SETID command of the Windows 'diskpart' tool). Then remove the partition from favorites and add it again. This will enable VeraCrypt to assign a label to the partition.</entry>
<entry lang="en" key="SYSTEM_FAVORITE_NETWORK_PATH_ERR">Due to a Windows limitation, a container stored in a remote filesystem shared over a network cannot be mounted as a system favorite volume (however, it can be mounted as a non-system favorite volume when a user logs on).</entry>
<entry lang="en" key="ENTER_PASSWORD_FOR">Enter password for %s</entry>
<entry lang="en" key="ENTER_PASSWORD_FOR_LABEL">Enter password for '%s'</entry>
<entry lang="en" key="ENTER_NORMAL_VOL_PASSWORD">Enter password for the normal/outer volume</entry>
<entry lang="en" key="ENTER_HIDDEN_VOL_PASSWORD">Enter password for the hidden volume</entry>
<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_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>
<entry lang="en" key="HEADER_DAMAGED_AUTO_USED_HEADER_BAK">WARNING: The header of this volume is damaged! VeraCrypt automatically used the backup of the volume header embedded in the volume.\n\nYou should repair the volume header by selecting 'Tools' > 'Restore Volume Header'.</entry>
<entry lang="en" key="VOL_HEADER_BACKED_UP">Volume header backup has been successfully created.\n\nIMPORTANT: Restoring the volume header using this backup will also restore the current volume password. Moreover, if keyfile(s) are/is necessary to mount the volume, the same keyfile(s) will be necessary to mount the volume again when the volume header is restored.\n\nWARNING: This volume header backup may be used to restore the header ONLY of this particular volume. If you use this header backup to restore a header of a different volume, you will be able to mount the volume, but you will NOT be able to decrypt any data stored in the volume (because you will change its master key).</entry>
<entry lang="en" key="VOL_HEADER_RESTORED">The volume header has been successfully restored.\n\nIMPORTANT: Please note that an old password may have been restored as well. Moreover, if keyfile(s) were/was necessary to mount the volume when the backup was created, the same keyfile(s) are now necessary to mount the volume again.</entry>
<entry lang="en" key="EXTERNAL_VOL_HEADER_BAK_FIRST_INFO">For security reasons, you will have to enter the correct password (and/or supply the correct keyfiles) for the volume.\n\nNote: If the volume contains a hidden volume, you will have to enter the correct password (and/or supply the correct keyfiles) for the outer volume first. Afterwards, if you choose to back up the header of the hidden volume, you will have to enter the correct password (and/or supply the correct keyfiles) for the hidden volume.</entry>
<entry lang="en" key="CONFIRM_VOL_HEADER_BAK">Are you sure you want to create volume header backup for %s?\n\nAfter you click Yes, you will prompted for a filename for the header backup.\n\nNote: Both the standard and the hidden volume headers will be re-encrypted using a new salt and stored in the backup file. If there is no hidden volume within this volume, the area reserved for the hidden volume header in the backup file will be filled with random data (to preserve plausible deniability). When restoring a volume header from the backup file, you will need to enter the correct password (and/or to supply the correct keyfiles) that was/were valid when the volume header backup was created. The password (and/or keyfiles) will also automatically determine the type of the volume header to restore, i.e. standard or hidden (note that VeraCrypt determines the type through the process of trial and error).</entry>
<entry lang="en" key="CONFIRM_VOL_HEADER_RESTORE">Are you sure you want to restore volume header of %s?\n\nWARNING: Restoring a volume header also restores the volume password that was valid when the backup was created. Moreover, if keyfile(s) were/was necessary to mount the volume when the backup was created, the same keyfile(s) will be necessary to mount the volume again after the volume header is restored.\n\nAfter you click Yes, you will select the header backup file.</entry>
<entry lang="en" key="DOES_VOLUME_CONTAIN_HIDDEN">Does the volume contain a hidden volume?</entry>
<entry lang="en" key="VOLUME_CONTAINS_HIDDEN">The volume contains a hidden volume</entry>
<entry lang="en" key="VOLUME_DOES_NOT_CONTAIN_HIDDEN">The volume does not contain a hidden volume</entry>
<entry lang="en" key="HEADER_RESTORE_EXTERNAL_INTERNAL">Please select the type of volume header backup you want to use:</entry>
<entry lang="en" key="HEADER_RESTORE_INTERNAL">Restore the volume header from the backup embedded in the volume</entry>
<entry lang="en" key="HEADER_RESTORE_EXTERNAL">Restore the volume header from an external backup file</entry>
<entry lang="en" key="HEADER_BACKUP_SIZE_INCORRECT">The size of the volume header backup file is incorrect.</entry>
<entry lang="en" key="VOLUME_HAS_NO_BACKUP_HEADER">There is no backup header embedded in this volume (note that only volumes created by TrueCrypt 6.0 or later contain embedded backup headers).</entry>
<entry lang="en" key="BACKUP_HEADER_NOT_FOR_SYS_DEVICE">You are attempting to back up the header of the system partition/drive. This is not allowed. Backup/restore operations pertaining to the system partition/drive can be performed only using the VeraCrypt Rescue Disk.\n\nDo you want to create a VeraCrypt Rescue Disk?</entry>
<entry lang="en" key="RESTORE_HEADER_NOT_FOR_SYS_DEVICE">You are attempting to restore the header of a virtual VeraCrypt volume but you selected the system partition/drive. This is not allowed. Backup/restore operations pertaining to the system partition/drive can be performed only using the VeraCrypt Rescue Disk.\n\nDo you want to create a VeraCrypt Rescue Disk?</entry>
<entry lang="en" key="RESCUE_DISK_NON_WIZARD_CREATION_SELECT_PATH">After you click OK, you will select a filename for the new VeraCrypt Rescue Disk image and the location where you wish to place it.</entry>
<entry lang="en" key="RESCUE_DISK_NON_WIZARD_CREATION_BURN">The Rescue Disk image has been created and stored in this file:\n%s\n\nNow you need to burn the Rescue Disk image to a CD or DVD.\n\nIMPORTANT: Note that the file must be written to the CD/DVD as an ISO disk image (not as an individual file). For information on how to do so, please refer to the documentation of your CD/DVD recording software.\n\nAfter you burn the Rescue Disk, select 'System' > 'Verify Rescue Disk' to verify that it has been correctly burned.</entry>
<entry lang="en" key="RESCUE_DISK_NON_WIZARD_CREATION_WIN_ISOBURN">The Rescue Disk image has been created and stored in this file:\n%s\n\nNow you need to burn the Rescue Disk image to a CD or DVD.\n\nDo you want to launch the Microsoft Windows Disc Image Burner now?\n\nNote: After you burn the Rescue Disk, select 'System' > 'Verify Rescue Disk' to verify that it has been correctly burned.</entry>
<entry lang="en" key="RESCUE_DISK_NON_WIZARD_CHECK_INSERT">Please insert your VeraCrypt Rescue Disk and click OK to verify it.</entry>
<entry lang="en" key="RESCUE_DISK_NON_WIZARD_CHECK_PASSED">The VeraCrypt Rescue Disk has been successfully verified.</entry>
<entry lang="en" key="RESCUE_DISK_NON_WIZARD_CHECK_FAILED">Cannot verify that the Rescue Disk has been correctly burned.\n\nIf you have burned the Rescue Disk, please eject and reinsert the CD/DVD; then try again. If this does not help, please try other CD/DVD recording software and/or medium.\n\nIf you attempted to verify a VeraCrypt Rescue Disk created for a different master key, password, salt, etc., please note that such Rescue Disk will always fail this verification. To create a new Rescue Disk fully compatible with your current configuration, select 'System' > 'Create Rescue Disk'.</entry>
<entry lang="en" key="RESCUE_DISK_ISO_IMAGE_CHECK_PASSED">The VeraCrypt Rescue Disk image has been successfully verified.</entry>
<entry lang="en" key="RESCUE_DISK_ISO_IMAGE_CHECK_FAILED">The Rescue Disk image verification failed.\n\nIf you attempted to verify a VeraCrypt Rescue Disk image created for a different master key, password, salt, etc., please note that such Rescue Disk image will always fail this verification. To create a new Rescue Disk image fully compatible with your current configuration, select 'System' > 'Create Rescue Disk'.</entry>
<entry lang="en" key="ERROR_CREATING_RESCUE_DISK">Error creating VeraCrypt Rescue Disk.</entry>
<entry lang="en" key="CANNOT_CREATE_RESCUE_DISK_ON_HIDDEN_OS">VeraCrypt Rescue Disk cannot be created when a hidden operating system is running.\n\nTo create a VeraCrypt Rescue Disk, boot the decoy operating system and then select 'System' > 'Create Rescue Disk'.</entry>
<entry lang="en" key="RESCUE_DISK_CHECK_FAILED">Cannot verify that the Rescue Disk has been correctly burned.\n\nIf you have burned the Rescue Disk, please eject and reinsert the CD/DVD; then click Next to try again. If this does not help, please try another medium%s.\n\nIf you have not burned the Rescue Disk yet, please do so, and then click Next.\n\nIf you attempted to verify a VeraCrypt Rescue Disk created before you started this wizard, please note that such Rescue Disk cannot be used, because it was created for a different master key. You need to burn the newly generated Rescue Disk.</entry>
<entry lang="en" key="RESCUE_DISK_CHECK_FAILED_SENTENCE_APPENDIX"> and/or other CD/DVD recording software</entry>
<entry lang="en" key="SYSTEM_FAVORITES_DLG_TITLE">VeraCrypt - System Favorite Volumes</entry>
<entry lang="en" key="SYS_FAVORITES_HELP_LINK">What are system favorite volumes?</entry>
<entry lang="en" key="SYS_FAVORITES_REQUIRE_PBA">The system partition/drive does not appear to be encrypted.\n\nSystem favorite volumes can be mounted using only a pre-boot authentication password. Therefore, to enable use of system favorite volumes, you need to encrypt the system partition/drive first.</entry>
<entry lang="en" key="DISMOUNT_FIRST">Please dismount the volume before proceeding.</entry>
<entry lang="en" key="CANNOT_SET_TIMER">Error: Cannot set timer.</entry>
<entry lang="en" key="IDPM_CHECK_FILESYS">Check Filesystem</entry>
<entry lang="en" key="IDPM_REPAIR_FILESYS">Repair Filesystem</entry>
<entry lang="en" key="IDPM_ADD_TO_FAVORITES">Add to Favorites...</entry>
<entry lang="en" key="IDPM_ADD_TO_SYSTEM_FAVORITES">Add to System Favorites...</entry>
<entry lang="en" key="IDPM_PROPERTIES">P&amp;roperties...</entry>
<entry lang="en" key="HIDDEN_VOL_PROTECTION">Hidden Volume Protected</entry>
<entry lang="en" key="NOT_APPLICABLE_OR_NOT_AVAILABLE">N/A</entry>
<entry lang="en" key="UISTR_YES">Yes</entry>
<entry lang="en" key="UISTR_NO">No</entry>
<entry lang="en" key="UISTR_DISABLED">Disabled</entry>
<entry lang="en" key="DIGIT_ONE">1</entry>
<entry lang="en" key="TWO_OR_MORE">2 or more</entry>
<entry lang="en" key="MODE_OF_OPERATION">Mode of Operation</entry>
<entry lang="en" key="LABEL_ITEM">Label: </entry>
<entry lang="en" key="SIZE_ITEM">Size: </entry>
<entry lang="en" key="PATH_ITEM">Path: </entry>
<entry lang="en" key="DRIVE_LETTER_ITEM">Drive Letter: </entry>
<entry lang="en" key="UNSUPPORTED_CHARS_IN_PWD">Error: Password must contain only ASCII characters.\n\nNon-ASCII characters in password might cause the volume to be impossible to mount when your system configuration changes.\n\nThe following characters are allowed:\n\n ! " # $ % &amp; ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; &lt; = &gt; ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \\ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~</entry>
<entry lang="en" key="UNSUPPORTED_CHARS_IN_PWD_RECOM">Warning: Password contains non-ASCII characters. This may cause the volume to be impossible to mount when your system configuration changes.\n\nYou should replace all non-ASCII characters in the password with ASCII characters. To do so, click 'Volumes' -&gt; 'Change Volume Password'.\n\nThe following are ASCII characters:\n\n ! " # $ % &amp; ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; &lt; = &gt; ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \\ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~</entry>
<entry lang="en" key="EXE_FILE_EXTENSION_CONFIRM">WARNING: We strongly recommend that you avoid file extensions that are used for executable files (such as .exe, .sys, or .dll) and other similarly problematic file extensions. Using such file extensions causes Windows and antivirus software to interfere with the container, which adversely affects the performance of the volume and may also cause other serious problems.\n\nWe strongly recommend that you remove the file extension or change it (e.g., to '.hc').\n\nAre you sure you want to use the problematic file extension?</entry>
<entry lang="en" key="EXE_FILE_EXTENSION_MOUNT_WARNING">WARNING: This container has a file extension that is used for executable files (such as .exe, .sys, or .dll) or some other file extension that is similarly problematic. It will very likely cause Windows and antivirus software to interfere with the container, which will adversely affect the performance of the volume and may also cause other serious problems.\n\nWe strongly recommend that you remove the file extension of the container or change it (e.g., to '.hc') after you dismount the volume.</entry>
<entry lang="en" key="HOMEPAGE">Homepage</entry>
<entry lang="en" key="LARGE_IDE_WARNING_XP">WARNING: It appears that you have not applied any Service Pack to your Windows installation. You should not write to IDE disks larger than 128 GiB under Windows XP to which you did not apply Service Pack 1 or later! If you do, data on the disk (no matter if it is a VeraCrypt volume or not) may get corrupted. Note that this is a limitation of Windows, not a bug in VeraCrypt.</entry>
<entry lang="en" key="LARGE_IDE_WARNING_2K">WARNING: It appears that you have not applied Service Pack 3 or later to your Windows installation. You should not write to IDE disks larger than 128 GiB under Windows 2000 to which you did not apply Service Pack 3 or later! If you do, data on the disk (no matter if it is a VeraCrypt volume or not) may get corrupted. Note that this is a limitation of Windows, not a bug in VeraCrypt.\n\nNote: You may also need to enable the 48-bit LBA support in the registry; for more information, see http://support.microsoft.com/kb/305098/EN-US</entry>
<entry lang="en" key="LARGE_IDE_WARNING_2K_REGISTRY">WARNING: 48-bit LBA ATAPI support is disabled on your system. Therefore, you should not write to IDE disks larger than 128 GiB! If you do, data on the disk (no matter if it is a VeraCrypt volume or not) may get corrupted. Note that this is a limitation of Windows, not a limitation of VeraCrypt.\n\nTo enable the 48-bit LBA support, add the 'EnableBigLba' registry value in the registry key HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\atapi\\Parameters and set it to 1.\n\nFor more information, see http://support.microsoft.com/kb/305098</entry>
<entry lang="en" key="VOLUME_TOO_LARGE_FOR_FAT32">Error: Files larger than 4 GiB cannot be stored on a FAT32 file system. Therefore, file-hosted VeraCrypt volumes (containers) stored on a FAT32 file system cannot be larger than 4 GiB.\n\nIf you need a larger volume, create it on an NTFS file system (or, if you use Windows Vista SP1 or later, on an exFAT file system) or, instead of creating a file-hosted volume, encrypt an entire partition or device.</entry>
<entry lang="en" key="VOLUME_TOO_LARGE_FOR_WINXP">Warning: Windows XP does not support files larger than 2048 GiB (it will report that "Not enough storage is available"). Therefore, you cannot create a file-hosted VeraCrypt volume (container) larger than 2048 GiB under Windows XP.\n\nNote that it is still possible to encrypt the entire drive or create a partition-hosted VeraCrypt volume larger than 2048 GiB under Windows XP.</entry>
<entry lang="en" key="FREE_SPACE_FOR_WRITING_TO_OUTER_VOLUME">WARNING: If you want to be able to add more data/files to the outer volume in future, you should consider choosing a smaller size for the hidden volume.\n\nAre you sure you want to continue with the size you specified?</entry>
<entry lang="en" key="NO_VOLUME_SELECTED">No volume selected.\n\nClick 'Select Device' or 'Select File' to select a VeraCrypt volume.</entry>
<entry lang="en" key="NO_SYSENC_PARTITION_SELECTED">No partition selected.\n\nClick 'Select Device' to select a dismounted partition that normally requires pre-boot authentication (for example, a partition located on the encrypted system drive of another operating system, which is not running, or the encrypted system partition of another operating system).\n\nNote: The selected partition will be mounted as a regular VeraCrypt volume without pre-boot authentication. This is useful e.g. for backup or repair operations.</entry>
<entry lang="en" key="CONFIRM_SAVE_DEFAULT_KEYFILES">WARNING: If default keyfiles are set and enabled, volumes that are not using these keyfiles will be impossible to mount. Therefore, after you enable default keyfiles, keep in mind to uncheck the 'Use keyfiles' checkbox (below a password input field) whenever mounting such volumes.\n\nAre you sure you want to save the selected keyfiles/paths as default?</entry>
<entry lang="en" key="HK_AUTOMOUNT_DEVICES">Auto-Mount Devices</entry>
<entry lang="en" key="HK_DISMOUNT_ALL">Dismount All</entry>
<entry lang="en" key="HK_WIPE_CACHE">Wipe Cache</entry>
<entry lang="en" key="HK_DISMOUNT_ALL_AND_WIPE">Dismount All &amp; Wipe Cache</entry>
<entry lang="en" key="HK_FORCE_DISMOUNT_ALL_AND_WIPE">Force Dismount All &amp; Wipe Cache</entry>
<entry lang="en" key="HK_FORCE_DISMOUNT_ALL_AND_WIPE_AND_EXIT">Force Dismount All, Wipe Cache &amp; Exit</entry>
<entry lang="en" key="HK_MOUNT_FAVORITE_VOLUMES">Mount Favorite Volumes</entry>
<entry lang="en" key="HK_SHOW_HIDE_MAIN_WINDOW">Show/Hide Main VeraCrypt Window</entry>
<entry lang="en" key="PRESS_A_KEY_TO_ASSIGN">(Click here and press a key)</entry>
<entry lang="en" key="ACTION">Action</entry>
<entry lang="en" key="SHORTCUT">Shortcut</entry>
<entry lang="en" key="CANNOT_USE_RESERVED_KEY">Error: This shortcut is reserved. Please choose a different shortcut.</entry>
<entry lang="en" key="SHORTCUT_ALREADY_IN_USE">Error: Shortcut already in use.</entry>
<entry lang="en" key="HOTKEY_REGISTRATION_ERROR">WARNING: One or more VeraCrypt system-wide hot keys will not work!\n\nPlease make sure that other applications and the operating system do not use the same shortcut(s) as VeraCrypt.</entry>
<entry lang="en" key="PAGING_FILE_CREATION_PREVENTED">Paging file creation has been prevented.\n\nPlease note that, due to Windows issues, paging files cannot be located on non-system VeraCrypt volumes (including system favorite volumes). VeraCrypt supports creation of paging files only on an encrypted system partition/drive.</entry>
<entry lang="en" key="SYS_ENC_HIBERNATION_PREVENTED">An error or incompatibility prevents VeraCrypt from encrypting the hibernation file. Therefore, hibernation has been prevented.\n\nNote: When a computer hibernates (or enters a power-saving mode), the content of its system memory is written to a hibernation storage file residing on the system drive. VeraCrypt would not be able to prevent encryption keys and the contents of sensitive files opened in RAM from being saved unencrypted to the hibernation storage file.</entry>
<entry lang="en" key="HIDDEN_OS_HIBERNATION_PREVENTED">Hibernation has been prevented.\n\nVeraCrypt does not support hibernation on hidden operating systems that use an extra boot partition. Please note that the boot partition is shared by both the decoy and the hidden system. Therefore, in order to prevent data leaks and problems while resuming from hibernation, VeraCrypt has to prevent the hidden system from writing to the shared boot partition and from hibernating.</entry>
<entry lang="en" key="VOLUME_MOUNTED_AS_DRIVE_LETTER_X_DISMOUNTED">VeraCrypt volume mounted as %c: has been dismounted.</entry>
<entry lang="en" key="MOUNTED_VOLUMES_DISMOUNTED">VeraCrypt volumes have been dismounted.</entry>
<entry lang="en" key="VOLUMES_DISMOUNTED_CACHE_WIPED">VeraCrypt volumes have been dismounted and password cache has been wiped.</entry>
<entry lang="en" key="SUCCESSFULLY_DISMOUNTED">Successfully dismounted</entry>
<entry lang="en" key="CONFIRM_BACKGROUND_TASK_DISABLED">WARNING: If the VeraCrypt Background Task is disabled, the following functions will be disabled:\n\n1) Hot keys\n2) Auto-dismount (e.g., upon logoff, inadvertent host device removal, time-out, etc.)\n3) Auto-mount of favorite volumes\n4) Notifications (e.g., when damage to hidden volume is prevented)\n5) Tray icon\n\nNote: You can shut down the Background Task anytime by right-clicking the VeraCrypt tray icon and selecting 'Exit'.\n\nAre you sure you want to permanently disable the VeraCrypt Background Task?</entry>
<entry lang="en" key="CONFIRM_NO_FORCED_AUTODISMOUNT">WARNING: If this option is disabled, volumes containing open files/directories will not be possible to auto-dismount.\n\nAre you sure you want to disable this option?</entry>
<entry lang="en" key="WARN_PREF_AUTO_DISMOUNT">WARNING: Volumes containing open files/directories will NOT be auto-dismounted.\n\nTo prevent this, enable the following option in this dialog window: 'Force auto-dismount even if volume contains open files or directories'</entry>
<entry lang="en" key="WARN_PREF_AUTO_DISMOUNT_ON_POWER">WARNING: When the notebook battery power is low, Windows may omit sending the appropriate messages to running applications when the computer is entering power saving mode. Therefore, VeraCrypt may fail to auto-dismount volumes in such cases.</entry>
<entry lang="en" key="NONSYS_INPLACE_ENC_RESUME_PROMPT">You have scheduled the process of encryption/decryption of a partition/volume. The process has not been completed yet.\n\nDo you want to resume the process now?</entry>
<entry lang="en" key="SYSTEM_ENCRYPTION_RESUME_PROMPT">You have scheduled the process of encryption or decryption of the system partition/drive. The process has not been completed yet.\n\nDo you want to start (resume) the process now?</entry>
<entry lang="en" key="ASK_NONSYS_INPLACE_ENC_NOTIFICATION_REMOVAL">Do you want to be prompted about whether you want to resume the currently scheduled processes of encryption/decryption of non-system partitions/volumes?</entry>
<entry lang="en" key="KEEP_PROMPTING_ME">Yes, keep prompting me</entry>
<entry lang="en" key="DO_NOT_PROMPT_ME">No, do not prompt me</entry>
<entry lang="en" key="NONSYS_INPLACE_ENC_NOTIFICATION_REMOVAL_NOTE">IMPORTANT: Keep in mind that you can resume the process of encryption/decryption of any non-system partition/volume by selecting 'Volumes' &gt; 'Resume Interrupted Process' from the menu bar of the main VeraCrypt window.</entry>
<entry lang="en" key="SYSTEM_ENCRYPTION_SCHEDULED_BUT_PBA_FAILED">You have scheduled the process of encryption or decryption of the system partition/drive. However, pre-boot authentication failed (or was bypassed).\n\nNote: If you decrypted the system partition/drive in the pre-boot environment, you may need to finalize the process by selecting 'System' &gt; 'Permanently Decrypt System Partition/Drive' from the menu bar of the main VeraCrypt window.</entry>
<entry lang="en" key="CONFIRM_EXIT">WARNING: If VeraCrypt exits now, the following functions will be disabled:\n\n1) Hot keys\n2) Auto-dismount (e.g., upon logoff, inadvertent host device removal, time-out, etc.)\n3) Auto-mount of favorite volumes\n4) Notifications (e.g., when damage to hidden volume is prevented)\n\nNote: If you do not wish VeraCrypt to run in the background, disable the VeraCrypt Background Task in the Preferences (and, if necessary, disable the automatic start of VeraCrypt in the Preferences).\n\nAre you sure you want VeraCrypt to exit?</entry>
<entry lang="en" key="CONFIRM_EXIT_UNIVERSAL">Exit?</entry>
<entry lang="en" key="CHOOSE_ENCRYPT_OR_DECRYPT">VeraCrypt does not have sufficient information to determine whether to encrypt or decrypt.</entry>
<entry lang="en" key="CHOOSE_ENCRYPT_OR_DECRYPT_FINALIZE_DECRYPT_NOTE">VeraCrypt does not have sufficient information to determine whether to encrypt or decrypt.\n\nNote: If you decrypted the system partition/drive in the pre-boot environment, you may need to finalize the process by clicking Decrypt.</entry>
<entry lang="en" key="NONSYS_INPLACE_ENC_REVERSE_INFO">Note: When you are encrypting a non-system partition/volume in place and an error persistently prevents you from finishing the process, you will not be able to mount the volume (and access data stored on it) until you entirely DECRYPT the volume (i.e. reverse the process).\n\nIf you need to do so, follow these steps:\n1) Exit this wizard.\n2) In the main VeraCrypt window, select 'Volumes' &gt; 'Resume Interrupted Process'.\n3) Select 'Decrypt'.</entry>
<entry lang="en" key="NONSYS_INPLACE_ENC_DEFER_CONFIRM">Do you want to interrupt and postpone the process of encryption/decryption of the partition/volume?\n\nNote: Keep in mind that the volume cannot be mounted until it has been fully encrypted or decrypted. You will be able to resume the process of encryption/decryption and it will continue from the point where it was stopped. You can do so, for example, by selecting 'Volumes' &gt; 'Resume Interrupted Process' from the menu bar of the main VeraCrypt window.</entry>
<entry lang="en" key="SYSTEM_ENCRYPTION_DEFER_CONFIRM">Do you want to interrupt and postpone the process of encryption of the system partition/drive?\n\nNote: You will be able to resume the process and it will continue from the point it was stopped. You can do so, for example, by selecting 'System' &gt; 'Resume Interrupted Process' from the menu bar of the main VeraCrypt window. If you want to permanently terminate or reverse the encryption process, select 'System' &gt; 'Permanently Decrypt System Partition/Drive'.</entry>
<entry lang="en" key="SYSTEM_DECRYPTION_DEFER_CONFIRM">Do you want to interrupt and postpone the process of decryption of the system partition/drive?\n\nNote: You will be able to resume the process and it will continue from the point it was stopped. You can do so, for example, by selecting 'System' &gt; 'Resume Interrupted Process' from the menu bar of the main VeraCrypt window. If you want to reverse the decryption process (and start encrypting), select 'System' &gt; 'Encrypt System Partition/Drive'.</entry>
<entry lang="en" key="FAILED_TO_INTERRUPT_SYSTEM_ENCRYPTION">Error: Failed to interrupt the process of encryption/decryption of the system partition/drive.</entry>
<entry lang="en" key="FAILED_TO_INTERRUPT_WIPING">Error: Failed to interrupt the process of wiping.</entry>
<entry lang="en" key="FAILED_TO_RESUME_SYSTEM_ENCRYPTION">Error: Failed to resume the process of encryption/decryption of the system partition/drive.</entry>
<entry lang="en" key="FAILED_TO_START_WIPING">Error: Failed to start the process of wiping.</entry>
<entry lang="en" key="INCONSISTENCY_RESOLVED">Inconsistency resolved.\n\n\n(If you report a bug in connection with this, please include the following technical information in the bug report:\n%hs)</entry>
<entry lang="en" key="UNEXPECTED_STATE">Error: Unexpected state.\n\n\n(If you report a bug in connection with this, please include the following technical information in the bug report:\n%hs)</entry>
<entry lang="en" key="NO_SYS_ENC_PROCESS_TO_RESUME">There is no interrupted process of encryption/decryption of the system partition/drive to resume.\n\nNote: If you want to resume an interrupted process of encryption/decryption of a non-system partition/volume, select 'Volumes' &gt; 'Resume Interrupted Process'.</entry>
<entry lang="en" key="HIDVOL_PROT_BKG_TASK_WARNING">WARNING: VeraCrypt Background Task is disabled. After you exit VeraCrypt, you will not be notified if damage to hidden volume is prevented.\n\nNote: You may shut down the Background Task anytime by right-clicking the VeraCrypt tray icon and selecting 'Exit'.\n\nEnable VeraCrypt Background Task?</entry>
<entry lang="en" key="LANG_PACK_VERSION">Language pack version: %s</entry>
<entry lang="en" key="CHECKING_FS">Checking the file system on the VeraCrypt volume mounted as %s...</entry>
<entry lang="en" key="REPAIRING_FS">Attempting to repair the file system on the VeraCrypt volume mounted as %s...</entry>
<entry lang="en" key="WARN_64_BIT_BLOCK_CIPHER">Warning: This volume is encrypted with a legacy encryption algorithm.\n\nAll 64-bit-block encryption algorithms (e.g., Blowfish, CAST-128, or Triple DES) are deprecated. It will be possible to mount this volume using future versions of VeraCrypt. However, there will be no further enhancements to the implementations of these legacy encryption algorithms. We recommend that you create a new VeraCrypt volume encrypted with a 128-bit-block encryption algorithm (e.g., AES, Serpent, Twofish, etc.) and that you move all files from this volume to the new volume.</entry>
<entry lang="en" key="SYS_AUTOMOUNT_DISABLED">Your system is not configured to auto-mount new volumes. It may be impossible to mount device-hosted VeraCrypt volumes. Auto-mounting can be enabled by executing the following command and restarting the system.\n\nmountvol.exe /E</entry>
<entry lang="en" key="SYS_ASSIGN_DRIVE_LETTER">Please assign a drive letter to the partition/device before proceeding ('Control Panel' > 'System and Maintenance' > 'Administrative Tools' - 'Create and format hard disk partitions').\n\nNote that this is a requirement of the operating system.</entry>
<entry lang="en" key="MOUNT_TC_VOLUME">Mount VeraCrypt volume</entry>
<entry lang="en" key="DISMOUNT_ALL_TC_VOLUMES">Dismount all VeraCrypt volumes</entry>
<entry lang="en" key="UAC_INIT_ERROR">VeraCrypt failed to obtain Administrator privileges.</entry>
<entry lang="en" key="ERR_ACCESS_DENIED">Access was denied by the operating system.\n\nPossible cause: The operating system requires that you have read/write permission (or administrator privileges) for certain folders, files, and devices, in order for you to be allowed to read and write data to/from them. Normally, a user without administrator privileges is allowed to create, read and modify files in his or her Documents folder.</entry>
<entry lang="en" key="SECTOR_SIZE_UNSUPPORTED">Error: The drive uses an unsupported sector size.\n\nIt is currently not possible to create partition/device-hosted volumes on drives that use sectors larger than 4096 bytes. However, note that you can create file-hosted volumes (containers) on such drives.</entry>
<entry lang="en" key="SYSENC_UNSUPPORTED_SECTOR_SIZE_BIOS">It is currently not possible to encrypt a system installed on a disk that uses a sector size other than 512 bytes.</entry>
<entry lang="en" key="NO_SPACE_FOR_BOOT_LOADER">The VeraCrypt Boot Loader requires at least 32 KibiBytes of free space at the beginning of the system drive (the VeraCrypt Boot Loader needs to be stored in that area). Unfortunately, your drive does not meet this condition.\n\nPlease do NOT report this as a bug/problem in VeraCrypt. To solve this problem, you will need to repartition your disk and leave the first 32 KibiBytes of the disk free (in most cases, you will need to delete and recreate the first partition). We recommend that you use the Microsoft partition manager that is available e.g. when you are installing Windows.</entry>
<entry lang="en" key="FEATURE_UNSUPPORTED_ON_CURRENT_OS">The feature is not supported on the version of the operating system you are currently using.</entry>
<entry lang="en" key="SYS_ENCRYPTION_UNSUPPORTED_ON_CURRENT_OS">VeraCrypt does not support encryption of a system partition/drive on the version of the operating system you are currently using.</entry>
<entry lang="en" key="SYS_ENCRYPTION_UNSUPPORTED_ON_VISTA_SP0">Before you can encrypt the system partition/drive on Windows Vista, you need to install Service Pack 1 or higher for Windows Vista (no such Service Pack has been installed on this system yet).\n\nNote: Service Pack 1 for Windows Vista resolved an issue causing a shortage of free base memory during system boot.</entry>
<entry lang="en" key="SYS_ENCRYPTION_UPGRADE_UNSUPPORTED_ON_VISTA_SP0">VeraCrypt no longer supports encryption of the system partition/drive on Windows Vista with no Service Pack installed. Before upgrading VeraCrypt, please install Service Pack 1 or higher for Windows Vista.</entry>
<entry lang="en" key="FEATURE_REQUIRES_INSTALLATION">Error: This feature requires VeraCrypt to be installed on the system (you are running VeraCrypt in portable mode).\n\nPlease install VeraCrypt and then try again.</entry>
<entry lang="en" key="WINDOWS_NOT_ON_BOOT_DRIVE_ERROR">WARNING: Windows does not appear to be installed on the drive from which it boots. This is not supported.\n\nYou should continue only if you are sure that Windows is installed on the drive from which it boots.\n\nDo you want to continue?</entry>
<entry lang="en" key="TC_BOOT_LOADER_ALREADY_INSTALLED">CAUTION: The VeraCrypt Boot Loader is already installed on your system drive!\n\nIt is possible that another system on your computer is already encrypted.\n\nWARNING: PROCEEDING WITH ENCRYPTION OF THE CURRENTLY RUNNING SYSTEM MAY MAKE OTHER SYSTEM(S) IMPOSSIBLE TO START AND RELATED DATA INACCESSIBLE.\n\nAre you sure you want to continue?</entry>
<entry lang="en" key="SYS_LOADER_RESTORE_FAILED">Failed to restore the original system loader.\n\nPlease use your VeraCrypt Rescue Disk ('Repair Options' > 'Restore original system loader') or Windows installation medium to replace the VeraCrypt Boot Loader with the Windows system loader.</entry>
<entry lang="en" key="SYS_LOADER_UNAVAILABLE_FOR_RESCUE_DISK">The original system loader will not be stored on the Rescue Disk (probable cause: missing backup file).</entry>
<entry lang="en" key="ERROR_MBR_PROTECTED">Failed to write the MBR sector.\n\nYour BIOS may be configured to protect the MBR sector. Check your BIOS settings (press F2, Delete, or Esc, after powering on your computer) for MBR/antivirus protection.</entry>
<entry lang="en" key="BOOT_LOADER_FINGERPRINT_CHECK_FAILED">WARNING: The verification of VeraCrypt bootloader fingerprint failed!\nYour disk may have been tampered with by an attacker ("Evil Maid" attack).\n\nThis warning can also be triggered if you restored VeraCrypt boot loader using an Rescue Disk generated using a different VeraCrypt version.\n\nYou are advised to change your password immediately which will also restore the correct VeraCrypt bootloader. It is recommended to reinstall VeraCrypt and to take measures to avoid access to this machine by untrusted entities.</entry>
<entry lang="en" key="BOOT_LOADER_VERSION_INCORRECT_PREFERENCES">The required version of the VeraCrypt Boot Loader is currently not installed. This may prevent some of the settings from being saved.</entry>
<entry lang="en" key="CUSTOM_BOOT_LOADER_MESSAGE_HELP">Note: In some situations, you may wish to prevent a person (adversary) that is watching you start the computer from knowing that you use VeraCrypt. The above options allow you to do that by customizing the VeraCrypt boot loader screen. If you enable the first option, no texts will be displayed by the boot loader (not even when you enter the wrong password). The computer will appear to be "frozen" while you can type your password. In addition, a custom message can be displayed to mislead the adversary. For example, fake error messages such as "Missing operating system" (which is normally displayed by the Windows boot loader if it finds no Windows boot partition). It is, however, important to note that if the adversary can analyze the content of the hard drive, he can still find out that it contains the VeraCrypt boot loader.</entry>
<entry lang="en" key="CUSTOM_BOOT_LOADER_MESSAGE_PROMPT">WARNING: Please keep in mind that if you enable this option, the VeraCrypt boot loader will not display any texts (not even when you enter the wrong password). The computer will appear to be "frozen" (unresponsive) while you can type your password (the cursor will NOT move and no asterisk will be displayed when you press a key).\n\nAre you sure you want to enable this option?</entry>
<entry lang="en" key="SYS_PARTITION_OR_DRIVE_APPEARS_FULLY_ENCRYPTED">Your system partition/drive appears to be fully encrypted.</entry>
<entry lang="en" key="SYSENC_UNSUPPORTED_FOR_DYNAMIC_DISK">VeraCrypt does not support encrypting a system drive that has been converted to a dynamic disk.</entry>
<entry lang="en" key="WDE_UNSUPPORTED_FOR_EXTENDED_PARTITIONS">The system drive contains extended (logical) partitions.\n\nYou can encrypt an entire system drive containing extended (logical) partitions only on Windows Vista and later versions of Windows. On Windows XP, you can encrypt an entire system drive provided that it contains only primary partitions.\n\nNote: You can still encrypt the system partition instead of the entire system drive (and, in addition to that, you can create partition-hosted VeraCrypt volumes within any non-system partitions on the drive).</entry>
<entry lang="en" key="WDE_EXTENDED_PARTITIONS_WARNING">WARNING: As you are running Windows XP/2003, after you start encrypting the drive, you must NOT create any extended (logical) partitions on it (you may create only primary partitions). Any extended (logical) partition on the drive would be inaccessible after you start encrypting (the drive currently does not contain any such partition).\n\nNote: If this limitation is not acceptable, you can go back and choose to encrypt only the system partition instead of the entire drive (and, in addition to that, you can create partition-hosted VeraCrypt volumes within any non-system partitions on the drive).\n\nAlternatively, if this limitation is not acceptable, you may want to consider upgrading to Windows Vista or a later version of Windows (you can encrypt an entire system drive containing extended/logical partitions only on Windows Vista or later).</entry>
<entry lang="en" key="SYSDRIVE_NON_STANDARD_PARTITIONS">Your system drive contains a non-standard partition.\n\nIf you are using a notebook, your system drive probably contains a special recovery partition. After the whole system drive is encrypted (including any recovery partition), your system might become unbootable if your computer is using an inappropriately designed BIOS. It would also be impossible to use any recovery partition until the system drive is decrypted. Therefore, we recommend that you encrypt only the system partition.</entry>
<entry lang="en" key="ASK_ENCRYPT_PARTITION_INSTEAD_OF_DRIVE">Do you want to encrypt the system partition instead of the entire drive?\n\nNote that you can create partition-hosted VeraCrypt volumes within any non-system partitions on the drive (in addition to encrypting the system partition).</entry>
<entry lang="en" key="WHOLE_SYC_DEVICE_RECOM">As your system drive contains only a single partition that occupies the whole drive, it is preferable (more secure) to encrypt the entire drive including the free "slack" space that typically surrounds such a partition.\n\nDo you want to encrypt the entire system drive?</entry>
<entry lang="en" key="TEMP_NOT_ON_SYS_PARTITION">Your system is configured to store temporary files on a non-system partition.\n\nTemporary files may be stored only on the system partition.</entry>
<entry lang="en" key="USER_PROFILE_NOT_ON_SYS_PARTITION">Your user profile files are not stored on the system partition.\n\nUser profile files may be stored only on the system partition.</entry>
<entry lang="en" key="PAGING_FILE_NOT_ON_SYS_PARTITION">There is/are paging file(s) on non-system partitions.\n\nPaging files may be located only on the system partition.</entry>
<entry lang="en" key="RESTRICT_PAGING_FILES_TO_SYS_PARTITION">Do you want to configure Windows to create paging files only on the Windows partition now?\n\nNote that if you click 'Yes', the computer will be restarted. Then start VeraCrypt and try creating the hidden OS again.</entry>
<entry lang="en" key="LEAKS_OUTSIDE_SYSPART_UNIVERSAL_EXPLANATION"> Otherwise, plausible deniability of the hidden operating system might be adversely affected.\n\nNote: If an adversary analyzed the content of such files (residing on a non-system partition), he might find out that you used this wizard in the hidden-system-creation mode (which might indicate the existence of a hidden operating system on your computer). Also note that any such files stored on the system partition will be securely erased by VeraCrypt during the process of creation of the hidden operating system.</entry>
<entry lang="en" key="DECOY_OS_REINSTALL_WARNING">WARNING: During the process of creation of the hidden operating system, you will be required to fully reinstall the currently running system (in order to create a decoy system securely).\n\nNote: The currently running operating system and the entire content of the system partition will be copied to the hidden volume (in order to create the hidden system).\n\n\nAre you sure you will be able to install Windows using a Windows Setup medium (or using a service partition)?</entry>
<entry lang="en" key="DECOY_OS_REQUIREMENTS">For security reasons, if the currently running operating system requires activation, it must be activated before proceeding. Note that the hidden operating system will be created by copying the content of the system partition to a hidden volume (so if this operating system is not activated, the hidden operating system will not be activated either). For more information, see the section "Security Requirements and Precautions Pertaining to Hidden Volumes" in the VeraCrypt User's Guide.\n\nImportant: Before proceeding, please make sure you have read the section "Security Requirements and Precautions Pertaining to Hidden Volumes" in the VeraCrypt User's Guide.\n\n\nDoes the currently running operating system meet the above condition?</entry>
<entry lang="en" key="CONFIRM_HIDDEN_OS_EXTRA_BOOT_PARTITION">Your system uses an extra boot partition. VeraCrypt does not support hibernation on hidden operating systems that use an extra boot partition (decoy systems can be hibernated without any problems).\n\nPlease note that the boot partition would be shared by both the decoy and the hidden system. Therefore, in order to prevent data leaks and problems while resuming from hibernation, VeraCrypt has to prevent the hidden system from writing to the shared boot partition and from hibernating.\n\n\nDo you want to continue? If you select 'No', instructions for removing the extra boot partition will be displayed.</entry>
<entry lang="en" key="EXTRA_BOOT_PARTITION_REMOVAL_INSTRUCTIONS">\nThe extra boot partition can be removed before installing Windows. To do so, follow these steps:\n\n1) Boot your Windows installation disc.\n\n2) In the Windows installer screen, click 'Install now' > 'Custom (advanced)'.\n\n3) Click 'Drive Options'.\n\n4) Select the main system partition and delete it by clicking 'Delete' and 'OK'.\n\n5) Select the 'System Reserved' partition, click 'Extend', and increase its size so that the operating system can be installed to it.\n\n6) Click 'Apply' and 'OK'.\n\n7) Install Windows on the 'System Reserved' partition.\n\n\nShould an attacker ask why you removed the extra boot partition, you can answer that you wanted to prevent any possible data leaks to the unencrypted boot partition.\n\nNote: You can print this text by clicking the 'Print' button below. If you save a copy of this text or print it (strongly recommended, unless your printer stores copies of documents it prints on its internal drive), you should destroy any copies of it after removing the extra boot partition (otherwise, if such a copy was found, it might indicate that there is a hidden operating system on this computer).</entry>
<entry lang="en" key="GAP_BETWEEN_SYS_AND_HIDDEN_OS_PARTITION">Warning: There is unallocated space between the system partition and the first partition behind it. After you create the hidden operating system, you must not create any new partitions in that unallocated space. Otherwise, the hidden operating system will be impossible to boot (until you delete such newly created partitions).</entry>
<entry lang="en" key="ALGO_NOT_SUPPORTED_FOR_SYS_ENCRYPTION">This algorithm is currently not supported for system encryption.</entry>
<entry lang="en" key="ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE">This algorithm is not supported for TrueCrypt mode.</entry>
<entry lang="en" key="PIM_NOT_SUPPORTED_FOR_TRUECRYPT_MODE">PIM (Personal Iterations Multiplier) not supported for TrueCrypt mode.</entry>
<entry lang="en" key="PIM_REQUIRE_LONG_PASSWORD">Password must contain 20 or more characters in order to use the specified PIM.\nShorter passwords can only be used if the PIM is 485 or greater.</entry>
<entry lang="en" key="BOOT_PIM_REQUIRE_LONG_PASSWORD">Pre-boot authentication Password must contain 20 or more characters in order to use the specified PIM.\nShorter passwords can only be used if the PIM is 98 or greater.</entry>
<entry lang="en" key="KEYFILES_NOT_SUPPORTED_FOR_SYS_ENCRYPTION">Keyfiles are currently not supported for system encryption.</entry>
<entry lang="en" key="CANNOT_RESTORE_KEYBOARD_LAYOUT">Warning: VeraCrypt could not restore the original keyboard layout. This may cause you to enter a password incorrectly.</entry>
<entry lang="en" key="CANT_CHANGE_KEYB_LAYOUT_FOR_SYS_ENCRYPTION">Error: Cannot set the keyboard layout for VeraCrypt to the standard US keyboard layout.\n\nNote that the password needs to be typed in the pre-boot environment (before Windows starts) where non-US Windows keyboard layouts are not available. Therefore, the password must always be typed using the standard US keyboard layout.</entry>
- <entry lang="en" key="ALT_KEY_CHARS_NOT_FOR_SYS_ENCRYPTION">It is not possible to type characters by pressing keys while the right Alt key is held down. However, you can type most of such characters by pressing appropriate keys while the Shift key is held down.</entry>
+ <entry lang="en" key="ALT_KEY_CHARS_NOT_FOR_SYS_ENCRYPTION">As VeraCrypt temporarily changed the keyboard layout to the standard US keyboard layout, it is not possible to type characters by pressing keys while the right Alt key is held down. However, you can type most of such characters by pressing appropriate keys while the Shift key is held down.</entry>
<entry lang="en" key="KEYB_LAYOUT_CHANGE_PREVENTED">VeraCrypt prevented change of keyboard layout.</entry>
<entry lang="en" key="KEYB_LAYOUT_SYS_ENC_EXPLANATION">Note: The password will need to be typed in the pre-boot environment (before Windows starts) where non-US Windows keyboard layouts are not available. Therefore, the password must always be typed using the standard US keyboard layout. However, it is important to note that you do NOT need a real US keyboard. VeraCrypt automatically ensures that you can safely type the password (right now and in the pre-boot environment) even if you do NOT have a real US keyboard.</entry>
<entry lang="en" key="RESCUE_DISK_INFO">Before you can encrypt the partition/drive, you must create a VeraCrypt Rescue Disk (VRD), which serves the following purposes:\n\n- If the VeraCrypt Boot Loader, master key, or other critical data gets damaged, the VRD allows you to restore it (note, however, that you will still have to enter the correct password then).\n\n- If Windows gets damaged and cannot start, the VRD allows you to permanently decrypt the partition/drive before Windows starts.\n\n- The VRD will contain a backup of the present content of the first drive track (which typically contains a system loader or boot manager) and will allow you to restore it if necessary.\n\nThe VeraCrypt Rescue Disk ISO image will be created in the location specified below.</entry>
<entry lang="en" key="RESCUE_DISK_WIN_ISOBURN_PRELAUNCH_NOTE">After you click OK, Microsoft Windows Disc Image Burner will be launched. Please use it to burn the VeraCrypt Rescue Disk ISO image to a CD or DVD.\n\nAfter you do so, return to the VeraCrypt Volume Creation Wizard and follow its instructions.</entry>
<entry lang="en" key="RESCUE_DISK_BURN_INFO">The Rescue Disk image has been created and stored in this file:\n%s\n\nNow you need to burn it to a CD or DVD.\n\n%lsAfter you burn the Rescue Disk, click Next to verify that it has been correctly burned.</entry>
<entry lang="en" key="RESCUE_DISK_BURN_INFO_NO_CHECK">The Rescue Disk image has been created and stored in this file:\n%s\n\nNow you should either burn the image to a CD/DVD or move it to a safe location for later use.\n\n%lsClick Next to continue.</entry>
<entry lang="en" key="RESCUE_DISK_BURN_INFO_NONWIN_ISO_BURNER">IMPORTANT: Note that the file must be written to the CD/DVD as an ISO disk image (not as an individual file). For information on how to do so, please refer to the documentation of your CD/DVD recording software. If you do not have any CD/DVD recording software that can write the ISO disk image to a CD/DVD, click the link below to download such free software.\n\n</entry>
<entry lang="en" key="LAUNCH_WIN_ISOBURN">Launch Microsoft Windows Disc Image Burner</entry>
<entry lang="en" key="RESCUE_DISK_BURN_NO_CHECK_WARN">WARNING: If you already created a VeraCrypt Rescue Disk in the past, it cannot be reused for this system partition/drive because it was created for a different master key! Every time you encrypt a system partition/drive, you must create a new VeraCrypt Rescue Disk for it even if you use the same password.</entry>
<entry lang="en" key="CANNOT_SAVE_SYS_ENCRYPTION_SETTINGS">Error: Cannot save system encryption settings.</entry>
<entry lang="en" key="CANNOT_INITIATE_SYS_ENCRYPTION_PRETEST">Cannot initiate the system encryption pretest.</entry>
<entry lang="en" key="CANNOT_INITIATE_HIDDEN_OS_CREATION">Cannot initiate the process of creation of the hidden operating system.</entry>
<entry lang="en" key="WIPE_MODE_TITLE">Wipe Mode</entry>
<entry lang="en" key="INPLACE_ENC_WIPE_MODE_INFO">On some types of storage media, when data is overwritten with other data, it may be possible to recover the overwritten data using techniques such as magnetic force microscopy. This also applies to data that are overwritten with their encrypted form (which happens when VeraCrypt initially encrypts an unencrypted partition or drive). According to some studies and governmental publications, recovery of overwritten data can be prevented (or made very difficult) by overwriting the data with pseudorandom and certain non-random data a certain number of times. Therefore, if you believe that an adversary might be able to use such techniques to recover the data you intend to encrypt, you may want to select one of the wipe modes (existing data will NOT be lost). Note that wiping will NOT be performed after the partition/drive is encrypted. When the partition/drive is fully encrypted, no unencrypted data is written to it. Any data being written to it is first encrypted on the fly in memory and only then is the (encrypted) data written to the disk.</entry>
<entry lang="en" key="WIPE_MODE_INFO">On some types of storage media, when data is overwritten with other data (e.g. when the data is erased), it may be possible to recover the overwritten data using techniques such as magnetic force microscopy. According to some studies and governmental publications, recovery of overwritten data can be prevented (or made very difficult) by overwriting the data with pseudorandom and certain non-random data a certain number of times. Therefore, if you believe that an adversary might be able to use such techniques to recover the data that is to be erased, you may want to select one of the multi-pass wipe modes.\n\nNote: The more wipe passes you use, the longer it takes to erase the data.</entry>
<entry lang="en" key="DEVICE_WIPE_PAGE_TITLE">Wiping</entry>
<entry lang="en" key="DEVICE_WIPE_PAGE_INFO_HIDDEN_OS">\nNote: You can interrupt the process of wiping, shut down your computer, start the hidden system again and then resume the process (this wizard will be launched automatically). However, if you interrupt it, the entire process of wiping will have to start from the beginning.</entry>
<entry lang="en" key="DEVICE_WIPE_PAGE_INFO">\n\nNote: If you interrupt the process of wiping and then attempt to resume it, the entire process will have to start from the beginning.</entry>
<entry lang="en" key="CONFIRM_WIPE_ABORT">Do you want to abort the process of wiping?</entry>
<entry lang="en" key="CONFIRM_WIPE_START">Warning: The entire content of the selected partition/device will be erased and lost.</entry>
<entry lang="en" key="CONFIRM_WIPE_START_DECOY_SYS_PARTITION">The entire content of the partition where the original system resides will be erased.\n\nNote: The entire content of the partition that is to be erased has been copied to this hidden system partition.</entry>
<entry lang="en" key="WIPE_MODE_WARN">WARNING: Note that when you choose e.g. the 3-pass wipe mode, the time necessary to encrypt the partition/drive will be up to 4 times longer. Likewise, if you choose the 35-pass wipe mode, it will be up to 36 times longer (it might even take several weeks).\n\nHowever, please note that wiping will NOT be performed after the partition/drive is fully encrypted. When the partition/drive is fully encrypted, no unencrypted data is written to it. Any data being written to it is first encrypted on the fly in memory and only then is the (encrypted) data written to the disk (so the performance will NOT be affected).\n\nAre you sure you want to use the wipe mode?</entry>
<entry lang="en" key="WIPE_MODE_NONE">None (fastest)</entry>
<entry lang="en" key="WIPE_MODE_1_RAND">1-pass (random data)</entry>
<entry lang="en" key="WIPE_MODE_3_DOD_5220">3-pass (US DoD 5220.22-M)</entry>
<entry lang="en" key="WIPE_MODE_7_DOD_5220">7-pass (US DoD 5220.22-M)</entry>
<entry lang="en" key="WIPE_MODE_35_GUTMANN">35-pass ("Gutmann")</entry>
<entry lang="en" key="WIPE_MODE_256">256-pass</entry>
<entry lang="en" key="SYS_MULTI_BOOT_MODE_TITLE">Number of Operating Systems</entry>
<entry lang="en" key="MULTI_BOOT_FOR_ADVANCED_ONLY">WARNING: Inexperienced users should never attempt to encrypt Windows in multi-boot configurations.\n\nContinue?</entry>
<entry lang="en" key="HIDDEN_OS_MULTI_BOOT">When creating/using a hidden operating system, VeraCrypt supports multi-boot configurations only when the following conditions are met:\n\n- The currently running operating system must be installed on the boot drive, which must not contain any other operating systems.\n\n- Operating systems installed on other drives must not use any boot loader residing on the drive on which the currently running operating system is installed.\n\nAre the above conditions met?</entry>
<entry lang="en" key="UNSUPPORTED_HIDDEN_OS_MULTI_BOOT_CFG">VeraCrypt does not support this multi-boot configuration when creating/using a hidden operating system.</entry>
<entry lang="en" key="SYSENC_MULTI_BOOT_SYS_EQ_BOOT_TITLE">Boot Drive</entry>
<entry lang="en" key="SYSENC_MULTI_BOOT_SYS_EQ_BOOT_HELP">Is the currently running operating system installed on the boot drive?\n\nNote: Sometimes, Windows is not installed on the same drive as the Windows boot loader (boot partition). If that is the case, select 'No'.</entry>
<entry lang="en" key="SYS_PARTITION_MUST_BE_ON_BOOT_DRIVE">VeraCrypt currently does not support encrypting an operating system that does not boot from the drive on which it is installed.</entry>
<entry lang="en" key="SYSENC_MULTI_BOOT_NBR_SYS_DRIVES_TITLE">Number of System Drives</entry>
<entry lang="en" key="SYSENC_MULTI_BOOT_NBR_SYS_DRIVES_HELP">How many drives contain an operating system?\n\nNote: For example, if you have any operating system (e.g. Windows, Mac OS X, Linux, etc.) installed on your primary drive and any additional operating system installed on your secondary drive, select '2 or more'.</entry>
<entry lang="en" key="WDE_UNSUPPORTED_FOR_MULTIPLE_SYSTEMS_ON_ONE_DRIVE">VeraCrypt currently does not support encrypting a whole drive that contains multiple operating systems.\n\nPossible Solutions:\n\n- You can still encrypt one of the systems if you go back and choose to encrypt only a single system partition (as opposed to choosing to encrypt the entire system drive).\n\n- Alternatively, you will be able to encrypt the entire drive if you move some of the systems to other drives leaving only one system on the drive you want to encrypt.</entry>
<entry lang="en" key="SYSENC_MULTI_BOOT_ADJACENT_SYS_TITLE">Multiple Systems on Single Drive</entry>
<entry lang="en" key="SYSENC_MULTI_BOOT_ADJACENT_SYS_HELP">Are there any other operating systems installed on the drive on which the currently running operating system is installed?\n\nNote: For example, if the currently running operating system is installed on the drive #0, which contains several partitions, and if one of the partitions contains Windows and another partition contains any additional operating system (e.g. Windows, Mac OS X, Linux, etc.), select 'Yes'.</entry>
<entry lang="en" key="SYSENC_MULTI_BOOT_NONWIN_BOOT_LOADER_TITLE">Non-Windows Boot Loader</entry>
<entry lang="en" key="SYSENC_MULTI_BOOT_NONWIN_BOOT_LOADER_HELP">Is a non-Windows boot loader (or boot manager) installed in the master boot record (MBR)?\n\nNote: For example, if the first track of the boot drive contains GRUB, LILO, XOSL, or some other non-Windows boot manager (or boot loader), select 'Yes'.</entry>
<entry lang="en" key="SYSENC_MULTI_BOOT_OUTCOME_TITLE">Multi-Boot</entry>
<entry lang="en" key="CUSTOM_BOOT_MANAGERS_IN_MBR_UNSUPPORTED">VeraCrypt currently does not support multi-boot configurations where a non-Windows boot loader is installed in the Master Boot Record.\n\nPossible Solutions:\n\n- If you use a boot manager to boot Windows and Linux, move the boot manager (typically, GRUB) from the Master Boot Record to a partition. Then start this wizard again and encrypt the system partition/drive. Note that the VeraCrypt Boot Loader will become your primary boot manager and it will allow you to launch the original boot manager (e.g. GRUB) as your secondary boot manager (by pressing Esc in the VeraCrypt Boot Loader screen) and thus you will be able boot Linux.</entry>
<entry lang="en" key="WINDOWS_BOOT_LOADER_HINTS">If the currently running operating system is installed on the boot partition, then, after you encrypt it, you will need to enter the correct password even if you want to start any other unencrypted Windows system(s) (as they will share a single encrypted Windows boot loader/manager).\n\nIn contrast, if the currently running operating system is not installed on the boot partition (or if the Windows boot loader/manager is not used by any other system), then, after you encrypt this system, you will not need to enter the correct password to boot the other unencrypted system(s) -- you will only need to press the Esc key to start the unencrypted system (if there are multiple unencrypted systems, you will also need to choose which system to start in the VeraCrypt Boot Manager menu).\n\nNote: Typically, the earliest installed Windows system is installed on the boot partition.</entry>
<entry lang="en" key="SYSENC_PRE_DRIVE_ANALYSIS_TITLE">Encryption of Host Protected Area</entry>
<entry lang="en" key="SYSENC_PRE_DRIVE_ANALYSIS_HELP">At the end of many drives, there is an area that is normally hidden from the operating system (such areas are usually referred to as Host Protected Areas). However, some programs can read and write data from/to such areas.\n\nWARNING: Some computer manufacturers may use such areas to store tools and data for RAID, system recovery, system setup, diagnostic, or other purposes. If such tools or data must be accessible before booting, the hidden area should NOT be encrypted (choose 'No' above).\n\nDo you want VeraCrypt to detect and encrypt such a hidden area (if any) at the end of the system drive?</entry>
- <entry lang="en" key="SYSENC_TYPE_PAGE_TITLE">Encrypt Windows Drive (%c:)</entry>
+ <entry lang="en" key="SYSENC_TYPE_PAGE_TITLE">Type of System Encryption</entry>
<entry lang="en" key="SYSENC_NORMAL_TYPE_HELP">Select this option if you merely want to encrypt the system partition or the entire system drive.</entry>
<entry lang="en" key="SYSENC_HIDDEN_TYPE_HELP">It may happen that you are forced by somebody to decrypt the operating system. There are many situations where you cannot refuse to do so (for example, due to extortion). If you select this option, you will create a hidden operating system whose existence should be impossible to prove (provided that certain guidelines are followed). Thus, you will not have to decrypt or reveal the password to the hidden operating system. For a detailed explanation, please click the link below.</entry>
<entry lang="en" key="HIDDEN_OS_PREINFO">It may happen that you are forced by somebody to decrypt the operating system. There are many situations where you cannot refuse to do so (for example, due to extortion).\n\nUsing this wizard, you can create a hidden operating system whose existence should be impossible to prove (provided that certain guidelines are followed). Thus, you will not have to decrypt or reveal the password for the hidden operating system.</entry>
<entry lang="en" key="SYSENC_HIDDEN_OS_REQ_CHECK_PAGE_TITLE">Hidden Operating System</entry>
<entry lang="en" key="SYSENC_HIDDEN_OS_REQ_CHECK_PAGE_HELP">In the following steps, you will create two VeraCrypt volumes (outer and hidden) within the first partition behind the system partition. The hidden volume will contain the hidden operating system (OS). VeraCrypt will create the hidden OS by copying the content of the system partition (where the currently running OS is installed) to the hidden volume. To the outer volume, you will copy some sensitive looking files that you actually do NOT want to hide. They will be there for anyone forcing you to disclose the password for the hidden OS partition. You can reveal the password for the outer volume within the hidden OS partition (the existence of the hidden OS remains secret).\n\nFinally, on the system partition of the currently running OS, you will install a new OS, so-called decoy OS, and encrypt it. It must not contain sensitive data and will be there for anyone forcing you to reveal your pre-boot authentication password. In total, there will be three passwords. Two of them can be disclosed (for the decoy OS and outer volume). If you use the third one, the hidden OS will start.</entry>
<entry lang="en" key="SYSENC_DRIVE_ANALYSIS_TITLE">Detecting Hidden Sectors</entry>
<entry lang="en" key="SYSENC_DRIVE_ANALYSIS_INFO">Please wait while VeraCrypt is detecting possible hidden sectors at the end of the system drive. Note that it may take a long time to complete.\n\nNote: In very rare cases, on some computers, the system may become unresponsive during this detection process. If it happens, restart the computer, start VeraCrypt, repeat the previous steps but skip this detection process. Note that this issue is not caused by a bug in VeraCrypt.</entry>
<entry lang="en" key="SYS_ENCRYPTION_SPAN_TITLE">Area to Encrypt</entry>
<entry lang="en" key="SYS_ENCRYPTION_SPAN_WHOLE_SYS_DRIVE_HELP">Select this option if you want to encrypt the entire drive on which the currently running Windows system is installed. The whole drive, including all its partitions, will be encrypted except the first track where the VeraCrypt Boot Loader will reside. Anyone who wants to access a system installed on the drive, or files stored on the drive, will need to enter the correct password each time before the system starts. This option cannot be used to encrypt a secondary or external drive if Windows is not installed on it and does not boot from it.</entry>
<entry lang="en" key="COLLECTING_RANDOM_DATA_TITLE">Collecting Random Data</entry>
<entry lang="en" key="KEYS_GEN_TITLE">Keys Generated</entry>
<entry lang="en" key="CD_BURNER_NOT_PRESENT">VeraCrypt has found no CD/DVD burner connected to your computer. VeraCrypt needs a CD/DVD burner to burn a bootable VeraCrypt Rescue Disk containing a backup of the encryption keys, VeraCrypt boot loader, original system loader, etc.\n\nWe strongly recommend that you burn the VeraCrypt Rescue Disk.</entry>
<entry lang="en" key="CD_BURNER_NOT_PRESENT_WILL_STORE_ISO">I have no CD/DVD burner but I will store the Rescue Disk ISO image on a removable drive (e.g. USB flash drive).</entry>
<entry lang="en" key="CD_BURNER_NOT_PRESENT_WILL_CONNECT_LATER">I will connect a CD/DVD burner to my computer later. Terminate the process now.</entry>
<entry lang="en" key="CD_BURNER_NOT_PRESENT_CONNECTED_NOW">A CD/DVD burner is connected to my computer now. Continue and write the Rescue Disk.</entry>
<entry lang="en" key="CD_BURNER_NOT_PRESENT_WILL_STORE_ISO_INFO">Please follow these steps:\n\n1) Connect a removable drive, such as a USB flash drive, to your computer now.\n\n2) Copy the VeraCrypt Rescue Disk image file (%s) to the removable drive.\n\nIn case you need to use the VeraCrypt Rescue Disk in the future, you will be able to connect your removable drive (containing the VeraCrypt Rescue Disk image) to a computer with a CD/DVD burner and create a bootable VeraCrypt Rescue Disk by burning the image to a CD or DVD. IMPORTANT: Note that the VeraCrypt Rescue Disk image file must be written to the CD/DVD as an ISO disk image (not as an individual file).</entry>
<entry lang="en" key="RESCUE_DISK_RECORDING_TITLE">Rescue Disk Recording</entry>
<entry lang="en" key="RESCUE_DISK_CREATED_TITLE">Rescue Disk Created</entry>
- <entry lang="en" key="SYS_ENCRYPTION_PRETEST_TITLE">System Encryption Test</entry>
+ <entry lang="en" key="SYS_ENCRYPTION_PRETEST_TITLE">System Encryption Pretest</entry>
<entry lang="en" key="RESCUE_DISK_DISK_VERIFIED_TITLE">Rescue Disk Verified</entry>
<entry lang="en" key="RESCUE_DISK_VERIFIED_INFO">\nThe VeraCrypt Rescue Disk has been successfully verified. Please remove it from the drive now and store it in a safe place.\n\nClick Next to continue.</entry>
<entry lang="en" key="REMOVE_RESCUE_DISK_FROM_DRIVE">WARNING: During the next steps, the VeraCrypt Rescue Disk must not be in the drive. Otherwise, it will not be possible to complete the steps correctly.\n\nPlease remove it from the drive now and store it in a safe place. Then click OK.</entry>
<entry lang="en" key="PREBOOT_NOT_LOCALIZED">Warning: Due to technical limitations of the pre-boot environment, texts displayed by VeraCrypt in the pre-boot environment (i.e. before Windows starts) cannot be localized. The VeraCrypt Boot Loader user interface is completely in English.\n\nContinue?</entry>
<entry lang="en" key="SYS_ENCRYPTION_PRETEST_INFO">Before encrypting your system partition or drive, VeraCrypt needs to verify that everything works correctly.\n\nAfter you click Test, all the necessary components (for example, the pre-boot authentication component, i.e. the VeraCrypt Boot Loader) will be installed and your computer will be restarted. Then you will have to enter your password in the VeraCrypt Boot Loader screen that will appear before Windows starts. After Windows starts, you will be automatically informed about the result of this pretest.\n\nThe following device will be modified: Drive #%d\n\n\nIf you click Cancel now, nothing will be installed and the pretest will not be performed.</entry>
<entry lang="en" key="SYS_ENCRYPTION_PRETEST_INFO2_PORTION_1">IMPORTANT NOTES -- PLEASE READ OR PRINT (click 'Print'):\n\nNote that none of your files will be encrypted before you successfully restart your computer and start Windows. Thus, if anything fails, your data will NOT be lost. However, if something does go wrong, you might encounter difficulties in starting Windows. Therefore, please read (and, if possible, print) the following guidelines on what to do if Windows cannot start after you restart the computer.\n\n</entry>
<entry lang="en" key="SYS_ENCRYPTION_PRETEST_INFO2_PORTION_2">What to Do If Windows Cannot Start\n------------------------------------------------\n\nNote: These instructions are valid only if you have not started encrypting.\n\n- If Windows does not start after you enter the correct password (or if you repeatedly enter the correct password but VeraCrypt says that the password is incorrect), do not panic. Restart (power off and on) the computer, and in the VeraCrypt Boot Loader screen, press the Esc key on your keyboard (and if you have multiple systems, choose which to start). Then Windows should start (provided that it is not encrypted) and VeraCrypt will automatically ask whether you want to uninstall the pre-boot authentication component. Note that the previous steps do NOT work if the system partition/drive is encrypted (nobody can start Windows or access encrypted data on the drive without the correct password even if he or she follows the previous steps).\n\n</entry>
<entry lang="en" key="SYS_ENCRYPTION_PRETEST_INFO2_PORTION_3">- If the previous steps do not help or if the VeraCrypt Boot Loader screen does not appear (before Windows starts), insert the VeraCrypt Rescue Disk into your CD/DVD drive and restart your computer. If the VeraCrypt Rescue Disk screen does not appear (or if you do not see the 'Repair Options' item in the 'Keyboard Controls' section of the VeraCrypt Rescue Disk screen), it is possible that your BIOS is configured to attempt to boot from hard drives before CD/DVD drives. If that is the case, restart your computer, press F2 or Delete (as soon as you see a BIOS start-up screen), and wait until a BIOS configuration screen appears. If no BIOS configuration screen appears, restart (reset) the computer again and start pressing F2 or Delete repeatedly as soon as you restart (reset) the computer. When a BIOS configuration screen appears, configure your BIOS to boot from the CD/DVD drive first (for information on how to do so, please refer to the documentation for your BIOS/motherboard or contact your computer vendor's technical support team for assistance). Then restart your computer. The VeraCrypt Rescue Disk screen should appear now. In the VeraCrypt Rescue Disk screen, select 'Repair Options' by pressing F8 on your keyboard. From the 'Repair Options' menu, select 'Restore original system loader'. Then remove the Rescue Disk from your CD/DVD drive and restart your computer. Windows should start normally (provided that it is not encrypted).\n\n</entry>
<entry lang="en" key="SYS_ENCRYPTION_PRETEST_INFO2_PORTION_4">Note that the previous steps do NOT work if the system partition/drive is encrypted (nobody can start Windows or access encrypted data on the drive without the correct password even if he or she follows the previous steps).\n\n\nNote that even if you lose your VeraCrypt Rescue Disk and an attacker finds it, he or she will NOT be able to decrypt the system partition or drive without the correct password.</entry>
- <entry lang="en" key="SYS_ENCRYPTION_PRETEST_RESULT_TITLE">Pretest Successfully Completed</entry>
- <entry lang="en" key="SYS_ENCRYPTION_PRETEST_RESULT_INFO">If the encryption is interrupted you can resume it restarting VeraCrypt and selecting 'System' > 'Resume Interrupted Process'\n\nPlease make sure, that your device does not run out of power during the encryption process.</entry>
- <entry lang="en" key="SYSENC_ENCRYPTION_PAGE_INFO">Make sure that your device does not run out of power.\nIf the encryption is interrupted you can resume it restarting VeraCrypt and selecting 'System' > 'Resume Interrupted Process'.</entry>
+ <entry lang="en" key="SYS_ENCRYPTION_PRETEST_RESULT_TITLE">Pretest Completed</entry>
+ <entry lang="en" key="SYS_ENCRYPTION_PRETEST_RESULT_INFO">The pretest has been successfully completed.\n\nWARNING: Please note that if power supply is suddenly interrupted while encrypting existing data in place, or when the operating system crashes due to a software error or hardware malfunction while VeraCrypt is encrypting existing data in place, portions of the data will be corrupted or lost. Therefore, before you start encrypting, please make sure that you have backup copies of the files you want to encrypt. If you do not, please back up the files now (you can click Defer, back up the files, then run VeraCrypt again anytime, and select 'System' &gt; 'Resume Interrupted Process' to start encrypting).\n\nWhen ready, click Encrypt to start encrypting.</entry>
+ <entry lang="en" key="SYSENC_ENCRYPTION_PAGE_INFO">You can click Pause or Defer anytime to interrupt the process of encryption or decryption, exit this wizard, restart or shut down your computer, and then resume the process, which will continue from the point it was stopped. To prevent slowdown when the system or applications write or read data from the system drive, VeraCrypt automatically waits until the data is written or read (see Status above) and then automatically continues encrypting or decrypting.</entry>
<entry lang="en" key="NONSYS_INPLACE_ENC_ENCRYPTION_PAGE_INFO">\n\nYou can click Pause or Defer anytime to interrupt the process of encryption, exit this wizard, restart or shut down your computer, and then resume the process, which will continue from the point it was stopped. Note that the volume cannot be mounted until it has been fully encrypted.</entry>
<entry lang="en" key="NONSYS_INPLACE_DEC_DECRYPTION_PAGE_INFO">\n\nYou can click Pause or Defer anytime to interrupt the process of decryption, exit this wizard, restart or shut down the computer, and then resume the process, which will continue from the point where it was stopped. Note that the volume cannot be mounted until it has been fully decrypted.</entry>
<entry lang="en" key="SYSENC_HIDDEN_OS_INITIAL_INFO_TITLE">Hidden System Started</entry>
<entry lang="en" key="SYSENC_HIDDEN_OS_WIPE_INFO_TITLE">Original System</entry>
<entry lang="en" key="SYSENC_HIDDEN_OS_WIPE_INFO">Windows creates (typically, without your knowledge or consent) various log files, temporary files, etc., on the system partition. It also saves the content of RAM to hibernation and paging files located on the system partition. Therefore, if an adversary analyzed files stored on the partition where the original system (of which the hidden system is a clone) resides, he might find out, for example, that you used the VeraCrypt wizard in the hidden-system-creation mode (which might indicate the existence of a hidden operating system on your computer).\n\nTo prevent such issues, VeraCrypt will, in the next steps, securely erase the entire content of the partition where the original system resides. Afterwards, in order to achieve plausible deniability, you will need to install a new system on the partition and encrypt it. Thus you will create the decoy system and the whole process of creation of the hidden operating system will be completed.</entry>
<entry lang="en" key="OS_WIPING_NOT_FINISHED_ASK">The hidden operating system has been successfully created. However, before you can start using it (and achieve plausible deniability), you need to securely erase (using VeraCrypt) the entire content of the partition where the currently running operating system is installed. Before you can do that, you need to restart the computer and, in the VeraCrypt Boot Loader screen (which appears before Windows starts), enter the pre-boot authentication password for the hidden operating system. Then, after the hidden system starts, the VeraCrypt wizard will be launched automatically.\n\nNote: If you choose to terminate the process of creation of the hidden operating system now, you will NOT be able to resume the process and the hidden system will NOT be accessible (because the VeraCrypt Boot Loader will be removed).</entry>
<entry lang="en" key="HIDDEN_OS_CREATION_NOT_FINISHED_ASK">You have scheduled the process of creation of a hidden operating system. The process has not been completed yet. To complete it, you need to restart the computer and, in the VeraCrypt Boot Loader screen (which appears before Windows starts), enter the password for the hidden operating system.\n\nNote: If you choose to terminate the process of creation of the hidden operating system now, you will NOT be able to resume the process.</entry>
<entry lang="en" key="HIDDEN_OS_CREATION_NOT_FINISHED_CHOICE_RETRY">Restart the computer and proceed</entry>
<entry lang="en" key="HIDDEN_OS_CREATION_NOT_FINISHED_CHOICE_TERMINATE">Permanently terminate the process of creation of the hidden operating system</entry>
<entry lang="en" key="HIDDEN_OS_CREATION_NOT_FINISHED_CHOICE_ASK_LATER">Do nothing now and ask again later</entry>
<entry lang="en" key="RESCUE_DISK_HELP_PORTION_1">\nIF POSSIBLE, PLEASE PRINT THIS TEXT (click 'Print' below).\n\n\nHow and When to Use VeraCrypt Rescue Disk (After Encrypting)\n-----------------------------------------------------------------------------------\n\n</entry>
<entry lang="en" key="RESCUE_DISK_HELP_PORTION_2">I. How to Boot VeraCrypt Rescue Disk\n\nTo boot a VeraCrypt Rescue Disk, insert it into your CD/DVD drive and restart your computer. If the VeraCrypt Rescue Disk screen does not appear (or if you do not see the 'Repair Options' item in the 'Keyboard Controls' section of the screen), it is possible that your BIOS is configured to attempt to boot from hard drives before CD/DVD drives. If that is the case, restart your computer, press F2 or Delete (as soon as you see a BIOS start-up screen), and wait until a BIOS configuration screen appears. If no BIOS configuration screen appears, restart (reset) the computer again and start pressing F2 or Delete repeatedly as soon as you restart (reset) the computer. When a BIOS configuration screen appears, configure your BIOS to boot from the CD/DVD drive first (for information on how to do so, please refer to the documentation for your BIOS/motherboard or contact your computer vendor's technical support team for assistance). Then restart your computer. The VeraCrypt Rescue Disk screen should appear now. Note: In the VeraCrypt Rescue Disk screen, you can select 'Repair Options' by pressing F8 on your keyboard.\n\n\n</entry>
<entry lang="en" key="RESCUE_DISK_HELP_PORTION_3">II. When and How to Use VeraCrypt Rescue Disk (After Encrypting)\n\n</entry>
<entry lang="en" key="RESCUE_DISK_HELP_PORTION_4">1) If the VeraCrypt Boot Loader screen does not appear after you start your computer (or if Windows does not boot), the VeraCrypt Boot Loader may be damaged. The VeraCrypt Rescue Disk allows you to restore it and thus to regain access to your encrypted system and data (however, note that you will still have to enter the correct password then). In the Rescue Disk screen, select 'Repair Options' > 'Restore VeraCrypt Boot Loader'. Then press 'Y' to confirm the action, remove the Rescue Disk from your CD/DVD drive and restart your computer.\n\n</entry>
<entry lang="en" key="RESCUE_DISK_HELP_PORTION_5">2) If you repeatedly enter the correct password but VeraCrypt says that the password is incorrect, the master key or other critical data may be damaged. The VeraCrypt Rescue Disk allows you to restore them and thus to regain access to your encrypted system and data (however, note that you will still have to enter the correct password then). In the Rescue Disk screen, select 'Repair Options' > 'Restore key data'. Then enter your password, press 'Y' to confirm the action, remove the Rescue Disk from your CD/DVD drive, and restart your computer.\n\n</entry>
<entry lang="en" key="RESCUE_DISK_HELP_PORTION_6">3) If the VeraCrypt Boot Loader is damaged, you can avoid running it by booting directly from the VeraCrypt Rescue Disk. Insert your Rescue Disk into your CD/DVD drive and then enter your password in the Rescue Disk screen.\n\n</entry>
<entry lang="en" key="RESCUE_DISK_HELP_PORTION_7">4) If Windows is damaged and cannot start, the VeraCrypt Rescue Disk allows you to permanently decrypt the partition/drive before Windows starts. In the Rescue Disk screen, select 'Repair Options' > 'Permanently decrypt system partition/drive'. Enter the correct password and wait until decryption is complete. Then you can e.g. boot your MS Windows setup CD/DVD to repair your Windows installation.\n\n</entry>
<entry lang="en" key="RESCUE_DISK_HELP_PORTION_8">Note: Alternatively, if Windows is damaged (cannot start) and you need to repair it (or access files on it), you can avoid decrypting the system partition/drive by following these steps: If you have multiple operating systems installed on your computer, boot the one that does not require pre-boot authentication. If you do not have multiple operating systems installed on your computer, you can boot a WinPE or BartPE CD/DVD or you can connect your system drive as a secondary or external drive to another computer and then boot the operating system installed on the computer. After you boot a system, run VeraCrypt, click 'Select Device', select the affected system partition, click 'OK', select 'System' > 'Mount Without Pre-Boot Authentication', enter your pre-boot authentication password and click 'OK'. The partition will be mounted as a regular VeraCrypt volume (data will be on-the-fly decrypted/encrypted in RAM on access, as usual).\n\n\n</entry>
<entry lang="en" key="RESCUE_DISK_HELP_PORTION_9">Note that even if you lose your VeraCrypt Rescue Disk and an attacker finds it, he or she will NOT be able to decrypt the system partition or drive without the correct password.</entry>
<entry lang="en" key="DECOY_OS_INSTRUCTIONS_PORTION_1">\n\nI M P O R T A N T -- PLEASE PRINT THIS TEXT IF POSSIBLE (click 'Print' below).\n\n\nNote: This text will be automatically displayed each time you start the hidden system until you start creating the decoy system.\n\n\n</entry>
<entry lang="en" key="DECOY_OS_INSTRUCTIONS_PORTION_2">How to Create Decoy System Safely and Securely\n----------------------------------------------------------------------------\n\nIn order to achieve plausible deniability, you need to create the decoy operating system now. To do so, follow these steps:\n\n</entry>
<entry lang="en" key="DECOY_OS_INSTRUCTIONS_PORTION_3">1) For security reasons, shut down your computer and leave it powered off for at least several minutes (the longer, the better). This is required to clear the memory, which contains sensitive data. Then turn on the computer but do not boot the hidden system.\n\n</entry>
<entry lang="en" key="DECOY_OS_INSTRUCTIONS_PORTION_4">2) Install Windows on the partition whose content has been erased (i.e. on the partition where the original system, of which the hidden system is a clone, was installed).\n\nIMPORTANT: WHEN YOU START INSTALLING THE DECOY SYSTEM, THE HIDDEN SYSTEM WILL *NOT* BE POSSIBLE TO BOOT (because the VeraCrypt Boot Loader will be erased by the Windows system installer). THIS IS NORMAL AND EXPECTED. PLEASE DO NOT PANIC. YOU WILL BE ABLE TO BOOT THE HIDDEN SYSTEM AGAIN AS SOON AS YOU START ENCRYPTING THE DECOY SYSTEM (because VeraCrypt will then automatically install the VeraCrypt Boot Loader on the system drive).\n\nImportant: The size of the decoy system partition must remain the same as the size of the hidden volume (this condition is now met). Moreover, you must not create any partition between the decoy system partition and the partition where the hidden system resides.\n\n</entry>
<entry lang="en" key="DECOY_OS_INSTRUCTIONS_PORTION_5">3) Boot the decoy system (which you installed in step 2 and install VeraCrypt on it).\n\nKeep in mind that the decoy system must never contain any sensitive data.\n\n</entry>
<entry lang="en" key="DECOY_OS_INSTRUCTIONS_PORTION_6">4) On the decoy system, run VeraCrypt and select 'System' &gt; 'Encrypt System Partition/Drive'. The VeraCrypt Volume Creation Wizard window should appear.\n\nThe following steps apply to the VeraCrypt Volume Creation Wizard.\n\n</entry>
<entry lang="en" key="DECOY_OS_INSTRUCTIONS_PORTION_7">5) In the VeraCrypt Volume Creation Wizard, do NOT select the 'Hidden' option. Leave the 'Normal' option selected and click 'Next'.\n\n</entry>
<entry lang="en" key="DECOY_OS_INSTRUCTIONS_PORTION_8">6) Select the option 'Encrypt the Windows system partition' and then click 'Next'.\n\n</entry>
<entry lang="en" key="DECOY_OS_INSTRUCTIONS_PORTION_9">7) If there are only the hidden system and the decoy system installed on the computer, select the option 'Single-boot' (if there are more than these two systems installed on the computer, select 'Multi-boot'). Then click 'Next'.\n\n</entry>
<entry lang="en" key="DECOY_OS_INSTRUCTIONS_PORTION_10">8) IMPORTANT: In this step, FOR THE DECOY SYSTEM, YOU MUST SELECT THE SAME ENCRYPTION ALGORITHM AND HASH ALGORITHM THAT YOU SELECTED FOR THE HIDDEN SYSTEM! OTHERWISE, THE HIDDEN SYSTEM WILL BE INACCESSIBLE! In other words, the decoy system must be encrypted with the same encryption algorithm as the hidden system. Note: The reason is that the decoy system and the hidden system will share a single boot loader, which supports only a single algorithm, selected by the user (for each algorithm, there is a special version of the VeraCrypt Boot Loader).\n\n</entry>
<entry lang="en" key="DECOY_OS_INSTRUCTIONS_PORTION_11">9) In this step, choose a password for the decoy operating system. This will be the password that you will be able to reveal to an adversary if you are asked or forced to disclose your pre-boot authentication password (the other password you can reveal is the one for the outer volume). The existence of the third password (i.e. of the pre-boot authentication password for the hidden operating system) will remain secret.\n\nImportant: The password you choose for the decoy system must be substantially different from the one you chose for the hidden volume (i.e. for the hidden operating system).\n\n</entry>
<entry lang="en" key="DECOY_OS_INSTRUCTIONS_PORTION_12">10) Follow the remaining instructions in the wizard so as to encrypt the decoy operating system.\n\n\n\n</entry>
<entry lang="en" key="DECOY_OS_INSTRUCTIONS_PORTION_13">After Decoy System Is Created\n------------------------------------------------\n\nAfter you encrypt the decoy system, the whole process of creation of the hidden operating system will be completed and you will be able to use these three passwords:\n\n1) Pre-boot authentication password for the hidden operating system.\n\n2) Pre-boot authentication password for the decoy operating system.\n\n3) Password for the outer volume.\n\n</entry>
<entry lang="en" key="DECOY_OS_INSTRUCTIONS_PORTION_14">If you want to start the hidden operating system, you will just need to enter the password for the hidden operating system in the VeraCrypt Boot Loader screen (which appears after you turn on or restart your computer).\n\nIf you want to start the decoy operating system, you will just need to enter the password for the decoy operating system in the VeraCrypt Boot Loader screen.\n\nThe password for the decoy system can be disclosed to anyone forcing you to reveal your pre-boot authentication password. The existence of the hidden volume (and of the hidden operating system) will remain secret.\n\n</entry>
<entry lang="en" key="DECOY_OS_INSTRUCTIONS_PORTION_15">The third password (for the outer volume) can be disclosed to anyone forcing you to reveal the password for the first partition behind the system partition, where both the outer volume and the hidden volume (containing the hidden operating system) reside. The existence of the hidden volume (and of the hidden operating system) will remain secret.\n\n\n</entry>
<entry lang="en" key="DECOY_OS_INSTRUCTIONS_PORTION_16">If you revealed the password for the decoy system to an adversary and he asked you why the free space of the (decoy) system partition contains random data, you could answer, for example: "The partition previously contained a system encrypted by VeraCrypt, but I forgot the pre-boot authentication password (or the system was damaged and stopped booting), so I had to reinstall Windows and encrypt the partition again."\n\n\n</entry>
<entry lang="en" key="DECOY_OS_INSTRUCTIONS_PORTION_17">If all the instructions are followed and if the precautions and requirements listed in the section "Security Requirements and Precautions Pertaining to Hidden Volumes" in the VeraCrypt User's Guide are followed, it should be impossible to prove that the hidden volume and hidden operating system exist, even when the outer volume is mounted or when the decoy operating system is decrypted or started.\n\nIf you save a copy of this text or print it (strongly recommended, unless your printer stores copies of documents it prints on its internal drive), you should destroy any copies of it after you have created the decoy system and after you have understood all the information contained in the text (otherwise, if such a copy was found, it might indicate that there is a hidden operating system on this computer).\n\n</entry>
<entry lang="en" key="DECOY_OS_INSTRUCTIONS_PORTION_18">WARNING: IF YOU DO NOT PROTECT THE HIDDEN VOLUME (for information on how to do so, refer to the section "Protection of Hidden Volumes Against Damage" in the VeraCrypt User's Guide), DO NOT WRITE TO THE OUTER VOLUME (note that the decoy operating system is NOT installed in the outer volume). OTHERWISE, YOU MAY OVERWRITE AND DAMAGE THE HIDDEN VOLUME (AND THE HIDDEN OPERATING SYSTEM WITHIN IT)!</entry>
<entry lang="en" key="HIDDEN_OS_CREATION_PREINFO_TITLE">Operating System Cloning</entry>
<entry lang="en" key="HIDDEN_OS_CREATION_PREINFO_HELP">In the next steps, VeraCrypt will create the hidden operating system by copying the content of the system partition to the hidden volume (data being copied will be encrypted on the fly with an encryption key different from the one that will be used for the decoy operating system).\n\nPlease note that the process will be performed in the pre-boot environment (before Windows starts) and it may take a long time to complete; several hours or even several days (depending on the size of the system partition and on the performance of your computer).\n\nYou will be able to interrupt the process, shut down your computer, start the operating system and then resume the process. However, if you interrupt it, the entire process of copying the system will have to start from the beginning (because the content of the system partition must not change during cloning).</entry>
<entry lang="en" key="CONFIRM_CANCEL_HIDDEN_OS_CREATION">Do you want to cancel the entire process of creation of the hidden operating system?\n\nNote: You will NOT be able to resume the process if you cancel it now.</entry>
<entry lang="en" key="CONFIRM_CANCEL_SYS_ENC_PRETEST">Do you want to cancel the system encryption pretest?</entry>
<entry lang="en" key="BOOT_PRETEST_FAILED_RETRY">The VeraCrypt system encryption pretest failed. Do you want to try again?\n\nIf you select 'No', the pre-boot authentication component will be uninstalled.\n\nNotes:\n\n- If the VeraCrypt Boot Loader did not ask you to enter the password before Windows started, it is possible that your operating system does not boot from the drive on which it is installed. This is not supported.\n\n- If you used an encryption algorithm other than AES and the pretest failed (and you entered the password), it may have been caused by an inappropriately designed driver. Select 'No', and try encrypting the system partition/drive again, but use the AES encryption algorithm (which has the lowest memory requirements).\n\n- For more possible causes and solutions, see: https://www.veracrypt.fr/en/Troubleshooting.html</entry>
<entry lang="en" key="SYS_DRIVE_NOT_ENCRYPTED">The system partition/drive does not appear to be encrypted (neither partially nor fully).</entry>
<entry lang="en" key="SETUP_FAILED_BOOT_DRIVE_ENCRYPTED">Your system partition/drive is encrypted (partially or fully).\n\nPlease decrypt your system partition/drive entirely before proceeding. To do so, select 'System' &gt; 'Permanently Decrypt System Partition/Drive' from the menu bar of the main VeraCrypt window.</entry>
<entry lang="en" key="SETUP_FAILED_BOOT_DRIVE_ENCRYPTED_DOWNGRADE">When the system partition/drive is encrypted (partially or fully), you cannot downgrade VeraCrypt (but you can upgrade it or reinstall the same version).</entry>
<entry lang="en" key="SYS_ENCRYPTION_OR_DECRYPTION_IN_PROGRESS">Your system partition/drive is currently being encrypted, decrypted, or otherwise modified. Please interrupt the encryption/decryption/modification process (or wait until it is complete) before proceeding.</entry>
<entry lang="en" key="SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE">An instance of the VeraCrypt Volume Creation Wizard is currently running on this system and performing or preparing encryption/decryption of the system partition/drive. Before you proceed, please wait for it to finish or close it. If you cannot close it, please restart your computer before proceeding.</entry>
<entry lang="en" key="SYSTEM_ENCRYPTION_NOT_COMPLETED">The process of encryption or decryption of the system partition/drive has not been completed. Please wait until it is complete before proceeding.</entry>
<entry lang="en" key="ERR_ENCRYPTION_NOT_COMPLETED">Error: The process of encryption of the partition/drive has not been completed. It must be completed first.</entry>
<entry lang="en" key="ERR_NONSYS_INPLACE_ENC_INCOMPLETE">Error: The process of encryption or decryption of the partition/volume has not been completed. It must be completed first.\n\nNote: To resume the process, select 'Volumes' &gt; 'Resume Interrupted Process' from the menu bar of the main VeraCrypt window.</entry>
<entry lang="en" key="ERR_SYS_HIDVOL_HEAD_REENC_MODE_WRONG">The password is correct, VeraCrypt has successfully decrypted the volume header and detected that this volume is a hidden system volume. However, you cannot modify the header of a hidden system volume this way.\n\nTo change the password for a hidden system volume, boot the operating system residing in the hidden volume, and then select 'System' &gt; 'Change Password' from the menu bar of the main VeraCrypt window.\n\nTo set the header key derivation algorithm, boot the hidden operating system and then select 'System' &gt; 'Set Header Key Derivation Algorithm'.</entry>
<entry lang="en" key="CANNOT_DECRYPT_HIDDEN_OS">VeraCrypt does not support in-place decryption of a hidden system partition.\n\nNote: If you want to decrypt the decoy system partition, boot the decoy system, and then select 'System' &gt; 'Permanently Decrypt System Partition/Drive' from the menu bar of the main VeraCrypt window.</entry>
<entry lang="en" key="ERR_PARAMETER_INCORRECT">Error: Incorrect/invalid parameter.</entry>
<entry lang="en" key="DEVICE_SELECTED_IN_NON_DEVICE_MODE">You have selected a partition or a device but the wizard mode you selected is suitable only for file containers.\n\nDo you want to change the wizard mode?</entry>
<entry lang="en" key="CONFIRM_CHANGE_WIZARD_MODE_TO_FILE_CONTAINER">Do you want to create a VeraCrypt file container instead?</entry>
<entry lang="en" key="CONFIRM_SYSTEM_ENCRYPTION_MODE">You have selected the system partition/drive (or the boot partition), but the wizard mode you selected is suitable only for non-system partitions/drives.\n\nDo you want to set up pre-boot authentication (which means that you will need to enter your password each time before Windows boots/starts) and encrypt the system partition/drive?</entry>
<entry lang="en" key="CONFIRM_DECRYPT_SYS_DEVICE">Are you sure you want to permanently decrypt the system partition/drive?</entry>
<entry lang="en" key="CONFIRM_DECRYPT_SYS_DEVICE_CAUTION">CAUTION: If you permanently decrypt the system partition/drive, unencrypted data will be written to it.\n\nAre you really sure you want to permanently decrypt the system partition/drive?</entry>
<entry lang="en" key="CONFIRM_DECRYPT_NON_SYS_DEVICE">Are you sure you want to permanently decrypt the following volume?</entry>
<entry lang="en" key="CONFIRM_DECRYPT_NON_SYS_DEVICE_CAUTION">CAUTION: If you permanently decrypt the VeraCrypt volume, unencrypted data will be written to the disk.\n\nAre you really sure you want to permanently decrypt the selected volume?</entry>
<entry lang="en" key="CONFIRM_CASCADE_FOR_SYS_ENCRYPTION">Warning: If you use a cascade of ciphers for system encryption, you may encounter the following issues:\n\n1) The VeraCrypt Boot Loader is larger than normal and, therefore, there is not enough space in the first drive track for a backup of the VeraCrypt Boot Loader. Hence, whenever it gets damaged (which often happens, for example, during inappropriately designed anti-piracy activation procedures of certain programs), you will need to use the VeraCrypt Rescue Disk to boot or to repair the VeraCrypt Boot Loader.\n\n2) On some computers, resuming from hibernation takes longer.\n\nThese potential issues can be prevented by choosing a non-cascade encryption algorithm (e.g. AES).\n\nAre you sure you want to use a cascade of ciphers?</entry>
<entry lang="en" key="NOTE_CASCADE_FOR_SYS_ENCRYPTION">If you encounter any of the previously described problems, decrypt the partition/drive (if it is encrypted) and then try encrypting it again using a non-cascade encryption algorithm (e.g. AES).</entry>
<entry lang="en" key="UPDATE_TC_IN_DECOY_OS_FIRST">WARNING: For safety and security reasons, you should update VeraCrypt on the decoy operating system before you update it on the hidden operating system.\n\nTo do so, boot the decoy system and run the VeraCrypt installer from within it. Then boot the hidden system and run the installer from within it as well.\n\nNote: The decoy system and the hidden system share a single boot loader. If you upgraded VeraCrypt only on the hidden system (but not on the decoy system), the decoy system would contain a VeraCrypt driver and VeraCrypt applications whose version numbers are different from the version number of the VeraCrypt Boot Loader. Such a discrepancy might indicate that there is a hidden operating system on this computer.\n\n\nDo you want to continue?</entry>
<entry lang="en" key="UPDATE_TC_IN_HIDDEN_OS_TOO">The version number of the VeraCrypt Boot Loader that booted this operating system is different from the version number of the VeraCrypt driver (and of the VeraCrypt applications) installed on this system.\n\nYou should run the VeraCrypt installer (whose version number is the same as the one of the VeraCrypt Boot Loader) to update VeraCrypt on this operating system.</entry>
<entry lang="en" key="BOOT_LOADER_VERSION_DIFFERENT_FROM_DRIVER_VERSION">The version number of the VeraCrypt Boot Loader that booted this operating system is different from the version number of the VeraCrypt driver (and of the VeraCrypt applications) installed on this system. Note that older versions may contain bugs fixed in later versions.\n\nIf you did not boot from the VeraCrypt Rescue Disk, you should reinstall VeraCrypt or upgrade it to the latest stable version (the boot loader will be updated too).\n\nIf you booted from the VeraCrypt Rescue Disk, you should update it ('System' > 'Create Rescue Disk').</entry>
<entry lang="en" key="BOOT_LOADER_UPGRADE_OK">The VeraCrypt Boot Loader has been upgraded.\n\nIt is strongly recommended that you create a new VeraCrypt Rescue Disk (which will contain the new version of the VeraCrypt Boot Loader) by selecting 'System' > 'Create Rescue Disk' after you restart your computer.</entry>
<entry lang="en" key="BOOT_LOADER_UPGRADE_OK_HIDDEN_OS">The VeraCrypt Boot Loader has been upgraded.\n\nIt is strongly recommended that you boot the decoy operating system and then create a new VeraCrypt Rescue Disk (which will contain the new version of the VeraCrypt Boot Loader) by selecting 'System' > 'Create Rescue Disk'.</entry>
<entry lang="en" key="BOOT_LOADER_UPGRADE_FAILED">Failed to upgrade the VeraCrypt Boot Loader.</entry>
<entry lang="en" key="SYS_DRIVE_SIZE_PROBE_TIMEOUT">VeraCrypt failed to detect the real size of the system drive and, therefore, the size reported by the operating system (which may be smaller than the real size) will be used. Also note that this is not a bug in VeraCrypt.</entry>
<entry lang="en" key="HIDDEN_SECTOR_DETECTION_FAILED_PREVIOUSLY">WARNING: It appears that VeraCrypt has already tried to detect hidden sectors on this system drive. If you encountered any problems during the previous detection process, you can avoid the problems by skipping the detection of hidden sectors now. Note that if you do so, VeraCrypt will use the size reported by the operating system (which may be smaller than the real size of the drive).\n\nNote that this issue is not caused by a bug in VeraCrypt.</entry>
<entry lang="en" key="SKIP_HIDDEN_SECTOR_DETECTION">Skip detection of hidden sectors (use the size reported by the operating system)</entry>
<entry lang="en" key="RETRY_HIDDEN_SECTOR_DETECTION">Try to detect hidden sectors again</entry>
<entry lang="en" key="ENABLE_BAD_SECTOR_ZEROING">Error: Content of one or more sectors on the disk cannot be read (probably due to a physical defect).\n\nThe process of in-place encryption can continue only when the sectors have been made readable again. VeraCrypt can attempt to make these sectors readable by writing zeros to the sectors (subsequently such all-zero blocks would be encrypted). However, note that any data stored in the unreadable sectors will be lost. If you want to avoid that, you can attempt to recover portions of the corrupted data using appropriate third-party tools.\n\nNote: In case of physically damaged sectors (as opposed to mere data corruption and checksum errors) most types of storage devices internally reallocate the sectors when data is attempted to be written to them (so the existing data in the damaged sectors may remain unencrypted on the drive).\n\nDo you want VeraCrypt to write zeroes to unreadable sectors?</entry>
<entry lang="en" key="DISCARD_UNREADABLE_ENCRYPTED_SECTORS">Error: Content of one or more sectors on the disk cannot be read (probably due to a physical defect).\n\nTo be able to proceed with decryption, VeraCrypt will have to discard the content of the unreadable sectors (the content will be replaced with pseudorandom data). Please note that, before proceeding, you can attempt to recover portions of any corrupted data using appropriate third-party tools.\n\nDo you want VeraCrypt to discard data in the unreadable sectors now?</entry>
<entry lang="en" key="ZEROED_BAD_SECTOR_COUNT">Note: VeraCrypt has replaced the content of %I64d unreadable sectors (%s) with encrypted all-zero plaintext blocks.</entry>
<entry lang="en" key="SKIPPED_BAD_SECTOR_COUNT">Note: VeraCrypt has replaced the content of %I64d unreadable sectors (%s) with pseudorandom data.</entry>
<entry lang="en" key="ENTER_TOKEN_PASSWORD">Enter password/PIN for token '%s':</entry>
<entry lang="en" key="PKCS11_LIB_LOCATION_HELP">In order to allow VeraCrypt to access a security token or smart card, you need to install a PKCS #11 software library for the token or smart card first. Such a library may be supplied with the device or it may be available for download from the website of the vendor or other third parties.\n\nAfter you install the library, you can either select it manually by clicking 'Select Library' or you can let VeraCrypt find and select it automatically by clicking 'Auto-Detect Library' (only the Windows system directory will be searched).</entry>
<entry lang="en" key="SELECT_PKCS11_MODULE_HELP">Note: For the filename and location of the PKCS #11 library installed for your security token or smart card, please refer to the documentation supplied with the token, card, or third-party software.\n\nClick 'OK' to select the path and filename.</entry>
<entry lang="en" key="NO_PKCS11_MODULE_SPECIFIED">In order to allow VeraCrypt to access a security token or smart card, you need to select a PKCS #11 software library for the token/card first. To do so, select 'Settings' > 'Security Tokens'.</entry>
<entry lang="en" key="PKCS11_MODULE_INIT_FAILED">Failed to initialize PKCS #11 security token library.\n\nPlease make sure the specified path and filename refer to a valid PKCS #11 library. To specify a PKCS #11 library path and filename, select 'Settings' > 'Security Tokens'.</entry>
<entry lang="en" key="PKCS11_MODULE_AUTO_DETECTION_FAILED">No PKCS #11 library has been found in the Windows system directory.\n\nPlease make sure that a PKCS #11 library for your security token (or for your smart card) is installed (such a library may be supplied with the token/card or it may be available for download from the website of the vendor or other third parties). If it is installed in a directory other than the Windows system directory, click 'Select Library' to locate the library (e.g. in the folder where the software for the token/card is installed).</entry>
<entry lang="en" key="NO_TOKENS_FOUND">No security token found.\n\nPlease make sure your security token is connected to your computer and the correct device driver for your token is installed.</entry>
<entry lang="en" key="TOKEN_KEYFILE_NOT_FOUND">Security token keyfile not found.</entry>
<entry lang="en" key="TOKEN_KEYFILE_ALREADY_EXISTS">A security token keyfile with the same name already exists.</entry>
<entry lang="en" key="CONFIRM_SEL_FILES_DELETE">Do you want to delete the selected files?</entry>
<entry lang="en" key="INVALID_TOKEN_KEYFILE_PATH">Security token keyfile path is invalid.</entry>
<entry lang="en" key="SECURITY_TOKEN_ERROR">Security token error</entry>
<entry lang="en" key="CKR_PIN_INCORRECT">Password for security token is incorrect.</entry>
<entry lang="en" key="CKR_DEVICE_MEMORY">The security token does not have enough memory/space to perform the requested operation.\n\nIf you are attempting to import a keyfile, you should select a smaller file or use a keyfile generated by VeraCrypt (select 'Tools' > 'Keyfile Generator').</entry>
<entry lang="en" key="ALL_TOKEN_SESSIONS_CLOSED">All open security token sessions have been closed.</entry>
<entry lang="en" key="SELECT_TOKEN_KEYFILES">Select Security Token Keyfiles</entry>
<entry lang="en" key="TOKEN_SLOT_ID">Slot</entry>
<entry lang="en" key="TOKEN_NAME">Token name</entry>
<entry lang="en" key="TOKEN_DATA_OBJECT_LABEL">File name</entry>
<entry lang="en" key="BOOT_PASSWORD_CACHE_KEYBOARD_WARNING">IMPORTANT: Please note that pre-boot authentication passwords are always typed using the standard US keyboard layout. Therefore, a volume that uses a password typed using any other keyboard layout may be impossible to mount using a pre-boot authentication password (note that this is not a bug in VeraCrypt). To allow such a volume to be mounted using a pre-boot authentication password, follow these steps:\n\n1) Click 'Select File' or 'Select Device' and select the volume.\n2) Select 'Volumes' > 'Change Volume Password'.\n3) Enter the current password for the volume.\n4) Change the keyboard layout to English (US) by clicking the Language bar icon in the Windows taskbar and selecting 'EN English (United States)'.\n5) In VeraCrypt, in the field for the new password, type the pre-boot authentication password.\n6) Confirm the new password by retyping it in the confirmation field and click 'OK'.\nWARNING: Please keep in mind that if you follow these steps, the volume password will always have to be typed using the US keyboard layout (which is automatically ensured only in the pre-boot environment).</entry>
<entry lang="en" key="SYS_FAVORITES_KEYBOARD_WARNING">System favorite volumes will be mounted using the pre-boot authentication password. If any system favorite volume uses a different password, it will not be mounted.</entry>
<entry lang="en" key="SYS_FAVORITES_ADMIN_ONLY_INFO">Please note that if you need to prevent normal VeraCrypt volume actions (such as 'Dismount All', auto-dismount, etc.) from affecting system favorite volumes, you should enable the option 'Allow only administrators to view and dismount system favorite volumes in VeraCrypt'. In addition, when VeraCrypt is run without administrator privileges (the default on Windows Vista and later), system favorite volumes will not be displayed in the drive letter list in the main VeraCrypt application window.</entry>
<entry lang="en" key="SYS_FAVORITES_ADMIN_ONLY_WARNING">IMPORTANT: Please keep in mind that if this option is enabled and VeraCrypt does not have administrator privileges, mounted system favorite volumes are NOT displayed in the VeraCrypt application window and they cannot be dismounted. Therefore, if you need e.g. to dismount a system favorite volume, please right-click the VeraCrypt icon (in the Start menu) and select 'Run as administrator' first. The same limitation applies to the 'Dismount All' function, 'Auto-Dismount' functions, 'Dismount All' hot keys, etc.</entry>
<entry lang="en" key="SETTING_REQUIRES_REBOOT">Note that this setting takes effect only after the operating system is restarted.</entry>
<entry lang="en" key="COMMAND_LINE_ERROR">Error while parsing command line.</entry>
<entry lang="en" key="RESCUE_DISK">Rescue Disk</entry>
<entry lang="en" key="SELECT_FILE_AND_MOUNT">Select &amp;File and Mount...</entry>
<entry lang="en" key="SELECT_DEVICE_AND_MOUNT">Select &amp;Device and Mount...</entry>
<entry lang="en" key="DISABLE_NONADMIN_SYS_FAVORITES_ACCESS">Allow only administrators to view and dismount system favorite volumes in VeraCrypt</entry>
<entry lang="en" key="MOUNT_SYSTEM_FAVORITES_ON_BOOT">Mount system favorite volumes when Windows starts (in the initial phase of the startup procedure)</entry>
<entry lang="en" key="MOUNTED_VOLUME_DIRTY">Warning: The filesystem on the volume mounted as '%s' was not cleanly dismounted and thus may contain errors. Using a corrupted filesystem can cause data loss or data corruption.\n\nNote: Before you physically remove or switch off a device (such as a USB flash drive or an external hard drive) where a mounted VeraCrypt volume resides, you should always dismount the VeraCrypt volume in VeraCrypt first.\n\n\nDo you want Windows to attempt to detect and fix errors (if any) on the filesystem?</entry>
<entry lang="en" key="SYS_FAVORITE_VOLUME_DIRTY">Warning: One or more system favorite volumes were not cleanly dismounted and thus may contain filesystem errors. Please see the system event log for further details.\n\nUsing a corrupted filesystem can cause data loss or data corruption. You should check the affected system favorite volume(s) for errors (right-click each of them in VeraCrypt and select 'Repair Filesystem').</entry>
<entry lang="en" key="FILESYS_REPAIR_CONFIRM_BACKUP">Warning: Repairing a damaged filesystem using the Microsoft 'chkdsk' tool might cause loss of files in damaged areas. Therefore, it is recommended that you first back up the files stored on the VeraCrypt volume to another, healthy, VeraCrypt volume.\n\nDo you want to repair the filesystem now?</entry>
<entry lang="en" key="MOUNTED_CONTAINER_FORCED_READ_ONLY">Volume '%s' has been mounted as read-only because write access was denied.\n\nPlease make sure the security permissions of the file container allow you to write to it (right-click the container and select Properties > Security).\n\nNote that, due to a Windows issue, you may see this warning even after setting the appropriate security permissions. This is not caused by a bug in VeraCrypt. A possible solution is to move your container to, e.g., your 'Documents' folder.\n\nIf you intend to keep your volume read-only, set the read-only attribute of the container (right-click the container and select Properties > Read-only), which will suppress this warning.</entry>
<entry lang="en" key="MOUNTED_DEVICE_FORCED_READ_ONLY">Volume '%s' had to be mounted as read-only because write access was denied.\n\nPlease make sure no other application (e.g. antivirus software) is accessing the partition/device on which the volume is hosted.</entry>
<entry lang="en" key="MOUNTED_DEVICE_FORCED_READ_ONLY_WRITE_PROTECTION">Volume '%s' has been mounted as read-only because the operating system reported the host device to be write-protected.\n\nPlease note that some custom chipset drivers have been reported to cause writable media to falsely appear write-protected. This problem is not caused by VeraCrypt. It may be solved by updating or uninstalling any custom (non-Microsoft) chipset drivers that are currently installed on this system.</entry>
<entry lang="en" key="LIMIT_ENC_THREAD_POOL_NOTE">Note that the Hyper-Threading technology provides multiple logical cores per a single physical core. When Hyper Threading is enabled, the number selected above represents the number of logical processors/cores.</entry>
<entry lang="en" key="NUMBER_OF_THREADS">%d threads</entry>
<entry lang="en" key="DISABLED_HW_AES_AFFECTS_PERFORMANCE">Note that hardware-accelerated AES is disabled, which will affect benchmark results (worse performance).\n\nTo enable hardware acceleration, select 'Settings' > 'Performance' and enable the corresponding option.</entry>
<entry lang="en" key="LIMITED_THREAD_COUNT_AFFECTS_PERFORMANCE">Note that the number of threads is currently limited, which will affect benchmark results (worse performance).\n\nTo utilize the full potential of the processor(s), select 'Settings' > 'Performance' and disable the corresponding option.</entry>
<entry lang="en" key="ASK_REMOVE_DEVICE_WRITE_PROTECTION">Do you want VeraCrypt to attempt to disable write protection of the partition/drive?</entry>
<entry lang="en" key="CONFIRM_SETTING_DEGRADES_PERFORMANCE">WARNING: This setting may degrade performance.\n\nAre you sure you want to use this setting?</entry>
<entry lang="en" key="HOST_DEVICE_REMOVAL_DISMOUNT_WARN_TITLE">Warning: VeraCrypt volume auto-dismounted</entry>
<entry lang="en" key="HOST_DEVICE_REMOVAL_DISMOUNT_WARN">Before you physically remove or turn off a device containing a mounted volume, you should always dismount the volume in VeraCrypt first.\n\nUnexpected spontaneous dismount is usually caused by an intermittently failing cable, drive (enclosure), etc.</entry>
<entry lang="en" key="UNSUPPORTED_TRUECRYPT_FORMAT">This volume was created with TrueCrypt %x.%x but VeraCrypt supports only TrueCrypt volumes created with TrueCrypt 6.x/7.x series</entry>
- <entry lang="en" key="TEST">Start pretest</entry>
+ <entry lang="en" key="TEST">Test</entry>
<entry lang="en" key="KEYFILE">Keyfile</entry>
<entry lang="en" key="VKEY_08">Backspace</entry>
<entry lang="en" key="VKEY_09">Tab</entry>
<entry lang="en" key="VKEY_0C">Clear</entry>
<entry lang="en" key="VKEY_0D">Enter</entry>
<entry lang="en" key="VKEY_13">Pause</entry>
<entry lang="en" key="VKEY_14">Caps Lock</entry>
<entry lang="en" key="VKEY_20">Spacebar</entry>
<entry lang="en" key="VKEY_21">Page Up</entry>
<entry lang="en" key="VKEY_22">Page Down</entry>
<entry lang="en" key="VKEY_23">End</entry>
<entry lang="en" key="VKEY_24">Home</entry>
<entry lang="en" key="VKEY_25">Left Arrow</entry>
<entry lang="en" key="VKEY_26">Up Arrow</entry>
<entry lang="en" key="VKEY_27">Right Arrow</entry>
<entry lang="en" key="VKEY_28">Down Arrow</entry>
<entry lang="en" key="VKEY_29">Select Key</entry>
<entry lang="en" key="VKEY_2A">Print Key</entry>
<entry lang="en" key="VKEY_2B">Execute Key</entry>
<entry lang="en" key="VKEY_2C">Print Screen</entry>
<entry lang="en" key="VKEY_2D">Insert</entry>
<entry lang="en" key="VKEY_2E">Delete</entry>
<entry lang="en" key="VKEY_5D">Applications Key</entry>
<entry lang="en" key="VKEY_5F">Sleep</entry>
<entry lang="en" key="VKEY_90">Num Lock</entry>
<entry lang="en" key="VKEY_91">Scroll Lock</entry>
<entry lang="en" key="VKEY_A6">Browser Back</entry>
<entry lang="en" key="VKEY_A7">Browser Forward</entry>
<entry lang="en" key="VKEY_A8">Browser Refresh</entry>
<entry lang="en" key="VKEY_A9">Browser Stop</entry>
<entry lang="en" key="VKEY_AA">Browser Search</entry>
<entry lang="en" key="VKEY_AB">Browser Favorites</entry>
<entry lang="en" key="VKEY_AC">Browser Home</entry>
<entry lang="en" key="VKEY_AD">Mute</entry>
<entry lang="en" key="VKEY_AE">Volume Down</entry>
<entry lang="en" key="VKEY_AF">Volume Up</entry>
<entry lang="en" key="VKEY_B0">Next Track</entry>
<entry lang="en" key="VKEY_B1">Previous Track</entry>
<entry lang="en" key="VKEY_B2">Stop Media</entry>
<entry lang="en" key="VKEY_B3">Play/Pause Media</entry>
<entry lang="en" key="VKEY_B4">Start Mail Key</entry>
<entry lang="en" key="VKEY_B5">Select Media Key</entry>
<entry lang="en" key="VKEY_B6">Application 1</entry>
<entry lang="en" key="VKEY_B7">Application 2</entry>
<entry lang="en" key="VKEY_F6">Attn</entry>
<entry lang="en" key="VKEY_F7">CrSel</entry>
<entry lang="en" key="VKEY_F8">ExSel</entry>
<entry lang="en" key="VKEY_FA">Play</entry>
<entry lang="en" key="VKEY_FB">Zoom</entry>
<entry lang="en" key="VK_NUMPAD">NumPad</entry>
<entry lang="en" key="VK_SHIFT">Shift</entry>
<entry lang="en" key="VK_CONTROL">Control</entry>
<entry lang="en" key="VK_ALT">Alt</entry>
<entry lang="en" key="VK_WIN">Win</entry>
<entry lang="en" key="BYTE">B</entry>
<entry lang="en" key="KB">KiB</entry>
<entry lang="en" key="MB">MiB</entry>
<entry lang="en" key="GB">GiB</entry>
<entry lang="en" key="TB">TiB</entry>
<entry lang="en" key="PB">PiB</entry>
<entry lang="en" key="B_PER_SEC">B/s</entry>
<entry lang="en" key="KB_PER_SEC">KiB/s</entry>
<entry lang="en" key="MB_PER_SEC">MiB/s</entry>
<entry lang="en" key="GB_PER_SEC">GiB/s</entry>
<entry lang="en" key="TB_PER_SEC">TiB/s</entry>
<entry lang="en" key="PB_PER_SEC">PiB/s</entry>
<entry lang="en" key="TRIPLE_DOT_GLYPH_ELLIPSIS">…</entry>
<entry lang="en" key="IDC_BOOT_LOADER_CACHE_PIM">Include &amp;PIM when caching pre-boot authentication password</entry>
<entry lang="en" key="IDC_PREF_CACHE_PIM">Include PIM when caching a password</entry>
<entry lang="en" key="IDC_SHOW_DISCONNECTED_NETWORK_DRIVES">Make disconnected network drives available for mounting</entry>
<entry lang="en" key="PASSWORD_UTF8_TOO_LONG">The entered password is too long: its UTF-8 representation exceeds %d bytes.</entry>
<entry lang="en" key="PASSWORD_UTF8_INVALID">The entered password contains Unicode characters that couldn't be converted to UTF-8 representation.</entry>
<entry lang="en" key="INIT_DLL">Error: Failed to load a system library.</entry>
<entry lang="en" key="ERR_EXFAT_INVALID_VOLUME_SIZE">The volume file size specified in the command line is incompatible with selected exFAT filesystem.</entry>
<entry lang="en" key="IDT_ENTROPY_BAR">Randomness Collected From Mouse Movements</entry>
<entry lang="en" key="IDT_VOLUME_ID">Volume ID:</entry>
<entry lang="en" key="VOLUME_ID">Volume ID</entry>
<entry lang="en" key="IDC_FAVORITE_USE_VOLUME_ID">Use Volume ID to mount favorite</entry>
<entry lang="en" key="VOLUME_ID_INVALID">The Volume ID value is invalid</entry>
<entry lang="en" key="VOLUME_ID_NOT_FOUND">No Volume with the specified ID was found on the system</entry>
<entry lang="en" key="IDPM_COPY_VALUE_TO_CLIPBOARD">Copy Value to Clipboard...</entry>
<entry lang="en" key="IDC_DISABLE_BOOT_LOADER_PIM_PROMPT">Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk)</entry>
<entry lang="en" key="DISABLE_BOOT_LOADER_PIM_PROMPT">WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option?</entry>
<entry lang="en" key="PIM_TOO_BIG">Personal Iterations Multiplier (PIM) maximum value is 2147468.</entry>
<entry lang="en" key="IDC_SKIP_RESCUE_VERIFICATION">Skip Rescue Disk verification</entry>
<entry lang="en" key="IDC_HIDE_WAITING_DIALOG">Don't show wait message dialog when performing operations</entry>
<entry lang="en" key="IDC_DISABLE_BOOT_LOADER_HASH_PROMPT">Do not request Hash algorithm in the pre-boot authentication screen</entry>
<entry lang="en" key="KUZNYECHIK_HELP">Kuznyechik is a block cipher first published in 2015 and defined in the National Standard of the Russian Federation GOST R 34.12-2015 and also in RFC 7801. 256-bit key, 128-bit block. Mode of operation is XTS.</entry>
<entry lang="en" key="CAMELLIA_HELP">Jointly developed by Mitsubishi Electric and NTT of Japan. First published on 2000. 256-bit key, 128-bit block. Mode of operation is XTS. It has been approved for use by the ISO/IEC, the European Union's NESSIE project and the Japanese CRYPTREC project.</entry>
<entry lang="en" key="TIME">Time</entry>
<entry lang="en" key="ITERATIONS">Iterations</entry>
<entry lang="en" key="PRE-BOOT">Pre-Boot</entry>
- <entry lang="en" key="RESCUE_DISK_EFI_INFO">\n\nIf Windows gets damaged and cannot start, the VeraCrypt Rescue Disk allows you to permanently decrypt the partition. Note, however, that you will still have to enter the correct password then!\n\n\nWARNING: If you have already created a VeraCrypt Rescue Disk in the past, it cannot be reused for this encryption! Every time you use this encryption tool, you must create and securely store a new VeraCrypt Rescue Disk for it even if you use the same password.</entry>
+ <entry lang="en" key="RESCUE_DISK_EFI_INFO">Before you can encrypt the partition, you must create a VeraCrypt Rescue Disk (VRD), which serves the following purposes:\n\n- If the VeraCrypt Boot Loader, master key, or other critical data gets damaged, the VRD allows you to restore it (note, however, that you will still have to enter the correct password then).\n\n- If Windows gets damaged and cannot start, the VRD allows you to permanently decrypt the partition before Windows starts.\n\n- The VRD will contain a backup of the present EFI boot loader and will allow you to restore it if necessary.\n\nThe VeraCrypt Rescue Disk ZIP image will be created in the location specified below.</entry>
<entry lang="en" key="RESCUE_DISK_EFI_EXTRACT_INFO">The Rescue Disk ZIP image has been created and stored in this file:\n%s\n\nNow you need to extract it to a USB stick that is formatted as FAT/FAT32.\n\n%lsAfter you create the Rescue Disk, click Next to verify that it has been correctly created.</entry>
- <entry lang="en" key="RESCUE_DISK_EFI_EXTRACT_INFO_NO_CHECK">The Rescue Disk ZIP image has been created and stored in this file:\n%s\n\nNow you should either extract the image to a USB stick that is formatted as FAT/FAT32 or move it to a safe location for later use.\n\n\n\n%lsClick Next to continue.</entry>
+ <entry lang="en" key="RESCUE_DISK_EFI_EXTRACT_INFO_NO_CHECK">The Rescue Disk ZIP image has been created and stored in this file:\n%s\n\nNow you should either extract the image to a USB stick that is formatted as FAT/FAT32 or move it to a safe location for later use.\n\n%lsClick Next to continue.</entry>
<entry lang="en" key="RESCUE_DISK_EFI_EXTRACT_INFO_NOTE">IMPORTANT: Note that the zip file must be extracted directly to the root of the USB stick. For example, if the drive letter of the USB stick is E: then extracting the zip file should create a folder E:\\EFI on the USB stick.\n\n</entry>
<entry lang="en" key="RESCUE_DISK_EFI_CHECK_FAILED">Cannot verify that the Rescue Disk has been correctly extracted.\n\nIf you have extracted the Rescue Disk, please eject and reinsert the USB stick; then click Next to try again. If this does not help, please try another USB stick and/or another ZIP software.\n\nIf you have not extracted the Rescue Disk yet, please do so, and then click Next.\n\nIf you attempted to verify a VeraCrypt Rescue Disk created before you started this wizard, please note that such Rescue Disk cannot be used, because it was created for a different master key. You need to extract the newly generated Rescue Disk ZIP image.</entry>
<entry lang="en" key="RESCUE_DISK_EFI_NON_WIZARD_CHECK_FAILED">Cannot verify that the Rescue Disk has been correctly extracted.\n\nIf you have extracted the Rescue Disk image to a USB stick, please eject it and reinsert it; then try again. If this does not help, please try other ZIP software and/or medium.\n\nIf you attempted to verify a VeraCrypt Rescue Disk created for a different master key, password, salt, etc., please note that such Rescue Disk will always fail this verification. To create a new Rescue Disk fully compatible with your current configuration, select 'System' > 'Create Rescue Disk'.</entry>
<entry lang="en" key="RESCUE_DISK_EFI_NON_WIZARD_CREATION">The Rescue Disk image has been created and stored in this file:\n%s\n\nNow you need to extract the Rescue Disk image to a USB stick that is formatted as FAT/FAT32.\n\nIMPORTANT: Note that the zip file must be extracted directly to the root of the USB stick. For example, if the drive letter of the USB stick is E: then extracting the zip file should create a folder E:\\EFI on the USB stick.\n\nAfter you create the Rescue Disk, select 'System' > 'Verify Rescue Disk' to verify that it has been correctly created.</entry>
<entry lang="en" key="IDC_SECURE_DESKTOP_PASSWORD_ENTRY">Use Secure Desktop for password entry</entry>
<entry lang="en" key="ERR_REFS_INVALID_VOLUME_SIZE">The volume file size specified in the command line is incompatible with selected ReFS filesystem.</entry>
<entry lang="en" key="IDC_EDIT_DCSPROP">Edit Boot Loader Configuration</entry>
<entry lang="en" key="IDC_SHOW_PLATFORMINFO">Display EFI Platform Information</entry>
<entry lang="en" key="BOOT_LOADER_CONFIGURATION_FILE">Boot Loader Configuration File</entry>
<entry lang="en" key="EFI_PLATFORM_INFORMATION">EFI Platform Information</entry>
<entry lang="en" key="EDIT_DCSPROP_FOR_ADVANCED_ONLY">WARNING: Inexperienced users should never attempt to manually edit boot loader configurations.\n\nContinue?</entry>
<entry lang="en" key="DCSPROP_XML_VALIDATION_FAILED">WARNING: Failed to validate the XML format of the Boot Loader configuration. Please check your modifications.</entry>
<entry lang="en" key="IDT_ADVANCED_OPTIONS">Advanced Options</entry>
<entry lang="en" key="AFTER_UPGRADE_RESCUE_DISK">It is strongly recommended that you create a new VeraCrypt Rescue Disk (which will contain the new version of the VeraCrypt Boot Loader) by selecting 'System' > 'Create Rescue Disk'.\nDo you want to do it now?</entry>
<entry lang="en" key="IDC_ALLOW_TRIM_NONSYS_SSD">Allow TRIM command for non-system SSD partition/drive</entry>
<entry lang="en" key="IDC_BLOCK_SYSENC_TRIM">Block TRIM command on system partition/drive</entry>
<entry lang="en" key="WINDOWS_EFI_BOOT_LOADER_MISSING">ERROR: Windows EFI system loader could not be located on the disk. Operation will be aborted.</entry>
<entry lang="en" key="SYSENC_EFI_UNSUPPORTED_SECUREBOOT">It is currently not possible to encrypt a system if SecureBoot is enabled and if VeraCrypt custom keys are not loaded into the machine firmware. SecureBoot needs to be disabled in the BIOS configuration in order to allow system encryption to proceed.</entry>
<entry lang="en" key="PASSWORD_PASTED_TRUNCATED">Pasted text truncated because the password maximum length is %d characters</entry>
<entry lang="en" key="PASSWORD_MAXLENGTH_REACHED">Password already reached its maximum length of %d characters.\nNo additional character is allowed.</entry>
<entry lang="en" key="IDC_SELECT_LANGUAGE_LABEL">Select the language to use during the installation:</entry>
<entry lang="en" key="VOLUME_TOO_LARGE_FOR_HOST">ERROR: The size of the file container is larger than the available free space on disk.</entry>
- <entry lang="en" key="IDC_ALLOW_WINDOWS_DEFRAG">Allow Windows Disk Defragmenter to defragment non-system partition/drive</entry>
+ <entry lang="en" key="IDC_ALLOW_WINDOWS_DEFRAG">Allow Windows Disk Defragmenter to defragment non-system partition/drive</entry>
<entry lang="en" key="CONFIRM_ALLOW_WINDOWS_DEFRAG">WARNING: Defragmenting non-system partitions/drives may leak metadata about their content or cause issues with hidden volumes they may contain.\n\nContinue?</entry>
<entry lang="en" key="VIRTUAL_DEVICE">Virtual Device</entry>
<entry lang="en" key="MOUNTED_VOLUME_NOT_ASSOCIATED">The selected mounted volume is not associated with its drive letter in Windows and so it can not be opened in Windows Explorer.</entry>
<entry lang="en" key="IDC_CLEAR_KEYS_ON_NEW_DEVICE_INSERTION">Clear encryption keys from memory if a new device is inserted</entry>
<entry lang="en" key="CLEAR_KEYS_ON_DEVICE_INSERTION_WARNING">IMPORTANT NOTES:\n - Please keep in mind that this option will not persist after a shutdown/reboot so you will need to select it again next time the machine is started.\n\n - With this option enabled and after a new device is connected, the machine will freeze and it will eventually crash with a BSOD since Windows can not access the encrypted disk after its keys are cleared from memory.\n</entry>
<entry lang="en" key="STARTING">Starting</entry>
<entry lang="en" key="IDC_ENABLE_CPU_RNG">Use CPU hardware random generator as an additional source of entropy</entry>
<entry lang="en" key="IDC_USE_LEGACY_MAX_PASSWORD_LENGTH">Use legacy maximum password length (64 characters)</entry>
<entry lang="en" key="IDC_ENABLE_RAM_ENCRYPTION">Activate encryption of keys and passwords stored in RAM</entry>
<entry lang="en" key="IDT_BENCHMARK">Benchmark:</entry>
<entry lang="en" key="IDC_DISABLE_MOUNT_MANAGER">Only create virtual device without mounting on selected drive letter</entry>
<entry lang="en" key="LEGACY_PASSWORD_UTF8_TOO_LONG">The entered password is too long: its UTF-8 representation exceeds 64 bytes.</entry>
<entry lang="en" key="HIDDEN_CREDS_SAME_AS_OUTER">The Hidden volume can't have the same password, PIM and keyfiles as the Outer volume</entry>
<entry lang="en" key="SYSENC_BITLOCKER_CONFLICT">VeraCrypt does not support encrypting a system drive that is already encrypted by BitLocker.</entry>
<entry lang="en" key="IDC_UPDATE_BOOTLOADER_ON_SHUTDOWN">Automatically fix boot configuration issues that may prevent Windows from starting</entry>
<entry lang="en" key="IDC_FORCE_NEXT_BOOT_VERACRYPT">Force machine to boot on VeraCrypt in the next startup</entry>
<entry lang="en" key="IDC_FORCE_VERACRYPT_BOOT_ENTRY">Force the presence of VeraCrypt entry in the EFI firmware boot menu</entry>
<entry lang="en" key="IDC_FORCE_VERACRYPT_FIRST_BOOT_ENTRY">Force VeraCrypt entry to be the first in the EFI firmware boot menu</entry>
<entry lang="en" key="RAM_ENCRYPTION_DISABLE_HIBERNATE">WARNING: RAM encryption is not compatible with Windows Hibernate and Windows Fast Startup features. VeraCrypt needs to disable them before activating RAM encryption.\n\nContinue?</entry>
<entry lang="en" key="CONFIRM_DISABLE_FAST_STARTUP">WARNING: Windows Fast Startup is enabled and it is known to cause issues when working with VeraCrypt volumes. It is advised to disable it for better security and usability.\n\nDo you want to disable Windows Fast Startup?</entry>
<entry lang="en" key="QUICK_FORMAT_HELP">In order to enable your operating system to mount your new volume, it has to be formatted with a filesystem. Please select a filesystem type.\n\nIf your volume is going to be hosted on a device or partition, you can use 'Quick format' to skip encryption of free space of the volume.</entry>
<entry lang="en" key="IDC_ENABLE_HARDWARE_ENCRYPTION_NEG">Do not accelerate AES encryption/decryption by using the AES instructions of the processor</entry>
<entry lang="en" key="IDM_ADD_ALL_VOLUME_TO_FAVORITES">Add All Mounted Volumes to Favorites...</entry>
<entry lang="en" key="TASKICON_PREF_MENU_ITEMS">Task Icon Menu Items</entry>
<entry lang="en" key="TASKICON_PREF_OPEN_VOL">Open Mounted Volumes</entry>
<entry lang="en" key="TASKICON_PREF_DISMOUNT_VOL">Dismount Mounted Volumes</entry>
<entry lang="en" key="DISK_FREE">Free space available: {0}</entry>
<entry lang="en" key="VOLUME_SIZE_HELP">Please specify the size of the container to create. Note that the minimum possible size of a volume is 292 KiB.</entry>
<entry lang="en" key="LINUX_CONFIRM_INNER_VOLUME_CALC">WARNING: You have selected a filesystem other than FAT for the outer volume.\nPlease Note that in this case VeraCrypt can't calculate the exact maximum allowed size for the hidden volume and it will use only an estimation that can be wrong.\nThus, it is your responsibility to use an adequate value for the size of the hidden volume so that it does not overlap the outer volume.\n\nDo you want to continue using the selected filesystem for the outer volume?</entry>
<entry lang="en" key="LINUX_PREF_TAB_SECURITY">Security</entry>
<entry lang="en" key="LINUX_PREF_TAB_MOUNT_OPTIONS">Mount Options</entry>
<entry lang="en" key="LINUX_PREF_TAB_BACKGROUND_TASK">Background Task</entry>
<entry lang="en" key="LINUX_PREF_TAB_SYSTEM_INTEGRATION">System Integration</entry>
<entry lang="en" key="LINUX_PREF_TAB_SYSTEM_INTEGRATION_EXPLORER">Filesystem Explorer</entry>
<entry lang="en" key="LINUX_PREF_TAB_PERFORMANCE">Performance</entry>
<entry lang="en" key="LINUX_PREF_TAB_KEYFILES">Keyfiles</entry>
<entry lang="en" key="LINUX_PREF_TAB_TOKENS">Security Tokens</entry>
<entry lang="en" key="LINUX_PREF_KERNEL_SERVICES">Kernel Services</entry>
<entry lang="en" key="LINUX_PREF_KERNEL_CRYPT">Do not use kernel cryptographic services</entry>
<entry lang="en" key="LINUX_PREF_TAB_MOUNT_OPTIONS_FS">Filesystem</entry>
<entry lang="en" key="IDT_LINUX_PREF_TAB_MOUNT_OPTIONS">Mount options:</entry>
<entry lang="en" key="LINUX_CROSS_SUPPORT">Cross-Platform Support</entry>
<entry lang="en" key="LINUX_CROSS_SUPPORT_OTHER">I will mount the volume on other platforms</entry>
<entry lang="en" key="LINUX_CROSS_SUPPORT_OTHER_HELP">Choose this option if you need to use the volume on other platforms.</entry>
<entry lang="en" key="LINUX_CROSS_SUPPORT_ONLY">I will mount the volume only on {0}</entry>
<entry lang="en" key="LINUX_CROSS_SUPPORT_ONLY_HELP">Choose this option if you do not need to use the volume on other platforms.</entry>
<entry lang="en" key="LINUX_DESELECT">Deselect</entry>
<entry lang="en" key="LINUX_ADMIN_PW_QUERY">Enter your user password or administrator password:</entry>
<entry lang="en" key="LINUX_ADMIN_PW_QUERY_TITLE">Administrator privileges required</entry>
<entry lang="en" key="LINUX_VC_RUNNING_ALREADY">VeraCrypt is already running.</entry>
<entry lang="en" key="LINUX_SYSTEM_ENC_PW_LENGTH_NOTE">System Encryption password is longer than {0} characters.</entry>
<entry lang="en" key="LINUX_MOUNT_SYSTEM_ENC_PREBOOT">Mount partition &amp;using system encryption (preboot authentication)</entry>
<entry lang="en" key="LINUX_DO_NOT_MOUNT">Do &amp;not mount</entry>
<entry lang="en" key="LINUX_MOUNT_AT_DIR">Mount at directory:</entry>
<entry lang="en" key="LINUX_SELECT">Se&amp;lect...</entry>
<entry lang="en" key="LINUX_DISMOUNT_ALL_WHEN">Dismount All Volumes When</entry>
<entry lang="en" key="LINUX_ENTERING_POWERSAVING">System is entering power saving mode</entry>
<entry lang="en" key="LINUX_LOGIN_ACTION">Actions to Perform when User Logs On</entry>
<entry lang="en" key="LINUX_CLOSE_EXPL_ON_DISMOUNT">Close all Explorer windows of volume being dismounted</entry>
<entry lang="en" key="LINUX_HOTKEYS">Hotkeys</entry>
<entry lang="en" key="LINUX_SYSTEM_HOTKEYS">System-Wide Hotkeys</entry>
<entry lang="en" key="LINUX_SOUND_NOTIFICATION">Play system notification sound after mount/dismount</entry>
<entry lang="en" key="LINUX_CONFIRM_AFTER_DISMOUNT">Display confirmation message box after dismount</entry>
<entry lang="en" key="LINUX_VC_QUITS">VeraCrypt quits</entry>
<entry lang="en" key="LINUX_OPEN_FINDER">Open Finder window for successfully mounted volume</entry>
<entry lang="en" key="LINUX_DISABLE_KERNEL_ONLY_SETTING">Please note that this setting takes effect only if use of the kernel cryptographic services is disabled.</entry>
<entry lang="en" key="LINUX_DISABLE_KERNEL_CRYPT_CONFIRM">Disabling the use of kernel cryptographic services can degrade performance.\n\nAre you sure?</entry>
<entry lang="en" key="LINUX_KERNEL_CRYPT_OPTION_CHANGE_MOUNTED_HINT">Please note that disabling this option may have no effect on volumes mounted using kernel cryptographic services.</entry>
<entry lang="en" key="LINUX_REMOUNT_BECAUSEOF_SETTING">Please note that any currently mounted volumes need to be remounted before they can use this setting.</entry>
<entry lang="en" key="LINUX_UNKNOWN_EXC_OCCURRED">Unknown exception occurred.</entry>
<entry lang="en" key="LINUX_FIRST_AID">"Disk Utility will be launched after you press 'OK'.\n\nPlease select your volume in the Disk Utility window and press 'Verify Disk' or 'Repair Disk' button on the 'First Aid' page.</entry>
<entry lang="en" key="LINUX_MOUNT_ALL_DEV">Mount All Devices</entry>
<entry lang="en" key="LINUX_ERROR_LOADING_CONFIG">Error while loading configuration files located in </entry>
<entry lang="en" key="LINUX_SELECT_FREE_SLOT">Please select a free drive slot from the list.</entry>
<entry lang="en" key="LINUX_MESSAGE_ON_MOUNT_AGAIN">\n\nDo you want to show this message next time you mount such a volume?</entry>
<entry lang="en" key="LINUX_WARNING">Warning</entry>
<entry lang="en" key="LINUX_ERROR">Error</entry>
<entry lang="en" key="LINUX_ONLY_TEXTMODE">This feature is currently supported only in text mode.</entry>
<entry lang="en" key="LINUX_FREE_SPACE_ON_DRIVE">Free space on drive {0}: is {1}.</entry>
<entry lang="en" key="LINUX_DYNAMIC_NOTICE">Please note that if your operating system does not allocate files from the beginning of the free space, the maximum possible hidden volume size may be much smaller than the size of the free space on the outer volume. This is not a bug in VeraCrypt but a limitation of the operating system.</entry>
<entry lang="en" key="LINUX_MAX_HIDDEN_SIZE">Maximum possible hidden volume size for this volume is {0}.</entry>
<entry lang="en" key="LINUX_OPEN_OUTER_VOL">Open Outer Volume</entry>
<entry lang="en" key="LINUX_OUTER_VOL_IS_MOUNTED">Outer volume has been successfully created and mounted as '{0}'. To this volume you should now copy some sensitive-looking files that you actually do NOT want to hide. The files will be there for anyone forcing you to disclose your password. You will reveal only the password for this outer volume, not for the hidden one. The files that you really care about will be stored in the hidden volume, which will be created later on. When you finish copying, click Next. Do not dismount the volume.\n\nNote: After you click Next, the outer volume will be analyzed to determine the size of uninterrupted area of free space whose end is aligned with the end of the volume. This area will accommodate the hidden volume, so it will limit its maximum possible size. The procedure ensures no data on the outer volume are overwritten by the hidden volume.</entry>
<entry lang="en" key="LINUX_ERROR_TRY_ENCRYPT_SYSTEM_DRIVE">Error: You are trying to encrypt a system drive.\n\nVeraCrypt can encrypt a system drive only under Windows.</entry>
<entry lang="en" key="LINUX_ERROR_TRY_ENCRYPT_SYSTEM_PARTITION">Error: You are trying to encrypt a system partition.\n\nVeraCrypt can encrypt system partitions only under Windows.</entry>
<entry lang="en" key="LINUX_WARNING_FORMAT_DESTROY_FS">WARNING: Formatting of the device will destroy all data on filesystem '{0}'.\n\nDo you want to continue?</entry>
<entry lang="en" key="LINUX_MOUNTET_HINT">The filesystem of the selected device is currently mounted. Please dismount '{0}' before proceeding.</entry>
<entry lang="en" key="LINUX_HIDDEN_PASS_NO_DIFF">The Hidden volume can't have the same password, PIM and keyfiles as the Outer volume</entry>
<entry lang="en" key="LINUX_NOT_FAT_HINT">Please note that the volume will not be formatted with a FAT filesystem and, therefore, you may be required to install additional filesystem drivers on platforms other than {0}, which will enable you to mount the volume.</entry>
<entry lang="en" key="LINUX_ERROR_SIZE_HIDDEN_VOL">Error: The hidden volume to be created is larger than {0} TB ({1} GB).\n\nPossible solutions:\n- Create a container/partition smaller than {0} TB.\n</entry>
<entry lang="en" key="LINUX_MAX_SIZE_HINT">- Use a drive with 4096-byte sectors to be able to create partition/device-hosted hidden volumes up to 16 TB in size</entry>
<entry lang="en" key="LINUX_DOT_LF">.\n</entry>
<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_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>
<entry lang="en" key="LINUX_CMD_HELP">VeraCrypt Command Line Help</entry>
<entry lang="en" key="LINUX_HIDDEN_FILES_PRESENT_IN_KEYFILE_PATH">\n\nWarning: Hidden files are present in a keyfile path. If you need to use them as keyfiles, remove the leading dot from their filenames. Hidden files are visible only if enabled in system options.</entry>
<entry lang="en" key="LINUX_EX2MSG_DEVICESECTORSIZEMISMATCH">Storage device and VC volume sector size mismatch</entry>
<entry lang="en" key="LINUX_EX2MSG_ENCRYPTEDSYSTEMREQUIRED">This operation must be performed only when the system hosted on the volume is running.</entry>
<entry lang="en" key="LINUX_EX2MSG_INSUFFICIENTDATA">Not enough data available.</entry>
<entry lang="en" key="LINUX_EX2MSG_KERNELCRYPTOSERVICETESTFAILED">Kernel cryptographic service test failed. The cryptographic service of your kernel most likely does not support volumes larger than 2 TB.\n\nPossible solutions:\n- Upgrade the Linux kernel to version 2.6.33 or later.\n- Disable use of the kernel cryptographic services (Settings > Preferences > System Integration) or use 'nokernelcrypto' mount option on the command line.</entry>
<entry lang="en" key="LINUX_EX2MSG_LOOPDEVICESETUPFAILED">Failed to set up a loop device.</entry>
<entry lang="en" key="LINUX_EX2MSG_MISSINGARGUMENT">A required argument is missing.</entry>
<entry lang="en" key="LINUX_EX2MSG_MISSINGVOLUMEDATA">Volume data missing.</entry>
<entry lang="en" key="LINUX_EX2MSG_MOUNTPOINTREQUIRED">Mount point required.</entry>
<entry lang="en" key="LINUX_EX2MSG_MOUNTPOINTUNAVAILABLE">Mount point is already in use.</entry>
<entry lang="en" key="LINUX_EX2MSG_PASSWORDEMPTY">No password or keyfile specified.</entry>
<entry lang="en" key="LINUX_EX2MSG_PASSWORDORKEYBOARDLAYOUTINCORRECT">\n\nNote that pre-boot authentication passwords need to be typed in the pre-boot environment where non-US keyboard layouts are not available. Therefore, pre-boot authentication passwords must always be typed using the standard US keyboard layout (otherwise, the password will be typed incorrectly in most cases). However, note that you do NOT need a real US keyboard; you just need to change the keyboard layout in your operating system.</entry>
<entry lang="en" key="LINUX_EX2MSG_PASSWORDORMOUNTOPTIONSINCORRECT">\n\nNote: If you are attempting to mount a partition located on an encrypted system drive without pre-boot authentication or to mount the encrypted system partition of an operating system that is not running, you can do so by selecting 'Options >' > 'Mount partition using system encryption'.</entry>
<entry lang="en" key="LINUX_EX2MSG_PASSWORDTOOLONG">Password is longer than {0} characters.</entry>
<entry lang="en" key="LINUX_EX2MSG_PARTITIONDEVICEREQUIRED">Partition device required.</entry>
<entry lang="en" key="LINUX_EX2MSG_PROTECTIONPASSWORDINCORRECT">Incorrect password to the protected hidden volume or the hidden volume does not exist.</entry>
<entry lang="en" key="LINUX_EX2MSG_PROTECTIONPASSWORDKEYFILESINCORRECT">Incorrect keyfile(s) and/or password to the protected hidden volume or the hidden volume does not exist.</entry>
<entry lang="en" key="LINUX_EX2MSG_STRINGCONVERSIONFAILED">Invalid characters encountered.</entry>
<entry lang="en" key="LINUX_EX2MSG_STRINGFORMATTEREXCEPTION">Error while parsing formatted string.</entry>
<entry lang="en" key="LINUX_EX2MSG_TEMPORARYDIRECTORYFAILURE">Failed to create a file or directory in a temporary directory.\n\nPlease make sure that the temporary directory exists, its security permissions allow you to access it, and there is sufficient disk space.</entry>
<entry lang="en" key="LINUX_EX2MSG_UNSUPPORTEDSECTORSIZEHIDDENVOLUMEPROTECTION">Error: The drive uses a sector size other than 512 bytes.\n\nDue to limitations of components available on your platform, outer volumes hosted on the drive cannot be mounted using hidden volume protection.\n\nPossible solutions:\n- Use a drive with 512-byte sectors.\n- Create a file-hosted volume (container) on the drive.\n- Backup the contents of the hidden volume and then update the outer volume.</entry>
<entry lang="en" key="LINUX_EX2MSG_UNSUPPORTEDSECTORSIZENOKERNELCRYPTO">Error: The drive uses a sector size other than 512 bytes.\n\nDue to limitations of components available on your platform, partition/device-hosted volumes on the drive can only be mounted using kernel cryptographic services.\n\nPossible solutions:\n- Enable use of the kernel cryptographic services (Preferences > System Integration).\n- Use a drive with 512-byte sectors.\n- Create a file-hosted volume (container) on the drive.</entry>
<entry lang="en" key="LINUX_EX2MSG_UNSUPPORTEDSECTORSIZE">Error: The drive uses a sector size other than 512 bytes.\n\nDue to limitations of components available on your platform, partition/device-hosted volumes cannot be created/used on the drive.\n\nPossible solutions:\n- Create a file-hosted volume (container) on the drive.\n- Use a drive with 512-byte sectors.\n- Use VeraCrypt on another platform.</entry>
<entry lang="en" key="LINUX_EX2MSG_VOLUMEHOSTINUSE">The host file/device is already in use.</entry>
<entry lang="en" key="LINUX_EX2MSG_VOLUMESLOTUNAVAILABLE">Volume slot unavailable.</entry>
<entry lang="en" key="LINUX_EX2MSG_HIGHERFUSEVERSIONREQUIRED">VeraCrypt requires OSXFUSE 2.5 or above.</entry>
<entry lang="en" key="EXCEPTION_OCCURRED">Exception occurred</entry>
<entry lang="en" key="ENTER_PASSWORD">Enter password</entry>
<entry lang="en" key="ENTER_TC_VOL_PASSWORD">Enter VeraCrypt Volume Password</entry>
<entry lang="en" key="MOUNT">Mount</entry>
<entry lang="en" key="MOUNT_POINT">Mount Directory</entry>
<entry lang="en" key="NO_VOLUMES_MOUNTED">No volumes mounted.</entry>
<entry lang="en" key="OPEN_NEW_VOLUME">Specify a New VeraCrypt Volume</entry>
<entry lang="en" key="PARAMETER_INCORRECT">Parameter incorrect</entry>
<entry lang="en" key="SELECT_KEYFILES">Select Keyfiles</entry>
<entry lang="en" key="START_TC">Start VeraCrypt</entry>
<entry lang="en" key="VOLUME_ALREADY_MOUNTED">The volume {0} is already mounted.</entry>
<entry lang="en" key="UNKNOWN_OPTION">Unknown option</entry>
<entry lang="en" key="VOLUME_LOCATION">Volume Location</entry>
<entry lang="en" key="VOLUME_HOST_IN_USE">WARNING: The host file/device {0} is already in use!\n\nIgnoring this can cause undesired results including system instability. All applications that might be using the host file/device should be closed before mounting the volume.\n\nContinue mounting?</entry>
<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="RESCUE_DISK_BACK_BUTTON">The Rescue Disk was already created depending on the selected options. In order to prevent incompatibility, you have to click 'cancel' and restart the system encryption process, if you want to modify any configuration.</entry>
- <entry lang="en" key="AES_BOX_HELP">AES is secure according to NIST</entry>
- <entry lang="en" key="BACKUP_RESCUE_DISK_TITLE">Backup Rescue Disk</entry>
- <entry lang="en" key="RESCUE_DISK_CHECKLIST_A">Store your password in a safe location. You can not recover your data without your password.\nThat is why VeraCrypt is considered to be secure.</entry>
- <entry lang="en" key="RESCUE_DISK_CHECKLIST_B">Make sure that the rescue file is stored on an external medium. This could be a flash drive, an external hard drive or even a cloud storage.\nYour rescue file is located here:</entry>
- <entry lang="en" key="RESCUE_DISK_CHECKLIST_C">Before you start encrypting your system, it is always a good idea to backup your personal data on an external drive for the unlikely case that the encryption process fails.</entry>
- <entry lang="en" key="RESCUE_DISK_INFO_2">The VeraCrypt Rescue Disk ZIP image will be created by clicking the Next button in location specified below.</entry>
- <entry lang="en" key="REMEMBER_PASSWORD"> I remember my Password</entry>
- <entry lang="en" key="STORE_RESCUE_DISK"> I stored my rescue file</entry>
- <entry lang="en" key="BACKUP_DATA"> I considered doing a backup of my personal Data</entry>
- <entry lang="en" key="CHECKLIST_TITLE">Checklist - Before clicking 'Next'</entry>
- <entry lang="en" key="SYS_ENCRYPTION_PRETEST_INFO">Some tests have to be done now to verify that everything works correctly.\n\nFor this test, your computer has to be restarted. Then you will have to enter your password in the VeraCrypt Boot Loader screen that will appear before Windows starts. After Windows starts, VeraCrypt is started automatically and you will be informed about the result of this pretest.\n\n\nThe following device will be modified: Drive %c:</entry>
- <entry lang="en" key="SYSENC_DECRYPTION_PAGE_INFO">Make sure that your device does not run out of power.\nIf the decryption is interrupted you can resume it restarting VeraCrypt and selecting 'System' > 'Resume Interrupted Process'.</entry>
- <entry lang="en" key="ADVANCED_FEATURES">Advanced features</entry>
- <entry lang="en" key="VERY_WEAK_PASSWORD">very weak</entry>
- <entry lang="en" key="WEAK_PASSWORD">weak</entry>
- <entry lang="en" key="MEDIUM_PASSWORD">medium</entry>
- <entry lang="en" key="STRONG_PASSWORD">strong</entry>
- <entry lang="en" key="VERY_STRONG_PASSWORD">very strong</entry>
- <entry lang="en" key="IDT_PASSWORD_STRENGTH">Password strength:</entry>
- <entry lang="en" key="PASSWORD_HELP_SYSENC">You might consider to write the password down somewhere safe. Please note, that the field to repeat your password is greyed out until your password has the minimum required strength.</entry>
- <entry lang="en" key="AES_HELP_NEW">AES is secure accoring to the National Institute of Standards and Technology (NIST) and the privacy and security research community.</entry>
- <entry lang="en" key="SHA512_HELP">SHA-512 is secure accoring to the National Institute of Standards and Technology (NIST) and the privacy and security research community.</entry>
- <entry lang="en" key="CHOOSE_PASSWORD_TITLE">Choose Password</entry>
- <entry lang="en" key="TRANSLATED_PWD_NOT_WRITTEN">Warning: Error occured while writing translated password! Please try again. If this error happens again, change keyboard layout to US keyboard layout manually.</entry>
- <entry lang="en" key="ERROR_TRANSLATE_PWD">Warning: Error occured while translating password!\nPlease type password again and try. If this error happens again, switch keyboard layout to US keyboard layout manually.</entry>
- <entry lang="en" key="ERROR_KEYB_LAYOUT_NOT_LOADED">Your system does not support the standard US-Keyboard layout. Please make sure the layout is available. For further help, please visit: https://support.microsoft.com/en-us/windows/manage-the-input-and-display-language-settings-in-windows-10-12a10cb4-8626-9b77-0ccb-5013e0c7c7a2 </entry>
- <entry lang="en" key="ERROR_PASTE_ACTION">Pasting text is disabled. Please type your password.</entry>
- <entry lang="en" key="WARNING_PASSWORD_NOT_IDENTICAL">Passwords are not identical! Please type identic passwords in both fields!</entry>
- <entry lang="en" key="SYSENC_INFO">This assistant will help you encrypt your drive (%c:)</entry>
- <entry lang="en" key="SYSENC_INFO_2">A windows password can easily be circumvented by bad actors with physical access to your device. Drive encryption helps to secure your data from beeing accessed by bad actors. VeraCrypt Drive Encryption will keep them out by protecting your data with an additional password. </entry>
- <entry lang="en" key="ADV_FEATURES_INTRO_TOOLTIP">Activate hidden OS here.</entry>
- <entry lang="en" key="ADV_FEATURES_NOTE">Most experts agree that the following preselected options are secure. Only change them if you know what you are doing. </entry>
- <entry lang="en" key="PIM_INFO">A Personal Iterations Multiplier (PIM) allows you to set the number of password hash iterations. This provides more flexibility for adjusting the desired security level while also controling the performance of the mount/boot operation.</entry>
- <entry lang="en" key="WIPE_INFO">Overrides your data before the encryption. This prevents possible data recovery. Wipe is not needed under normal circumstances.</entry>
- <entry lang="en" key="PRETEST_INFO">Before encrypting VeraCrypt will verify that everything is working correctly.\n\nVeraCrypt will run some tests, restart your computer and you have to enter you password before windows starts.</entry>
- <entry lang="en" key="PRETEST_CANCEL">If you click cancel now, no changes will be made your system.</entry>
- <entry lang="en" key="ERROR_GETTING_PATH">Error occured while getting path to executable file.</entry>
- <entry lang="en" key="ERROR_GETTING_PWD">Error occured while getting the password. Please try again.</entry>
- <entry lang="en" key="ERROR_GETTING_KEYB_STATE">Error occured while getting the keyboard state.</entry>
- <entry lang="en" key="ERR_NO_TRANSLATION">There is no translation for that key you just pressed!</entry>
- <entry lang="en" key="DEAD_KEY_SUPPORT">Dead keys will not reproduce dead char in this case because your password need to be translated to US keyboard layout so you can type your password in pre-boot environment.</entry>
- <entry lang="en" key="PRETEST_CHECKBOX"> I made sure that my device will not run out of power during the encryption process.</entry>
- <entry lang="en" key="OPEN_PATH_CHECKLIST_PAGE">Open path</entry>
- <entry lang="en" key="RESCUE_DISK_PATH">Rescue Disk Path</entry>
- <entry lang="en" key="PRETEST_BACK_BUTTON">If you want to cancel the encryption wizard, please click on cancel. In this case no changes will be made to your computer.</entry>
- <entry lang="en" key="WIPE_WARNING">Wiping can take a long time (Up to hours). Wiping is not recommended if you have an SSD Drive.</entry>
</localization>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="VeraCrypt">
<xs:complexType>
<xs:sequence>
<xs:element name="localization">
<xs:complexType>
<xs:sequence>
<xs:element name="language">
<xs:complexType>
<xs:attribute name="langid" type="xs:string" use="required" />
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="en-name" type="xs:string" use="required" />
<xs:attribute name="version" type="xs:string" use="required" />
<xs:attribute name="translators" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
<xs:element minOccurs="4" maxOccurs="4" name="font">
<xs:complexType>
<xs:attribute name="lang" type="xs:string" use="required" />
<xs:attribute name="class" type="xs:string" use="required" />
<xs:attribute name="size" type="xs:unsignedByte" use="required" />
<xs:attribute name="face" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
<xs:element maxOccurs="unbounded" name="entry">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="lang" type="xs:string" use="required" />
<xs:attribute name="key" type="xs:string" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="prog-version" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</VeraCrypt>
diff --git a/src/Common/Password.c b/src/Common/Password.c
index 3c9faa82..4caf3a21 100644
--- a/src/Common/Password.c
+++ b/src/Common/Password.c
@@ -1,566 +1,566 @@
/*
Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses'
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. */
#include "Tcdefs.h"
#include "Crypto.h"
#include "Volumes.h"
#include "Password.h"
#include "Dlgcode.h"
#include "Language.h"
#include "Pkcs5.h"
#include "Endian.h"
#include "Random.h"
#include <io.h>
#include <strsafe.h>
#ifndef SRC_POS
#define SRC_POS (__FUNCTION__ ":" TC_TO_STRING(__LINE__))
#endif
void VerifyPasswordAndUpdate (HWND hwndDlg, HWND hButton, HWND hPassword,
HWND hVerify, unsigned char *szPassword,
char *szVerify,
BOOL keyFilesEnabled)
{
wchar_t szTmp1[MAX_PASSWORD + 1];
wchar_t szTmp2[MAX_PASSWORD + 1];
char szTmp1Utf8[MAX_PASSWORD + 1];
char szTmp2Utf8[MAX_PASSWORD + 1];
int k = GetWindowTextLength (hPassword);
- int j = GetWindowTextLength (hVerify);
BOOL bEnable = FALSE;
int utf8Len1, utf8Len2;
UNREFERENCED_PARAMETER (hwndDlg); /* Remove warning */
GetWindowText (hPassword, szTmp1, ARRAYSIZE (szTmp1));
GetWindowText (hVerify, szTmp2, ARRAYSIZE (szTmp2));
utf8Len1 = WideCharToMultiByte (CP_UTF8, 0, szTmp1, -1, szTmp1Utf8, MAX_PASSWORD + 1, NULL, NULL);
utf8Len2 = WideCharToMultiByte (CP_UTF8, 0, szTmp2, -1, szTmp2Utf8, MAX_PASSWORD + 1, NULL, NULL);
if (wcscmp (szTmp1, szTmp2) != 0)
- {
bEnable = FALSE;
- if(k > 0 && j == k)
- Warning ("WARNING_PASSWORD_NOT_IDENTICAL", hwndDlg);
-
- }
else if (utf8Len1 <= 0)
bEnable = FALSE;
else
{
if (k >= MIN_PASSWORD || keyFilesEnabled)
bEnable = TRUE;
else
bEnable = FALSE;
}
if (szPassword != NULL)
{
if (utf8Len1 > 0)
memcpy (szPassword, szTmp1Utf8, sizeof (szTmp1Utf8));
else
szPassword [0] = 0;
}
if (szVerify != NULL)
{
if (utf8Len2 > 0)
memcpy (szVerify, szTmp2Utf8, sizeof (szTmp2Utf8));
else
szVerify [0] = 0;
}
burn (szTmp1, sizeof (szTmp1));
burn (szTmp2, sizeof (szTmp2));
burn (szTmp1Utf8, sizeof (szTmp1Utf8));
burn (szTmp2Utf8, sizeof (szTmp2Utf8));
EnableWindow (hButton, bEnable);
}
BOOL CheckPasswordCharEncoding (HWND hPassword, Password *ptrPw)
{
int i, len;
if (hPassword == NULL)
{
if (ptrPw)
{
unsigned char *pw;
len = ptrPw->Length;
pw = (unsigned char *) ptrPw->Text;
for (i = 0; i < len; i++)
{
if (pw[i] >= 0x7f || pw[i] < 0x20) // A non-ASCII or non-printable character?
return FALSE;
}
}
else
return FALSE;
}
else
{
wchar_t s[MAX_PASSWORD + 1];
len = GetWindowTextLength (hPassword);
if (len > (bUseLegacyMaxPasswordLength? MAX_LEGACY_PASSWORD: MAX_PASSWORD))
return FALSE;
GetWindowTextW (hPassword, s, sizeof (s) / sizeof (wchar_t));
for (i = 0; i < len; i++)
{
if (s[i] >= 0x7f || s[i] < 0x20) // A non-ASCII or non-printable character?
break;
}
burn (s, sizeof(s));
if (i < len)
return FALSE;
}
return TRUE;
}
BOOL CheckPasswordLength (HWND hwndDlg, unsigned __int32 passwordLength, int pim, BOOL bForBoot, int bootPRF, BOOL bSkipPasswordWarning, BOOL bSkipPimWarning)
{
BOOL bootPimCondition = (bForBoot && (bootPRF != SHA512 && bootPRF != WHIRLPOOL))? TRUE : FALSE;
BOOL bCustomPimSmall = ((pim != 0) && (pim < (bootPimCondition? 98 : 485)))? TRUE : FALSE;
if (passwordLength < PASSWORD_LEN_WARNING)
{
if (bCustomPimSmall)
{
Error (bootPimCondition? "BOOT_PIM_REQUIRE_LONG_PASSWORD": "PIM_REQUIRE_LONG_PASSWORD", hwndDlg);
return FALSE;
}
+
+#ifndef _DEBUG
+ if (!bSkipPasswordWarning && (MessageBoxW (hwndDlg, GetString ("PASSWORD_LENGTH_WARNING"), lpszTitle, MB_YESNO|MB_ICONWARNING|MB_DEFBUTTON2) != IDYES))
+ return FALSE;
+#endif
}
#ifndef _DEBUG
else if (bCustomPimSmall)
{
if (!bSkipPimWarning && AskWarnNoYes ("PIM_SMALL_WARNING", hwndDlg) != IDYES)
return FALSE;
}
#endif
if ((pim != 0) && (pim > (bootPimCondition? 98 : 485)))
{
// warn that mount/boot will take more time
Warning ("PIM_LARGE_WARNING", hwndDlg);
}
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 nDosLinkCreated = 1, nStatus = ERR_OS_ERROR;
wchar_t szDiskFile[TC_MAX_PATH], szCFDevice[TC_MAX_PATH];
wchar_t szDosDevice[TC_MAX_PATH];
char buffer[TC_VOLUME_HEADER_EFFECTIVE_SIZE];
PCRYPTO_INFO cryptoInfo = NULL, ci = NULL;
void *dev = INVALID_HANDLE_VALUE;
DWORD dwError;
DWORD bytesRead;
BOOL bDevice;
unsigned __int64 hostSize = 0;
int volumeType;
int wipePass;
FILETIME ftCreationTime;
FILETIME ftLastWriteTime;
FILETIME ftLastAccessTime;
BOOL bTimeStampValid = FALSE;
LARGE_INTEGER headerOffset;
BOOL backupHeader;
if (oldPassword->Length == 0 || newPassword->Length == 0) return -1;
if ((wipePassCount <= 0) || (truecryptMode && (old_pkcs5 == SHA256)))
{
nStatus = ERR_PARAMETER_INCORRECT;
handleError (hwndDlg, nStatus, SRC_POS);
return nStatus;
}
if (!lpszVolume)
{
nStatus = ERR_OUTOFMEMORY;
handleError (hwndDlg, nStatus, SRC_POS);
return nStatus;
}
WaitCursor ();
CreateFullVolumePath (szDiskFile, sizeof(szDiskFile), lpszVolume, &bDevice);
if (bDevice == FALSE)
{
StringCchCopyW (szCFDevice, ARRAYSIZE(szCFDevice), szDiskFile);
}
else
{
nDosLinkCreated = FakeDosNameForDevice (szDiskFile, szDosDevice, sizeof(szDosDevice), szCFDevice, sizeof(szCFDevice),FALSE);
if (nDosLinkCreated != 0)
goto error;
}
dev = CreateFile (szCFDevice, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (dev == INVALID_HANDLE_VALUE)
goto error;
else if (!bDevice && bPreserveTimestamp)
{
// ensure that Last Access and Last Write timestamps are not modified
ftLastAccessTime.dwHighDateTime = 0xFFFFFFFF;
ftLastAccessTime.dwLowDateTime = 0xFFFFFFFF;
SetFileTime (dev, NULL, &ftLastAccessTime, NULL);
if (GetFileTime ((HANDLE) dev, &ftCreationTime, &ftLastAccessTime, &ftLastWriteTime) == 0)
bTimeStampValid = FALSE;
else
bTimeStampValid = TRUE;
}
if (bDevice)
{
/* This is necessary to determine the hidden volume header offset */
if (dev == INVALID_HANDLE_VALUE)
{
goto error;
}
else
{
BYTE dgBuffer[256];
PARTITION_INFORMATION diskInfo;
DWORD dwResult;
BOOL bResult;
bResult = DeviceIoControl (dev, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, NULL, 0,
dgBuffer, sizeof (dgBuffer), &dwResult, NULL);
if (!bResult)
{
DISK_GEOMETRY geo;
if (DeviceIoControl (dev, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, (LPVOID) &geo, sizeof (geo), &dwResult, NULL))
{
((PDISK_GEOMETRY_EX) dgBuffer)->DiskSize.QuadPart = geo.Cylinders.QuadPart * geo.SectorsPerTrack * geo.TracksPerCylinder * geo.BytesPerSector;
if (CurrentOSMajor >= 6)
{
STORAGE_READ_CAPACITY storage = {0};
storage.Version = sizeof (STORAGE_READ_CAPACITY);
storage.Size = sizeof (STORAGE_READ_CAPACITY);
if (DeviceIoControl (dev, IOCTL_STORAGE_READ_CAPACITY, NULL, 0, (LPVOID) &storage, sizeof (storage), &bytesRead, NULL)
&& (bytesRead >= sizeof (storage))
&& (storage.Size == sizeof (STORAGE_READ_CAPACITY))
)
{
((PDISK_GEOMETRY_EX) dgBuffer)->DiskSize.QuadPart = storage.DiskLength.QuadPart;
}
}
}
else
{
goto error;
}
}
bResult = GetPartitionInfo (lpszVolume, &diskInfo);
if (bResult)
{
hostSize = diskInfo.PartitionLength.QuadPart;
}
else
{
hostSize = ((PDISK_GEOMETRY_EX) dgBuffer)->DiskSize.QuadPart;
}
if (hostSize == 0)
{
nStatus = ERR_VOL_SIZE_WRONG;
goto error;
}
}
}
else
{
LARGE_INTEGER fileSize;
if (!GetFileSizeEx (dev, &fileSize))
{
nStatus = ERR_OS_ERROR;
goto error;
}
hostSize = fileSize.QuadPart;
}
if (Randinit ())
{
if (CryptoAPILastError == ERROR_SUCCESS)
nStatus = ERR_RAND_INIT_FAILED;
else
nStatus = ERR_CAPI_INIT_FAILED;
goto error;
}
SetRandomPoolEnrichedByUserStatus (FALSE); /* force the display of the random enriching dialog */
for (volumeType = TC_VOLUME_TYPE_NORMAL; volumeType < TC_VOLUME_TYPE_COUNT; volumeType++)
{
// Seek the volume header
switch (volumeType)
{
case TC_VOLUME_TYPE_NORMAL:
headerOffset.QuadPart = TC_VOLUME_HEADER_OFFSET;
break;
case TC_VOLUME_TYPE_HIDDEN:
if (TC_HIDDEN_VOLUME_HEADER_OFFSET + TC_VOLUME_HEADER_SIZE > hostSize)
continue;
headerOffset.QuadPart = TC_HIDDEN_VOLUME_HEADER_OFFSET;
break;
}
if (!SetFilePointerEx ((HANDLE) dev, headerOffset, NULL, FILE_BEGIN))
{
nStatus = ERR_OS_ERROR;
goto error;
}
/* Read in volume header */
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));
}
/* Try to decrypt the header */
nStatus = ReadVolumeHeader (FALSE, buffer, oldPassword, old_pkcs5, old_pim, truecryptMode, &cryptoInfo, NULL);
if (nStatus == ERR_CIPHER_INIT_WEAK_KEY)
nStatus = 0; // We can ignore this error here
if (nStatus == ERR_PASSWORD_WRONG)
{
continue; // Try next volume type
}
else if (nStatus != 0)
{
cryptoInfo = NULL;
goto error;
}
else
break;
}
if (nStatus != 0)
{
cryptoInfo = NULL;
goto error;
}
if (cryptoInfo->HeaderFlags & TC_HEADER_FLAG_ENCRYPTED_SYSTEM)
{
nStatus = ERR_SYS_HIDVOL_HEAD_REENC_MODE_WRONG;
goto error;
}
// Change the PKCS-5 PRF if requested by user
if (pkcs5 != 0)
cryptoInfo->pkcs5 = pkcs5;
RandSetHashFunction (cryptoInfo->pkcs5);
NormalCursor();
UserEnrichRandomPool (hwndDlg);
EnableElevatedCursorChange (hwndDlg);
WaitCursor();
/* Re-encrypt the volume header */
backupHeader = FALSE;
while (TRUE)
{
/* The header will be re-encrypted wipePassCount times to prevent adversaries from using
techniques such as magnetic force microscopy or magnetic force scanning tunnelling microscopy
to recover the overwritten header. According to Peter Gutmann, data should be overwritten 22
times (ideally, 35 times) using non-random patterns and pseudorandom data. However, as users might
impatiently interupt the process (etc.) we will not use the Gutmann's patterns but will write the
valid re-encrypted header, i.e. pseudorandom data, and there will be many more passes than Guttman
recommends. During each pass we will write a valid working header. Each pass will use the same master
key, and also the same header key, secondary key (XTS), etc., derived from the new password. The only
item that will be different for each pass will be the salt. This is sufficient to cause each "version"
of the header to differ substantially and in a random manner from the versions written during the
other passes. */
for (wipePass = 0; wipePass < wipePassCount; wipePass++)
{
// Prepare new volume header
nStatus = CreateVolumeHeaderInMemory (hwndDlg, FALSE,
buffer,
cryptoInfo->ea,
cryptoInfo->mode,
newPassword,
cryptoInfo->pkcs5,
pim,
cryptoInfo->master_keydata,
&ci,
cryptoInfo->VolumeSize.Value,
(volumeType == TC_VOLUME_TYPE_HIDDEN) ? cryptoInfo->hiddenVolumeSize : 0,
cryptoInfo->EncryptedAreaStart.Value,
cryptoInfo->EncryptedAreaLength.Value,
truecryptMode? 0 : cryptoInfo->RequiredProgramVersion,
cryptoInfo->HeaderFlags,
cryptoInfo->SectorSize,
wipePass < wipePassCount - 1);
if (ci != NULL)
crypto_close (ci);
if (nStatus != 0)
goto error;
if (!SetFilePointerEx ((HANDLE) dev, headerOffset, NULL, FILE_BEGIN))
{
nStatus = ERR_OS_ERROR;
goto error;
}
if (!WriteEffectiveVolumeHeader (bDevice, dev, buffer))
{
nStatus = ERR_OS_ERROR;
goto error;
}
if (bDevice
&& !cryptoInfo->LegacyVolume
&& !cryptoInfo->hiddenVolume
&& cryptoInfo->HeaderVersion == 4
&& (cryptoInfo->HeaderFlags & TC_HEADER_FLAG_NONSYS_INPLACE_ENC) != 0
&& (cryptoInfo->HeaderFlags & ~TC_HEADER_FLAG_NONSYS_INPLACE_ENC) == 0)
{
PCRYPTO_INFO dummyInfo = NULL;
LARGE_INTEGER hiddenOffset;
nStatus = WriteRandomDataToReservedHeaderAreas (hwndDlg, dev, cryptoInfo, cryptoInfo->VolumeSize.Value, !backupHeader, backupHeader);
if (nStatus != ERR_SUCCESS)
goto error;
// write fake hidden volume header to protect against attacks that use statistical entropy
// analysis to detect presence of hidden volumes
hiddenOffset.QuadPart = backupHeader ? cryptoInfo->VolumeSize.Value + TC_VOLUME_HEADER_GROUP_SIZE + TC_HIDDEN_VOLUME_HEADER_OFFSET: TC_HIDDEN_VOLUME_HEADER_OFFSET;
nStatus = CreateVolumeHeaderInMemory (hwndDlg, FALSE,
buffer,
cryptoInfo->ea,
cryptoInfo->mode,
NULL,
0,
0,
NULL,
&dummyInfo,
cryptoInfo->VolumeSize.Value,
cryptoInfo->VolumeSize.Value,
cryptoInfo->EncryptedAreaStart.Value,
cryptoInfo->EncryptedAreaLength.Value,
truecryptMode? 0 : cryptoInfo->RequiredProgramVersion,
cryptoInfo->HeaderFlags,
cryptoInfo->SectorSize,
wipePass < wipePassCount - 1);
if (nStatus != ERR_SUCCESS)
goto error;
crypto_close (dummyInfo);
if (!SetFilePointerEx ((HANDLE) dev, hiddenOffset, NULL, FILE_BEGIN))
{
nStatus = ERR_OS_ERROR;
goto error;
}
if (!WriteEffectiveVolumeHeader (bDevice, dev, buffer))
{
nStatus = ERR_OS_ERROR;
goto error;
}
}
FlushFileBuffers (dev);
}
if (backupHeader || cryptoInfo->LegacyVolume)
break;
backupHeader = TRUE;
headerOffset.QuadPart += hostSize - TC_VOLUME_HEADER_GROUP_SIZE;
}
/* Password successfully changed */
nStatus = 0;
error:
dwError = GetLastError ();
burn (buffer, sizeof (buffer));
if (cryptoInfo != NULL)
crypto_close (cryptoInfo);
if (bTimeStampValid)
SetFileTime (dev, &ftCreationTime, &ftLastAccessTime, &ftLastWriteTime);
if (dev != INVALID_HANDLE_VALUE)
CloseHandle ((HANDLE) dev);
if (nDosLinkCreated == 0)
RemoveFakeDosName (szDiskFile, szDosDevice);
RandStop (FALSE);
NormalCursor ();
SetLastError (dwError);
if (nStatus == ERR_OS_ERROR && dwError == ERROR_ACCESS_DENIED
&& bDevice
&& !UacElevated
&& IsUacSupported ())
return nStatus;
if (nStatus != 0)
handleError (hwndDlg, nStatus, SRC_POS);
return nStatus;
}
+
diff --git a/src/Format/Format.rc b/src/Format/Format.rc
index 8a14f413..d4a9a5f5 100644
--- a/src/Format/Format.rc
+++ b/src/Format/Format.rc
@@ -1,816 +1,744 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
#include "..\\common\\resource.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,26,0,0
PRODUCTVERSION 1,26,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "IDRIX"
VALUE "FileDescription", "VeraCrypt Format"
VALUE "FileVersion", "1.26"
VALUE "LegalTrademarks", "VeraCrypt"
VALUE "OriginalFilename", "VeraCrypt Format.exe"
VALUE "ProductName", "VeraCrypt"
VALUE "ProductVersion", "1.26"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
/////////////////////////////////////////////////////////////////////////////
//
// HEADER
//
IDR_FORMAT_RSRC_HEADER HEADER "resource.h"
/////////////////////////////////////////////////////////////////////////////
//
// TYPELIB
//
IDR_FORMAT_TLB TYPELIB "Format.tlb"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_VOL_CREATION_WIZARD_DLG DIALOGEX 0, 0, 450, 250
STYLE DS_SETFONT | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "VeraCrypt Volume Creation Wizard"
CLASS "VeraCryptCustomDlg"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
- PUSHBUTTON "&Documentation",IDHELP,166,234,60,14
- PUSHBUTTON "",IDC_PREV,243,234,60,14
- DEFPUSHBUTTON "",IDC_NEXT,305,234,60,14
+ PUSHBUTTON "&Help",IDHELP,166,234,60,14
+ PUSHBUTTON "",IDC_PREV,238,234,60,14
+ DEFPUSHBUTTON "",IDC_NEXT,310,234,60,14
PUSHBUTTON "Cancel",IDCANCEL,382,234,60,14
- LTEXT "",IDC_BOX_TITLE,160,10,283,17
- GROUPBOX "",IDC_STATIC,4,0,440,230
- CONTROL 116,IDC_BITMAP_WIZARD,"Static",SS_BITMAP | SS_SUNKEN,10,18,137,200
+ LTEXT "",IDC_BOX_TITLE,160,8,283,17
+ GROUPBOX "",IDC_STATIC,4,0,439,230
+ CONTROL 116,IDC_BITMAP_WIZARD,"Static",SS_BITMAP | SS_SUNKEN,10,9,137,193
LTEXT "",IDC_POS_BOX,160,24,281,193
END
IDD_CIPHER_PAGE_DLG DIALOGEX 0, 0, 276, 193
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
COMBOBOX IDC_COMBO_BOX,7,23,172,126,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "&Test",IDC_CIPHER_TEST,191,22,81,14
PUSHBUTTON "&Benchmark",IDC_BENCHMARK,191,122,81,14
COMBOBOX IDC_COMBO_BOX_HASH_ALGO,7,169,95,126,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "",IDC_BOX_HELP,7,40,266,78
GROUPBOX "Encryption Algorithm",IDT_ENCRYPTION_ALGO,0,10,273,131
GROUPBOX "Hash Algorithm",IDT_HASH_ALGO,0,156,273,35
LTEXT "More information",IDC_LINK_MORE_INFO_ABOUT_CIPHER,7,124,176,10,SS_NOTIFY
LTEXT "Information on hash algorithms",IDC_LINK_HASH_INFO,121,171,148,8,SS_NOTIFY
END
IDD_PASSWORD_PAGE_DLG DIALOGEX 0, 0, 276, 193
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
- EDITTEXT IDC_PASSWORD,69,3,202,14,ES_PASSWORD | ES_AUTOHSCROLL
- EDITTEXT IDC_VERIFY,69,20,202,14,ES_PASSWORD | ES_AUTOHSCROLL
- LTEXT "Password strength: ", IDT_PASSWORD_STRENGTH, 71, 54, 70, 10
- LTEXT "", PASSWORD_METER, 140, 55, 50, 20
- CONTROL "&Display password",IDC_SHOW_PASSWORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,71,41,108,11,WS_EX_TRANSPARENT
- RTEXT "Password:", IDT_PASSWORD, 1, 6, 40, 8
- RTEXT "&Confirm:", IDT_CONFIRM, 1, 23, 40, 8
- LTEXT "", IDC_BOX_HELP, 1, 95, 270, 120
- PUSHBUTTON "Advanced features", IDC_ADVANCE, 203, 156, 68, 14, NOT WS_VISIBLE
- CONTROL "",IDC_SYS_POOL_CONTENTS,"Static",SS_LEFTNOWORDWRAP | WS_GROUP | NOT WS_VISIBLE,33,17,209,63,WS_EX_TRANSPARENT
- CONTROL "", IDC_ENTROPY_BAR, "msctls_progress32", WS_BORDER | NOT WS_VISIBLE, 11, 140, 202, 6
- CONTROL "U&se keyfiles",IDC_KEYFILES_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,71,64,103,10
- PUSHBUTTON "&Keyfiles...",IDC_KEY_FILES,192,65,71,14,WS_DISABLED
- CONTROL "Use P&IM",IDC_PIM_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,71,76,114,10
-
+ EDITTEXT IDC_PASSWORD,71,3,202,14,ES_PASSWORD | ES_AUTOHSCROLL
+ EDITTEXT IDC_VERIFY,71,19,202,14,ES_PASSWORD | ES_AUTOHSCROLL
+ CONTROL "U&se keyfiles",IDC_KEYFILES_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,71,35,103,10
+ PUSHBUTTON "&Keyfiles...",IDC_KEY_FILES,182,36,91,14,WS_DISABLED
+ CONTROL "&Display password",IDC_SHOW_PASSWORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,71,45,108,11,WS_EX_TRANSPARENT
+ CONTROL "Use P&IM",IDC_PIM_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,71,56,114,10
+ RTEXT "Password:",IDT_PASSWORD,1,6,68,8
+ RTEXT "&Confirm:",IDT_CONFIRM,1,23,68,8
+ LTEXT "",IDC_BOX_HELP,0,71,273,121
END
IDD_SIZE_PAGE_DLG DIALOGEX 0, 0, 276, 193
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
EDITTEXT IDC_SIZEBOX,0,22,96,14,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "&KB",IDC_KB,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,105,25,27,10
CONTROL "&MB",IDC_MB,"Button",BS_AUTORADIOBUTTON,140,25,27,10
CONTROL "&GB",IDC_GB,"Button",BS_AUTORADIOBUTTON,175,25,27,10
LTEXT "",IDC_BOX_HELP,0,65,273,123
LTEXT "",IDC_SPACE_LEFT,0,44,273,18
CONTROL "&TB",IDC_TB,"Button",BS_AUTORADIOBUTTON,210,25,27,10
END
IDD_VOLUME_LOCATION_PAGE_DLG DIALOGEX 0, 0, 276, 193
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
COMBOBOX IDC_COMBO_BOX,0,9,174,80,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
CONTROL "&Never save history",IDC_NO_HISTORY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3,28,270,10
PUSHBUTTON "",IDC_SELECT_VOLUME_LOCATION,181,9,92,14
LTEXT "",IDC_BOX_HELP,0,45,273,143
END
IDD_FORMAT_PAGE_DLG DIALOGEX 0, 0, 276, 193
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
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
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
CONTROL "",IDC_HEADER_KEY,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,83,46,190,8,WS_EX_TRANSPARENT
RTEXT "Master Key: ",IDT_MASTER_KEY,2,55,76,8
LTEXT "",IDC_DISK_KEY,83,54,190,8,0,WS_EX_TRANSPARENT
RTEXT "Cluster ",IDT_CLUSTER,91,15,44,8
LTEXT "",IDC_BOX_HELP,1,112,274,58
GROUPBOX "Options",IDT_FORMAT_OPTIONS,0,3,276,29
CONTROL "",IDC_PROGRESS_BAR,"msctls_progress32",PBS_SMOOTH | WS_BORDER,6,76,189,12
RTEXT "",IDC_TIMEREMAIN,217,93,46,11,SS_CENTERIMAGE,WS_EX_TRANSPARENT | WS_EX_RIGHT | WS_EX_STATICEDGE
RTEXT "",IDC_WRITESPEED,128,93,42,11,SS_CENTERIMAGE,WS_EX_TRANSPARENT | WS_EX_RIGHT | WS_EX_STATICEDGE
LTEXT "",IDC_BYTESWRITTEN,29,93,39,11,SS_CENTERIMAGE,WS_EX_TRANSPARENT | WS_EX_RIGHT | WS_EX_STATICEDGE
RTEXT "Done",IDT_DONE,5,94,22,8
RTEXT "Speed",IDT_SPEED,81,94,45,8
RTEXT "Left",IDT_LEFT,177,94,35,8
GROUPBOX "",IDC_STATIC,0,67,276,41
RTEXT "Filesystem ",IDT_FILESYSTEM,1,15,46,8,0,WS_EX_RIGHT
RTEXT "Random Pool: ",IDT_RANDOM_POOL,2,39,76,8
GROUPBOX "",IDC_STATIC,0,32,276,35
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
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "Create an encrypted file container",IDC_FILE_CONTAINER,
"Button",BS_AUTORADIOBUTTON,0,7,269,10
LTEXT "More information",IDC_MORE_INFO_ON_CONTAINERS,16,40,253,10,SS_NOTIFY
CONTROL "Encrypt a non-system partition/drive",IDC_NONSYS_DEVICE,
"Button",BS_AUTORADIOBUTTON,0,55,269,10
CONTROL "Encrypt the system partition or entire system drive",IDC_SYS_DEVICE,
"Button",BS_AUTORADIOBUTTON,0,98,269,10
LTEXT "More information about system encryption",IDC_MORE_INFO_ON_SYS_ENCRYPTION,16,177,253,10,SS_NOTIFY
LTEXT "Creates a virtual encrypted disk within a file. Recommended for inexperienced users.",IDT_FILE_CONTAINER,16,20,253,16
LTEXT "Encrypts a non-system partition on any internal or external drive (e.g. a flash drive). Optionally, creates a hidden volume.",IDT_NON_SYS_DEVICE,16,68,253,26
LTEXT "Encrypts the partition/drive where Windows is installed. Anyone who wants to gain access and use the system, read and write files, etc., will need to enter the correct password each time before Windows boots. Optionally, creates a hidden system.",IDT_SYS_DEVICE,16,112,253,59
END
IDD_INFO_PAGE_DLG DIALOGEX 0, 0, 276, 193
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- LTEXT "",IDC_BOX_HELP,0,15,267,155
- CONTROL "", IDC_CHECKBOX_PRETEST, "Button", BS_AUTOCHECKBOX | BS_MULTILINE | NOT WS_VISIBLE, 0, 150, 267, 50
+ LTEXT "",IDC_BOX_HELP,0,31,269,155
END
IDD_HIDVOL_HOST_FILL_PAGE_DLG DIALOGEX 0, 0, 276, 193
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
LTEXT "",IDC_BOX_HELP,0,6,269,167
PUSHBUTTON "Open Outer Volume",IDC_OPEN_OUTER_VOLUME,0,176,85,14
END
IDD_HIDDEN_VOL_WIZARD_MODE_PAGE_DLG DIALOGEX 0, 0, 276, 193
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "Normal mode",IDC_HIDVOL_WIZ_MODE_FULL,"Button",BS_AUTORADIOBUTTON,0,7,269,10
CONTROL "Direct mode",IDC_HIDVOL_WIZ_MODE_DIRECT,"Button",BS_AUTORADIOBUTTON,0,97,269,10
LTEXT "",IDC_BOX_HELP,16,20,253,72
LTEXT "",IDC_BOX_HELP2,16,110,253,72
END
IDD_PASSWORD_ENTRY_PAGE_DLG DIALOGEX 0, 0, 276, 193
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
EDITTEXT IDC_PASSWORD_DIRECT,75,2,198,14,ES_PASSWORD | ES_AUTOHSCROLL
COMBOBOX IDC_PKCS5_PRF_ID,75,17,131,90,CBS_DROPDOWNLIST | WS_TABSTOP
EDITTEXT IDC_PIM,75,32,42,14,ES_RIGHT | ES_PASSWORD | ES_AUTOHSCROLL | ES_NUMBER | NOT WS_VISIBLE
LTEXT "(Empty or 0 for default iterations)",IDC_PIM_HELP,121,34,152,8,NOT WS_VISIBLE
CONTROL "&Display password",IDC_SHOW_PASSWORD_SINGLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,75,46,109,11,WS_EX_TRANSPARENT
CONTROL "U&se keyfiles",IDC_KEYFILES_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,75,57,106,11
PUSHBUTTON "&Keyfiles...",IDC_KEY_FILES,188,54,85,14
LTEXT "",IDC_BOX_HELP,0,74,273,119
RTEXT "Password:",IDT_PASSWORD,0,6,71,8
RTEXT "PKCS-5 PRF:",IDT_PKCS5_PRF,0,19,71,8
RTEXT "Volume PIM:",IDT_PIM,0,35,71,8,NOT WS_VISIBLE
CONTROL "Use P&IM",IDC_PIM_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,75,35,97,10
END
IDD_VOLUME_TYPE_PAGE_DLG DIALOGEX 0, 0, 276, 193
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "Standard VeraCrypt volume",IDC_STD_VOL,"Button",BS_AUTORADIOBUTTON,0,7,269,10
CONTROL "Hi&dden VeraCrypt volume ",IDC_HIDDEN_VOL,"Button",BS_AUTORADIOBUTTON,0,76,269,10
LTEXT "More information about hidden volumes",IDC_HIDDEN_VOL_HELP,16,173,253,10,SS_NOTIFY
LTEXT "",IDC_BOX_HELP_NORMAL_VOL,16,20,253,52
LTEXT "",IDC_BOX_HELP,16,93,253,70
END
IDD_SYSENC_SPAN_PAGE_DLG DIALOGEX 0, 0, 276, 193
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "Encrypt the Windows system partition",IDC_SYS_PARTITION,
"Button",BS_AUTORADIOBUTTON,0,7,269,10
CONTROL "Encrypt the whole drive",IDC_WHOLE_SYS_DRIVE,"Button",BS_AUTORADIOBUTTON,0,67,269,10
LTEXT "Select this option to encrypt the partition where the currently running Windows operating system is installed.",IDT_SYS_PARTITION,16,20,253,42
LTEXT "",IDT_WHOLE_SYS_DRIVE,16,82,253,104
END
IDD_SYSENC_RESCUE_DISK_CREATION_DLG DIALOGEX 0, 0, 276, 193
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
- EDITTEXT IDC_RESCUE_DISK_ISO_PATH, 0, 159, 180, 13, ES_AUTOHSCROLL
- PUSHBUTTON "Bro&wse...",IDC_BROWSE,185,159,70,14
- LTEXT "",IDT_RESCUE_DISK_INFO,0,1,266,137
- LTEXT "",IDT_RESCUE_DISK_INFO_2,0,135,266,20
+ EDITTEXT IDC_RESCUE_DISK_ISO_PATH,0,180,201,13,ES_AUTOHSCROLL
+ PUSHBUTTON "Bro&wse...",IDC_BROWSE,204,179,70,14
+ LTEXT "",IDT_RESCUE_DISK_INFO,0,1,273,137
CONTROL "Skip Rescue Disk verification",IDC_SKIP_RESCUE_VERIFICATION,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,0,178,273,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,0,166,273,10
END
IDD_SYSENC_COLLECTING_RANDOM_DATA_DLG DIALOGEX 0, 0, 276, 193
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
CONTROL "Display pool content",IDC_DISPLAY_POOL_CONTENTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,93,266,10
CONTROL "",IDC_SYS_POOL_CONTENTS,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,33,17,209,63,WS_EX_TRANSPARENT
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 encryption keys. Then click Next to continue.",IDT_COLLECTING_RANDOM_DATA_NOTE,10,107,265,63
GROUPBOX "Current pool content (partial)",IDT_PARTIAL_POOL_CONTENTS,0,5,276,83
GROUPBOX "Randomness Collected From Mouse Movements",IDT_ENTROPY_BAR,0,174,276,18
CONTROL "",IDC_ENTROPY_BAR,"msctls_progress32",WS_BORDER,11,183,254,6
END
IDD_SYSENC_MULTI_BOOT_MODE_PAGE_DLG DIALOGEX 0, 0, 276, 193
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "Single-boot",IDC_SINGLE_BOOT,"Button",BS_AUTORADIOBUTTON,0,7,269,10
CONTROL "Multi-boot",IDC_MULTI_BOOT,"Button",BS_AUTORADIOBUTTON,0,75,217,10
LTEXT "Select this option if there is only one operating system installed on this computer (even if it has multiple users).",IDT_SINGLE_BOOT,16,20,253,48
LTEXT "Select this option if there are two or more operating systems installed on this computer.\n\nFor example:\n- Windows XP and Windows XP\n- Windows XP and Windows Vista\n- Windows and Mac OS X\n- Windows and Linux\n- Windows, Linux and Mac OS X",IDT_MULTI_BOOT,16,89,253,90
END
IDD_SYSENC_RESCUE_DISK_BURN_PAGE_DLG DIALOGEX 0, 0, 276, 193
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
- LTEXT "",IDT_RESCUE_DISK_BURN_INFO,0,15,275,170
+ LTEXT "Download CD/DVD recording software",IDC_DOWNLOAD_CD_BURN_SOFTWARE,0,159,273,10,SS_NOTIFY
+ LTEXT "",IDT_RESCUE_DISK_BURN_INFO,0,4,273,148
END
IDD_SYSENC_WIPE_MODE_PAGE_DLG DIALOGEX 0, 0, 276, 193
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- CONTROL "A", IDC_CHECKLIST_A, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 0, 13, 10, 10
- CONTROL "B", IDC_CHECKLIST_B, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 0, 60, 10, 10
- CONTROL "C", IDC_CHECKLIST_C, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 0, 135, 10, 10
- LTEXT " I remember my Password", IDC_REMEMBER_PASSWORD, 11, 13, 212, 10
- LTEXT " I securely stored the Rescue Disk", IDC_STORE_RESCUE_DISK, 11, 60, 217, 10
- LTEXT " I considered doing a backup of my personal Data", IDC_BACKUP_DATA, 11, 135, 226, 10
- LTEXT "", IDT_REMEMBER_PASSWORD, 16, 26, 205, 32
- LTEXT "", IDT_STORE_RESCUE_DISK, 16, 73, 205, 60
- PUSHBUTTON "",IDC_BROWSE,16,109,60,14
- LTEXT "", IDT_BACKUP_DATA, 16, 146, 205, 72
- COMBOBOX IDC_WIPE_MODE,88,0,138,90,CBS_DROPDOWNLIST | WS_TABSTOP
- RTEXT "Wipe mode:", IDT_WIPE_MODE,0,2,83,8,0,WS_EX_RIGHT
- LTEXT "", IDT_WIPE_MODE_INFO,0,19,269,167
+ COMBOBOX IDC_WIPE_MODE,88,0,138,90,CBS_DROPDOWNLIST | WS_TABSTOP
+ RTEXT "Wipe mode:",IDT_WIPE_MODE,0,2,83,8,0,WS_EX_RIGHT
+ LTEXT "",IDT_WIPE_MODE_INFO,0,19,269,167
END
IDD_INPLACE_ENCRYPTION_PAGE_DLG DIALOGEX 0, 0, 276, 193
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
- COMBOBOX IDC_WIPE_MODE,96,60,125,90,CBS_DROPDOWNLIST | WS_TABSTOP
- PUSHBUTTON "&Pause",IDC_PAUSE,204,8,63,14
- LTEXT "More information",IDC_MORE_INFO_SYS_ENCRYPTION,1,176,266,10,SS_NOTIFY | NOT WS_VISIBLE
- LTEXT "",IDC_BYTESWRITTEN,29,26,39,11,SS_CENTERIMAGE,WS_EX_TRANSPARENT | WS_EX_RIGHT | WS_EX_STATICEDGE
- RTEXT "",IDC_WRITESPEED,110,26,56,11,SS_CENTERIMAGE,WS_EX_TRANSPARENT | WS_EX_RIGHT | WS_EX_STATICEDGE
- RTEXT "",IDC_TIMEREMAIN,212,26,54,11,SS_CENTERIMAGE,WS_EX_TRANSPARENT | WS_EX_RIGHT | WS_EX_STATICEDGE
- RTEXT "Wipe mode:",IDT_WIPE_MODE,6,62,85,8,0,WS_EX_RIGHT
- CONTROL "",IDC_PROGRESS_BAR,"msctls_progress32",PBS_SMOOTH | WS_BORDER,6,9,192,12
- RTEXT "Done",IDT_DONE,5,27,22,8
- RTEXT "Status",IDT_STATUS,73,27,33,8
- RTEXT "Left",IDT_LEFT,172,27,35,8
- LTEXT "",IDC_BOX_HELP,1,100,266,90
- GROUPBOX "",IDC_STATIC,0,3,268,41
- GROUPBOX "Options",IDT_FORMAT_OPTIONS,0,50,268,29
+ COMBOBOX IDC_WIPE_MODE,96,13,125,90,CBS_DROPDOWNLIST | WS_TABSTOP
+ PUSHBUTTON "&Pause",IDC_PAUSE,204,40,63,14
+ LTEXT "More information",IDC_MORE_INFO_SYS_ENCRYPTION,1,176,266,10,SS_NOTIFY
+ LTEXT "",IDC_BYTESWRITTEN,29,58,39,11,SS_CENTERIMAGE,WS_EX_TRANSPARENT | WS_EX_RIGHT | WS_EX_STATICEDGE
+ RTEXT "",IDC_WRITESPEED,110,58,56,11,SS_CENTERIMAGE,WS_EX_TRANSPARENT | WS_EX_RIGHT | WS_EX_STATICEDGE
+ RTEXT "",IDC_TIMEREMAIN,212,58,54,11,SS_CENTERIMAGE,WS_EX_TRANSPARENT | WS_EX_RIGHT | WS_EX_STATICEDGE
+ RTEXT "Wipe mode:",IDT_WIPE_MODE,6,15,85,8,0,WS_EX_RIGHT
+ CONTROL "",IDC_PROGRESS_BAR,"msctls_progress32",PBS_SMOOTH | WS_BORDER,6,41,192,12
+ RTEXT "Done",IDT_DONE,5,59,22,8
+ RTEXT "Status",IDT_STATUS,73,59,33,8
+ RTEXT "Left",IDT_LEFT,172,59,35,8
+ LTEXT "",IDC_BOX_HELP,1,77,266,95
+ GROUPBOX "Options",IDT_FORMAT_OPTIONS,0,3,267,29
+ GROUPBOX "",IDC_STATIC,0,32,267,41
END
IDD_SYSENC_KEYS_GEN_PAGE_DLG DIALOGEX 0, 0, 276, 193
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
CONTROL "Display generated keys (their portions)",IDC_DISPLAY_KEYS,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,51,110,216,10
CONTROL "",IDC_HEADER_KEY,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,100,87,163,8,WS_EX_TRANSPARENT
LTEXT "",IDC_DISK_KEY,100,95,163,8,0,WS_EX_TRANSPARENT
LTEXT "The keys, salt, and other data have been successfully generated. If you want to generate new keys, click Back and then Next. Otherwise, click Next to continue.",IDT_SYSENC_KEYS_GEN_INFO,1,23,266,57
RTEXT "Header Key: ",IDT_HEADER_KEY,2,88,93,8
RTEXT "Master Key: ",IDT_MASTER_KEY,2,96,93,8
GROUPBOX "",-1,0,81,267,26
END
IDD_UNIVERSAL_DUAL_CHOICE_PAGE_DLG DIALOGEX 0, 0, 276, 193
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "",IDC_CHOICE1,"Button",BS_AUTORADIOBUTTON,0,7,269,10
CONTROL "",IDC_CHOICE2,"Button",BS_AUTORADIOBUTTON,0,17,269,10
LTEXT "",IDC_BOX_HELP,1,34,268,152
END
IDD_SYSENC_DRIVE_ANALYSIS_PAGE_DLG DIALOGEX 0, 0, 276, 193
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
LTEXT "",IDT_SYSENC_DRIVE_ANALYSIS_INFO,0,10,267,109
CONTROL "",IDC_PROGRESS_BAR,"msctls_progress32",PBS_SMOOTH | WS_BORDER,0,135,267,12
LTEXT "Progress:",IDT_PROGRESS,2,124,172,8
END
IDD_SYSENC_TYPE_PAGE_DLG DIALOGEX 0, 0, 276, 193
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- LTEXT "", IDC_BOX_HELP, 5, 20, 250, 16
- LTEXT "", IDT_SYSENC_INFO_2, 5, 50, 250, 60
- PUSHBUTTON "Advanced features", IDC_ADVANCE_INTRO, 190, 160, 68, 14
- CONTROL "", IDC_INFORMATION_TIP, "Static", SS_ICON | SS_NOTIFY, 262,163,10,5
-END
-
-IDD_ADVANCE_MBR DIALOGEX 102, -10, 245, 233
-STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "Advanced Options"
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- CONTROL " Normal",IDC_SYSENC_NORMAL,"Button", BS_AUTOCHECKBOX, 10,40,200,10
- CONTROL " Hi&dden",IDC_SYSENC_HIDDEN,"Button", BS_AUTOCHECKBOX, 10,99,200,10
- LTEXT "Select this option if you merely want to encrypt the system partition or the entire system drive.",-1,26,57,200,30
- LTEXT "If you select this option, you will create a hidden operating system whose existence should be impossible to prove (provided that certain guidelines are followed). Thus, you will not have to decrypt or reveal the password to the hidden operating system.",-1,26,116,200,50
- LTEXT "For a detailed explanation, please click the Help button. ",-1,26,180,200,10
- LTEXT "IMPORTANT: Only advanced users should make modifications on this page.", -1, 10, 12, 217, 19,
-
- GROUPBOX "", -1, 6, 30, 232, 178
- DEFPUSHBUTTON "OK", IDOK, 129, 213, 50, 14
- PUSHBUTTON "Cancel", IDCANCEL, 180, 213, 50, 14
- PUSHBUTTON "&Help",IDHELP,15,213,50,14
+ CONTROL "Normal",IDC_SYSENC_NORMAL,"Button",BS_AUTORADIOBUTTON,0,7,269,10
+ CONTROL "Hi&dden",IDC_SYSENC_HIDDEN,"Button",BS_AUTORADIOBUTTON,0,64,269,10
+ LTEXT "More information",IDC_HIDDEN_SYSENC_INFO_LINK,16,173,253,10,SS_NOTIFY
+ LTEXT "",IDC_BOX_HELP_SYSENC_NORMAL,16,20,253,41
+ LTEXT "",IDC_BOX_HELP,16,78,253,90
END
+
IDD_SYSENC_HIDDEN_OS_REQ_CHECK_PAGE_DLG DIALOGEX 0, 0, 276, 193
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
LTEXT "More information",IDC_HIDDEN_SYSENC_INFO_LINK,0,172,273,10,SS_NOTIFY
LTEXT "",IDC_BOX_HELP,0,2,273,166
END
IDD_DEVICE_WIPE_PAGE_DLG DIALOGEX 0, 0, 276, 193
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
PUSHBUTTON "Abort",IDC_ABORT_BUTTON,217,48,50,14
LTEXT "",IDC_BYTESWRITTEN,29,66,39,11,SS_CENTERIMAGE,WS_EX_TRANSPARENT | WS_EX_RIGHT | WS_EX_STATICEDGE
RTEXT "",IDC_WRITESPEED,119,66,46,11,SS_CENTERIMAGE | NOT WS_VISIBLE,WS_EX_TRANSPARENT | WS_EX_RIGHT | WS_EX_STATICEDGE
RTEXT "",IDC_TIMEREMAIN,219,66,48,11,SS_CENTERIMAGE,WS_EX_TRANSPARENT | WS_EX_RIGHT | WS_EX_STATICEDGE
RTEXT "Wipe mode:",IDT_WIPE_MODE,6,22,92,8,0,WS_EX_RIGHT
CONTROL "",IDC_PROGRESS_BAR,"msctls_progress32",PBS_SMOOTH | WS_BORDER,6,49,208,12
RTEXT "Done",IDT_DONE,5,67,22,8
RTEXT "Pass",IDT_PASS,73,67,44,8,NOT WS_VISIBLE
RTEXT "Left",IDT_LEFT,180,67,34,8
LTEXT "",IDC_BOX_HELP,1,96,266,91
GROUPBOX "",IDT_FORMAT_OPTIONS,0,10,267,29
GROUPBOX "",IDC_STATIC,0,40,267,42
LTEXT "",IDC_WIPE_MODE,101,21,125,11,SS_CENTERIMAGE,WS_EX_TRANSPARENT | WS_EX_STATICEDGE
END
IDD_DEVICE_WIPE_MODE_PAGE_DLG DIALOGEX 0, 0, 276, 193
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
COMBOBOX IDC_WIPE_MODE,89,9,127,90,CBS_DROPDOWNLIST | WS_TABSTOP
RTEXT "Wipe mode:",IDT_WIPE_MODE,0,11,86,8,0,WS_EX_RIGHT
LTEXT "",IDT_WIPE_MODE_INFO,0,29,269,157
END
IDD_DEVICE_TRANSFORM_MODE_DLG DIALOGEX 0, 0, 276, 193
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "Create encrypted volume and format it",IDC_DEVICE_TRANSFORM_MODE_FORMAT,
"Button",BS_AUTORADIOBUTTON,0,8,269,10
CONTROL "Encrypt partition in place",IDC_DEVICE_TRANSFORM_MODE_INPLACE,
"Button",BS_AUTORADIOBUTTON,0,111,269,10
LTEXT "",IDC_BOX_HELP,16,21,253,84
LTEXT "",IDC_BOX_HELP2,16,125,253,61
END
IDD_EXPANDED_LIST_SELECT_PAGE_DLG DIALOGEX 0, 0, 276, 193
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
LTEXT "",IDC_BOX_HELP,0,117,269,69
LISTBOX IDC_LIST_BOX,0,3,269,107,LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_VSCROLL
END
IDD_DRIVE_LETTER_SELECTION_PAGE DIALOGEX 0, 0, 277, 193
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
LTEXT "",IDC_BOX_HELP,0,40,270,146
COMBOBOX IDC_DRIVE_LETTER_LIST,115,15,38,69,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
RTEXT "Drive letter:",IDT_DRIVE_LETTER,5,17,106,8
END
IDD_PIM_PAGE_DLG DIALOGEX 0, 0, 276, 193
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
EDITTEXT IDC_PIM,74,0,42,14,ES_RIGHT | ES_PASSWORD | ES_AUTOHSCROLL | ES_NUMBER
LTEXT "",IDC_BOX_HELP,0,32,273,142
RTEXT "Volume PIM:",IDT_PIM,1,3,69,8
LTEXT "(Empty or 0 for default iterations)",IDC_PIM_HELP,120,3,153,8
LTEXT "Information on PIM",IDC_LINK_PIM_INFO,0,179,273,8,SS_NOTIFY
CONTROL "Display PIM",IDC_SHOW_PIM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,74,17,196,10
END
-IDD_ADVANCE DIALOGEX 75, -62, 245, 362
-STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "Advanced Algorithm Options"
-FONT 8, "MS Shell Dlg", 400, 0, 0x1
-BEGIN
- DEFPUSHBUTTON "OK", IDOK, 129, 345, 50, 14
- PUSHBUTTON "Cancel", IDCANCEL, 180, 345, 50, 14
- COMBOBOX IDC_COMBO_BOX_HASH_ALGO, 21, 47, 137, 130, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- LTEXT "", IDC_SHA512_HELP, 21, 65, 205, 40
- COMBOBOX IDC_COMBO_BOX, 21, 113, 137, 126, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- LTEXT "", IDC_BOX_HELP, 21, 131, 205, 40
- PUSHBUTTON "&Verify", IDC_CIPHER_TEST, 40, 181, 59, 14
- PUSHBUTTON "&Benchmark", IDC_BENCHMARK, 140, 181, 59, 14, BS_PUSHBUTTON | WS_TABSTOP | WS_VISIBLE
- GROUPBOX "Encryption Algorithm", IDT_ENCRYPTION_ALGO, 14, 100, 217, 60
- GROUPBOX "Hash Algorithm", IDT_HASH_ALGO, 14, 35, 217, 60
- GROUPBOX "Test Algorithms", IDT_TEST_ALGO, 14, 168, 217, 35
- GROUPBOX "PIM", -1, 14, 206, 217, 59
- CONTROL "Modify P&IM", IDC_PIM_ENABLE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 19, 217, 97, 10
- LTEXT "", IDT_PIM_INFO, 21, 231, 203, 25
- GROUPBOX "Wipe Mode", IDT_WIPE_MODE, 14, 270, 217, 71
- COMBOBOX IDC_WIPE_MODE, 21, 284, 127, 90, CBS_DROPDOWNLIST | WS_TABSTOP
- LTEXT "", IDT_WIPE_INFO, 21, 303, 200, 32
- LTEXT "", IDT_IMPORTANT_NOTE, 18, 10, 217, 19
-END
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"#include ""..\\\\common\\\\resource.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"#include ""..\\\\common\\\\common.rc""\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_VOL_CREATION_WIZARD_DLG, DIALOG
BEGIN
RIGHTMARGIN, 443
TOPMARGIN, 1
BOTTOMMARGIN, 248
HORZGUIDE, 241
END
IDD_CIPHER_PAGE_DLG, DIALOG
BEGIN
RIGHTMARGIN, 273
BOTTOMMARGIN, 182
END
IDD_PASSWORD_PAGE_DLG, DIALOG
BEGIN
RIGHTMARGIN, 273
BOTTOMMARGIN, 192
END
IDD_SIZE_PAGE_DLG, DIALOG
BEGIN
RIGHTMARGIN, 273
BOTTOMMARGIN, 186
END
IDD_VOLUME_LOCATION_PAGE_DLG, DIALOG
BEGIN
RIGHTMARGIN, 273
BOTTOMMARGIN, 188
END
IDD_FORMAT_PAGE_DLG, DIALOG
BEGIN
HORZGUIDE, 80
HORZGUIDE, 96
END
IDD_INTRO_PAGE_DLG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 269
TOPMARGIN, 7
BOTTOMMARGIN, 186
END
IDD_INFO_PAGE_DLG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 269
TOPMARGIN, 7
BOTTOMMARGIN, 186
END
IDD_HIDVOL_HOST_FILL_PAGE_DLG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 269
TOPMARGIN, 7
BOTTOMMARGIN, 186
END
IDD_HIDDEN_VOL_WIZARD_MODE_PAGE_DLG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 269
TOPMARGIN, 7
BOTTOMMARGIN, 186
END
IDD_PASSWORD_ENTRY_PAGE_DLG, DIALOG
BEGIN
RIGHTMARGIN, 273
END
IDD_VOLUME_TYPE_PAGE_DLG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 269
TOPMARGIN, 7
BOTTOMMARGIN, 186
END
IDD_SYSENC_SPAN_PAGE_DLG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 269
TOPMARGIN, 7
BOTTOMMARGIN, 186
END
IDD_SYSENC_RESCUE_DISK_CREATION_DLG, DIALOG
BEGIN
RIGHTMARGIN, 273
BOTTOMMARGIN, 188
END
IDD_SYSENC_COLLECTING_RANDOM_DATA_DLG, DIALOG
BEGIN
BOTTOMMARGIN, 174
HORZGUIDE, 80
HORZGUIDE, 96
END
IDD_SYSENC_MULTI_BOOT_MODE_PAGE_DLG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 269
TOPMARGIN, 7
BOTTOMMARGIN, 186
END
IDD_SYSENC_RESCUE_DISK_BURN_PAGE_DLG, DIALOG
BEGIN
RIGHTMARGIN, 273
BOTTOMMARGIN, 188
END
IDD_SYSENC_WIPE_MODE_PAGE_DLG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 269
TOPMARGIN, 7
BOTTOMMARGIN, 186
END
IDD_INPLACE_ENCRYPTION_PAGE_DLG, DIALOG
BEGIN
RIGHTMARGIN, 267
BOTTOMMARGIN, 187
HORZGUIDE, 80
HORZGUIDE, 96
END
- IDD_ADVANCE, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 238
- TOPMARGIN, 7
- BOTTOMMARGIN, 242
- END
-
- IDD_ADVANCE_MBR, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 238
- TOPMARGIN, 7
- BOTTOMMARGIN, 242
- END
-
IDD_SYSENC_KEYS_GEN_PAGE_DLG, DIALOG
BEGIN
RIGHTMARGIN, 267
BOTTOMMARGIN, 174
HORZGUIDE, 80
HORZGUIDE, 96
END
IDD_UNIVERSAL_DUAL_CHOICE_PAGE_DLG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 269
TOPMARGIN, 7
BOTTOMMARGIN, 186
END
IDD_SYSENC_DRIVE_ANALYSIS_PAGE_DLG, DIALOG
BEGIN
RIGHTMARGIN, 267
BOTTOMMARGIN, 174
HORZGUIDE, 80
HORZGUIDE, 96
END
IDD_SYSENC_TYPE_PAGE_DLG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 269
TOPMARGIN, 7
BOTTOMMARGIN, 186
END
IDD_SYSENC_HIDDEN_OS_REQ_CHECK_PAGE_DLG, DIALOG
BEGIN
RIGHTMARGIN, 273
BOTTOMMARGIN, 188
END
IDD_DEVICE_WIPE_PAGE_DLG, DIALOG
BEGIN
RIGHTMARGIN, 267
BOTTOMMARGIN, 187
HORZGUIDE, 80
HORZGUIDE, 96
END
IDD_DEVICE_WIPE_MODE_PAGE_DLG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 269
TOPMARGIN, 7
BOTTOMMARGIN, 186
END
IDD_DEVICE_TRANSFORM_MODE_DLG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 269
TOPMARGIN, 7
BOTTOMMARGIN, 186
END
IDD_EXPANDED_LIST_SELECT_PAGE_DLG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 269
TOPMARGIN, 7
BOTTOMMARGIN, 186
END
IDD_DRIVE_LETTER_SELECTION_PAGE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 270
TOPMARGIN, 7
BOTTOMMARGIN, 186
END
IDD_PIM_PAGE_DLG, DIALOG
BEGIN
RIGHTMARGIN, 273
BOTTOMMARGIN, 192
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_WIZARD BITMAP "VeraCrypt_wizard.bmp"
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDS_UACSTRING_FMT "VeraCrypt"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#include "..\\common\\common.rc"
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
+
diff --git a/src/Format/Resource.h b/src/Format/Resource.h
index d031a7dd..c37a6f4a 100644
--- a/src/Format/Resource.h
+++ b/src/Format/Resource.h
@@ -1,183 +1,160 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by Format.rc
//
#define IDR_FORMAT_TLB 1
#define IDD_VOL_CREATION_WIZARD_DLG 101
#define IDD_CIPHER_PAGE_DLG 102
#define IDD_SIZE_PAGE_DLG 103
#define IDD_PASSWORD_PAGE_DLG 104
#define IDD_VOLUME_LOCATION_PAGE_DLG 105
#define IDD_FORMAT_PAGE_DLG 106
#define IDD_INTRO_PAGE_DLG 107
#define IDD_INFO_PAGE_DLG 108
#define IDD_HIDVOL_HOST_FILL_PAGE_DLG 109
#define IDD_HIDDEN_VOL_WIZARD_MODE_PAGE_DLG 110
#define IDD_PASSWORD_ENTRY_PAGE_DLG 111
#define IDS_UACSTRING_FMT 112
#define IDD_VOLUME_TYPE_PAGE_DLG 113
#define IDR_FORMAT_RSRC_HEADER 114
#define IDD_SYSENC_SPAN_PAGE_DLG 115
#define IDB_WIZARD 116
#define IDD_SYSENC_RESCUE_DISK_CREATION_DLG 117
#define IDD_SYSENC_COLLECTING_RANDOM_DATA_DLG 118
#define IDD_SYSENC_MULTI_BOOT_MODE_PAGE_DLG 119
#define IDD_SYSENC_RESCUE_DISK_BURN_PAGE_DLG 120
#define IDD_SYSENC_WIPE_MODE_PAGE_DLG 121
#define IDD_INPLACE_ENCRYPTION_PAGE_DLG 122
#define IDD_SYSENC_KEYS_GEN_PAGE_DLG 123
#define IDD_UNIVERSAL_DUAL_CHOICE_PAGE_DLG 124
#define IDD_SYSENC_DRIVE_ANALYSIS_PAGE_DLG 125
#define IDD_SYSENC_TYPE_PAGE_DLG 126
#define IDD_SYSENC_HIDDEN_OS_REQ_CHECK_PAGE_DLG 127
#define IDD_DEVICE_WIPE_PAGE_DLG 128
#define IDD_DEVICE_WIPE_MODE_PAGE_DLG 129
#define IDD_DEVICE_TRANSFORM_MODE_DLG 130
#define IDD_EXPANDED_LIST_SELECT_PAGE_DLG 131
#define IDD_DRIVE_LETTER_SELECTION_PAGE 132
#define IDD_PIM_PAGE_DLG 133
#define IDC_BOX_TITLE 1000
#define IDC_RESCUE_DISK_ISO_PATH 1001
#define IDC_COMBO_BOX 1002
#define IDC_BOX_HELP 1003
#define IDC_PASSWORD 1004
#define IDC_BROWSE 1005
#define IDC_BOX_HELP2 1006
#define IDC_COMBO_BOX_HASH 1007
#define IDC_COMBO_BOX_HASH_ALGO 1008
#define IDC_SPACE_LEFT 1009
#define IDC_VERIFY 1010
#define IDC_KB 1011
#define IDC_NO_HISTORY 1012
#define IDC_MB 1013
#define IDC_PROGRESS_BAR 1014
#define IDC_GB 1015
#define IDC_ABORT_BUTTON 1016
#define IDC_HEADER_KEY 1017
#define IDC_LIST_BOX 1018
#define IDC_DISK_KEY 1019
#define IDC_RANDOM_BYTES 1020
#define IDC_CIPHER_TEST 1021
#define IDC_BENCHMARK 1022
#define IDC_QUICKFORMAT 1023
#define IDC_BYTESWRITTEN 1024
#define IDC_WRITESPEED 1025
#define IDC_KEY_FILES 1026
#define IDC_TIMEREMAIN 1027
#define IDC_CLUSTERSIZE 1028
#define IDC_FILESYS 1029
#define IDC_SHOW_KEYS 1030
#define IDC_STD_VOL 1031
#define IDC_HIDDEN_VOL 1032
#define IDC_HIDDEN_VOL_HELP 1033
#define IDC_OPEN_OUTER_VOLUME 1034
#define IDC_HIDVOL_WIZ_MODE_FULL 1035
#define IDC_HIDVOL_WIZ_MODE_DIRECT 1036
#define IDC_PASSWORD_DIRECT 1037
#define IDC_SIZEBOX 1038
#define IDC_SELECT_VOLUME_LOCATION 1039
#define IDC_NEXT 1040
#define IDC_PREV 1041
#define IDT_ENCRYPTION_ALGO 1042
#define IDT_HASH_ALGO 1043
#define IDT_FORMAT_OPTIONS 1044
#define IDT_FILESYSTEM 1045
#define IDT_CLUSTER 1046
#define IDT_RANDOM_POOL 1047
#define IDT_HEADER_KEY 1048
#define IDT_MASTER_KEY 1049
#define IDT_DONE 1050
#define IDT_SPEED 1051
#define IDT_LEFT 1052
#define IDT_CONFIRM 1053
#define IDT_PASSWORD 1054
#define IDC_SHOW_PASSWORD_SINGLE 1055
#define IDC_SHOW_PASSWORD 1056
#define IDC_LINK_MORE_INFO_ABOUT_CIPHER 1057
#define IDC_LINK_HASH_INFO 1058
#define IDC_POS_BOX 1059
#define IDC_BITMAP_WIZARD 1060
#define IDC_FILE_CONTAINER 1061
#define IDC_NONSYS_DEVICE 1062
#define IDC_SYS_DEVICE 1063
#define IDT_FILE_CONTAINER 1064
#define IDT_NON_SYS_DEVICE 1065
#define IDT_SYS_DEVICE 1066
#define IDC_WHOLE_SYS_DRIVE 1067
#define IDC_SYS_PARTITION 1068
#define IDT_WHOLE_SYS_DRIVE 1069
#define IDT_SYS_PARTITION 1070
#define IDT_RESCUE_DISK_INFO 1071
#define IDC_MORE_INFO 1072
#define IDC_MORE_INFO_ON_SYS_ENCRYPTION 1073
#define IDT_COLLECTING_RANDOM_DATA_NOTE 1074
#define IDC_MORE_INFO_ON_CONTAINERS 1075
#define IDC_SINGLE_BOOT 1076
#define IDC_MULTI_BOOT 1077
#define IDT_MULTI_BOOT 1078
#define IDT_SINGLE_BOOT 1079
#define IDC_SYS_POOL_CONTENTS 1080
#define IDT_PARTIAL_POOL_CONTENTS 1081
+#define IDC_DOWNLOAD_CD_BURN_SOFTWARE 1082
#define IDT_RESCUE_DISK_BURN_INFO 1083
#define IDT_WIPE_MODE_INFO 1084
#define IDC_WIPE_MODE 1085
#define IDC_SELECT 1086
#define IDT_SYSENC_KEYS_GEN_INFO 1087
#define IDC_DISPLAY_KEYS 1088
#define IDC_PAUSE 1089
#define IDT_WIPE_MODE 1090
#define IDC_MORE_INFO_SYS_ENCRYPTION 1091
#define IDC_BOX_HELP_NORMAL_VOL 1092
#define IDT_STATUS 1093
#define IDT_PROGRESS 1094
#define IDT_SYSENC_DRIVE_ANALYSIS_INFO 1095
#define IDC_SYSENC_NORMAL 1096
#define IDC_SYSENC_HIDDEN 1097
#define IDC_BOX_HELP_SYSENC_NORMAL 1098
#define IDC_HIDDEN_SYSENC_INFO_LINK 1099
#define IDT_PASS 1100
#define IDC_DEVICE_TRANSFORM_MODE_FORMAT 1101
#define IDC_DEVICE_TRANSFORM_MODE_INPLACE 1102
#define IDC_DRIVE_LETTER_LIST 1103
#define IDT_DRIVE_LETTER 1104
#define IDC_LINK_PIM_INFO 1105
#define IDC_SHOW_PIM 1106
#define IDC_TB 1107
#define IDC_SKIP_RESCUE_VERIFICATION 1108
#define SPARSE_FILE 1109
-#define IDC_ADVANCE_INTRO 1110
-#define IDD_ADVANCE 1111
-#define IDC_ADVANCE 1112
-#define PASSWORD_METER 1113
-#define IDC_REMEMBER_PASSWORD 1114
-#define IDC_STORE_RESCUE_DISK 1115
-#define IDC_BACKUP_DATA 1116
-#define IDT_REMEMBER_PASSWORD 1117
-#define IDT_STORE_RESCUE_DISK 1118
-#define IDT_BACKUP_DATA 1119
-#define IDC_CHECKLIST_A 1120
-#define IDC_CHECKLIST_B 1121
-#define IDC_CHECKLIST_C 1122
-#define IDD_ADVANCE_MBR 1123
-#define IDC_INFORMATION_TIP 1124
-#define IDC_SHA512_HELP 1125
-#define IDT_PASSWORD_STRENGTH 1126
-#define IDT_RESCUE_DISK_INFO_2 1127
-#define IDT_SYSENC_INFO_2 1128
-#define IDT_IMPORTANT_NOTE 1129
-#define IDT_PIM_INFO 1130
-#define IDT_WIPE_INFO 1131
-#define IDT_TEST_ALGO 1132
-#define IDC_CHECKBOX_PRETEST 1133
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#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_SYMED_VALUE 101
#endif
#endif
diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c
index db0a8209..efd95caf 100644
--- a/src/Format/Tcformat.c
+++ b/src/Format/Tcformat.c
@@ -1,11478 +1,10633 @@
/*
Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses'
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. */
#include "Tcdefs.h"
-#include <iostream>
-#include <fstream>
-#include <set>
-#include <iterator>
#include <stdlib.h>
#include <limits.h>
#include <time.h>
#include <errno.h>
#include <io.h>
#include <sys/stat.h>
#include <shlobj.h>
-#include <commctrl.h>
#include "Crypto.h"
#include "cpu.h"
#include "Apidrvr.h"
#include "Dlgcode.h"
#include "Language.h"
#include "Combo.h"
#include "Registry.h"
#include "Boot/Windows/BootDefs.h"
#include "Common/Common.h"
#include "Common/BootEncryption.h"
#include "Common/Dictionary.h"
#include "Common/Endian.h"
#include "Common/resource.h"
#include "Common/Pkcs5.h"
#include "Platform/Finally.h"
#include "Platform/ForEach.h"
#include "Random.h"
#include "Fat.h"
#include "InPlace.h"
#include "Resource.h"
#include "TcFormat.h"
#include "Format.h"
#include "FormatCom.h"
#include "Password.h"
#include "Progress.h"
#include "Tests.h"
#include "Cmdline.h"
#include "Volumes.h"
#include "Wipe.h"
#include "Xml.h"
#include "SecurityToken.h"
#include <Strsafe.h>
using namespace VeraCrypt;
enum wizard_pages
{
/* IMPORTANT: IF YOU ADD/REMOVE/MOVE ANY PAGES THAT ARE RELATED TO SYSTEM ENCRYPTION,
REVISE THE 'DECOY_OS_INSTRUCTIONS_PORTION_??' STRINGS! */
INTRO_PAGE,
SYSENC_TYPE_PAGE,
SYSENC_HIDDEN_OS_REQ_CHECK_PAGE,
SYSENC_SPAN_PAGE,
SYSENC_PRE_DRIVE_ANALYSIS_PAGE,
SYSENC_DRIVE_ANALYSIS_PAGE,
SYSENC_MULTI_BOOT_MODE_PAGE,
SYSENC_MULTI_BOOT_SYS_EQ_BOOT_PAGE,
SYSENC_MULTI_BOOT_NBR_SYS_DRIVES_PAGE,
SYSENC_MULTI_BOOT_ADJACENT_SYS_PAGE,
SYSENC_MULTI_BOOT_NONWIN_BOOT_LOADER_PAGE,
SYSENC_MULTI_BOOT_OUTCOME_PAGE,
VOLUME_TYPE_PAGE,
HIDDEN_VOL_WIZARD_MODE_PAGE,
VOLUME_LOCATION_PAGE,
DEVICE_TRANSFORM_MODE_PAGE,
HIDDEN_VOL_HOST_PRE_CIPHER_PAGE,
HIDDEN_VOL_PRE_CIPHER_PAGE,
CIPHER_PAGE,
SIZE_PAGE,
HIDDEN_VOL_HOST_PASSWORD_PAGE,
PASSWORD_PAGE,
PIM_PAGE,
FILESYS_PAGE,
SYSENC_COLLECTING_RANDOM_DATA_PAGE,
SYSENC_KEYS_GEN_PAGE,
SYSENC_RESCUE_DISK_CREATION_PAGE,
SYSENC_RESCUE_DISK_BURN_PAGE,
SYSENC_RESCUE_DISK_VERIFIED_PAGE,
SYSENC_WIPE_MODE_PAGE,
SYSENC_PRETEST_INFO_PAGE,
SYSENC_PRETEST_RESULT_PAGE,
SYSENC_ENCRYPTION_PAGE,
NONSYS_INPLACE_ENC_RESUME_PASSWORD_PAGE,
NONSYS_INPLACE_ENC_RESUME_PARTITION_SEL_PAGE,
NONSYS_INPLACE_ENC_RAND_DATA_PAGE,
NONSYS_INPLACE_ENC_WIPE_MODE_PAGE,
NONSYS_INPLACE_ENC_TRANSFORM_PAGE,
NONSYS_INPLACE_ENC_TRANSFORM_FINISHED_PAGE,
NONSYS_INPLACE_DEC_TRANSFORM_FINISHED_DRIVE_LETTER_PAGE,
FORMAT_PAGE,
FORMAT_FINISHED_PAGE,
SYSENC_HIDDEN_OS_INITIAL_INFO_PAGE,
SYSENC_HIDDEN_OS_WIPE_INFO_PAGE,
DEVICE_WIPE_MODE_PAGE,
DEVICE_WIPE_PAGE
};
#define TIMER_INTERVAL_RANDVIEW 30
#define TIMER_INTERVAL_SYSENC_PROGRESS 30
#define TIMER_INTERVAL_NONSYS_INPLACE_ENC_PROGRESS 30
#define TIMER_INTERVAL_SYSENC_DRIVE_ANALYSIS_PROGRESS 100
#define TIMER_INTERVAL_WIPE_PROGRESS 30
#define TIMER_INTERVAL_KEYB_LAYOUT_GUARD 10
enum sys_encryption_cmd_line_switches
{
SYSENC_COMMAND_NONE = 0,
SYSENC_COMMAND_RESUME,
SYSENC_COMMAND_STARTUP_SEQ_RESUME,
SYSENC_COMMAND_ENCRYPT,
SYSENC_COMMAND_DECRYPT,
SYSENC_COMMAND_CREATE_HIDDEN_OS,
SYSENC_COMMAND_CREATE_HIDDEN_OS_ELEV
};
-enum password_status
-{
- very_weak = 0,
- weak,
- medium,
- strong,
- very_strong
-};
-
typedef struct
{
int NumberOfSysDrives; // Number of drives that contain an operating system. -1: unknown, 1: one, 2: two or more
int MultipleSystemsOnDrive; // Multiple systems are installed on the drive where the currently running system resides. -1: unknown, 0: no, 1: yes
int BootLoaderLocation; // Boot loader (boot manager) installed in: 1: MBR/1st cylinder, 0: partition/bootsector: -1: unknown
int BootLoaderBrand; // -1: unknown, 0: Microsoft Windows, 1: any non-Windows boot manager/loader
int SystemOnBootDrive; // If the currently running operating system is installed on the boot drive. -1: unknown, 0: no, 1: yes
} SYSENC_MULTIBOOT_CFG;
#define SYSENC_PAUSE_RETRY_INTERVAL 100
#define SYSENC_PAUSE_RETRIES 200
// Expected duration of system drive analysis, in ms
#define SYSENC_DRIVE_ANALYSIS_ETA (4*60000)
BootEncryption *BootEncObj = NULL;
BootEncryptionStatus BootEncStatus;
HWND hCurPage = NULL; /* Handle to current wizard page */
int nCurPageNo = -1; /* The current wizard page */
int nLastPageNo = -1;
volatile int WizardMode = DEFAULT_VOL_CREATION_WIZARD_MODE; /* IMPORTANT: Never change this value directly -- always use ChangeWizardMode() instead. */
volatile BOOL bHiddenOS = FALSE; /* If TRUE, we are performing or (or supposed to perform) actions relating to an operating system installed in a hidden volume (i.e., encrypting a decoy OS partition or creating the outer/hidden volume for the hidden OS). To determine or set the phase of the process, call ChangeHiddenOSCreationPhase() and DetermineHiddenOSCreationPhase()) */
BOOL bDirectSysEncMode = FALSE;
BOOL bDirectSysEncModeCommand = SYSENC_COMMAND_NONE;
BOOL DirectDeviceEncMode = FALSE;
BOOL DirectNonSysInplaceDecStartMode = FALSE;
BOOL DirectNonSysInplaceEncResumeMode = FALSE;
BOOL DirectNonSysInplaceDecResumeMode = FALSE;
BOOL DirectPromptNonSysInplaceEncResumeMode = FALSE;
BOOL DirectCreationMode = FALSE;
-int iIconX=0;
-int iIconY=0;
-HWND hDlgItemTooltip = NULL;
-HANDLE hIconTooltip = NULL;
-char tempPassword[MAX_PASSWORD + 1];
-int iPasswordStrength;
-
-volatile BOOL bInPlaceEncNonSys = TRUE; /* If TRUE, existing data on a non-system partition/volume are to be encrypted (or decrypted if bInPlaceDecNonSys is TRUE) in place (for system encryption, this flag is ignored) */
+volatile BOOL bInPlaceEncNonSys = FALSE; /* If TRUE, existing data on a non-system partition/volume are to be encrypted (or decrypted if bInPlaceDecNonSys is TRUE) in place (for system encryption, this flag is ignored) */
volatile BOOL bInPlaceDecNonSys = FALSE; /* If TRUE, existing data on a non-system partition/volume are to be decrypted in place (for system encryption, this flag is ignored) */
volatile BOOL bInPlaceEncNonSysResumed = FALSE; /* If TRUE, the wizard is supposed to resume (or has resumed) process of non-system in-place encryption/decryption. */
volatile BOOL bFirstNonSysInPlaceEncResumeDone = FALSE;
__int64 NonSysInplaceEncBytesDone = 0;
__int64 NonSysInplaceEncTotalSize = 0;
BOOL bDeviceTransformModeChoiceMade = FALSE; /* TRUE if the user has at least once manually selected the 'in-place' or 'format' option (on the 'device transform mode' page). */
int nNeedToStoreFilesOver4GB = 0; /* Whether the user wants to be able to store files larger than 4GB on the volume: -1 = Undecided or error, 0 = No, 1 = Yes */
int nVolumeEA = 1; /* Default encryption algorithm */
BOOL bSystemEncryptionInProgress = FALSE; /* TRUE when encrypting/decrypting the system partition/drive (FALSE when paused). */
BOOL bWholeSysDrive = FALSE; /* Whether to encrypt the entire system drive or just the system partition. */
static BOOL bSystemEncryptionStatusChanged = FALSE; /* TRUE if this instance changed the value of SystemEncryptionStatus (it's set to FALSE each time the system encryption settings are saved to the config file). This value is to be treated as protected -- only the wizard can change this value (others may only read it). */
volatile BOOL bSysEncDriveAnalysisInProgress = FALSE;
volatile BOOL bSysEncDriveAnalysisTimeOutOccurred = FALSE;
int SysEncDetectHiddenSectors = -1; /* Whether the user wants us to detect and encrypt the Host Protect Area (if any): -1 = Undecided or error, 0 = No, 1 = Yes */
int SysEncDriveAnalysisStart;
BOOL bDontVerifyRescueDisk = FALSE;
BOOL bFirstSysEncResumeDone = FALSE;
BOOL bDontCheckFileContainerSize = FALSE; /* If true, we don't check if the given size of file container is smaller than the available size on the hosting disk */
int nMultiBoot = 0; /* The number of operating systems installed on the computer, according to the user. 0: undetermined, 1: one, 2: two or more */
volatile BOOL bHiddenVol = FALSE; /* If true, we are (or will be) creating a hidden volume. */
volatile BOOL bHiddenVolHost = FALSE; /* If true, we are (or will be) creating the host volume (called "outer") for a hidden volume. */
volatile BOOL bHiddenVolDirect = FALSE; /* If true, the wizard omits creating a host volume in the course of the process of hidden volume creation. */
volatile BOOL bHiddenVolFinished = FALSE;
int hiddenVolHostDriveNo = -1; /* Drive letter for the volume intended to host a hidden volume. */
BOOL bRemovableHostDevice = FALSE; /* TRUE when creating a device/partition-hosted volume on a removable device. State undefined when creating file-hosted volumes. */
int realClusterSize; /* Parameter used when determining the maximum possible size of a hidden volume. */
int hash_algo = DEFAULT_HASH_ALGORITHM; /* Which PRF to use in header key derivation (PKCS #5) and in the RNG. */
unsigned __int64 nUIVolumeSize = 0; /* The volume size. Important: This value is not in bytes. It has to be multiplied by nMultiplier. Do not use this value when actually creating the volume (it may chop off sector size, if it is not a multiple of 1024 bytes). */
unsigned __int64 nVolumeSize = 0; /* The volume size, in bytes. */
unsigned __int64 nHiddenVolHostSize = 0; /* Size of the hidden volume host, in bytes */
__int64 nMaximumHiddenVolSize = 0; /* Maximum possible size of the hidden volume, in bytes */
__int64 nbrFreeClusters = 0;
__int64 nMultiplier = BYTES_PER_MB; /* Size selection multiplier. */
wchar_t szFileName[TC_MAX_PATH+1]; /* The file selected by the user */
wchar_t szDiskFile[TC_MAX_PATH+1]; /* Fully qualified name derived from szFileName */
wchar_t szRescueDiskISO[TC_MAX_PATH+1]; /* The filename and path to the Rescue Disk ISO file to be burned (for boot encryption) */
BOOL bDeviceWipeInProgress = FALSE;
volatile BOOL bTryToCorrectReadErrors = FALSE;
volatile BOOL DiscardUnreadableEncryptedSectors = FALSE;
volatile BOOL bVolTransformThreadCancel = FALSE; /* TRUE if the user cancels/pauses volume encryption/format */
volatile BOOL bVolTransformThreadRunning = FALSE; /* Is the volume encryption/format thread running */
volatile BOOL bVolTransformThreadToRun = FALSE; /* TRUE if the Format/Encrypt button has been clicked and we are proceeding towards launching the thread. */
volatile BOOL bConfirmQuit = FALSE; /* If TRUE, the user is asked to confirm exit when he clicks the X icon, Exit, etc. */
volatile BOOL bConfirmQuitSysEncPretest = FALSE;
BOOL bDevice = FALSE; /* Is this a partition volume ? */
BOOL showKeys = FALSE;
volatile HWND hMasterKey = NULL; /* Text box showing hex dump of the master key */
volatile HWND hHeaderKey = NULL; /* Text box showing hex dump of the header key */
volatile HWND hRandPool = NULL; /* Text box showing hex dump of the random pool */
volatile HWND hRandPoolSys = NULL; /* Text box showing hex dump of the random pool for system encryption */
volatile HWND hPasswordInputField = NULL; /* Password input field */
volatile HWND hVerifyPasswordInputField = NULL; /* Verify-password input field */
HBITMAP hbmWizardBitmapRescaled = NULL;
wchar_t OrigKeyboardLayout [8+1] = L"00000409";
BOOL bKeyboardLayoutChanged = FALSE; /* TRUE if the keyboard layout was changed to the standard US keyboard layout (from any other layout). */
BOOL bKeybLayoutAltKeyWarningShown = FALSE; /* TRUE if the user has been informed that it is not possible to type characters by pressing keys while the right Alt key is held down. */
#ifndef _DEBUG
BOOL bWarnDeviceFormatAdvanced = TRUE;
#else
BOOL bWarnDeviceFormatAdvanced = FALSE;
#endif
BOOL bWarnOuterVolSuitableFileSys = TRUE;
Password volumePassword; /* User password */
Password outerVolumePassword; /* Outer volume user password */
char szVerify[MAX_PASSWORD + 1]; /* Tmp password buffer */
char szRawPassword[MAX_PASSWORD + 1]; /* Password before keyfile was applied to it */
-BOOL bNextButtonClicked = FALSE;
int volumePim = 0;
int outerVolumePim = 0;
BOOL bHistoryCmdLine = FALSE; /* History control is always disabled */
BOOL ComServerMode = FALSE;
Password CmdVolumePassword = {0}; /* Password passed from command line */
int CmdVolumeEA = 0;
int CmdVolumePkcs5 = 0;
int CmdVolumePim = 0;
int CmdVolumeFilesystem = FILESYS_NONE;
unsigned __int64 CmdVolumeFileSize = 0;
BOOL CmdSparseFileSwitch = FALSE;
BOOL CmdQuickFormat = FALSE;
BOOL CmdFastCreateFile = FALSE;
BOOL bForceOperation = FALSE;
BOOL bOperationSuccess = FALSE;
BOOL bGuiMode = TRUE;
BOOL bSystemIsGPT = FALSE;
KeyFile *FirstCmdKeyFile = NULL;
int nPbar = 0; /* Control ID of progress bar:- for format code */
wchar_t HeaderKeyGUIView [KEY_GUI_VIEW_SIZE];
wchar_t MasterKeyGUIView [KEY_GUI_VIEW_SIZE];
#define RANDPOOL_DISPLAY_COLUMNS 15
#define RANDPOOL_DISPLAY_ROWS 8
#define RANDPOOL_DISPLAY_BYTE_PORTION (RANDPOOL_DISPLAY_COLUMNS * RANDPOOL_DISPLAY_ROWS)
#define RANDPOOL_DISPLAY_SIZE (RANDPOOL_DISPLAY_BYTE_PORTION * 3 + RANDPOOL_DISPLAY_ROWS + 2)
unsigned char randPool [RANDPOOL_DISPLAY_BYTE_PORTION];
unsigned char lastRandPool [RANDPOOL_DISPLAY_BYTE_PORTION];
static unsigned char maskRandPool [RANDPOOL_DISPLAY_BYTE_PORTION];
static BOOL bUseMask = FALSE;
static DWORD mouseEntropyGathered = 0xFFFFFFFF;
static DWORD mouseEventsInitialCount = 0;
/* max value of entropy needed to fill all random pool = 8 * RNG_POOL_SIZE = 2560 bits */
static const DWORD maxEntropyLevel = RNG_POOL_SIZE * 8;
static HWND hEntropyBar = NULL;
wchar_t outRandPoolDispBuffer [RANDPOOL_DISPLAY_SIZE];
BOOL bDisplayPoolContents = TRUE;
volatile BOOL bSparseFileSwitch = FALSE;
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 clusterSize = 0;
SYSENC_MULTIBOOT_CFG SysEncMultiBootCfg;
wchar_t SysEncMultiBootCfgOutcome [4096] = {L'N',L'/',L'A',0};
volatile int NonSysInplaceEncStatus = NONSYS_INPLACE_ENC_STATUS_NONE;
LONGLONG nAvailableFreeSpace = -1;
BOOL bIsSparseFilesSupportedByHost = FALSE;
vector <HostDevice> DeferredNonSysInPlaceEncDevices;
-BOOL bChecklistA;
-BOOL bChecklistB;
-BOOL bChecklistC;
-BOOL bCheckboxPretest;
-
int iMaxPasswordLength = MAX_PASSWORD;
// specific definitions and implementation for support of resume operation
// in wait dialog mechanism
void CALLBACK ResumeInPlaceEncWaitThreadProc(void* pArg, HWND hwndDlg)
{
wchar_t szDevicePath[MAX_PATH] = {0};
RawDevicesDlgParam param;
param.devices = GetAvailableHostDevices (false, true, false);
param.pszFileName = szDevicePath;
DeferredNonSysInPlaceEncDevices.clear();
if ((IDOK == DialogBoxParamW (hInst,
MAKEINTRESOURCEW (IDD_RAWDEVICES_DLG), hwndDlg,
(DLGPROC) RawDevicesDlgProc, (LPARAM) &param)) && wcslen(szDevicePath))
{
foreach (const HostDevice &device, param.devices)
{
if (device.Path == szDevicePath)
{
OpenVolumeContext volume;
int status = OpenVolume (&volume, device.Path.c_str(), &volumePassword, hash_algo, volumePim, FALSE, FALSE, FALSE, TRUE);
if ( status == ERR_SUCCESS)
{
if ((volume.CryptoInfo->HeaderFlags & TC_HEADER_FLAG_NONSYS_INPLACE_ENC) != 0
&& volume.CryptoInfo->EncryptedAreaLength.Value != volume.CryptoInfo->VolumeSize.Value)
{
DeferredNonSysInPlaceEncDevices.push_back (device);
}
else if (volume.CryptoInfo->EncryptedAreaLength.Value == volume.CryptoInfo->VolumeSize.Value)
{
WCHAR szMsg[1024];
StringCbPrintfW(szMsg, sizeof(szMsg), GetString ("SELECTED_PARTITION_ALREADY_INPLACE_ENC"),
volume.CryptoInfo->HeaderFlags);
ErrorDirect(szMsg, hwndDlg);
}
else
{
WCHAR szMsg[1024];
StringCbPrintfW(szMsg, sizeof(szMsg), GetString ("SELECTED_PARTITION_NOT_INPLACE_ENC"),
volume.CryptoInfo->HeaderFlags);
ErrorDirect(szMsg, hwndDlg);
}
CloseVolume (&volume);
}
else
{
handleError(hwndDlg, status, SRC_POS);
}
break;
}
}
}
else
{
foreach (const HostDevice &device, param.devices)
{
if ( !device.ContainsSystem
&& (device.IsPartition || device.DynamicVolume || device.IsVirtualPartition || device.Partitions.empty())
)
{
OpenVolumeContext volume;
if (OpenVolume (&volume, device.Path.c_str(), &volumePassword, hash_algo, volumePim, FALSE, FALSE, FALSE, TRUE) == ERR_SUCCESS)
{
if ((volume.CryptoInfo->HeaderFlags & TC_HEADER_FLAG_NONSYS_INPLACE_ENC) != 0
&& volume.CryptoInfo->EncryptedAreaLength.Value != volume.CryptoInfo->VolumeSize.Value)
{
DeferredNonSysInPlaceEncDevices.push_back (device);
}
CloseVolume (&volume);
}
}
}
}
}
static BOOL ElevateWholeWizardProcess (wstring arguments)
{
wchar_t modPath[MAX_PATH];
if (IsAdmin())
return TRUE;
if (!IsUacSupported())
return IsAdmin();
GetModuleFileName (NULL, modPath, ARRAYSIZE (modPath));
while (true)
{
if ((int)ShellExecute (MainDlg, L"runas", modPath, (wstring(L"/q UAC ") + arguments).c_str(), NULL, SW_SHOWNORMAL) > 32)
{
exit (0);
}
else
{
if (IDRETRY == ErrorRetryCancel ("UAC_INIT_ERROR", MainDlg))
continue;
return FALSE;
}
}
}
static void WipePasswordsAndKeyfiles (bool bFull)
{
wchar_t tmp[MAX_PASSWORD+1];
// Attempt to wipe passwords stored in the input field buffers
wmemset (tmp, L'X', MAX_PASSWORD);
tmp [MAX_PASSWORD] = 0;
if (hPasswordInputField)
SetWindowText (hPasswordInputField, tmp);
if (hVerifyPasswordInputField)
SetWindowText (hVerifyPasswordInputField, tmp);
burn (&szVerify[0], sizeof (szVerify));
burn (&volumePassword, sizeof (volumePassword));
burn (&szRawPassword[0], sizeof (szRawPassword));
burn (&volumePim, sizeof (volumePim));
burn (&CmdVolumePassword, sizeof (CmdVolumePassword));
burn (&CmdVolumePim, sizeof (CmdVolumePim));
if (bFull)
{
burn (&outerVolumePassword, sizeof (outerVolumePassword));
burn (&outerVolumePim, sizeof (outerVolumePim));
}
if (hPasswordInputField)
SetWindowText (hPasswordInputField, L"");
if (hVerifyPasswordInputField)
SetWindowText (hVerifyPasswordInputField, L"");
KeyFileRemoveAll (&FirstKeyFile);
KeyFileRemoveAll (&defaultKeyFilesParam.FirstKeyFile);
}
static void localcleanup (void)
{
wchar_t tmp[RANDPOOL_DISPLAY_SIZE+1];
// System encryption
if (WizardMode == WIZARD_MODE_SYS_DEVICE
&& InstanceHasSysEncMutex ())
{
try
{
BootEncStatus = BootEncObj->GetStatus();
if (BootEncStatus.SetupInProgress)
{
BootEncObj->AbortSetup ();
}
}
catch (...)
{
// NOP
}
}
// Mon-system in-place encryption
if (bInPlaceEncNonSys && (bVolTransformThreadRunning || bVolTransformThreadToRun))
{
NonSysInplaceEncPause ();
}
CloseNonSysInplaceEncMutex ();
// Device wipe
if (bDeviceWipeInProgress)
WipeAbort();
WipePasswordsAndKeyfiles (true);
RandStop (TRUE);
burn (HeaderKeyGUIView, sizeof(HeaderKeyGUIView));
burn (MasterKeyGUIView, sizeof(MasterKeyGUIView));
burn (randPool, sizeof(randPool));
burn (lastRandPool, sizeof(lastRandPool));
burn (outRandPoolDispBuffer, sizeof(outRandPoolDispBuffer));
burn (&mouseEntropyGathered, sizeof(mouseEntropyGathered));
burn (&mouseEventsInitialCount, sizeof(mouseEventsInitialCount));
burn (maskRandPool, sizeof(maskRandPool));
burn (szFileName, sizeof(szFileName));
burn (szDiskFile, sizeof(szDiskFile));
KeyFileRemoveAll (&FirstCmdKeyFile);
// Attempt to wipe the GUI fields showing portions of randpool, of the master and header keys
wmemset (tmp, L'X', ARRAYSIZE(tmp));
tmp [ARRAYSIZE(tmp)-1] = 0;
SetWindowText (hRandPool, tmp);
SetWindowText (hRandPoolSys, tmp);
SetWindowText (hMasterKey, tmp);
SetWindowText (hHeaderKey, tmp);
UnregisterRedTick (hInst);
// Delete buffered bitmaps (if any)
if (hbmWizardBitmapRescaled != NULL)
{
DeleteObject ((HGDIOBJ) hbmWizardBitmapRescaled);
hbmWizardBitmapRescaled = NULL;
}
// Cleanup common code resources
cleanup ();
if (BootEncObj != NULL)
{
delete BootEncObj;
BootEncObj = NULL;
}
}
static BOOL CALLBACK BroadcastSysEncCfgUpdateCallb (HWND hwnd, LPARAM lParam)
{
LONG_PTR userDataVal = GetWindowLongPtrW (hwnd, GWLP_USERDATA);
if ((userDataVal == (LONG_PTR) 'VERA') || (userDataVal == (LONG_PTR) 'TRUE')) // Prior to 1.0e, 'TRUE' was used for VeraCrypt dialogs
{
wchar_t name[1024] = { 0 };
GetWindowText (hwnd, name, ARRAYSIZE (name) - 1);
if (hwnd != MainDlg && wcsstr (name, L"VeraCrypt"))
{
PostMessage (hwnd, TC_APPMSG_SYSENC_CONFIG_UPDATE, 0, 0);
}
}
return TRUE;
}
static BOOL BroadcastSysEncCfgUpdate (void)
{
BOOL bSuccess = FALSE;
EnumWindows (BroadcastSysEncCfgUpdateCallb, (LPARAM) &bSuccess);
return bSuccess;
}
// IMPORTANT: This function may be called only by Format (other modules can only _read_ the system encryption config).
// Returns TRUE if successful (otherwise FALSE)
static BOOL SaveSysEncSettings (HWND hwndDlg)
{
FILE *f;
if (!bSystemEncryptionStatusChanged)
return TRUE;
if (hwndDlg == NULL && MainDlg != NULL)
hwndDlg = MainDlg;
if (!CreateSysEncMutex ())
return FALSE; // Only one instance that has the mutex can modify the system encryption settings
if (SystemEncryptionStatus == SYSENC_STATUS_NONE)
{
if (_wremove (GetConfigPath (TC_APPD_FILENAME_SYSTEM_ENCRYPTION)) != 0)
{
Error ("CANNOT_SAVE_SYS_ENCRYPTION_SETTINGS", hwndDlg);
return FALSE;
}
bSystemEncryptionStatusChanged = FALSE;
BroadcastSysEncCfgUpdate ();
return TRUE;
}
f = _wfopen (GetConfigPath (TC_APPD_FILENAME_SYSTEM_ENCRYPTION), L"w,ccs=UTF-8");
if (f == NULL)
{
Error ("CANNOT_SAVE_SYS_ENCRYPTION_SETTINGS", hwndDlg);
handleWin32Error (hwndDlg, SRC_POS);
return FALSE;
}
if (XmlWriteHeader (f) < 0
|| fputws (L"\n\t<sysencryption>", f) < 0
|| fwprintf (f, L"\n\t\t<config key=\"SystemEncryptionStatus\">%d</config>", SystemEncryptionStatus) < 0
|| fwprintf (f, L"\n\t\t<config key=\"WipeMode\">%d</config>", (int) nWipeMode) < 0
|| fputws (L"\n\t</sysencryption>", f) < 0
|| XmlWriteFooter (f) < 0)
{
handleWin32Error (hwndDlg, SRC_POS);
fclose (f);
Error ("CANNOT_SAVE_SYS_ENCRYPTION_SETTINGS", hwndDlg);
return FALSE;
}
TCFlushFile (f);
fclose (f);
bSystemEncryptionStatusChanged = FALSE;
BroadcastSysEncCfgUpdate ();
return TRUE;
}
// WARNING: This function may take a long time to finish
static unsigned int DetermineHiddenOSCreationPhase (void)
{
unsigned int phase = TC_HIDDEN_OS_CREATION_PHASE_NONE;
try
{
phase = BootEncObj->GetHiddenOSCreationPhase();
}
catch (Exception &e)
{
e.Show (MainDlg);
AbortProcess("ERR_GETTING_SYSTEM_ENCRYPTION_STATUS");
}
return phase;
}
// IMPORTANT: This function may be called only by Format (other modules can only _read_ the status).
// Returns TRUE if successful (otherwise FALSE)
static BOOL ChangeHiddenOSCreationPhase (int newPhase)
{
if (!CreateSysEncMutex ())
{
Error ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", MainDlg);
return FALSE;
}
try
{
BootEncObj->SetHiddenOSCreationPhase (newPhase);
}
catch (Exception &e)
{
e.Show (MainDlg);
return FALSE;
}
//// The contents of the following items might be inappropriate after a change of the phase
//szFileName[0] = 0;
//szDiskFile[0] = 0;
//nUIVolumeSize = 0;
//nVolumeSize = 0;
return TRUE;
}
// IMPORTANT: This function may be called only by Format (other modules can only _read_ the system encryption status).
// Returns TRUE if successful (otherwise FALSE)
static BOOL ChangeSystemEncryptionStatus (int newStatus)
{
if (!CreateSysEncMutex ())
{
Error ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", MainDlg);
return FALSE; // Only one instance that has the mutex can modify the system encryption settings
}
SystemEncryptionStatus = newStatus;
bSystemEncryptionStatusChanged = TRUE;
if (newStatus == SYSENC_STATUS_ENCRYPTING)
{
// If the user has created a hidden OS and now is creating a decoy OS, we must wipe the hidden OS
// config area in the MBR.
WipeHiddenOSCreationConfig();
}
if (newStatus == SYSENC_STATUS_NONE && !IsHiddenOSRunning())
{
if (DetermineHiddenOSCreationPhase() != TC_HIDDEN_OS_CREATION_PHASE_NONE
&& !ChangeHiddenOSCreationPhase (TC_HIDDEN_OS_CREATION_PHASE_NONE))
return FALSE;
WipeHiddenOSCreationConfig();
}
if (!SaveSysEncSettings (MainDlg))
{
return FALSE;
}
return TRUE;
}
// If the return code of this function is ignored and newWizardMode == WIZARD_MODE_SYS_DEVICE, then this function
// may be called only after CreateSysEncMutex() returns TRUE. It returns TRUE if successful (otherwise FALSE).
static BOOL ChangeWizardMode (int newWizardMode)
{
if (WizardMode != newWizardMode)
{
if (WizardMode == WIZARD_MODE_SYS_DEVICE || newWizardMode == WIZARD_MODE_SYS_DEVICE)
{
if (newWizardMode == WIZARD_MODE_SYS_DEVICE)
{
if (!CreateSysEncMutex ())
{
Error ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", MainDlg);
return FALSE;
}
}
// If the previous mode was different, the password may have been typed using a different
// keyboard layout (which might confuse the user and cause other problems if system encryption
// was or will be involved).
WipePasswordsAndKeyfiles(true);
}
if (newWizardMode != WIZARD_MODE_NONSYS_DEVICE)
{
bInPlaceEncNonSys = FALSE;
bInPlaceDecNonSys = FALSE;
}
if (newWizardMode == WIZARD_MODE_NONSYS_DEVICE && !IsAdmin() && IsUacSupported())
{
if (!ElevateWholeWizardProcess (L"/e"))
return FALSE;
}
// The contents of the following items may be inappropriate after a change of mode
if (! (bInPlaceDecNonSys && !bInPlaceEncNonSysResumed)) // If we are starting (but not resuming) decryption of non-system volume, we actually need szFileName as it contains the command line param.
szFileName[0] = 0;
szDiskFile[0] = 0;
nUIVolumeSize = 0;
nVolumeSize = 0;
WizardMode = newWizardMode;
}
bDevice = (WizardMode != WIZARD_MODE_FILE_CONTAINER);
if (newWizardMode != WIZARD_MODE_SYS_DEVICE
&& !bHiddenOS)
{
CloseSysEncMutex ();
}
return TRUE;
}
// Determines whether the wizard directly affects system encryption in any way.
// Note, for example, that when the user enters a password for a hidden volume that is to host a hidden OS,
// WizardMode is NOT set to WIZARD_MODE_SYS_DEVICE. The keyboard layout, however, has to be US. That's why
// this function has to be called instead of checking the value of WizardMode.
static BOOL SysEncInEffect (void)
{
return (WizardMode == WIZARD_MODE_SYS_DEVICE
|| CreatingHiddenSysVol());
}
static BOOL CreatingHiddenSysVol (void)
{
return (bHiddenOS
&& bHiddenVol && !bHiddenVolHost);
}
static void LoadSettingsAndCheckModified (HWND hwndDlg, BOOL bOnlyCheckModified, BOOL* pbSettingsModified, BOOL* pbHistoryModified)
{
if (!bOnlyCheckModified)
EnableHwEncryption ((ReadDriverConfigurationFlags() & TC_DRIVER_CONFIG_DISABLE_HARDWARE_ENCRYPTION) ? FALSE : TRUE);
WipeAlgorithmId savedWipeAlgorithm = TC_WIPE_NONE;
if (!bOnlyCheckModified)
LoadSysEncSettings ();
if (!bOnlyCheckModified && LoadNonSysInPlaceEncSettings (&savedWipeAlgorithm) != 0)
bInPlaceEncNonSysPending = TRUE;
if (!bOnlyCheckModified)
defaultKeyFilesParam.EnableKeyFiles = FALSE;
ConfigReadCompareInt ("StartOnLogon", FALSE, &bStartOnLogon, bOnlyCheckModified, pbSettingsModified);
ConfigReadCompareInt ("HiddenSectorDetectionStatus", 0, &HiddenSectorDetectionStatus, bOnlyCheckModified, pbSettingsModified);
ConfigReadCompareInt ("ShowDisconnectedNetworkDrives", FALSE, &bShowDisconnectedNetworkDrives, bOnlyCheckModified, pbSettingsModified);
ConfigReadCompareInt ("HideWaitingDialog", FALSE, &bHideWaitingDialog, bOnlyCheckModified, pbSettingsModified);
ConfigReadCompareInt ("SaveVolumeHistory", FALSE, &bHistory, bOnlyCheckModified, pbSettingsModified);
ConfigReadCompareInt ("UseLegacyMaxPasswordLength", FALSE, &bUseLegacyMaxPasswordLength, bOnlyCheckModified, pbSettingsModified);
{
char szTmp[MAX_PATH] = {0};
WideCharToMultiByte (CP_UTF8, 0, SecurityTokenLibraryPath, -1, szTmp, MAX_PATH, NULL, NULL);
ConfigReadCompareString ("SecurityTokenLibrary", "", szTmp, sizeof (szTmp) - 1, bOnlyCheckModified, pbSettingsModified);
MultiByteToWideChar (CP_UTF8, 0, szTmp, -1, SecurityTokenLibraryPath, ARRAYSIZE (SecurityTokenLibraryPath));
if (!bOnlyCheckModified && SecurityTokenLibraryPath[0])
InitSecurityTokenLibrary(hwndDlg);
}
if (bOnlyCheckModified)
{
char langid[6] = {0};
if (!IsNonInstallMode ())
{
ConfigReadString ("Language", "", langid, sizeof (langid));
// when installed, if no preferred language set by user, English is selected default
if (langid [0] == 0)
StringCbCopyA (langid, sizeof(langid), "en");
if (pbSettingsModified && strcmp (langid, GetPreferredLangId ()))
*pbSettingsModified = TRUE;
}
else
{
StringCbCopyA (langid, sizeof(langid), GetPreferredLangId ());
ConfigReadCompareString ("Language", "", langid, sizeof (langid), TRUE, pbSettingsModified);
}
}
if (hwndDlg != NULL)
{
LoadCombo (GetDlgItem (hwndDlg, IDC_COMBO_BOX), bHistory, bOnlyCheckModified, pbHistoryModified);
return;
}
if (bHistoryCmdLine)
return;
}
static void LoadSettings (HWND hwndDlg)
{
LoadSettingsAndCheckModified (hwndDlg, FALSE, NULL, NULL);
}
void SaveSettings (HWND hwndDlg)
{
WaitCursor ();
// Check first if modifications ocurred before writing to the settings and history files
// This avoids leaking information about VeraCrypt usage when user only mount volumes without changing setttings or history
BOOL bSettingsChanged = FALSE;
BOOL bHistoryChanged = FALSE;
LoadSettingsAndCheckModified (hwndDlg, TRUE, &bSettingsChanged, &bHistoryChanged);
if (bHistoryChanged && hwndDlg != NULL)
DumpCombo (GetDlgItem (hwndDlg, IDC_COMBO_BOX), !bHistory);
if (bSettingsChanged)
{
ConfigWriteBegin ();
ConfigWriteInt ("StartOnLogon", bStartOnLogon);
ConfigWriteInt ("HiddenSectorDetectionStatus", HiddenSectorDetectionStatus);
ConfigWriteInt ("SaveVolumeHistory", bHistory);
ConfigWriteStringW ("SecurityTokenLibrary", SecurityTokenLibraryPath[0] ? SecurityTokenLibraryPath : L"");
ConfigWriteString ("Language", GetPreferredLangId ());
ConfigWriteEnd (hwndDlg);
}
NormalCursor ();
}
// WARNING: This function does NOT cause immediate application exit (use e.g. return 1 after calling it
// from a DialogProc function).
static void EndMainDlg (HWND hwndDlg)
{
if (nCurPageNo == VOLUME_LOCATION_PAGE)
{
if (IsWindow(GetDlgItem(hCurPage, IDC_NO_HISTORY)))
bHistory = !IsButtonChecked (GetDlgItem (hCurPage, IDC_NO_HISTORY));
MoveEditToCombo (GetDlgItem (hCurPage, IDC_COMBO_BOX), bHistory);
SaveSettings (hCurPage);
}
else
{
SaveSettings (NULL);
}
SaveSysEncSettings (hwndDlg);
if (!bHistory)
CleanLastVisitedMRU ();
EndDialog (hwndDlg, 0);
}
// Returns TRUE if system encryption or decryption had been or is in progress and has not been completed
static BOOL SysEncryptionOrDecryptionRequired (void)
{
/* If you update this function, revise SysEncryptionOrDecryptionRequired() in Mount.c as well. */
static BootEncryptionStatus locBootEncStatus;
try
{
locBootEncStatus = BootEncObj->GetStatus();
}
catch (Exception &e)
{
e.Show (MainDlg);
}
return (SystemEncryptionStatus == SYSENC_STATUS_ENCRYPTING
|| SystemEncryptionStatus == SYSENC_STATUS_DECRYPTING
||
(
locBootEncStatus.DriveMounted
&&
(
locBootEncStatus.ConfiguredEncryptedAreaStart != locBootEncStatus.EncryptedAreaStart
|| locBootEncStatus.ConfiguredEncryptedAreaEnd != locBootEncStatus.EncryptedAreaEnd
)
)
);
}
// Returns TRUE if the system partition/drive is completely encrypted
static BOOL SysDriveOrPartitionFullyEncrypted (BOOL bSilent)
{
/* If you update this function, revise SysDriveOrPartitionFullyEncrypted() in Mount.c as well. */
static BootEncryptionStatus locBootEncStatus;
try
{
locBootEncStatus = BootEncObj->GetStatus();
}
catch (Exception &e)
{
if (!bSilent)
e.Show (MainDlg);
}
return (!locBootEncStatus.SetupInProgress
&& locBootEncStatus.ConfiguredEncryptedAreaEnd != 0
&& locBootEncStatus.ConfiguredEncryptedAreaEnd != -1
&& locBootEncStatus.ConfiguredEncryptedAreaStart == locBootEncStatus.EncryptedAreaStart
&& locBootEncStatus.ConfiguredEncryptedAreaEnd == locBootEncStatus.EncryptedAreaEnd);
}
// This functions is to be used when the wizard mode needs to be changed to WIZARD_MODE_SYS_DEVICE.
// If the function fails to switch the mode, it returns FALSE (otherwise TRUE).
BOOL SwitchWizardToSysEncMode (void)
{
WaitCursor ();
SystemDriveConfiguration config;
try
{
BootEncStatus = BootEncObj->GetStatus();
bWholeSysDrive = BootEncObj->SystemPartitionCoversWholeDrive();
config = BootEncObj->GetSystemDriveConfiguration ();
}
catch (Exception &e)
{
e.Show (MainDlg);
Error ("ERR_GETTING_SYSTEM_ENCRYPTION_STATUS", MainDlg);
NormalCursor ();
return FALSE;
}
// From now on, we should be the only instance of the TC wizard allowed to deal with system encryption
if (!CreateSysEncMutex ())
{
Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", MainDlg);
NormalCursor ();
return FALSE;
}
// User-mode app may have crashed and its mutex may have gotten lost, so we need to check the driver status too
if (BootEncStatus.SetupInProgress)
{
if (AskWarnYesNo ("SYSTEM_ENCRYPTION_RESUME_PROMPT", MainDlg) == IDYES)
{
if (SystemEncryptionStatus != SYSENC_STATUS_ENCRYPTING
&& SystemEncryptionStatus != SYSENC_STATUS_DECRYPTING)
{
// The config file with status was lost or not written correctly
if (!ResolveUnknownSysEncDirection ())
{
CloseSysEncMutex ();
NormalCursor ();
return FALSE;
}
}
bDirectSysEncMode = TRUE;
ChangeWizardMode (WIZARD_MODE_SYS_DEVICE);
LoadPage (MainDlg, SYSENC_ENCRYPTION_PAGE);
NormalCursor ();
return TRUE;
}
else
{
CloseSysEncMutex ();
Error ("SYS_ENCRYPTION_OR_DECRYPTION_IN_PROGRESS", MainDlg);
NormalCursor ();
return FALSE;
}
}
if (BootEncStatus.DriveMounted
|| BootEncStatus.DriveEncrypted
|| SysEncryptionOrDecryptionRequired ())
{
if (!SysDriveOrPartitionFullyEncrypted (FALSE)
&& AskWarnYesNo ("SYSTEM_ENCRYPTION_RESUME_PROMPT", MainDlg) == IDYES)
{
if (SystemEncryptionStatus == SYSENC_STATUS_NONE)
{
// If the config file with status was lost or not written correctly, we
// don't know whether to encrypt or decrypt (but we know that encryption or
// decryption is required). Ask the user to select encryption, decryption,
// or cancel
if (!ResolveUnknownSysEncDirection ())
{
CloseSysEncMutex ();
NormalCursor ();
return FALSE;
}
}
bDirectSysEncMode = TRUE;
ChangeWizardMode (WIZARD_MODE_SYS_DEVICE);
LoadPage (MainDlg, SYSENC_ENCRYPTION_PAGE);
NormalCursor ();
return TRUE;
}
else
{
CloseSysEncMutex ();
Error ("SETUP_FAILED_BOOT_DRIVE_ENCRYPTED", MainDlg);
NormalCursor ();
return FALSE;
}
}
else
{
// Check compliance with requirements for boot encryption
if (!IsAdmin())
{
if (!IsUacSupported())
{
Warning ("ADMIN_PRIVILEGES_WARN_DEVICES", MainDlg);
}
}
try
{
BootEncObj->CheckRequirements ();
}
catch (Exception &e)
{
CloseSysEncMutex ();
e.Show (MainDlg);
NormalCursor ();
return FALSE;
}
if (!ChangeWizardMode (WIZARD_MODE_SYS_DEVICE))
{
NormalCursor ();
return FALSE;
}
if (bSysDriveSelected || bSysPartitionSelected)
{
// The user selected the non-sys-device wizard mode but then selected a system device
bWholeSysDrive = (bSysDriveSelected && !bSysPartitionSelected);
bSysDriveSelected = FALSE;
bSysPartitionSelected = FALSE;
try
{
if (!bHiddenVol)
{
if (bWholeSysDrive && !BootEncObj->SystemPartitionCoversWholeDrive())
{
if (BootEncObj->SystemDriveContainsNonStandardPartitions())
{
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)
bWholeSysDrive = (AskYesNo ("WHOLE_SYC_DEVICE_RECOM", MainDlg) == IDYES);
}
}
catch (Exception &e)
{
e.Show (MainDlg);
return FALSE;
}
if (!bHiddenVol)
{
// Skip SYSENC_SPAN_PAGE and SYSENC_TYPE_PAGE as the user already made the choice
LoadPage (MainDlg, bWholeSysDrive ? SYSENC_PRE_DRIVE_ANALYSIS_PAGE : SYSENC_MULTI_BOOT_MODE_PAGE);
}
else
{
// The user selected the non-sys-device wizard mode but then selected a system device.
// In addition, he selected the hidden volume mode.
if (bWholeSysDrive)
Warning ("HIDDEN_OS_PRECLUDES_SINGLE_KEY_WDE", MainDlg);
bWholeSysDrive = FALSE;
LoadPage (MainDlg, SYSENC_TYPE_PAGE);
}
}
else
LoadPage (MainDlg, SYSENC_TYPE_PAGE);
NormalCursor ();
return TRUE;
}
}
void SwitchWizardToFileContainerMode (void)
{
ChangeWizardMode (WIZARD_MODE_FILE_CONTAINER);
LoadPage (MainDlg, VOLUME_LOCATION_PAGE);
NormalCursor ();
}
void SwitchWizardToNonSysDeviceMode (void)
{
ChangeWizardMode (WIZARD_MODE_NONSYS_DEVICE);
LoadPage (MainDlg, VOLUME_TYPE_PAGE);
NormalCursor ();
}
BOOL SwitchWizardToHiddenOSMode (void)
{
if (SwitchWizardToSysEncMode())
{
if (nCurPageNo != SYSENC_ENCRYPTION_PAGE) // If the user did not manually choose to resume encryption or decryption of the system partition/drive
{
bHiddenOS = TRUE;
bHiddenVol = TRUE;
bHiddenVolHost = TRUE;
bHiddenVolDirect = FALSE;
bWholeSysDrive = FALSE;
bInPlaceEncNonSys = FALSE;
bInPlaceDecNonSys = FALSE;
if (bDirectSysEncModeCommand == SYSENC_COMMAND_CREATE_HIDDEN_OS_ELEV)
{
// Some of the requirements for hidden OS should have already been checked by the wizard process
// that launched us (in order to elevate), but we must recheck them. Otherwise, an advanced user
// could bypass the checks by using the undocumented CLI switch. Moreover, some requirements
// can be checked only at this point (when we are elevated).
try
{
BootEncObj->CheckRequirementsHiddenOS ();
BootEncObj->InitialSecurityChecksForHiddenOS ();
}
catch (Exception &e)
{
e.Show (MainDlg);
return FALSE;
}
LoadPage (MainDlg, SYSENC_MULTI_BOOT_MODE_PAGE);
}
else
LoadPage (MainDlg, SYSENC_HIDDEN_OS_REQ_CHECK_PAGE);
NormalCursor ();
}
else
return TRUE;
}
else
return FALSE;
return TRUE;
}
void SwitchWizardToNonSysInplaceEncResumeMode (BOOL bDecrypt)
{
if (!IsAdmin() && IsUacSupported())
{
if (!ElevateWholeWizardProcess (bDecrypt ? L"/resumeinplacedec" : L"/zinplace"))
AbortProcessSilent ();
}
if (!IsAdmin())
AbortProcess("ADMIN_PRIVILEGES_WARN_DEVICES");
CreateNonSysInplaceEncMutex ();
bInPlaceEncNonSys = TRUE;
bInPlaceDecNonSys = bDecrypt;
bInPlaceEncNonSysResumed = TRUE;
ChangeWizardMode (WIZARD_MODE_NONSYS_DEVICE);
LoadPage (MainDlg, NONSYS_INPLACE_ENC_RESUME_PASSWORD_PAGE);
}
void SwitchWizardToNonSysInplaceDecStartMode (wchar_t *volPath)
{
if (!IsAdmin() && IsUacSupported())
{
if (!ElevateWholeWizardProcess ((wstring (L"/inplacedec \"") + volPath + L"\"").c_str()))
AbortProcessSilent ();
}
if (!IsAdmin())
AbortProcess("ADMIN_PRIVILEGES_WARN_DEVICES");
if (!CheckRequirementsForNonSysInPlaceDec (MainDlg, volPath, FALSE))
AbortProcessSilent ();
CreateNonSysInplaceEncMutex ();
bInPlaceEncNonSys = TRUE;
bInPlaceDecNonSys = TRUE;
bInPlaceEncNonSysResumed = FALSE;
ChangeWizardMode (WIZARD_MODE_NONSYS_DEVICE);
LoadPage (MainDlg, NONSYS_INPLACE_ENC_RESUME_PASSWORD_PAGE);
}
// Use this function e.g. if the config file with the system encryption settings was lost or not written
// correctly, and we don't know whether to encrypt or decrypt (but we know that encryption or decryption
// is required). Returns FALSE if failed or cancelled.
static BOOL ResolveUnknownSysEncDirection (void)
{
if (CreateSysEncMutex ())
{
if (SystemEncryptionStatus != SYSENC_STATUS_ENCRYPTING
&& SystemEncryptionStatus != SYSENC_STATUS_DECRYPTING)
{
try
{
BootEncStatus = BootEncObj->GetStatus();
}
catch (Exception &e)
{
e.Show (MainDlg);
Error ("ERR_GETTING_SYSTEM_ENCRYPTION_STATUS", MainDlg);
return FALSE;
}
if (BootEncStatus.SetupInProgress)
{
return ChangeSystemEncryptionStatus (
(BootEncStatus.SetupMode != SetupDecryption) ? SYSENC_STATUS_ENCRYPTING : SYSENC_STATUS_DECRYPTING);
}
else
{
// Ask the user to select encryption, decryption, or cancel
char *tmpStr[] = {0,
!BootEncStatus.DriveEncrypted ? "CHOOSE_ENCRYPT_OR_DECRYPT_FINALIZE_DECRYPT_NOTE" : "CHOOSE_ENCRYPT_OR_DECRYPT",
"ENCRYPT",
"DECRYPT",
"IDCANCEL",
0};
switch (AskMultiChoice ((void **) tmpStr, FALSE, MainDlg))
{
case 1:
return ChangeSystemEncryptionStatus (SYSENC_STATUS_ENCRYPTING);
case 2:
return ChangeSystemEncryptionStatus (SYSENC_STATUS_DECRYPTING);
default:
return FALSE;
}
}
}
else
return TRUE;
}
else
{
Error ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", MainDlg);
return FALSE;
}
}
// This function should be used to resolve inconsistencies that might lead to a deadlock (inability to encrypt or
// decrypt the system partition/drive and to uninstall TrueCrypt). The function removes the system encryption key
// data ("volume header"), the TrueCrypt boot loader, restores the original system loader (if available),
// unregisters the boot driver, etc. Note that if the system partition/drive is encrypted, it will start decrypting
// it in the background (therefore, it should be used when the system partition/drive is not encrypted, ideally).
// Exceptions are handled and errors are reported within the function. Returns TRUE if successful.
static BOOL ForceRemoveSysEnc (void)
{
if (CreateSysEncMutex ()) // If no other instance is currently taking care of system encryption
{
BootEncryptionStatus locBootEncStatus;
try
{
locBootEncStatus = BootEncObj->GetStatus();
if (locBootEncStatus.SetupInProgress)
BootEncObj->AbortSetupWait ();
locBootEncStatus = BootEncObj->GetStatus();
if (locBootEncStatus.DriveMounted)
{
// Remove the header
BootEncObj->StartDecryption (DiscardUnreadableEncryptedSectors);
locBootEncStatus = BootEncObj->GetStatus();
while (locBootEncStatus.SetupInProgress)
{
Sleep (100);
locBootEncStatus = BootEncObj->GetStatus();
}
BootEncObj->CheckEncryptionSetupResult ();
}
Sleep (50);
}
catch (Exception &e)
{
e.Show (MainDlg);
return FALSE;
}
try
{
locBootEncStatus = BootEncObj->GetStatus();
if (!locBootEncStatus.DriveMounted)
BootEncObj->Deinstall (true);
}
catch (Exception &e)
{
e.Show (MainDlg);
return FALSE;
}
return TRUE;
}
else
return FALSE;
}
// Returns 0 if there's an error.
__int64 GetSystemPartitionSize (void)
{
try
{
return BootEncObj->GetSystemDriveConfiguration().SystemPartition.Info.PartitionLength.QuadPart;
}
catch (Exception &e)
{
e.Show (MainDlg);
return 0;
}
}
void ComboSelChangeEA (HWND hwndDlg)
{
int nIndex = (int) SendMessage (GetDlgItem (hwndDlg, IDC_COMBO_BOX), CB_GETCURSEL, 0, 0);
if (nIndex == CB_ERR)
{
SetWindowText (GetDlgItem (hwndDlg, IDC_BOX_HELP), L"");
}
else
{
wchar_t name[100];
+ wchar_t auxLine[4096];
+ wchar_t hyperLink[256] = { 0 };
+ int cipherIDs[5];
+ int i, cnt = 0;
nIndex = (int) SendMessage (GetDlgItem (hwndDlg, IDC_COMBO_BOX), CB_GETITEMDATA, nIndex, 0);
EAGetName (name, ARRAYSIZE(name),nIndex, 0);
- SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString ("AES_HELP_NEW"));
+ if (wcscmp (name, L"AES") == 0)
+ {
+ StringCbPrintfW (hyperLink, sizeof(hyperLink) / 2, GetString ("MORE_INFO_ABOUT"), name);
+
+ SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString ("AES_HELP"));
+ }
+ else if (wcscmp (name, L"Serpent") == 0)
+ {
+ StringCbPrintfW (hyperLink, sizeof(hyperLink) / 2, GetString ("MORE_INFO_ABOUT"), name);
+
+ SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString ("SERPENT_HELP"));
+ }
+ else if (wcscmp (name, L"Twofish") == 0)
+ {
+ StringCbPrintfW (hyperLink, sizeof(hyperLink) / 2, GetString ("MORE_INFO_ABOUT"), name);
+
+ SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString ("TWOFISH_HELP"));
+ }
+ else if (wcscmp (name, L"Kuznyechik") == 0)
+ {
+ StringCbPrintfW (hyperLink, sizeof(hyperLink) / 2, GetString ("MORE_INFO_ABOUT"), name);
+
+ SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString ("KUZNYECHIK_HELP"));
+ }
+ else if (wcscmp (name, L"Camellia") == 0)
+ {
+ StringCbPrintfW (hyperLink, sizeof(hyperLink) / 2, GetString ("MORE_INFO_ABOUT"), name);
+
+ SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString ("CAMELLIA_HELP"));
+ }
+ else if (EAGetCipherCount (nIndex) > 1)
+ {
+ // Cascade
+ cipherIDs[cnt++] = i = EAGetLastCipher(nIndex);
+ while (i = EAGetPreviousCipher(nIndex, i))
+ {
+ cipherIDs[cnt] = i;
+ cnt++;
+ }
+
+ switch (cnt) // Number of ciphers in the cascade
+ {
+ case 2:
+ StringCbPrintfW (auxLine, sizeof(auxLine), GetString ("TWO_LAYER_CASCADE_HELP"),
+ CipherGetName (cipherIDs[1]),
+ CipherGetKeySize (cipherIDs[1])*8,
+ CipherGetName (cipherIDs[0]),
+ CipherGetKeySize (cipherIDs[0])*8);
+ break;
+
+ case 3:
+ StringCbPrintfW (auxLine, sizeof(auxLine), GetString ("THREE_LAYER_CASCADE_HELP"),
+ CipherGetName (cipherIDs[2]),
+ CipherGetKeySize (cipherIDs[2])*8,
+ CipherGetName (cipherIDs[1]),
+ CipherGetKeySize (cipherIDs[1])*8,
+ CipherGetName (cipherIDs[0]),
+ CipherGetKeySize (cipherIDs[0])*8);
+ break;
+ }
+
+ StringCbCopyW (hyperLink, sizeof(hyperLink), GetString ("IDC_LINK_MORE_INFO_ABOUT_CIPHER"));
+
+ SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), auxLine);
+ }
+ else
+ {
+ // No info available for this encryption algorithm
+ SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), L"");
+ }
+
+
+ // Update hyperlink
+ SetWindowTextW (GetDlgItem (hwndDlg, IDC_LINK_MORE_INFO_ABOUT_CIPHER), hyperLink);
+ AccommodateTextField (hwndDlg, IDC_LINK_MORE_INFO_ABOUT_CIPHER, FALSE, hUserUnderlineFont);
}
}
static void VerifySizeAndUpdate (HWND hwndDlg, BOOL bUpdate)
{
BOOL bEnable = TRUE;
wchar_t szTmp[50];
__int64 lTmp;
__int64 i;
static unsigned __int64 nLastVolumeSize = 0;
GetWindowText (GetDlgItem (hwndDlg, IDC_SIZEBOX), szTmp, ARRAYSIZE (szTmp));
for (i = 0; i < (__int64) wcslen (szTmp); i++)
{
if (szTmp[i] >= L'0' && szTmp[i] <= L'9')
continue;
else
{
bEnable = FALSE;
break;
}
}
if (IsButtonChecked (GetDlgItem (hwndDlg, IDC_KB)))
nMultiplier = BYTES_PER_KB;
else if (IsButtonChecked (GetDlgItem (hwndDlg, IDC_MB)))
nMultiplier = BYTES_PER_MB;
else if (IsButtonChecked (GetDlgItem (hwndDlg, IDC_GB)))
nMultiplier = BYTES_PER_GB;
else
nMultiplier = BYTES_PER_TB;
if (bDevice && !(bHiddenVol && !bHiddenVolHost)) // If raw device but not a hidden volume
{
lTmp = nVolumeSize;
i = 1;
}
else
{
i = nMultiplier;
lTmp = _wtoi64 (szTmp);
DWORD sectorSize = GetFormatSectorSize();
uint32 sectorSizeRem = (lTmp * nMultiplier) % sectorSize;
if (sectorSizeRem != 0)
lTmp = (lTmp * nMultiplier + (sectorSize - sectorSizeRem)) / nMultiplier;
}
if (bEnable)
{
if (lTmp * i < (bHiddenVolHost ? TC_MIN_HIDDEN_VOLUME_HOST_SIZE : (bHiddenVol ? TC_MIN_HIDDEN_VOLUME_SIZE : TC_MIN_VOLUME_SIZE)))
bEnable = FALSE;
if (!bHiddenVolHost && bHiddenVol)
{
if (lTmp * i > nMaximumHiddenVolSize)
bEnable = FALSE;
}
else
{
if (lTmp * i > (bHiddenVolHost ? TC_MAX_HIDDEN_VOLUME_HOST_SIZE : TC_MAX_VOLUME_SIZE))
bEnable = FALSE;
else if (!bDevice && (lTmp * i > nAvailableFreeSpace) && !bDontCheckFileContainerSize && (!bIsSparseFilesSupportedByHost || bHiddenVolHost))
{
// we check container size against available free space only when creating dynamic volume is not possible
// which is the case if filesystem doesn't allow sparce file or if we are creating outer volume of a hidden volume
bEnable = FALSE;
}
}
}
if (bUpdate)
{
nUIVolumeSize = lTmp;
if (!bDevice || (bHiddenVol && !bHiddenVolHost)) // Update only if it's not a raw device or if it's a hidden volume
nVolumeSize = i * lTmp;
}
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), bEnable);
if (nVolumeSize != nLastVolumeSize)
{
// Change of volume size may make some file systems allowed or disallowed, so the default filesystem must
// be reselected.
fileSystem = FILESYS_NONE;
nLastVolumeSize = nVolumeSize;
}
}
static void UpdateWizardModeControls (HWND hwndDlg, int setWizardMode)
{
SendMessage (GetDlgItem (hwndDlg, IDC_FILE_CONTAINER),
BM_SETCHECK,
setWizardMode == WIZARD_MODE_FILE_CONTAINER ? BST_CHECKED : BST_UNCHECKED,
0);
SendMessage (GetDlgItem (hwndDlg, IDC_NONSYS_DEVICE),
BM_SETCHECK,
setWizardMode == WIZARD_MODE_NONSYS_DEVICE ? BST_CHECKED : BST_UNCHECKED,
0);
SendMessage (GetDlgItem (hwndDlg, IDC_SYS_DEVICE),
BM_SETCHECK,
setWizardMode == WIZARD_MODE_SYS_DEVICE ? BST_CHECKED : BST_UNCHECKED,
0);
}
static int GetSelectedWizardMode (HWND hwndDlg)
{
if (IsButtonChecked (GetDlgItem (hwndDlg, IDC_FILE_CONTAINER)))
return WIZARD_MODE_FILE_CONTAINER;
if (IsButtonChecked (GetDlgItem (hwndDlg, IDC_NONSYS_DEVICE)))
return WIZARD_MODE_NONSYS_DEVICE;
if (IsButtonChecked (GetDlgItem (hwndDlg, IDC_SYS_DEVICE)))
return WIZARD_MODE_SYS_DEVICE;
return DEFAULT_VOL_CREATION_WIZARD_MODE;
}
static void RefreshMultiBootControls (HWND hwndDlg)
{
#ifdef DEBUG
if (nMultiBoot == 0)
nMultiBoot = 1;
#endif
SendMessage (GetDlgItem (hwndDlg, IDC_SINGLE_BOOT),
BM_SETCHECK,
nMultiBoot == 1 ? BST_CHECKED : BST_UNCHECKED,
0);
SendMessage (GetDlgItem (hwndDlg, IDC_MULTI_BOOT),
BM_SETCHECK,
nMultiBoot > 1 ? BST_CHECKED : BST_UNCHECKED,
0);
}
// -1 = Undecided or error, 0 = No, 1 = Yes
static int Get2RadButtonPageAnswer (void)
{
if (IsButtonChecked (GetDlgItem (hCurPage, IDC_CHOICE1)))
return 1;
if (IsButtonChecked (GetDlgItem (hCurPage, IDC_CHOICE2)))
return 0;
return -1;
}
// 0 = No, 1 = Yes
static void Update2RadButtonPage (int answer)
{
SendMessage (GetDlgItem (hCurPage, IDC_CHOICE1),
BM_SETCHECK,
answer == 1 ? BST_CHECKED : BST_UNCHECKED,
0);
SendMessage (GetDlgItem (hCurPage, IDC_CHOICE2),
BM_SETCHECK,
answer == 0 ? BST_CHECKED : BST_UNCHECKED,
0);
}
// -1 = Undecided, 0 = No, 1 = Yes
static void Init2RadButtonPageYesNo (int answer)
{
SetWindowTextW (GetDlgItem (hCurPage, IDC_CHOICE1), GetString ("UISTR_YES"));
SetWindowTextW (GetDlgItem (hCurPage, IDC_CHOICE2), GetString ("UISTR_NO"));
SetWindowTextW (GetDlgItem (MainDlg, IDC_NEXT), GetString ("NEXT"));
SetWindowTextW (GetDlgItem (MainDlg, IDC_PREV), GetString ("PREV"));
SetWindowTextW (GetDlgItem (MainDlg, IDCANCEL), GetString ("CANCEL"));
EnableWindow (GetDlgItem (MainDlg, IDC_NEXT), answer >= 0);
EnableWindow (GetDlgItem (MainDlg, IDC_PREV), TRUE);
Update2RadButtonPage (answer);
}
static void UpdateSysEncProgressBar (void)
{
BootEncryptionStatus locBootEncStatus;
try
{
locBootEncStatus = BootEncObj->GetStatus();
}
catch (...)
{
return;
}
if (locBootEncStatus.EncryptedAreaEnd == -1
|| locBootEncStatus.EncryptedAreaStart == -1)
{
UpdateProgressBarProc (0);
}
else
{
UpdateProgressBarProc (locBootEncStatus.EncryptedAreaEnd - locBootEncStatus.EncryptedAreaStart + 1);
if (locBootEncStatus.SetupInProgress)
{
wchar_t tmpStr[100];
// Status
if (locBootEncStatus.TransformWaitingForIdle)
StringCbCopyW (tmpStr, sizeof(tmpStr), GetString ("PROGRESS_STATUS_WAITING"));
else
StringCbCopyW (tmpStr, sizeof(tmpStr), GetString (SystemEncryptionStatus == SYSENC_STATUS_DECRYPTING ? "PROGRESS_STATUS_DECRYPTING" : "PROGRESS_STATUS_ENCRYPTING"));
StringCbCatW (tmpStr, sizeof(tmpStr), L" ");
SetWindowTextW (GetDlgItem (hCurPage, IDC_WRITESPEED), tmpStr);
}
}
}
static void InitSysEncProgressBar (void)
{
BootEncryptionStatus locBootEncStatus;
try
{
locBootEncStatus = BootEncObj->GetStatus();
}
catch (...)
{
return;
}
if (locBootEncStatus.ConfiguredEncryptedAreaEnd == -1
|| locBootEncStatus.ConfiguredEncryptedAreaStart == -1)
return;
InitProgressBar (locBootEncStatus.ConfiguredEncryptedAreaEnd
- locBootEncStatus.ConfiguredEncryptedAreaStart + 1,
(locBootEncStatus.EncryptedAreaEnd == locBootEncStatus.EncryptedAreaStart || locBootEncStatus.EncryptedAreaEnd == -1) ?
0 : locBootEncStatus.EncryptedAreaEnd - locBootEncStatus.EncryptedAreaStart + 1,
SystemEncryptionStatus == SYSENC_STATUS_DECRYPTING,
TRUE,
TRUE,
TRUE);
}
static void UpdateSysEncControls (void)
{
BootEncryptionStatus locBootEncStatus;
try
{
locBootEncStatus = BootEncObj->GetStatus();
}
catch (...)
{
return;
}
EnableWindow (GetDlgItem (hCurPage, IDC_WIPE_MODE),
!locBootEncStatus.SetupInProgress
&& SystemEncryptionStatus == SYSENC_STATUS_ENCRYPTING);
SetWindowTextW (GetDlgItem (hCurPage, IDC_PAUSE),
GetString (locBootEncStatus.SetupInProgress ? "IDC_PAUSE" : "RESUME"));
EnableWindow (GetDlgItem (MainDlg, IDC_NEXT), !locBootEncStatus.SetupInProgress && !bFirstSysEncResumeDone);
if (!locBootEncStatus.SetupInProgress)
{
wchar_t tmpStr[100];
StringCbCopyW (tmpStr, sizeof(tmpStr), GetString ((SysDriveOrPartitionFullyEncrypted (TRUE) || !locBootEncStatus.DriveMounted) ?
"PROGRESS_STATUS_FINISHED" : "PROGRESS_STATUS_PAUSED"));
StringCbCatW (tmpStr, sizeof(tmpStr), L" ");
// Status
SetWindowTextW (GetDlgItem (hCurPage, IDC_WRITESPEED), tmpStr);
if (SysDriveOrPartitionFullyEncrypted (TRUE) || SystemEncryptionStatus == SYSENC_STATUS_NONE)
{
StringCbCopyW (tmpStr, sizeof(tmpStr), GetString ("PROCESSED_PORTION_100_PERCENT"));
StringCbCatW (tmpStr, sizeof(tmpStr), L" ");
SetWindowTextW (GetDlgItem (hCurPage, IDC_BYTESWRITTEN), tmpStr);
}
SetWindowText (GetDlgItem (hCurPage, IDC_TIMEREMAIN), L" ");
}
}
static void SysEncPause (void)
{
BootEncryptionStatus locBootEncStatus;
if (CreateSysEncMutex ())
{
EnableWindow (GetDlgItem (hCurPage, IDC_PAUSE), FALSE);
try
{
locBootEncStatus = BootEncObj->GetStatus();
}
catch (Exception &e)
{
e.Show (MainDlg);
Error ("ERR_GETTING_SYSTEM_ENCRYPTION_STATUS", MainDlg);
EnableWindow (GetDlgItem (hCurPage, IDC_PAUSE), TRUE);
return;
}
if (!locBootEncStatus.SetupInProgress)
{
EnableWindow (GetDlgItem (hCurPage, IDC_PAUSE), TRUE);
return;
}
WaitCursor ();
try
{
int attempts = SYSENC_PAUSE_RETRIES;
BootEncObj->AbortSetup ();
locBootEncStatus = BootEncObj->GetStatus();
while (locBootEncStatus.SetupInProgress && attempts > 0)
{
Sleep (SYSENC_PAUSE_RETRY_INTERVAL);
attempts--;
locBootEncStatus = BootEncObj->GetStatus();
}
if (!locBootEncStatus.SetupInProgress)
BootEncObj->CheckEncryptionSetupResult ();
}
catch (Exception &e)
{
e.Show (MainDlg);
}
NormalCursor ();
if (locBootEncStatus.SetupInProgress)
{
SetTimer (MainDlg, TIMER_ID_SYSENC_PROGRESS, TIMER_INTERVAL_SYSENC_PROGRESS, NULL);
EnableWindow (GetDlgItem (hCurPage, IDC_PAUSE), TRUE);
Error ("FAILED_TO_INTERRUPT_SYSTEM_ENCRYPTION", MainDlg);
return;
}
UpdateSysEncControls ();
EnableWindow (GetDlgItem (hCurPage, IDC_PAUSE), TRUE);
}
else
Error ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", MainDlg);
}
static void SysEncResume (void)
{
BootEncryptionStatus locBootEncStatus;
if (CreateSysEncMutex ())
{
EnableWindow (GetDlgItem (hCurPage, IDC_PAUSE), FALSE);
try
{
locBootEncStatus = BootEncObj->GetStatus();
}
catch (Exception &e)
{
e.Show (MainDlg);
Error ("ERR_GETTING_SYSTEM_ENCRYPTION_STATUS", MainDlg);
EnableWindow (GetDlgItem (hCurPage, IDC_PAUSE), TRUE);
return;
}
if (locBootEncStatus.SetupInProgress)
{
// Prevent the OS from entering Sleep mode when idle
SetThreadExecutionState (ES_CONTINUOUS | ES_SYSTEM_REQUIRED);
bSystemEncryptionInProgress = TRUE;
UpdateSysEncControls ();
SetTimer (MainDlg, TIMER_ID_SYSENC_PROGRESS, TIMER_INTERVAL_SYSENC_PROGRESS, NULL);
EnableWindow (GetDlgItem (hCurPage, IDC_PAUSE), TRUE);
return;
}
bVolTransformThreadCancel = FALSE;
bSystemEncryptionInProgress = FALSE;
WaitCursor ();
try
{
switch (SystemEncryptionStatus)
{
case SYSENC_STATUS_ENCRYPTING:
BootEncObj->StartEncryption (nWipeMode, bTryToCorrectReadErrors ? true : false);
break;
case SYSENC_STATUS_DECRYPTING:
if (locBootEncStatus.DriveMounted) // If the drive is not encrypted we will just deinstall
BootEncObj->StartDecryption (DiscardUnreadableEncryptedSectors);
break;
}
bSystemEncryptionInProgress = TRUE;
}
catch (Exception &e)
{
e.Show (MainDlg);
}
NormalCursor ();
if (!bSystemEncryptionInProgress)
{
// Allow the OS to enter Sleep mode when idle
SetThreadExecutionState (ES_CONTINUOUS);
EnableWindow (GetDlgItem (hCurPage, IDC_PAUSE), TRUE);
Error ("FAILED_TO_RESUME_SYSTEM_ENCRYPTION", MainDlg);
return;
}
// Prevent the OS from entering Sleep mode when idle
SetThreadExecutionState (ES_CONTINUOUS | ES_SYSTEM_REQUIRED);
bFirstSysEncResumeDone = TRUE;
InitSysEncProgressBar ();
UpdateSysEncProgressBar ();
UpdateSysEncControls ();
EnableWindow (GetDlgItem (hCurPage, IDC_PAUSE), TRUE);
SetTimer (MainDlg, TIMER_ID_SYSENC_PROGRESS, TIMER_INTERVAL_SYSENC_PROGRESS, NULL);
}
else
Error ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", MainDlg);
}
static BOOL GetDevicePathForHiddenOS (void)
{
BOOL tmpbDevice = FALSE;
try
{
StringCbCopyW (szFileName, sizeof(szFileName), BootEncObj->GetPartitionForHiddenOS().DevicePath.c_str());
CreateFullVolumePath (szDiskFile, sizeof(szDiskFile), szFileName, &tmpbDevice);
}
catch (Exception &e)
{
e.Show (MainDlg);
return FALSE;
}
return (szFileName[0] != 0
&& szDiskFile[0] != 0
&& tmpbDevice);
}
// Returns TRUE if there is unallocated space greater than 64 MB (max possible slack space size) between the
// boot partition and the first partition behind it. If there's none or if an error occurs, returns FALSE.
static BOOL CheckGapBetweenSysAndHiddenOS (void)
{
try
{
SystemDriveConfiguration sysDriveCfg = BootEncObj->GetSystemDriveConfiguration();
return (sysDriveCfg.SystemPartition.Info.StartingOffset.QuadPart
+ sysDriveCfg.SystemPartition.Info.PartitionLength.QuadPart
+ 64 * BYTES_PER_MB
+ 128 * BYTES_PER_KB
<= BootEncObj->GetPartitionForHiddenOS().Info.StartingOffset.QuadPart);
}
catch (Exception &e)
{
e.Show (MainDlg);
}
return FALSE;
}
static void NonSysInplaceEncPause (void)
{
bVolTransformThreadCancel = TRUE;
WaitCursor ();
int waitThreshold = 100; // Do not block GUI events for more than 10 seconds. IMPORTANT: This prevents deadlocks when the thread calls us back e.g. to update GUI!
while (bVolTransformThreadRunning || bVolTransformThreadToRun)
{
MSG guiMsg;
bVolTransformThreadCancel = TRUE;
if (waitThreshold <= 0)
{
while (PeekMessageW (&guiMsg, NULL, 0, 0, PM_REMOVE) != 0)
{
DispatchMessageW (&guiMsg);
}
}
else
waitThreshold--;
Sleep (100);
}
}
static void NonSysInplaceEncResume (void)
{
if (bVolTransformThreadRunning || bVolTransformThreadToRun || bVolTransformThreadCancel)
return;
if (!bInPlaceEncNonSysResumed
&& !FinalPreTransformPrompts ())
{
return;
}
CreateNonSysInplaceEncMutex ();
bFirstNonSysInPlaceEncResumeDone = TRUE;
SetTimer (MainDlg, TIMER_ID_NONSYS_INPLACE_ENC_PROGRESS, TIMER_INTERVAL_NONSYS_INPLACE_ENC_PROGRESS, NULL);
bVolTransformThreadCancel = FALSE;
bVolTransformThreadToRun = TRUE;
UpdateNonSysInPlaceEncControls ();
LastDialogId = "NONSYS_INPLACE_ENC_IN_PROGRESS";
_beginthread (volTransformThreadFunction, 0, MainDlg);
return;
}
void ShowNonSysInPlaceEncUIStatus (void)
{
wchar_t nonSysInplaceEncUIStatus [300] = {0};
switch (NonSysInplaceEncStatus)
{
case NONSYS_INPLACE_ENC_STATUS_PAUSED:
StringCbCopyW (nonSysInplaceEncUIStatus, sizeof(nonSysInplaceEncUIStatus), GetString ("PROGRESS_STATUS_PAUSED"));
break;
case NONSYS_INPLACE_ENC_STATUS_PREPARING:
StringCbCopyW (nonSysInplaceEncUIStatus, sizeof(nonSysInplaceEncUIStatus), GetString ("PROGRESS_STATUS_PREPARING"));
break;
case NONSYS_INPLACE_ENC_STATUS_RESIZING:
StringCbCopyW (nonSysInplaceEncUIStatus, sizeof(nonSysInplaceEncUIStatus), GetString ("PROGRESS_STATUS_RESIZING"));
break;
case NONSYS_INPLACE_ENC_STATUS_ENCRYPTING:
StringCbCopyW (nonSysInplaceEncUIStatus, sizeof(nonSysInplaceEncUIStatus), GetString ("PROGRESS_STATUS_ENCRYPTING"));
break;
case NONSYS_INPLACE_ENC_STATUS_DECRYPTING:
StringCbCopyW (nonSysInplaceEncUIStatus, sizeof(nonSysInplaceEncUIStatus), GetString ("PROGRESS_STATUS_DECRYPTING"));
break;
case NONSYS_INPLACE_ENC_STATUS_FINALIZING:
StringCbCopyW (nonSysInplaceEncUIStatus, sizeof(nonSysInplaceEncUIStatus), GetString ("PROGRESS_STATUS_FINALIZING"));
break;
case NONSYS_INPLACE_ENC_STATUS_FINISHED:
StringCbCopyW (nonSysInplaceEncUIStatus, sizeof(nonSysInplaceEncUIStatus), GetString ("PROGRESS_STATUS_FINISHED"));
break;
case NONSYS_INPLACE_ENC_STATUS_ERROR:
StringCbCopyW (nonSysInplaceEncUIStatus, sizeof(nonSysInplaceEncUIStatus), GetString ("PROGRESS_STATUS_ERROR"));
break;
}
StringCbCatW (nonSysInplaceEncUIStatus, sizeof(nonSysInplaceEncUIStatus), L" ");
SetWindowTextW (GetDlgItem (hCurPage, IDC_WRITESPEED), nonSysInplaceEncUIStatus);
}
void UpdateNonSysInPlaceEncControls (void)
{
// Reduce flickering by updating a GUI element only when a relevant change affects it
static BOOL lastbVolTransformThreadRunning = !bVolTransformThreadRunning;
static BOOL lastbVolTransformThreadToRun = !bVolTransformThreadToRun;
static BOOL lastbInPlaceEncNonSysResumed = !bInPlaceEncNonSysResumed;
EnableWindow (GetDlgItem (hCurPage, IDC_WIPE_MODE), !(bVolTransformThreadRunning || bVolTransformThreadToRun) && !bInPlaceDecNonSys);
if (lastbVolTransformThreadRunning != bVolTransformThreadRunning
|| lastbVolTransformThreadToRun != bVolTransformThreadToRun)
{
SetWindowTextW (GetDlgItem (hCurPage, IDC_PAUSE),
GetString ((bVolTransformThreadRunning || bVolTransformThreadToRun) ? "IDC_PAUSE" : "RESUME"));
lastbVolTransformThreadRunning = bVolTransformThreadRunning;
lastbVolTransformThreadToRun = bVolTransformThreadToRun;
}
if (lastbInPlaceEncNonSysResumed != bInPlaceEncNonSysResumed)
{
SetWindowTextW (GetDlgItem (MainDlg, IDCANCEL), GetString (bInPlaceEncNonSysResumed ? "DEFER" : "CANCEL"));
lastbInPlaceEncNonSysResumed = bInPlaceEncNonSysResumed;
}
EnableWindow (GetDlgItem (hCurPage, IDC_PAUSE), bFirstNonSysInPlaceEncResumeDone
&& NonSysInplaceEncStatus != NONSYS_INPLACE_ENC_STATUS_FINALIZING
&& NonSysInplaceEncStatus != NONSYS_INPLACE_ENC_STATUS_FINISHED);
EnableWindow (GetDlgItem (MainDlg, IDC_NEXT), !(bVolTransformThreadRunning || bVolTransformThreadToRun) && !bFirstNonSysInPlaceEncResumeDone);
EnableWindow (GetDlgItem (MainDlg, IDC_PREV), !(bVolTransformThreadRunning || bVolTransformThreadToRun) && !bInPlaceEncNonSysResumed);
EnableWindow (GetDlgItem (MainDlg, IDCANCEL),
!(bVolTransformThreadToRun
|| NonSysInplaceEncStatus == NONSYS_INPLACE_ENC_STATUS_PREPARING
|| NonSysInplaceEncStatus == NONSYS_INPLACE_ENC_STATUS_RESIZING
|| NonSysInplaceEncStatus == NONSYS_INPLACE_ENC_STATUS_FINALIZING
|| NonSysInplaceEncStatus == NONSYS_INPLACE_ENC_STATUS_FINISHED));
if (bVolTransformThreadRunning || bVolTransformThreadToRun)
{
switch (NonSysInplaceEncStatus)
{
case NONSYS_INPLACE_ENC_STATUS_PREPARING:
case NONSYS_INPLACE_ENC_STATUS_RESIZING:
case NONSYS_INPLACE_ENC_STATUS_FINALIZING:
ArrowWaitCursor ();
break;
case NONSYS_INPLACE_ENC_STATUS_ENCRYPTING:
NormalCursor ();
break;
default:
NormalCursor ();
break;
}
if (bVolTransformThreadCancel)
WaitCursor ();
}
else
{
NormalCursor ();
if (bInPlaceEncNonSysResumed)
{
SetNonSysInplaceEncUIStatus (NONSYS_INPLACE_ENC_STATUS_PAUSED);
}
else
SetWindowText (GetDlgItem (hCurPage, IDC_WRITESPEED), L" ");
SetWindowText (GetDlgItem (hCurPage, IDC_TIMEREMAIN), L" ");
}
ShowNonSysInPlaceEncUIStatus ();
UpdateNonSysInplaceEncProgressBar ();
}
static void UpdateNonSysInplaceEncProgressBar (void)
{
static int lastNonSysInplaceEncStatus = NONSYS_INPLACE_ENC_STATUS_NONE;
int nonSysInplaceEncStatus = NonSysInplaceEncStatus;
__int64 totalSize = NonSysInplaceEncTotalSize;
if (bVolTransformThreadRunning
&& (nonSysInplaceEncStatus == NONSYS_INPLACE_ENC_STATUS_ENCRYPTING
|| nonSysInplaceEncStatus == NONSYS_INPLACE_ENC_STATUS_DECRYPTING
|| nonSysInplaceEncStatus == NONSYS_INPLACE_ENC_STATUS_FINALIZING
|| nonSysInplaceEncStatus == NONSYS_INPLACE_ENC_STATUS_FINISHED))
{
if (lastNonSysInplaceEncStatus != nonSysInplaceEncStatus
&& (nonSysInplaceEncStatus == NONSYS_INPLACE_ENC_STATUS_ENCRYPTING || nonSysInplaceEncStatus == NONSYS_INPLACE_ENC_STATUS_DECRYPTING))
{
InitNonSysInplaceEncProgressBar ();
}
else
{
if (totalSize <= 0 && nVolumeSize > 0)
totalSize = nVolumeSize;
if (totalSize > 0)
UpdateProgressBarProc (NonSysInplaceEncBytesDone);
}
}
ShowNonSysInPlaceEncUIStatus ();
lastNonSysInplaceEncStatus = nonSysInplaceEncStatus;
}
static void InitNonSysInplaceEncProgressBar (void)
{
__int64 totalSize = NonSysInplaceEncTotalSize;
if (totalSize <= 0)
{
if (nVolumeSize <= 0)
return;
totalSize = nVolumeSize;
}
InitProgressBar (totalSize,
NonSysInplaceEncBytesDone,
bInPlaceDecNonSys,
TRUE,
TRUE,
TRUE);
}
void DisplayRandPool (HWND hwndDlg, HWND hPoolDisplay, BOOL bShow)
{
wchar_t tmp[4];
unsigned char tmpByte;
int col, row;
static BOOL bRandPoolDispAscii = FALSE;
DWORD mouseEventsCounter;
RandpeekBytes (hwndDlg, randPool, sizeof (randPool), &mouseEventsCounter);
ProcessEntropyEstimate (hEntropyBar, &mouseEventsInitialCount, mouseEventsCounter, maxEntropyLevel, &mouseEntropyGathered);
if (memcmp (lastRandPool, randPool, sizeof(lastRandPool)) != 0)
{
outRandPoolDispBuffer[0] = 0;
for (row = 0; row < RANDPOOL_DISPLAY_ROWS; row++)
{
for (col = 0; col < RANDPOOL_DISPLAY_COLUMNS; col++)
{
if (bShow)
{
tmpByte = randPool[row * RANDPOOL_DISPLAY_COLUMNS + col];
StringCbPrintfW (tmp, sizeof(tmp), bRandPoolDispAscii ? ((tmpByte >= 32 && tmpByte < 255 && tmpByte != L'&') ? L" %c " : L" . ") : L"%02X ", tmpByte);
}
else if (bUseMask)
{
/* use mask to compute a randomized ASCII representation */
tmpByte = (randPool[row * RANDPOOL_DISPLAY_COLUMNS + col] -
lastRandPool[row * RANDPOOL_DISPLAY_COLUMNS + col]) ^ maskRandPool [row * RANDPOOL_DISPLAY_COLUMNS + col];
tmp[0] = (wchar_t) (((tmpByte >> 4) % 6) + L'*');
tmp[1] = (wchar_t) (((tmpByte & 0x0F) % 6) + L'*');
tmp[2] = L' ';
tmp[3] = 0;
}
else
{
StringCbCopyW (tmp, sizeof(tmp), L"** ");
}
StringCbCatW (outRandPoolDispBuffer, sizeof(outRandPoolDispBuffer), tmp);
}
StringCbCatW (outRandPoolDispBuffer, sizeof(outRandPoolDispBuffer), L"\n");
}
SetWindowText (hPoolDisplay, outRandPoolDispBuffer);
memcpy (lastRandPool, randPool, sizeof(lastRandPool));
}
}
void DisplayPortionsOfKeys (HWND headerKeyHandle, HWND masterKeyHandle, wchar_t *headerKeyStr, wchar_t *masterKeyStr, BOOL hideKeys)
{
const wchar_t *hiddenKey = L"******************************** ";
SetWindowTextW (headerKeyHandle, hideKeys ? hiddenKey : (std::wstring (headerKeyStr) + GetString ("TRIPLE_DOT_GLYPH_ELLIPSIS")).c_str());
SetWindowTextW (masterKeyHandle, hideKeys ? hiddenKey : (std::wstring (masterKeyStr) + GetString ("TRIPLE_DOT_GLYPH_ELLIPSIS")).c_str());
}
static void WipeAbort (void)
{
EnableWindow (GetDlgItem (hCurPage, IDC_ABORT_BUTTON), FALSE);
if (bHiddenOS && IsHiddenOSRunning())
{
/* Decoy system partition wipe */
DecoySystemWipeStatus decoySysPartitionWipeStatus;
try
{
decoySysPartitionWipeStatus = BootEncObj->GetDecoyOSWipeStatus();
}
catch (Exception &e)
{
e.Show (MainDlg);
EnableWindow (GetDlgItem (hCurPage, IDC_ABORT_BUTTON), TRUE);
return;
}
if (!decoySysPartitionWipeStatus.WipeInProgress)
{
EnableWindow (GetDlgItem (hCurPage, IDC_ABORT_BUTTON), TRUE);
return;
}
WaitCursor ();
try
{
int attempts = SYSENC_PAUSE_RETRIES;
BootEncObj->AbortDecoyOSWipe ();
decoySysPartitionWipeStatus = BootEncObj->GetDecoyOSWipeStatus();
while (decoySysPartitionWipeStatus.WipeInProgress && attempts > 0)
{
Sleep (SYSENC_PAUSE_RETRY_INTERVAL);
attempts--;
decoySysPartitionWipeStatus = BootEncObj->GetDecoyOSWipeStatus();
}
if (!decoySysPartitionWipeStatus.WipeInProgress)
BootEncObj->CheckDecoyOSWipeResult ();
}
catch (Exception &e)
{
e.Show (MainDlg);
}
NormalCursor ();
if (decoySysPartitionWipeStatus.WipeInProgress)
{
SetTimer (MainDlg, TIMER_ID_WIPE_PROGRESS, TIMER_INTERVAL_WIPE_PROGRESS, NULL);
EnableWindow (GetDlgItem (hCurPage, IDC_ABORT_BUTTON), TRUE);
Error ("FAILED_TO_INTERRUPT_WIPING", MainDlg);
return;
}
}
else
{
/* Regular device wipe (not decoy system partition wipe) */
}
UpdateWipeControls ();
EnableWindow (GetDlgItem (hCurPage, IDC_ABORT_BUTTON), TRUE);
}
static void WipeStart (void)
{
if (bHiddenOS && IsHiddenOSRunning())
{
/* Decoy system partition wipe */
EnableWindow (GetDlgItem (hCurPage, IDC_ABORT_BUTTON), FALSE);
bDeviceWipeInProgress = FALSE;
WaitCursor ();
try
{
BootEncObj->StartDecoyOSWipe (nWipeMode);
bDeviceWipeInProgress = TRUE;
}
catch (Exception &e)
{
e.Show (MainDlg);
}
NormalCursor ();
if (!bDeviceWipeInProgress)
{
EnableWindow (GetDlgItem (hCurPage, IDC_ABORT_BUTTON), TRUE);
Error ("FAILED_TO_START_WIPING", MainDlg);
return;
}
}
else
{
/* Regular device wipe (not decoy system partition wipe) */
}
InitWipeProgressBar ();
UpdateWipeProgressBar ();
UpdateWipeControls ();
EnableWindow (GetDlgItem (hCurPage, IDC_ABORT_BUTTON), TRUE);
SetTimer (MainDlg, TIMER_ID_WIPE_PROGRESS, TIMER_INTERVAL_WIPE_PROGRESS, NULL);
}
static void UpdateWipeProgressBar (void)
{
if (bHiddenOS && IsHiddenOSRunning())
{
/* Decoy system partition wipe */
DecoySystemWipeStatus decoySysPartitionWipeStatus;
try
{
decoySysPartitionWipeStatus = BootEncObj->GetDecoyOSWipeStatus();
BootEncStatus = BootEncObj->GetStatus();
}
catch (...)
{
return;
}
if (decoySysPartitionWipeStatus.WipedAreaEnd == -1)
UpdateProgressBarProc (0);
else
UpdateProgressBarProc (decoySysPartitionWipeStatus.WipedAreaEnd - BootEncStatus.ConfiguredEncryptedAreaStart + 1);
}
else
{
/* Regular device wipe (not decoy system partition wipe) */
}
}
static void InitWipeProgressBar (void)
{
if (bHiddenOS && IsHiddenOSRunning())
{
/* Decoy system partition wipe */
DecoySystemWipeStatus decoySysPartitionWipeStatus;
try
{
decoySysPartitionWipeStatus = BootEncObj->GetDecoyOSWipeStatus();
BootEncStatus = BootEncObj->GetStatus();
}
catch (...)
{
return;
}
if (BootEncStatus.ConfiguredEncryptedAreaEnd == -1
|| BootEncStatus.ConfiguredEncryptedAreaStart == -1)
return;
InitProgressBar (BootEncStatus.ConfiguredEncryptedAreaEnd - BootEncStatus.ConfiguredEncryptedAreaStart + 1,
(decoySysPartitionWipeStatus.WipedAreaEnd == BootEncStatus.ConfiguredEncryptedAreaStart || decoySysPartitionWipeStatus.WipedAreaEnd == -1) ?
0 : decoySysPartitionWipeStatus.WipedAreaEnd - BootEncStatus.ConfiguredEncryptedAreaStart + 1,
FALSE,
TRUE,
FALSE,
TRUE);
}
else
{
/* Regular device wipe (not decoy system partition wipe) */
}
}
static void UpdateWipeControls (void)
{
if (bHiddenOS && IsHiddenOSRunning())
{
/* Decoy system partition wipe */
DecoySystemWipeStatus decoySysPartitionWipeStatus;
try
{
decoySysPartitionWipeStatus = BootEncObj->GetDecoyOSWipeStatus();
BootEncStatus = BootEncObj->GetStatus();
}
catch (...)
{
return;
}
EnableWindow (GetDlgItem (MainDlg, IDC_NEXT), !decoySysPartitionWipeStatus.WipeInProgress);
}
else
{
/* Regular device wipe (not decoy system partition wipe) */
EnableWindow (GetDlgItem (MainDlg, IDC_NEXT), bDeviceWipeInProgress);
if (!bDeviceWipeInProgress)
{
SetWindowText (GetDlgItem (hCurPage, IDC_TIMEREMAIN), L" ");
}
}
EnableWindow (GetDlgItem (hCurPage, IDC_ABORT_BUTTON), bDeviceWipeInProgress);
EnableWindow (GetDlgItem (MainDlg, IDC_PREV), !bDeviceWipeInProgress);
bConfirmQuit = bDeviceWipeInProgress;
}
static void __cdecl sysEncDriveAnalysisThread (void *hwndDlgArg)
{
// Mark the detection process as 'in progress'
HiddenSectorDetectionStatus = 1;
SaveSettings (NULL);
BroadcastSysEncCfgUpdate ();
try
{
BootEncObj->ProbeRealSystemDriveSize ();
bSysEncDriveAnalysisTimeOutOccurred = FALSE;
}
catch (TimeOut &)
{
bSysEncDriveAnalysisTimeOutOccurred = TRUE;
}
catch (Exception &e)
{
// There was a problem but the system did not freeze. Mark the detection process as completed.
HiddenSectorDetectionStatus = 0;
SaveSettings (NULL);
BroadcastSysEncCfgUpdate ();
e.Show (NULL);
EndMainDlg (MainDlg);
exit(0);
}
// Mark the detection process as completed
HiddenSectorDetectionStatus = 0;
SaveSettings (NULL);
BroadcastSysEncCfgUpdate ();
// This artificial delay prevents user confusion on systems where the analysis ends almost instantly
Sleep (3000);
bSysEncDriveAnalysisInProgress = FALSE;
}
static void __cdecl volTransformThreadFunction (void *hwndDlgArg)
{
int nStatus;
DWORD dwWin32FormatError;
BOOL bHidden;
HWND hwndDlg = (HWND) hwndDlgArg;
volatile FORMAT_VOL_PARAMETERS *volParams = (FORMAT_VOL_PARAMETERS *) malloc (sizeof(FORMAT_VOL_PARAMETERS));
if (volParams == NULL)
AbortProcess ("ERR_MEM_ALLOC");
VirtualLock ((LPVOID) volParams, sizeof(FORMAT_VOL_PARAMETERS));
bOperationSuccess = FALSE;
if (bGuiMode)
{
bVolTransformThreadRunning = TRUE;
bVolTransformThreadToRun = FALSE;
}
// Check administrator privileges
if (!IsAdmin () && !IsUacSupported ())
{
if (fileSystem == FILESYS_NTFS || fileSystem == FILESYS_EXFAT || fileSystem == FILESYS_REFS)
{
if (Silent || (MessageBoxW (hwndDlg, GetString ("ADMIN_PRIVILEGES_WARN_NTFS"), lpszTitle, MB_OKCANCEL|MB_ICONWARNING|MB_DEFBUTTON2) == IDCANCEL))
goto cancel;
}
if (bDevice)
{
if (Silent || (MessageBoxW (hwndDlg, GetString ("ADMIN_PRIVILEGES_WARN_DEVICES"), lpszTitle, MB_OKCANCEL|MB_ICONWARNING|MB_DEFBUTTON2) == IDCANCEL))
goto cancel;
}
}
if (!bInPlaceEncNonSys)
{
if (!bDevice)
{
int x = _waccess (szDiskFile, 06);
if (x == 0 || errno != ENOENT)
{
wchar_t szTmp[512];
if (!bForceOperation && !((bHiddenVol && !bHiddenVolHost) && errno != EACCES)) // Only ask ask for permission to overwrite an existing volume if we're not creating a hidden volume
{
StringCbPrintfW (szTmp, sizeof szTmp,
GetString (errno == EACCES ? "READONLYPROMPT" : "OVERWRITEPROMPT"),
szDiskFile);
x = Silent? IDNO : MessageBoxW (hwndDlg, szTmp, lpszTitle, YES_NO|MB_ICONWARNING|MB_DEFBUTTON2);
if (x != IDYES)
goto cancel;
}
}
if (_waccess (szDiskFile, 06) != 0)
{
if (errno == EACCES)
{
if (_wchmod (szDiskFile, _S_IREAD | _S_IWRITE) != 0)
{
if (!Silent) MessageBoxW (hwndDlg, GetString ("ACCESSMODEFAIL"), lpszTitle, ICON_HAND);
goto cancel;
}
}
}
}
else
{
// Partition / device / dynamic volume
if (!FinalPreTransformPrompts ())
goto cancel;
}
}
// Prevent the OS from entering Sleep mode when idle
SetThreadExecutionState (ES_CONTINUOUS | ES_SYSTEM_REQUIRED);
bHidden = bHiddenVol && !bHiddenVolHost;
volParams->bDevice = bDevice;
volParams->hiddenVol = bHidden;
volParams->volumePath = szDiskFile;
volParams->size = nVolumeSize;
volParams->hiddenVolHostSize = nHiddenVolHostSize;
volParams->ea = nVolumeEA;
volParams->pkcs5 = hash_algo;
volParams->headerFlags = (CreatingHiddenSysVol() ? TC_HEADER_FLAG_ENCRYPTED_SYSTEM : 0);
volParams->fileSystem = fileSystem;
volParams->clusterSize = clusterSize;
volParams->sparseFileSwitch = dynamicFormat;
volParams->quickFormat = quickFormat;
volParams->fastCreateFile = fastCreateFile;
volParams->sectorSize = GetFormatSectorSize();
volParams->realClusterSize = &realClusterSize;
volParams->password = &volumePassword;
volParams->pim = volumePim;
volParams->hwndDlg = hwndDlg;
volParams->bForceOperation = bForceOperation;
volParams->bGuiMode = bGuiMode;
if (bInPlaceDecNonSys)
{
// In-place decryption of non-system volume
if (!bInPlaceEncNonSysResumed)
DiscardUnreadableEncryptedSectors = FALSE;
nStatus = DecryptPartitionInPlace (volParams, &DiscardUnreadableEncryptedSectors);
}
else if (bInPlaceEncNonSys)
{
// In-place encryption of non-system volume
HANDLE hPartition = INVALID_HANDLE_VALUE;
SetNonSysInplaceEncUIStatus (NONSYS_INPLACE_ENC_STATUS_PREPARING);
if (!bInPlaceEncNonSysResumed)
{
bTryToCorrectReadErrors = FALSE;
nStatus = EncryptPartitionInPlaceBegin (volParams, &hPartition, nWipeMode);
if (nStatus == ERR_SUCCESS)
{
nStatus = EncryptPartitionInPlaceResume (hPartition, volParams, nWipeMode, &bTryToCorrectReadErrors);
}
else if (hPartition != INVALID_HANDLE_VALUE)
{
CloseHandle (hPartition);
hPartition = INVALID_HANDLE_VALUE;
}
}
else
{
nStatus = EncryptPartitionInPlaceResume (INVALID_HANDLE_VALUE, volParams, nWipeMode, &bTryToCorrectReadErrors);
}
}
else
{
// Format-encryption
if (hwndDlg && bGuiMode) InitProgressBar (GetVolumeDataAreaSize (bHidden, nVolumeSize), 0, FALSE, FALSE, FALSE, TRUE);
nStatus = TCFormatVolume (volParams);
}
// Allow the OS to enter Sleep mode when idle
SetThreadExecutionState (ES_CONTINUOUS);
if (nStatus == ERR_OUTOFMEMORY)
{
AbortProcess ("OUTOFMEMORY");
}
if (bInPlaceEncNonSys
&& nStatus == ERR_USER_ABORT
&& NonSysInplaceEncStatus == NONSYS_INPLACE_ENC_STATUS_FINISHED)
{
// Ignore user abort if non-system in-place encryption/decryption successfully finished
nStatus = ERR_SUCCESS;
}
dwWin32FormatError = GetLastError ();
if (bHiddenVolHost && (!bGuiMode || !bVolTransformThreadCancel) && nStatus == 0)
{
/* Auto mount the newly created hidden volume host */
switch (MountHiddenVolHost (hwndDlg, szDiskFile, &hiddenVolHostDriveNo, &volumePassword, hash_algo, volumePim, FALSE))
{
case ERR_NO_FREE_DRIVES:
if (!Silent) MessageBoxW (hwndDlg, GetString ("NO_FREE_DRIVE_FOR_OUTER_VOL"), lpszTitle, ICON_HAND);
if (bGuiMode) bVolTransformThreadCancel = TRUE;
break;
case ERR_VOL_MOUNT_FAILED:
case ERR_PASSWORD_WRONG:
if (!Silent) MessageBoxW (hwndDlg, GetString ("CANT_MOUNT_OUTER_VOL"), lpszTitle, ICON_HAND);
if (bGuiMode) bVolTransformThreadCancel = TRUE;
break;
}
}
SetLastError (dwWin32FormatError);
if ((bVolTransformThreadCancel || nStatus == ERR_USER_ABORT)
&& !(bInPlaceEncNonSys && NonSysInplaceEncStatus == NONSYS_INPLACE_ENC_STATUS_FINISHED)) // Ignore user abort if non-system in-place encryption/decryption successfully finished.
{
if (!bDevice && !(bHiddenVol && !bHiddenVolHost)) // If we're not creating a hidden volume and if it's a file container
{
_wremove (szDiskFile); // Delete the container
}
goto cancel;
}
if (nStatus != ERR_USER_ABORT)
{
if (nStatus != 0)
{
/* An error occurred */
wchar_t szMsg[8192];
handleError (hwndDlg, nStatus, SRC_POS);
if (bInPlaceEncNonSys)
{
if (bInPlaceEncNonSysResumed)
{
SetNonSysInplaceEncUIStatus (NONSYS_INPLACE_ENC_STATUS_PAUSED);
Error ("INPLACE_ENC_GENERIC_ERR_RESUME", hwndDlg);
}
else
{
SetNonSysInplaceEncUIStatus (NONSYS_INPLACE_ENC_STATUS_ERROR);
if (bInPlaceDecNonSys)
Error ("INPLACE_DEC_GENERIC_ERR", hwndDlg);
else
ShowInPlaceEncErrMsgWAltSteps (hwndDlg, "INPLACE_ENC_GENERIC_ERR_ALT_STEPS", TRUE);
}
}
else if (!Silent && !(bHiddenVolHost && hiddenVolHostDriveNo < 0)) // If the error was not that the hidden volume host could not be mounted (this error has already been reported to the user)
{
StringCbPrintfW (szMsg, sizeof(szMsg), GetString ("CREATE_FAILED"), szDiskFile);
MessageBoxW (hwndDlg, szMsg, lpszTitle, ICON_HAND);
}
if (!bDevice && !(bHiddenVol && !bHiddenVolHost)) // If we're not creating a hidden volume and if it's a file container
{
_wremove (szDiskFile); // Delete the container
}
goto cancel;
}
else
{
/* Volume successfully created */
RestoreDefaultKeyFilesParam ();
PimEnable = FALSE;
bOperationSuccess = TRUE;
if (bDevice && !bInPlaceEncNonSys)
{
// Handle assigned drive letter (if any)
HandleOldAssignedDriveLetter ();
}
if (!bHiddenVolHost)
{
if (bHiddenVol)
{
bHiddenVolFinished = TRUE;
if (!bHiddenOS)
Warning ("HIDVOL_FORMAT_FINISHED_HELP", hwndDlg);
}
else if (bInPlaceEncNonSys)
{
if (!bInPlaceDecNonSys)
{
Warning ("NONSYS_INPLACE_ENC_FINISHED_INFO", hwndDlg);
HandleOldAssignedDriveLetter ();
}
else
{
// NOP - Final steps for in-place decryption are handled with the TC_APPMSG_NONSYS_INPLACE_ENC_FINISHED message.
}
}
else
{
Info("FORMAT_FINISHED_INFO", hwndDlg);
if (dynamicFormat)
Warning("SPARSE_FILE_SIZE_NOTE", hwndDlg);
}
}
else
{
/* We've just created an outer volume (to host a hidden volume within) */
bHiddenVolHost = FALSE;
bHiddenVolFinished = FALSE;
nHiddenVolHostSize = nVolumeSize;
// Clear the outer volume password
burn(&szVerify[0], sizeof (szVerify));
burn(&szRawPassword[0], sizeof (szRawPassword));
if (!Silent) MessageBeep (MB_OK);
}
if (!bInPlaceEncNonSys && hwndDlg && bGuiMode)
SetTimer (hwndDlg, TIMER_ID_RANDVIEW, TIMER_INTERVAL_RANDVIEW, NULL);
// volParams is ensured to be non NULL at this stage
burn ((LPVOID) volParams, sizeof(FORMAT_VOL_PARAMETERS));
VirtualUnlock ((LPVOID) volParams, sizeof(FORMAT_VOL_PARAMETERS));
free ((LPVOID) volParams);
volParams = NULL;
if (bGuiMode)
{
bVolTransformThreadRunning = FALSE;
bVolTransformThreadCancel = FALSE;
}
if (hwndDlg && bGuiMode) PostMessage (hwndDlg, bInPlaceEncNonSys ? TC_APPMSG_NONSYS_INPLACE_ENC_FINISHED : TC_APPMSG_FORMAT_FINISHED, 0, 0);
LastDialogId = "FORMAT_FINISHED";
if (bGuiMode) _endthread ();
}
}
cancel:
LastDialogId = (bInPlaceEncNonSys ? "NONSYS_INPLACE_ENC_CANCELED" : "FORMAT_CANCELED");
if (!bInPlaceEncNonSys && hwndDlg && bGuiMode)
SetTimer (hwndDlg, TIMER_ID_RANDVIEW, TIMER_INTERVAL_RANDVIEW, NULL);
if (volParams != NULL)
{
burn ((LPVOID) volParams, sizeof(FORMAT_VOL_PARAMETERS));
VirtualUnlock ((LPVOID) volParams, sizeof(FORMAT_VOL_PARAMETERS));
free ((LPVOID) volParams);
volParams = NULL;
}
if (bGuiMode)
{
bVolTransformThreadRunning = FALSE;
bVolTransformThreadCancel = FALSE;
}
// Allow the OS to enter Sleep mode when idle
SetThreadExecutionState (ES_CONTINUOUS);
if (hwndDlg) PostMessage (hwndDlg, TC_APPMSG_VOL_TRANSFORM_THREAD_ENDED, 0, 0);
if (bHiddenVolHost && hiddenVolHostDriveNo < -1 && !bVolTransformThreadCancel) // If hidden volume host could not be mounted
AbortProcessSilent ();
if (bGuiMode) _endthread ();
}
static void LoadPage (HWND hwndDlg, int nPageNo)
{
RECT rD, rW;
nLastPageNo = nCurPageNo;
if (hCurPage != NULL)
{
// WARNING: nCurPageNo must be set to a non-existent ID here before wiping the password fields below in
// this function, etc. Otherwise, such actions (SetWindowText) would invoke the EN_CHANGE handlers, which
// would, if keyfiles were applied, e.g. use strlen() on a buffer full of random data, in most cases
// not null-terminated.
nCurPageNo = -1;
// Place here any actions that need to be performed at the latest possible time when leaving a wizard page
// (i.e. right before "destroying" the page). Also, code that needs to be executed both on IDC_NEXT and
// on IDC_PREV can be placed here so as to avoid code doubling.
switch (nLastPageNo)
{
case PASSWORD_PAGE:
{
wchar_t tmp[MAX_PASSWORD+1];
// Attempt to wipe passwords stored in the input field buffers. This is performed here (and
// not in the IDC_PREV or IDC_NEXT sections) in order to prevent certain race conditions
// when keyfiles are used.
wmemset (tmp, 'X', MAX_PASSWORD);
tmp [MAX_PASSWORD] = 0;
SetWindowText (hPasswordInputField, tmp);
SetWindowText (hVerifyPasswordInputField, tmp);
}
break;
}
DestroyWindow (hCurPage);
hCurPage = NULL;
}
// This prevents the mouse pointer from remaining as the "hand" cursor when the user presses Enter
// while hovering over a hyperlink.
bHyperLinkBeingTracked = FALSE;
NormalCursor();
GetWindowRect (GetDlgItem (hwndDlg, IDC_POS_BOX), &rW);
nCurPageNo = nPageNo;
switch (nPageNo)
{
case INTRO_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_INTRO_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case SYSENC_TYPE_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_SYSENC_TYPE_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case SYSENC_HIDDEN_OS_REQ_CHECK_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_SYSENC_HIDDEN_OS_REQ_CHECK_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case SYSENC_SPAN_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_SYSENC_SPAN_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case SYSENC_PRE_DRIVE_ANALYSIS_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_UNIVERSAL_DUAL_CHOICE_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case SYSENC_DRIVE_ANALYSIS_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_SYSENC_DRIVE_ANALYSIS_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case SYSENC_MULTI_BOOT_MODE_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_SYSENC_MULTI_BOOT_MODE_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case SYSENC_MULTI_BOOT_SYS_EQ_BOOT_PAGE:
case SYSENC_MULTI_BOOT_NBR_SYS_DRIVES_PAGE:
case SYSENC_MULTI_BOOT_ADJACENT_SYS_PAGE:
case SYSENC_MULTI_BOOT_NONWIN_BOOT_LOADER_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_UNIVERSAL_DUAL_CHOICE_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case SYSENC_MULTI_BOOT_OUTCOME_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_INFO_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case VOLUME_TYPE_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_VOLUME_TYPE_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case HIDDEN_VOL_WIZARD_MODE_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_HIDDEN_VOL_WIZARD_MODE_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case VOLUME_LOCATION_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_VOLUME_LOCATION_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
EnableWindow (GetDlgItem(hCurPage, IDC_NO_HISTORY), !bHistoryCmdLine);
EnableWindow (GetDlgItem (hwndDlg, IDC_NEXT),
GetWindowTextLength (GetDlgItem (hCurPage, IDC_COMBO_BOX)) > 0);
break;
case DEVICE_TRANSFORM_MODE_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_DEVICE_TRANSFORM_MODE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case HIDDEN_VOL_HOST_PRE_CIPHER_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_INFO_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case HIDDEN_VOL_PRE_CIPHER_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_INFO_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case CIPHER_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_CIPHER_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case SIZE_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_SIZE_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case HIDDEN_VOL_HOST_PASSWORD_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_PASSWORD_ENTRY_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case PASSWORD_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_PASSWORD_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case PIM_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_PIM_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case FILESYS_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_UNIVERSAL_DUAL_CHOICE_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case SYSENC_COLLECTING_RANDOM_DATA_PAGE:
case NONSYS_INPLACE_ENC_RAND_DATA_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_SYSENC_COLLECTING_RANDOM_DATA_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case SYSENC_KEYS_GEN_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_SYSENC_KEYS_GEN_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case SYSENC_RESCUE_DISK_CREATION_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_SYSENC_RESCUE_DISK_CREATION_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case SYSENC_RESCUE_DISK_BURN_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_SYSENC_RESCUE_DISK_BURN_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case SYSENC_RESCUE_DISK_VERIFIED_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_INFO_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case SYSENC_WIPE_MODE_PAGE:
case NONSYS_INPLACE_ENC_WIPE_MODE_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_SYSENC_WIPE_MODE_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case SYSENC_PRETEST_INFO_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_INFO_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case SYSENC_PRETEST_RESULT_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_INFO_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case SYSENC_ENCRYPTION_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_INPLACE_ENCRYPTION_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case NONSYS_INPLACE_ENC_RESUME_PASSWORD_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_PASSWORD_ENTRY_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case NONSYS_INPLACE_ENC_RESUME_PARTITION_SEL_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_EXPANDED_LIST_SELECT_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case NONSYS_INPLACE_ENC_TRANSFORM_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_INPLACE_ENCRYPTION_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case NONSYS_INPLACE_ENC_TRANSFORM_FINISHED_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_INFO_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case NONSYS_INPLACE_DEC_TRANSFORM_FINISHED_DRIVE_LETTER_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_DRIVE_LETTER_SELECTION_PAGE), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case FORMAT_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_FORMAT_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case FORMAT_FINISHED_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW ((bHiddenVol && !bHiddenVolHost && !bHiddenVolFinished) ? IDD_HIDVOL_HOST_FILL_PAGE_DLG : IDD_INFO_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
case SYSENC_HIDDEN_OS_INITIAL_INFO_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_INFO_PAGE_DLG), hwndDlg, (DLGPROC) PageDialogProc);
break;
case SYSENC_HIDDEN_OS_WIPE_INFO_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_INFO_PAGE_DLG), hwndDlg, (DLGPROC) PageDialogProc);
break;
case DEVICE_WIPE_MODE_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_DEVICE_WIPE_MODE_PAGE_DLG), hwndDlg, (DLGPROC) PageDialogProc);
break;
case DEVICE_WIPE_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_DEVICE_WIPE_PAGE_DLG), hwndDlg, (DLGPROC) PageDialogProc);
break;
}
rD.left = 162;
rD.top = 25;
rD.right = 0;
rD.bottom = 0;
MapDialogRect (hwndDlg, &rD);
if (hCurPage != NULL)
{
MoveWindow (hCurPage, rD.left, rD.top, rW.right - rW.left, rW.bottom - rW.top, TRUE);
ShowWindow (hCurPage, SW_SHOWNORMAL);
// Place here any message boxes that need to be displayed as soon as a new page is displayed. This
// ensures that the page is fully rendered (otherwise it would remain blank, until the message box
// is closed).
switch (nPageNo)
{
case PASSWORD_PAGE:
CheckCapsLock (hwndDlg, FALSE);
if (CreatingHiddenSysVol())
Warning ("PASSWORD_HIDDEN_OS_NOTE", MainDlg);
break;
case CIPHER_PAGE:
if (CreatingHiddenSysVol())
Warning ("HIDDEN_OS_PRE_CIPHER_WARNING", MainDlg);
break;
}
}
}
__int64 PrintFreeSpace (HWND hwndTextBox, wchar_t *lpszDrive, PLARGE_INTEGER lDiskFree)
{
char *nResourceString;
__int64 nMultiplier;
wchar_t szTmp2[256];
if (lDiskFree->QuadPart < BYTES_PER_KB)
nMultiplier = 1;
else if (lDiskFree->QuadPart < BYTES_PER_MB)
nMultiplier = BYTES_PER_KB;
else if (lDiskFree->QuadPart < BYTES_PER_GB)
nMultiplier = BYTES_PER_MB;
else if (lDiskFree->QuadPart < BYTES_PER_TB)
nMultiplier = BYTES_PER_GB;
else
nMultiplier = BYTES_PER_TB;
if (nMultiplier == 1)
{
if (bHiddenVol && !bHiddenVolHost) // If it's a hidden volume
nResourceString = "MAX_HIDVOL_SIZE_BYTES";
else if (bDevice)
nResourceString = "DEVICE_FREE_BYTES";
else
nResourceString = "DISK_FREE_BYTES";
}
else if (nMultiplier == BYTES_PER_KB)
{
if (bHiddenVol && !bHiddenVolHost) // If it's a hidden volume
nResourceString = "MAX_HIDVOL_SIZE_KB";
else if (bDevice)
nResourceString = "DEVICE_FREE_KB";
else
nResourceString = "DISK_FREE_KB";
}
else if (nMultiplier == BYTES_PER_MB)
{
if (bHiddenVol && !bHiddenVolHost) // If it's a hidden volume
nResourceString = "MAX_HIDVOL_SIZE_MB";
else if (bDevice)
nResourceString = "DEVICE_FREE_MB";
else
nResourceString = "DISK_FREE_MB";
}
else if (nMultiplier == BYTES_PER_GB)
{
if (bHiddenVol && !bHiddenVolHost) // If it's a hidden volume
nResourceString = "MAX_HIDVOL_SIZE_GB";
else if (bDevice)
nResourceString = "DEVICE_FREE_GB";
else
nResourceString = "DISK_FREE_GB";
}
else
{
if (bHiddenVol && !bHiddenVolHost) // If it's a hidden volume
nResourceString = "MAX_HIDVOL_SIZE_TB";
else if (bDevice)
nResourceString = "DEVICE_FREE_TB";
else
nResourceString = "DISK_FREE_TB";
}
if (bHiddenVol && !bHiddenVolHost) // If it's a hidden volume
{
StringCbPrintfW (szTmp2, sizeof szTmp2, GetString (nResourceString), ((double) lDiskFree->QuadPart) / nMultiplier);
SetWindowTextW (GetDlgItem (hwndTextBox, IDC_SIZEBOX), szTmp2);
}
else if (lpszDrive)
StringCbPrintfW (szTmp2, sizeof szTmp2, GetString (nResourceString), lpszDrive, ((double) lDiskFree->QuadPart) / nMultiplier);
else
szTmp2 [0] = 0;
SetWindowTextW (hwndTextBox, szTmp2);
if (lDiskFree->QuadPart % (__int64) BYTES_PER_MB != 0)
nMultiplier = BYTES_PER_KB;
return nMultiplier;
}
void DisplaySizingErrorText (HWND hwndTextBox)
{
wchar_t szTmp[1024];
if (translateWin32Error (szTmp, sizeof (szTmp) / sizeof(szTmp[0])))
{
wchar_t szTmp2[1024];
StringCbPrintfW (szTmp2, sizeof(szTmp2), L"%s\n%s", GetString ("CANNOT_CALC_SPACE"), szTmp);
SetWindowTextW (hwndTextBox, szTmp2);
}
else
{
SetWindowText (hwndTextBox, L"");
}
}
void EnableDisableFileNext (HWND hComboBox, HWND hMainButton)
{
int nIndex = (int) SendMessage (hComboBox, CB_GETCURSEL, 0, 0);
if (bHistory && nIndex == CB_ERR)
{
EnableWindow (hMainButton, FALSE);
SetFocus (hComboBox);
}
else
{
EnableWindow (hMainButton, TRUE);
SetFocus (hMainButton);
}
}
// Returns TRUE if the file is a sparse file. If it's not a sparse file or in case of any error, returns FALSE.
BOOL IsSparseFile (HWND hwndDlg)
{
HANDLE hFile;
BY_HANDLE_FILE_INFORMATION bhFileInfo;
FILETIME ftLastAccessTime;
BOOL bTimeStampValid = FALSE;
BOOL retCode = FALSE;
hFile = CreateFile (szFileName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
MessageBoxW (hwndDlg, GetString ("CANT_ACCESS_VOL"), lpszTitle, ICON_HAND);
return FALSE;
}
if (bPreserveTimestamp)
{
ftLastAccessTime.dwHighDateTime = 0xFFFFFFFF;
ftLastAccessTime.dwLowDateTime = 0xFFFFFFFF;
SetFileTime (hFile, NULL, &ftLastAccessTime, NULL);
if (GetFileTime (hFile, NULL, &ftLastAccessTime, NULL) == 0)
bTimeStampValid = FALSE;
else
bTimeStampValid = TRUE;
}
bhFileInfo.dwFileAttributes = 0;
GetFileInformationByHandle(hFile, &bhFileInfo);
retCode = bhFileInfo.dwFileAttributes & FILE_ATTRIBUTE_SPARSE_FILE;
if (bTimeStampValid)
SetFileTime (hFile, NULL, &ftLastAccessTime, NULL);
CloseHandle (hFile);
return retCode;
}
// Note: GetFileVolSize is not to be used for devices (only for file-hosted volumes)
BOOL GetFileVolSize (HWND hwndDlg, unsigned __int64 *size)
{
LARGE_INTEGER fileSize;
HANDLE hFile;
FILETIME ftLastAccessTime;
BOOL bTimeStampValid = FALSE;
hFile = CreateFile (szFileName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
MessageBoxW (hwndDlg, GetString ("CANT_ACCESS_VOL"), lpszTitle, ICON_HAND);
return FALSE;
}
if (bPreserveTimestamp)
{
ftLastAccessTime.dwHighDateTime = 0xFFFFFFFF;
ftLastAccessTime.dwLowDateTime = 0xFFFFFFFF;
SetFileTime (hFile, NULL, &ftLastAccessTime, NULL);
if (GetFileTime (hFile, NULL, &ftLastAccessTime, NULL) == 0)
bTimeStampValid = FALSE;
else
bTimeStampValid = TRUE;
}
if (GetFileSizeEx(hFile, &fileSize) == 0)
{
MessageBoxW (hwndDlg, GetString ("CANT_GET_VOLSIZE"), lpszTitle, ICON_HAND);
if (bTimeStampValid)
SetFileTime (hFile, NULL, &ftLastAccessTime, NULL);
CloseHandle (hFile);
return FALSE;
}
if (bTimeStampValid)
SetFileTime (hFile, NULL, &ftLastAccessTime, NULL);
CloseHandle (hFile);
*size = fileSize.QuadPart;
return TRUE;
}
BOOL QueryFreeSpace (HWND hwndDlg, HWND hwndTextBox, BOOL display, LONGLONG *pFreeSpaceValue, BOOL* pbIsSparceFilesSupported)
{
if (pFreeSpaceValue)
*pFreeSpaceValue = 0;
if (pbIsSparceFilesSupported)
*pbIsSparceFilesSupported = FALSE;
if (bHiddenVol && !bHiddenVolHost) // If it's a hidden volume
{
LARGE_INTEGER lDiskFree;
lDiskFree.QuadPart = nMaximumHiddenVolSize;
if (pFreeSpaceValue)
*pFreeSpaceValue = nMaximumHiddenVolSize;
if (display)
PrintFreeSpace (hwndTextBox, NULL, &lDiskFree);
return TRUE;
}
else if (bDevice == FALSE)
{
wchar_t root[TC_MAX_PATH];
DWORD fileSystemFlags = 0;
ULARGE_INTEGER free;
if (!GetVolumePathName (szFileName, root, ARRAYSIZE (root)))
{
handleWin32Error (hwndDlg, SRC_POS);
return FALSE;
}
if ( pbIsSparceFilesSupported
&& GetVolumeInformation (root, NULL, 0, NULL, NULL, &fileSystemFlags, NULL, 0)
&& (fileSystemFlags & FILE_SUPPORTS_SPARSE_FILES)
)
{
*pbIsSparceFilesSupported = TRUE;
}
if (!GetDiskFreeSpaceEx (root, &free, 0, 0))
{
if (display)
DisplaySizingErrorText (hwndTextBox);
return FALSE;
}
else
{
LARGE_INTEGER lDiskFree;
lDiskFree.QuadPart = free.QuadPart;
if (pFreeSpaceValue)
*pFreeSpaceValue = free.QuadPart;
if (display)
PrintFreeSpace (hwndTextBox, root, &lDiskFree);
return TRUE;
}
}
else
{
DISK_GEOMETRY_EX driveInfo;
PARTITION_INFORMATION diskInfo;
BOOL piValid = FALSE;
BOOL gValid = FALSE;
// Query partition size
piValid = GetPartitionInfo (szDiskFile, &diskInfo);
gValid = GetDriveGeometry (szDiskFile, &driveInfo);
if (!piValid && !gValid)
{
if (display)
DisplaySizingErrorText (hwndTextBox);
return FALSE;
}
DWORD sectorSize = GetFormatSectorSize();
if (sectorSize < TC_MIN_VOLUME_SECTOR_SIZE
|| sectorSize > TC_MAX_VOLUME_SECTOR_SIZE
|| sectorSize % ENCRYPTION_DATA_UNIT_SIZE != 0)
{
Error ("SECTOR_SIZE_UNSUPPORTED", hwndDlg);
return FALSE;
}
if (piValid)
{
nVolumeSize = diskInfo.PartitionLength.QuadPart;
if(display)
nMultiplier = PrintFreeSpace (hwndTextBox, szDiskFile, &diskInfo.PartitionLength);
nUIVolumeSize = diskInfo.PartitionLength.QuadPart / nMultiplier;
if (nVolumeSize == 0)
{
if (display)
SetWindowTextW (hwndTextBox, GetString ("EXT_PARTITION"));
return FALSE;
}
}
else
{
LARGE_INTEGER lDiskFree;
// Drive geometry info is used only when GetPartitionInfo() fails
lDiskFree.QuadPart = driveInfo.DiskSize.QuadPart;
nVolumeSize = lDiskFree.QuadPart;
if (pFreeSpaceValue)
*pFreeSpaceValue = lDiskFree.QuadPart;
if (display)
nMultiplier = PrintFreeSpace (hwndTextBox, szDiskFile, &lDiskFree);
nUIVolumeSize = lDiskFree.QuadPart / nMultiplier;
}
return TRUE;
}
}
static BOOL FinalPreTransformPrompts (void)
{
int x;
wchar_t szTmp[4096];
int driveNo;
WCHAR deviceName[MAX_PATH];
StringCbCopyW (deviceName, sizeof(deviceName), szFileName);
driveNo = GetDiskDeviceDriveLetter (deviceName);
if (!bForceOperation && !(bHiddenVol && !bHiddenVolHost)) // Do not ask for permission to overwrite an existing volume if we're creating a hidden volume within it
{
wchar_t drive[128];
wchar_t volumeLabel[128];
wchar_t *type;
BOOL bTmpIsPartition = FALSE;
type = GetPathType (szFileName, !bInPlaceEncNonSys, &bTmpIsPartition);
if (driveNo != -1)
{
if (!GetDriveLabel (driveNo, volumeLabel, sizeof (volumeLabel)))
volumeLabel[0] = 0;
StringCbPrintfW (drive, sizeof (drive), volumeLabel[0] ? L" (%hc: '%s')" : L" (%hc:%s)", 'A' + driveNo, volumeLabel[0] ? volumeLabel : L"");
}
else
{
drive[0] = 0;
volumeLabel[0] = 0;
}
if (bHiddenOS && bHiddenVolHost)
StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("OVERWRITEPROMPT_DEVICE_HIDDEN_OS_PARTITION"), szFileName, drive);
else
StringCbPrintfW (szTmp, sizeof(szTmp), GetString (bInPlaceEncNonSys ? (bInPlaceDecNonSys ? "NONSYS_INPLACE_DEC_CONFIRM" : "NONSYS_INPLACE_ENC_CONFIRM") : "OVERWRITEPROMPT_DEVICE"), type, szFileName, drive);
if (bInPlaceEncNonSys)
x = AskWarnYesNoString (szTmp, MainDlg);
else
x = AskWarnNoYesString (szTmp, MainDlg);
if (x != IDYES)
return FALSE;
if (driveNo != -1 && bTmpIsPartition && !bInPlaceEncNonSys)
{
float percentFreeSpace = 100.0;
__int64 occupiedBytes = 0;
// Do a second check. If we find that the partition contains more than 1GB of data or more than 12%
// of its space is occupied, we will display an extra warning, however, this time it won't be a Yes/No
// dialog box (because users often ignore such dialog boxes).
if (GetStatsFreeSpaceOnPartition (szFileName, &percentFreeSpace, &occupiedBytes, TRUE) != -1)
{
if (occupiedBytes > BYTES_PER_GB && percentFreeSpace < 99.99 // "percentFreeSpace < 99.99" is needed because an NTFS filesystem larger than several terabytes can have more than 1GB of data in use, even if there are no files stored on it.
|| percentFreeSpace < 88) // A 24-MB NTFS filesystem has 11.5% of space in use even if there are no files stored on it.
{
wchar_t tmpMcMsg [8000];
wchar_t tmpMcOption1 [500];
wchar_t tmpMcOptionCancel [50];
StringCbCopyW (tmpMcMsg, sizeof(tmpMcMsg), GetString("OVERWRITEPROMPT_DEVICE_SECOND_WARNING_LOTS_OF_DATA"));
StringCbCopyW (tmpMcOption1, sizeof(tmpMcOption1), GetString("ERASE_FILES_BY_CREATING_VOLUME"));
StringCbCopyW (tmpMcOptionCancel, sizeof(tmpMcOptionCancel), GetString("CANCEL"));
StringCbCatW (tmpMcMsg, sizeof(tmpMcMsg), L"\n\n");
StringCbCatW (tmpMcMsg, sizeof(tmpMcMsg), GetString("DRIVE_LETTER_ITEM"));
StringCbPrintfW (szTmp, sizeof (szTmp), L"%hc:", 'A' + driveNo);
StringCbCatW (tmpMcMsg, sizeof(tmpMcMsg), szTmp);
StringCbCatW (tmpMcMsg, sizeof(tmpMcMsg), L"\n");
StringCbCatW (tmpMcMsg, sizeof(tmpMcMsg), GetString("LABEL_ITEM"));
StringCbCatW (tmpMcMsg, sizeof(tmpMcMsg), volumeLabel[0] != 0 ? volumeLabel : GetString("NOT_APPLICABLE_OR_NOT_AVAILABLE"));
StringCbCatW (tmpMcMsg, sizeof(tmpMcMsg), L"\n");
StringCbCatW (tmpMcMsg, sizeof(tmpMcMsg), GetString("SIZE_ITEM"));
GetSizeString (nVolumeSize, szTmp, sizeof(szTmp));
StringCbCatW (tmpMcMsg, sizeof(tmpMcMsg), szTmp);
StringCbCatW (tmpMcMsg, sizeof(tmpMcMsg), L"\n");
StringCbCatW (tmpMcMsg, sizeof(tmpMcMsg), GetString("PATH_ITEM"));
StringCbCatW (tmpMcMsg, sizeof(tmpMcMsg), deviceName);
wchar_t *tmpStr[] = {L"", tmpMcMsg, tmpMcOption1, tmpMcOptionCancel, 0};
switch (AskMultiChoice ((void **) tmpStr, TRUE, MainDlg))
{
case 1:
// Proceed
// NOP
break;
default:
return FALSE;
}
}
}
}
}
return TRUE;
}
void UpdateLastDialogId (void)
{
static char PageDebugId[128];
StringCbPrintfA (PageDebugId, sizeof(PageDebugId), "FORMAT_PAGE_%d", nCurPageNo);
LastDialogId = PageDebugId;
}
void HandleOldAssignedDriveLetter (void)
{
if (bDevice)
{
// Handle assigned drive letter (if any)
WCHAR deviceName[MAX_PATH];
int driveLetter = -1;
StringCbCopyW (deviceName, sizeof(deviceName), szDiskFile);
driveLetter = GetDiskDeviceDriveLetter (deviceName);
if (!Silent && !bHiddenVolHost
&& !bHiddenOS
&& driveLetter >= 0)
{
wchar_t rootPath[] = { (wchar_t) driveLetter + L'A', L':', L'\\', 0 };
wchar_t szTmp[8192];
StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("AFTER_FORMAT_DRIVE_LETTER_WARN"), rootPath[0], rootPath[0], rootPath[0], rootPath[0]);
MessageBoxW (MainDlg, szTmp, lpszTitle, MB_ICONWARNING);
}
}
}
// Returns TRUE if it makes sense to ask the user whether he wants to store files larger than 4GB in the volume.
static BOOL FileSize4GBLimitQuestionNeeded (void)
{
uint64 dataAreaSize = GetVolumeDataAreaSize (bHiddenVol && !bHiddenVolHost, nVolumeSize);
return (dataAreaSize > 4 * BYTES_PER_GB + TC_MIN_FAT_FS_SIZE
&& dataAreaSize <= TC_MAX_FAT_SECTOR_COUNT * GetFormatSectorSize());
}
void DisableIfGpt(HWND control)
{
if (bSystemIsGPT) {
EnableWindow(control, FALSE);
}
}
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)
{
wstringstream s;
DWORD size = GetFormatSectorSize() * i;
if (size > TC_MAX_FAT_CLUSTER_SIZE)
break;
/* ReFS supports only 4KiB and 64KiB clusters */
if ((fsType == FILESYS_REFS) && (size != 4*BYTES_PER_KB) && (size != 64*BYTES_PER_KB))
continue;
if (size == 512)
s << L"0.5";
else
s << size / BYTES_PER_KB;
s << L" " << GetString ("KB");
AddComboPair (GetDlgItem (hwndDlg, IDC_CLUSTERSIZE), s.str().c_str(), i);
}
SendMessage (GetDlgItem (hwndDlg, IDC_CLUSTERSIZE), CB_SETCURSEL, 0, 0);
}
/* Except in response to the WM_INITDIALOG message, the dialog box procedure
should return nonzero if it processes the message, and zero if it does
not. - see DialogProc */
BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
WORD lw = LOWORD (wParam);
WORD hw = HIWORD (wParam);
static BOOL PimValueChangedWarning = FALSE;
hCurPage = hwndDlg;
switch (uMsg)
{
case WM_INITDIALOG:
PimValueChangedWarning = FALSE;
LocalizeDialog (hwndDlg, "IDD_VOL_CREATION_WIZARD_DLG");
burn (randPool, sizeof(randPool));
burn (lastRandPool, sizeof(lastRandPool));
burn (maskRandPool, sizeof (maskRandPool));
UpdateLastDialogId ();
switch (nCurPageNo)
{
case INTRO_PAGE:
SendMessage (GetDlgItem (hwndDlg, IDC_FILE_CONTAINER), WM_SETFONT, (WPARAM) hUserBoldFont, (LPARAM) TRUE);
SendMessage (GetDlgItem (hwndDlg, IDC_NONSYS_DEVICE), WM_SETFONT, (WPARAM) hUserBoldFont, (LPARAM) TRUE);
SendMessage (GetDlgItem (hwndDlg, IDC_SYS_DEVICE), WM_SETFONT, (WPARAM) hUserBoldFont, (LPARAM) TRUE);
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("INTRO_TITLE"));
ToHyperlink (hwndDlg, IDC_MORE_INFO_ON_CONTAINERS);
ToHyperlink (hwndDlg, IDC_MORE_INFO_ON_SYS_ENCRYPTION);
EnableWindow (GetDlgItem (hwndDlg, IDC_STD_VOL), TRUE);
EnableWindow (GetDlgItem (hwndDlg, IDC_HIDDEN_VOL), TRUE);
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("NEXT"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDCANCEL), GetString ("CANCEL"));
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), FALSE);
UpdateWizardModeControls (hwndDlg, WizardMode);
break;
case SYSENC_TYPE_PAGE:
- {
bHiddenVolHost = bHiddenVol = bHiddenOS;
- wchar_t finalMsg[8024] = {0};
+ SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("SYSENC_TYPE_PAGE_TITLE"));
- try
- {
- StringCbPrintfW (finalMsg, sizeof(finalMsg),
- GetString ("SYSENC_TYPE_PAGE_TITLE"),
- GetSystemDriveLetter ());
- }
- catch (Exception &e)
- {
- e.Show (hwndDlg);
- EndMainDlg (MainDlg);
- return 0;
- }
+ SendMessage (GetDlgItem (hwndDlg, IDC_SYSENC_HIDDEN), WM_SETFONT, (WPARAM) hUserBoldFont, (LPARAM) TRUE);
+ SendMessage (GetDlgItem (hwndDlg, IDC_SYSENC_NORMAL), WM_SETFONT, (WPARAM) hUserBoldFont, (LPARAM) TRUE);
- SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), finalMsg);
+ DisableIfGpt(GetDlgItem(hwndDlg, IDC_SYSENC_HIDDEN));
- memset (finalMsg, 0, sizeof (finalMsg));
- try
- {
- StringCbPrintfW (finalMsg, sizeof(finalMsg),
- GetString ("SYSENC_INFO"),
- GetSystemDriveLetter ());
- }
- catch (Exception &e)
- {
- e.Show (hwndDlg);
- EndMainDlg (MainDlg);
- return 0;
- }
+ CheckButton (GetDlgItem (hwndDlg, bHiddenOS ? IDC_SYSENC_HIDDEN : IDC_SYSENC_NORMAL));
- SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), finalMsg);
- SetWindowTextW (GetDlgItem (hwndDlg, IDT_SYSENC_INFO_2), GetString ("SYSENC_INFO_2"));
-
- if (bSystemIsGPT)
- {
- ShowWindow (GetDlgItem(hwndDlg, IDC_ADVANCE_INTRO), SW_HIDE);
- ShowWindow (GetDlgItem(hwndDlg, IDC_INFORMATION_TIP), SW_HIDE);
- }
- else
- {
- EnableWindow (GetDlgItem(hwndDlg, IDC_ADVANCE_INTRO), TRUE);
- iIconX = GetSystemMetrics (SM_CXSMICON);
- iIconY = GetSystemMetrics (SM_CYSMICON);
+ SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString ("SYSENC_HIDDEN_TYPE_HELP"));
+ SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP_SYSENC_NORMAL), GetString ("SYSENC_NORMAL_TYPE_HELP"));
+
+ ToHyperlink (hwndDlg, IDC_HIDDEN_SYSENC_INFO_LINK);
- hIconTooltip = LoadImage (NULL, MAKEINTRESOURCE (104), IMAGE_ICON, iIconX, iIconY, LR_DEFAULTCOLOR);
- SendDlgItemMessage (hwndDlg, IDC_INFORMATION_TIP, STM_SETICON, (WPARAM) hIconTooltip, 0);
-
- hDlgItemTooltip = GetDlgItem (hwndDlg, IDC_INFORMATION_TIP);
- if (hDlgItemTooltip)
- {
- CreateToolTip (hwndDlg, hDlgItemTooltip, GetString ("ADV_FEATURES_INTRO_TOOLTIP"));
- }
- else
- {
- MessageBox (0, TEXT("Cannot find dialog item"), 0, 0);
- }
- }
-
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), !bDirectSysEncMode);
SetWindowTextW (GetDlgItem (MainDlg, IDC_NEXT), GetString ("NEXT"));
SetWindowTextW (GetDlgItem (MainDlg, IDC_PREV), GetString ("PREV"));
SetWindowTextW (GetDlgItem (MainDlg, IDCANCEL), GetString ("CANCEL"));
-
- // Start loading the password dictonary into memory ("need" is just a random word for initializing the process)
- CheckWord("need");
break;
- }
+
case SYSENC_HIDDEN_OS_REQ_CHECK_PAGE:
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("SYSENC_HIDDEN_OS_REQ_CHECK_PAGE_TITLE"));
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString ("SYSENC_HIDDEN_OS_REQ_CHECK_PAGE_HELP"));
SetWindowTextW (GetDlgItem (MainDlg, IDC_NEXT), GetString ("NEXT"));
SetWindowTextW (GetDlgItem (MainDlg, IDC_PREV), GetString ("PREV"));
SetWindowTextW (GetDlgItem (MainDlg, IDCANCEL), GetString ("CANCEL"));
EnableWindow (GetDlgItem (MainDlg, IDC_NEXT), TRUE);
EnableWindow (GetDlgItem (MainDlg, IDC_PREV), bDirectSysEncModeCommand != SYSENC_COMMAND_CREATE_HIDDEN_OS && bDirectSysEncModeCommand != SYSENC_COMMAND_CREATE_HIDDEN_OS_ELEV);
ToHyperlink (hwndDlg, IDC_HIDDEN_SYSENC_INFO_LINK);
break;
case SYSENC_SPAN_PAGE:
SendMessage (GetDlgItem (hwndDlg, IDC_WHOLE_SYS_DRIVE), WM_SETFONT, (WPARAM) hUserBoldFont, (LPARAM) TRUE);
SendMessage (GetDlgItem (hwndDlg, IDC_SYS_PARTITION), WM_SETFONT, (WPARAM) hUserBoldFont, (LPARAM) TRUE);
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("SYS_ENCRYPTION_SPAN_TITLE"));
SetWindowTextW (GetDlgItem (hwndDlg, IDT_WHOLE_SYS_DRIVE), GetString ("SYS_ENCRYPTION_SPAN_WHOLE_SYS_DRIVE_HELP"));
CheckButton (GetDlgItem (hwndDlg, bWholeSysDrive ? IDC_WHOLE_SYS_DRIVE : IDC_SYS_PARTITION));
DisableIfGpt(GetDlgItem(hwndDlg, IDC_WHOLE_SYS_DRIVE));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("NEXT"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDCANCEL), GetString ("CANCEL"));
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), TRUE);
break;
+
case SYSENC_PRE_DRIVE_ANALYSIS_PAGE:
Init2RadButtonPageYesNo (SysEncDetectHiddenSectors);
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("SYSENC_PRE_DRIVE_ANALYSIS_TITLE"));
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString ("SYSENC_PRE_DRIVE_ANALYSIS_HELP"));
break;
case SYSENC_DRIVE_ANALYSIS_PAGE:
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("SYSENC_DRIVE_ANALYSIS_TITLE"));
SetWindowTextW (GetDlgItem (hwndDlg, IDT_SYSENC_DRIVE_ANALYSIS_INFO), GetString ("SYSENC_DRIVE_ANALYSIS_INFO"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("NEXT"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDCANCEL), GetString ("CANCEL"));
EnableWindow (GetDlgItem (MainDlg, IDC_NEXT), FALSE);
EnableWindow (GetDlgItem (MainDlg, IDC_PREV), FALSE);
EnableWindow (GetDlgItem (MainDlg, IDCANCEL), FALSE);
LoadSettings (hwndDlg);
if (HiddenSectorDetectionStatus == 1)
{
// Detection of hidden sectors was already in progress but it did not finish successfully.
// Ask the user if he wants to try again (to prevent repeated system freezing, etc.)
char *tmpStr[] = {0, "HIDDEN_SECTOR_DETECTION_FAILED_PREVIOUSLY", "SKIP_HIDDEN_SECTOR_DETECTION", "RETRY_HIDDEN_SECTOR_DETECTION", "IDC_EXIT", 0};
switch (AskMultiChoice ((void **) tmpStr, FALSE, MainDlg))
{
case 1:
// Do not try again
LoadPage (MainDlg, SYSENC_DRIVE_ANALYSIS_PAGE + 1);
return 0;
case 2:
// Try again
break;
default:
EndMainDlg (MainDlg);
return 0;
}
}
SetTimer (MainDlg, TIMER_ID_SYSENC_DRIVE_ANALYSIS_PROGRESS, TIMER_INTERVAL_SYSENC_DRIVE_ANALYSIS_PROGRESS, NULL);
bSysEncDriveAnalysisInProgress = TRUE;
ArrowWaitCursor ();
SysEncDriveAnalysisStart = GetTickCount ();
InitProgressBar (SYSENC_DRIVE_ANALYSIS_ETA, 0, FALSE, FALSE, FALSE, TRUE);
_beginthread (sysEncDriveAnalysisThread, 0, hwndDlg);
break;
case SYSENC_MULTI_BOOT_MODE_PAGE:
SendMessage (GetDlgItem (hwndDlg, IDC_SINGLE_BOOT), WM_SETFONT, (WPARAM) hUserBoldFont, (LPARAM) TRUE);
SendMessage (GetDlgItem (hwndDlg, IDC_MULTI_BOOT), WM_SETFONT, (WPARAM) hUserBoldFont, (LPARAM) TRUE);
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("SYS_MULTI_BOOT_MODE_TITLE"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("NEXT"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDCANCEL), GetString ("CANCEL"));
RefreshMultiBootControls (hwndDlg);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), nMultiBoot > 0);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), TRUE);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDCANCEL), TRUE);
break;
case SYSENC_MULTI_BOOT_SYS_EQ_BOOT_PAGE:
Init2RadButtonPageYesNo (SysEncMultiBootCfg.SystemOnBootDrive);
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("SYSENC_MULTI_BOOT_SYS_EQ_BOOT_TITLE"));
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString ("SYSENC_MULTI_BOOT_SYS_EQ_BOOT_HELP"));
break;
case SYSENC_MULTI_BOOT_NBR_SYS_DRIVES_PAGE:
SetWindowTextW (GetDlgItem (hCurPage, IDC_CHOICE1), GetString ("DIGIT_ONE"));
SetWindowTextW (GetDlgItem (hCurPage, IDC_CHOICE2), GetString ("TWO_OR_MORE"));
SetWindowTextW (GetDlgItem (MainDlg, IDC_NEXT), GetString ("NEXT"));
SetWindowTextW (GetDlgItem (MainDlg, IDC_PREV), GetString ("PREV"));
SetWindowTextW (GetDlgItem (MainDlg, IDCANCEL), GetString ("CANCEL"));
EnableWindow (GetDlgItem (MainDlg, IDC_NEXT), SysEncMultiBootCfg.NumberOfSysDrives > 0);
EnableWindow (GetDlgItem (MainDlg, IDC_PREV), TRUE);
if (SysEncMultiBootCfg.NumberOfSysDrives == 2)
Update2RadButtonPage (0); // 2 or more drives contain an OS
else if (SysEncMultiBootCfg.NumberOfSysDrives == 1)
Update2RadButtonPage (1); // Only 1 drive contains an OS
else
Update2RadButtonPage (-1);
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("SYSENC_MULTI_BOOT_NBR_SYS_DRIVES_TITLE"));
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString ("SYSENC_MULTI_BOOT_NBR_SYS_DRIVES_HELP"));
break;
case SYSENC_MULTI_BOOT_ADJACENT_SYS_PAGE:
Init2RadButtonPageYesNo (SysEncMultiBootCfg.MultipleSystemsOnDrive);
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("SYSENC_MULTI_BOOT_ADJACENT_SYS_TITLE"));
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString ("SYSENC_MULTI_BOOT_ADJACENT_SYS_HELP"));
break;
case SYSENC_MULTI_BOOT_NONWIN_BOOT_LOADER_PAGE:
Init2RadButtonPageYesNo (SysEncMultiBootCfg.BootLoaderBrand);
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("SYSENC_MULTI_BOOT_NONWIN_BOOT_LOADER_TITLE"));
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString ("SYSENC_MULTI_BOOT_NONWIN_BOOT_LOADER_HELP"));
break;
case SYSENC_MULTI_BOOT_OUTCOME_PAGE:
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("SYSENC_MULTI_BOOT_OUTCOME_TITLE"));
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), SysEncMultiBootCfgOutcome);
SetWindowTextW (GetDlgItem (MainDlg, IDC_NEXT), GetString ("NEXT"));
SetWindowTextW (GetDlgItem (MainDlg, IDC_PREV), GetString ("PREV"));
SetWindowTextW (GetDlgItem (MainDlg, IDCANCEL), GetString ("CANCEL"));
EnableWindow (GetDlgItem (MainDlg, IDC_NEXT), TRUE);
EnableWindow (GetDlgItem (MainDlg, IDC_PREV), TRUE);
break;
case VOLUME_TYPE_PAGE:
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("VOLUME_TYPE_TITLE"));
SendMessage (GetDlgItem (hwndDlg, IDC_HIDDEN_VOL), WM_SETFONT, (WPARAM) hUserBoldFont, (LPARAM) TRUE);
SendMessage (GetDlgItem (hwndDlg, IDC_STD_VOL), WM_SETFONT, (WPARAM) hUserBoldFont, (LPARAM) TRUE);
CheckButton (GetDlgItem (hwndDlg, bHiddenVol ? IDC_HIDDEN_VOL : IDC_STD_VOL));
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString ("HIDDEN_VOLUME_TYPE_HELP"));
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP_NORMAL_VOL), GetString ("NORMAL_VOLUME_TYPE_HELP"));
ToHyperlink (hwndDlg, IDC_HIDDEN_VOL_HELP);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), TRUE);
SetWindowTextW (GetDlgItem (MainDlg, IDC_NEXT), GetString ("NEXT"));
SetWindowTextW (GetDlgItem (MainDlg, IDC_PREV), GetString ("PREV"));
SetWindowTextW (GetDlgItem (MainDlg, IDCANCEL), GetString ("CANCEL"));
break;
case HIDDEN_VOL_WIZARD_MODE_PAGE:
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("HIDDEN_VOL_WIZARD_MODE_TITLE"));
SendMessage (GetDlgItem (hwndDlg, IDC_HIDVOL_WIZ_MODE_DIRECT), WM_SETFONT, (WPARAM) hUserBoldFont, (LPARAM) TRUE);
SendMessage (GetDlgItem (hwndDlg, IDC_HIDVOL_WIZ_MODE_FULL), WM_SETFONT, (WPARAM) hUserBoldFont, (LPARAM) TRUE);
CheckButton (GetDlgItem (hwndDlg, bHiddenVolDirect ? IDC_HIDVOL_WIZ_MODE_DIRECT : IDC_HIDVOL_WIZ_MODE_FULL));
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString ("HIDDEN_VOL_WIZARD_MODE_NORMAL_HELP"));
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP2), GetString ("HIDDEN_VOL_WIZARD_MODE_DIRECT_HELP"));
EnableWindow (GetDlgItem (hwndDlg, IDC_HIDVOL_WIZ_MODE_DIRECT), TRUE);
EnableWindow (GetDlgItem (hwndDlg, IDC_HIDVOL_WIZ_MODE_FULL), TRUE);
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("NEXT"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDCANCEL), GetString ("CANCEL"));
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), TRUE);
break;
case VOLUME_LOCATION_PAGE:
{
char *nID;
SetWindowTextW (GetDlgItem (hwndDlg, IDC_SELECT_VOLUME_LOCATION),
GetString (bDevice ? "IDC_SELECT_DEVICE" : "IDC_SELECT_FILE"));
if (bHiddenVolDirect && bHiddenVolHost)
{
nID = "FILE_HELP_HIDDEN_HOST_VOL_DIRECT";
}
else
{
if (bDevice)
nID = bHiddenVolHost ? "DEVICE_HELP_HIDDEN_HOST_VOL" : "DEVICE_HELP";
else
nID = bHiddenVolHost ? "FILE_HELP_HIDDEN_HOST_VOL" : "FILE_HELP";
}
SendMessage (GetDlgItem (hwndDlg, IDC_COMBO_BOX), CB_RESETCONTENT, 0, 0);
SendMessage (GetDlgItem (hwndDlg, IDC_COMBO_BOX), CB_LIMITTEXT, TC_MAX_PATH, 0);
LoadCombo (GetDlgItem (hwndDlg, IDC_COMBO_BOX), bHistory, FALSE, NULL);
SendMessage (GetDlgItem (hwndDlg, IDC_NO_HISTORY), BM_SETCHECK, bHistory ? BST_UNCHECKED : BST_CHECKED, 0);
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("FILE_TITLE"));
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString (nID));
SetFocus (GetDlgItem (hwndDlg, IDC_COMBO_BOX));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("NEXT"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV"));
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), TRUE);
AddComboItem (GetDlgItem (hwndDlg, IDC_COMBO_BOX), szFileName, bHistory);
EnableDisableFileNext (GetDlgItem (hwndDlg, IDC_COMBO_BOX),
GetDlgItem (GetParent (hwndDlg), IDC_NEXT));
}
break;
case DEVICE_TRANSFORM_MODE_PAGE:
if (!bDeviceTransformModeChoiceMade && !bInPlaceEncNonSys)
{
// The user has not chosen whether to perform in-place encryption or format yet.
// We will preselect in-place encryption if the requirements are met and if the
// filesystem does not appear empty.
WaitCursor();
if (CheckRequirementsForNonSysInPlaceEnc (hwndDlg, szDiskFile, TRUE))
{
bInPlaceEncNonSys = (FileSystemAppearsEmpty (szDiskFile) == 0);
}
}
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("DEVICE_TRANSFORM_MODE_PAGE_TITLE"));
SendMessage (GetDlgItem (hwndDlg, IDC_DEVICE_TRANSFORM_MODE_INPLACE), WM_SETFONT, (WPARAM) hUserBoldFont, (LPARAM) TRUE);
SendMessage (GetDlgItem (hwndDlg, IDC_DEVICE_TRANSFORM_MODE_FORMAT), WM_SETFONT, (WPARAM) hUserBoldFont, (LPARAM) TRUE);
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString ("DEVICE_TRANSFORM_MODE_PAGE_FORMAT_HELP"));
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP2), GetString ("DEVICE_TRANSFORM_MODE_PAGE_INPLACE_HELP"));
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), TRUE);
CheckButton (GetDlgItem (hwndDlg, bInPlaceEncNonSys ? IDC_DEVICE_TRANSFORM_MODE_INPLACE : IDC_DEVICE_TRANSFORM_MODE_FORMAT));
NormalCursor();
break;
case HIDDEN_VOL_HOST_PRE_CIPHER_PAGE:
{
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("HIDVOL_HOST_PRE_CIPHER_TITLE"));
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString (bHiddenOS ? "HIDVOL_HOST_PRE_CIPHER_HELP_SYSENC" : "HIDVOL_HOST_PRE_CIPHER_HELP"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("NEXT"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV"));
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), TRUE);
if (bHiddenOS)
{
if (!GetDevicePathForHiddenOS())
AbortProcess ("INVALID_PATH");
}
}
break;
case HIDDEN_VOL_PRE_CIPHER_PAGE:
{
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("NEXT"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV"));
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), FALSE);
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("HIDVOL_PRE_CIPHER_TITLE"));
if (bHiddenOS)
{
// Verify whether the clone of the OS fits in the hidden volume (the hidden
// volume is to host a hidden OS).
if (nMaximumHiddenVolSize - TC_HIDDEN_VOLUME_HOST_FS_RESERVED_END_AREA_SIZE_HIGH < GetSystemPartitionSize())
{
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString ("HIDDEN_VOLUME_TOO_SMALL_FOR_OS_CLONE"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDCANCEL), GetString ("EXIT"));
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDCANCEL), TRUE);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), FALSE);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), FALSE);
bConfirmQuit = FALSE;
bConfirmQuitSysEncPretest = FALSE;
}
else
{
// The hidden volume must be as large as the system partition
nVolumeSize = GetSystemPartitionSize() + TC_HIDDEN_VOLUME_HOST_FS_RESERVED_END_AREA_SIZE_HIGH;
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString ("HIDDEN_OS_PRE_CIPHER_HELP"));
}
}
else
{
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString ("HIDVOL_PRE_CIPHER_HELP"));
}
}
break;
case CIPHER_PAGE:
{
int ea, hid;
wchar_t buf[100];
// Encryption algorithms
SendMessage (GetDlgItem (hwndDlg, IDC_COMBO_BOX), CB_RESETCONTENT, 0, 0);
if (bHiddenVol)
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString (bHiddenVolHost ? "CIPHER_HIDVOL_HOST_TITLE" : "CIPHER_HIDVOL_TITLE"));
else
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("CIPHER_TITLE"));
for (ea = EAGetFirst (); ea != 0; ea = EAGetNext (ea))
{
if (EAIsFormatEnabled (ea) && (!SysEncInEffect () || bSystemIsGPT || EAIsMbrSysEncEnabled (ea)))
AddComboPair (GetDlgItem (hwndDlg, IDC_COMBO_BOX), EAGetName (buf, ARRAYSIZE(buf),ea, 1), ea);
}
SelectAlgo (GetDlgItem (hwndDlg, IDC_COMBO_BOX), &nVolumeEA);
ComboSelChangeEA (hwndDlg);
SetFocus (GetDlgItem (hwndDlg, IDC_COMBO_BOX));
ToHyperlink (hwndDlg, IDC_LINK_MORE_INFO_ABOUT_CIPHER);
// Hash algorithms
if (SysEncInEffect ())
{
hash_algo = bSystemIsGPT? SHA512 : DEFAULT_HASH_ALGORITHM_BOOT;
RandSetHashFunction (hash_algo);
for (hid = FIRST_PRF_ID; hid <= LAST_PRF_ID; hid++)
{
if ((!HashIsDeprecated (hid)) && (bSystemIsGPT || HashForSystemEncryption (hid)))
AddComboPair (GetDlgItem (hwndDlg, IDC_COMBO_BOX_HASH_ALGO), HashGetName(hid), hid);
}
}
else
{
hash_algo = RandGetHashFunction();
for (hid = FIRST_PRF_ID; hid <= LAST_PRF_ID; hid++)
{
if (!HashIsDeprecated (hid))
AddComboPair (GetDlgItem (hwndDlg, IDC_COMBO_BOX_HASH_ALGO), HashGetName(hid), hid);
}
}
SelectAlgo (GetDlgItem (hwndDlg, IDC_COMBO_BOX_HASH_ALGO), &hash_algo);
ToHyperlink (hwndDlg, IDC_LINK_HASH_INFO);
// Wizard buttons
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("NEXT"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV"));
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), TRUE);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
}
break;
case SIZE_PAGE:
{
wchar_t str[1000];
if (bHiddenVolHost)
{
StringCbCopyW (str, sizeof(str), GetString ("SIZE_HELP_HIDDEN_HOST_VOL"));
}
else
{
StringCbCopyW (str, sizeof(str), GetString (bHiddenVol ? "SIZE_HELP_HIDDEN_VOL" : "SIZE_HELP"));
}
if (bDevice && !(bHiddenVol && !bHiddenVolHost)) // If raw device but not a hidden volume
{
StringCbPrintfW (str, sizeof str, L"%s%s",
GetString ((bHiddenOS && bHiddenVol) ? "SIZE_PARTITION_HIDDEN_SYSENC_HELP" : "SIZE_PARTITION_HELP"),
(bHiddenVolHost && !bHiddenOS) ? GetString ("SIZE_PARTITION_HIDDEN_VOL_HELP") : L"");
}
SendMessage (GetDlgItem (hwndDlg, IDC_SPACE_LEFT), WM_SETFONT, (WPARAM) hBoldFont, (LPARAM) TRUE);
SendMessage (GetDlgItem (hwndDlg, IDC_SIZEBOX), EM_LIMITTEXT, 12, 0);
if(!QueryFreeSpace (hwndDlg, GetDlgItem (hwndDlg, IDC_SPACE_LEFT), TRUE, &nAvailableFreeSpace, &bIsSparseFilesSupportedByHost))
{
nUIVolumeSize=0;
nVolumeSize=0;
SetWindowTextW (GetDlgItem (hwndDlg, IDC_SIZEBOX), GetString ("UNKNOWN"));
EnableWindow (GetDlgItem (hwndDlg, IDC_SIZEBOX), FALSE);
EnableWindow (GetDlgItem (hwndDlg, IDC_KB), FALSE);
EnableWindow (GetDlgItem (hwndDlg, IDC_MB), FALSE);
EnableWindow (GetDlgItem (hwndDlg, IDC_GB), FALSE);
EnableWindow (GetDlgItem (hwndDlg, IDC_TB), FALSE);
}
else if (bDevice && !(bHiddenVol && !bHiddenVolHost)) // If raw device but not a hidden volume
{
EnableWindow (GetDlgItem (hwndDlg, IDC_SIZEBOX), FALSE);
EnableWindow (GetDlgItem (hwndDlg, IDC_KB), FALSE);
EnableWindow (GetDlgItem (hwndDlg, IDC_MB), FALSE);
EnableWindow (GetDlgItem (hwndDlg, IDC_GB), FALSE);
EnableWindow (GetDlgItem (hwndDlg, IDC_TB), FALSE);
}
else
{
EnableWindow (GetDlgItem (hwndDlg, IDC_SIZEBOX), TRUE);
EnableWindow (GetDlgItem (hwndDlg, IDC_KB), TRUE);
EnableWindow (GetDlgItem (hwndDlg, IDC_MB), TRUE);
EnableWindow (GetDlgItem (hwndDlg, IDC_GB), TRUE);
EnableWindow (GetDlgItem (hwndDlg, IDC_TB), TRUE);
}
SendMessage (GetDlgItem (hwndDlg, IDC_KB), BM_SETCHECK, BST_UNCHECKED, 0);
SendMessage (GetDlgItem (hwndDlg, IDC_MB), BM_SETCHECK, BST_UNCHECKED, 0);
SendMessage (GetDlgItem (hwndDlg, IDC_GB), BM_SETCHECK, BST_UNCHECKED, 0);
SendMessage (GetDlgItem (hwndDlg, IDC_TB), BM_SETCHECK, BST_UNCHECKED, 0);
switch (nMultiplier)
{
case BYTES_PER_KB:
SendMessage (GetDlgItem (hwndDlg, IDC_KB), BM_SETCHECK, BST_CHECKED, 0);
break;
case BYTES_PER_MB:
SendMessage (GetDlgItem (hwndDlg, IDC_MB), BM_SETCHECK, BST_CHECKED, 0);
break;
case BYTES_PER_GB:
SendMessage (GetDlgItem (hwndDlg, IDC_GB), BM_SETCHECK, BST_CHECKED, 0);
break;
case BYTES_PER_TB:
SendMessage (GetDlgItem (hwndDlg, IDC_TB), BM_SETCHECK, BST_CHECKED, 0);
break;
}
if (nUIVolumeSize != 0)
{
wchar_t szTmp[32];
StringCbPrintfW (szTmp, sizeof(szTmp), L"%I64u", nUIVolumeSize);
SetWindowText (GetDlgItem (hwndDlg, IDC_SIZEBOX), szTmp);
}
SetFocus (GetDlgItem (hwndDlg, IDC_SIZEBOX));
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), str);
if (bHiddenVol)
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString (bHiddenVolHost ? "SIZE_HIDVOL_HOST_TITLE" : "SIZE_HIDVOL_TITLE"));
else
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("SIZE_TITLE"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("NEXT"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV"));
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), TRUE);
VerifySizeAndUpdate (hwndDlg, FALSE);
}
break;
case HIDDEN_VOL_HOST_PASSWORD_PAGE:
case NONSYS_INPLACE_ENC_RESUME_PASSWORD_PAGE:
{
/* Populate the PRF algorithms list */
int nIndex, i;
HWND hComboBox = GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID);
SendMessage (hComboBox, CB_RESETCONTENT, 0, 0);
nIndex = (int) SendMessageW (hComboBox, CB_ADDSTRING, 0, (LPARAM) GetString ("AUTODETECTION"));
SendMessage (hComboBox, CB_SETITEMDATA, nIndex, (LPARAM) 0);
for (i = FIRST_PRF_ID; i <= LAST_PRF_ID; i++)
{
nIndex = (int) SendMessage (hComboBox, CB_ADDSTRING, 0, (LPARAM) get_pkcs5_prf_name(i));
SendMessage (hComboBox, CB_SETITEMDATA, nIndex, (LPARAM) i);
}
/* make autodetection the default */
SendMessage (hComboBox, CB_SETCURSEL, 0, 0);
hPasswordInputField = GetDlgItem (hwndDlg, IDC_PASSWORD_DIRECT);
hVerifyPasswordInputField = NULL;
ToNormalPwdField (hwndDlg, IDC_PASSWORD_DIRECT);
SetPassword (hwndDlg, IDC_PASSWORD_DIRECT, szRawPassword);
SetFocus (GetDlgItem (hwndDlg, IDC_PASSWORD_DIRECT));
SendMessage (GetDlgItem (hwndDlg, IDC_PIM), EM_LIMITTEXT, MAX_PIM, 0);
SetPim (hwndDlg, IDC_PIM, volumePim);
ShowWindow (GetDlgItem( hwndDlg, IDC_PIM_ENABLE), PimEnable? SW_HIDE : SW_SHOW);
ShowWindow (GetDlgItem( hwndDlg, IDT_PIM), PimEnable? SW_SHOW : SW_HIDE);
ShowWindow (GetDlgItem( hwndDlg, IDC_PIM), PimEnable? SW_SHOW : SW_HIDE);
ShowWindow (GetDlgItem( hwndDlg, IDC_PIM_HELP), PimEnable? SW_SHOW : SW_HIDE);
SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, KeyFilesEnable);
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString (bInPlaceEncNonSys ? (bInPlaceEncNonSysResumed ? "NONSYS_INPLACE_ENC_RESUME_PASSWORD_PAGE_HELP" : "NONSYS_INPLACE_DEC_PASSWORD_PAGE_HELP") : "PASSWORD_HIDDENVOL_HOST_DIRECT_HELP"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString (bInPlaceEncNonSys ? "PASSWORD" : "PASSWORD_HIDVOL_HOST_TITLE"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("NEXT"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV"));
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), !bInPlaceEncNonSys);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
}
break;
case PASSWORD_PAGE:
{
wchar_t str[1000];
- EnableWindow(GetDlgItem(hwndDlg, IDC_VERIFY), FALSE);
-
hPasswordInputField = GetDlgItem (hwndDlg, IDC_PASSWORD);
hVerifyPasswordInputField = GetDlgItem (hwndDlg, IDC_VERIFY);
ToNormalPwdField (hwndDlg, IDC_PASSWORD);
ToNormalPwdField (hwndDlg, IDC_VERIFY);
if (SysEncInEffect ())
{
ToBootPwdField (hwndDlg, IDC_PASSWORD);
ToBootPwdField (hwndDlg, IDC_VERIFY);
- StringCbPrintfW(OrigKeyboardLayout, sizeof(OrigKeyboardLayout), L"%08X", (DWORD)GetKeyboardLayout(NULL) & 0xFFFF);
+ StringCbPrintfW (OrigKeyboardLayout, sizeof(OrigKeyboardLayout), L"%08X", (DWORD) GetKeyboardLayout (NULL) & 0xFFFF);
- if ((DWORD)GetKeyboardLayout(NULL) != 0x00000409 && (DWORD)GetKeyboardLayout(NULL) != 0x04090409)
+ if ((DWORD) GetKeyboardLayout (NULL) != 0x00000409 && (DWORD) GetKeyboardLayout (NULL) != 0x04090409)
{
- DWORD keybLayout = (DWORD)LoadKeyboardLayout(L"00000409", KLF_ACTIVATE);
+ DWORD keybLayout = (DWORD) LoadKeyboardLayout (L"00000409", KLF_ACTIVATE);
if (keybLayout != 0x00000409 && keybLayout != 0x04090409)
{
- Error("CANT_CHANGE_KEYB_LAYOUT_FOR_SYS_ENCRYPTION", MainDlg);
- EndMainDlg(MainDlg);
+ Error ("CANT_CHANGE_KEYB_LAYOUT_FOR_SYS_ENCRYPTION", MainDlg);
+ EndMainDlg (MainDlg);
return 1;
}
bKeyboardLayoutChanged = TRUE;
}
+
if (SetTimer (MainDlg, TIMER_ID_KEYB_LAYOUT_GUARD, TIMER_INTERVAL_KEYB_LAYOUT_GUARD, NULL) == 0)
{
Error ("CANNOT_SET_TIMER", MainDlg);
EndMainDlg (MainDlg);
return 1;
}
-
- ShowWindow(GetDlgItem(hwndDlg, IDC_KEYFILES_ENABLE), SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_KEY_FILES), SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_PIM_ENABLE), SW_HIDE);
-
- ShowWindow(GetDlgItem(hwndDlg, IDC_ADVANCE), SW_SHOW);
- }
- else
- {
- SetCheckBox (hwndDlg, IDC_PIM_ENABLE, PimEnable);
-
- SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, KeyFilesEnable && !SysEncInEffect());
- EnableWindow (GetDlgItem (hwndDlg, IDC_KEY_FILES), KeyFilesEnable && !SysEncInEffect());
- EnableWindow (GetDlgItem (hwndDlg, IDC_KEYFILES_ENABLE), !SysEncInEffect());
}
if (bHiddenVolHost)
{
StringCbCopyW (str, sizeof(str), GetString (bHiddenOS ? "PASSWORD_SYSENC_OUTERVOL_HELP" : "PASSWORD_HIDDENVOL_HOST_HELP"));
}
else if (bHiddenVol)
{
StringCbPrintfW (str, sizeof str, L"%s%s",
GetString (bHiddenOS ? "PASSWORD_HIDDEN_OS_HELP" : "PASSWORD_HIDDENVOL_HELP"),
GetString ("PASSWORD_HELP"));
}
else
{
- StringCbCopyW (str, sizeof(str), GetString ("PASSWORD_HELP_SYSENC"));
+ StringCbCopyW (str, sizeof(str), GetString ("PASSWORD_HELP"));
}
- SetPassword(hwndDlg, IDC_PASSWORD, szRawPassword);
- SetPassword(hwndDlg, IDC_VERIFY, szVerify);
+ SetPassword (hwndDlg, IDC_PASSWORD, szRawPassword);
+ SetPassword (hwndDlg, IDC_VERIFY, szVerify);
SetFocus (GetDlgItem (hwndDlg, IDC_PASSWORD));
+ SetCheckBox (hwndDlg, IDC_PIM_ENABLE, PimEnable);
+
+ SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, KeyFilesEnable && !SysEncInEffect());
+ EnableWindow (GetDlgItem (hwndDlg, IDC_KEY_FILES), KeyFilesEnable && !SysEncInEffect());
+ EnableWindow (GetDlgItem (hwndDlg, IDC_KEYFILES_ENABLE), !SysEncInEffect());
+
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), str);
if (CreatingHiddenSysVol())
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("PASSWORD_HIDDEN_OS_TITLE"));
else if (bHiddenVol)
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString (bHiddenVolHost ? "PASSWORD_HIDVOL_HOST_TITLE" : "PASSWORD_HIDVOL_TITLE"));
else if (WizardMode == WIZARD_MODE_SYS_DEVICE)
- SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("CHOOSE_PASSWORD_TITLE"));
+ SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("PASSWORD"));
else
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("PASSWORD_TITLE"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("NEXT"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV"));
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), TRUE);
VerifyPasswordAndUpdate (hwndDlg, GetDlgItem (GetParent (hwndDlg), IDC_NEXT),
GetDlgItem (hwndDlg, IDC_PASSWORD),
GetDlgItem (hwndDlg, IDC_VERIFY),
NULL,
NULL,
KeyFilesEnable && FirstKeyFile!=NULL && !SysEncInEffect());
volumePassword.Length = (unsigned __int32) strlen ((char *) volumePassword.Text);
-
- if(SysEncInEffect ())
- {
- /* Random pool parameter is here because random page is removed */
-
- mouseEntropyGathered = 0xFFFFFFFF;
- mouseEventsInitialCount = 0;
- bUseMask = FALSE;
-
- {
- HCRYPTPROV hRngProv;
- if (CryptAcquireContext (&hRngProv, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT))
- {
- if (CryptGenRandom (hRngProv, sizeof (maskRandPool), maskRandPool))
- bUseMask = TRUE;
- CryptReleaseContext (hRngProv, 0);
- }
- }
-
- SetTimer(GetParent(hwndDlg), TIMER_ID_RANDVIEW, TIMER_INTERVAL_RANDVIEW, NULL);
- hRandPoolSys = GetDlgItem(hwndDlg, IDC_SYS_POOL_CONTENTS);
- hEntropyBar = GetDlgItem(hwndDlg, IDC_ENTROPY_BAR);
- SendMessage(hEntropyBar, PBM_SETRANGE32, 0, maxEntropyLevel);
- SendMessage(hEntropyBar, PBM_SETSTEP, 1, 0);
- SendMessage(GetDlgItem(hwndDlg, IDC_SYS_POOL_CONTENTS), WM_SETFONT, (WPARAM)hFixedDigitFont, (LPARAM)TRUE);
-
- /* set default values */
-
- hash_algo = bSystemIsGPT ? SHA512 : DEFAULT_HASH_ALGORITHM_BOOT;
- RandSetHashFunction(hash_algo);
-
- nWipeMode = TC_WIPE_NONE;
- }
}
break;
case PIM_PAGE:
{
SendMessage (GetDlgItem (hwndDlg, IDC_PIM), EM_LIMITTEXT, SysEncInEffect()? MAX_BOOT_PIM: MAX_PIM, 0);
if (volumePim > 0)
{
SetPim (hwndDlg, IDC_PIM, volumePim);
PimValueChangedWarning = TRUE;
SetDlgItemTextW (hwndDlg, IDC_PIM_HELP, GetString (SysEncInEffect ()? "PIM_SYSENC_CHANGE_WARNING" : "PIM_CHANGE_WARNING"));
}
SetFocus (GetDlgItem (hwndDlg, IDC_PIM));
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString (SysEncInEffect () && hash_algo != SHA512 && hash_algo != WHIRLPOOL? "PIM_SYSENC_HELP" : "PIM_HELP"));
ToHyperlink (hwndDlg, IDC_LINK_PIM_INFO);
if (CreatingHiddenSysVol())
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("PIM_HIDDEN_OS_TITLE"));
else if (bHiddenVol)
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString (bHiddenVolHost ? "PIM_HIDVOL_HOST_TITLE" : "PIM_HIDVOL_TITLE"));
else if (WizardMode == WIZARD_MODE_SYS_DEVICE)
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("PIM"));
else
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("PIM_TITLE"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("NEXT"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV"));
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), TRUE);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
}
break;
case FILESYS_PAGE:
{
wchar_t szTmp[8192];
Init2RadButtonPageYesNo (nNeedToStoreFilesOver4GB);
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("FILESYS_PAGE_TITLE"));
StringCbCopyW (szTmp, sizeof(szTmp), GetString ("FILESYS_PAGE_HELP_QUESTION"));
if (bHiddenVolHost)
StringCbCatW (szTmp, sizeof(szTmp), L"\n\n");
else
{
StringCbCatW (szTmp, sizeof(szTmp), L"\n\n\n");
StringCbCatW (szTmp, sizeof(szTmp), GetString ("NOTE_BEGINNING"));
}
StringCbCatW (szTmp, sizeof(szTmp), GetString ("FILESYS_PAGE_HELP_EXPLANATION"));
if (bHiddenVolHost)
{
StringCbCatW (szTmp, sizeof(szTmp), L" ");
StringCbCatW (szTmp, sizeof(szTmp), GetString ("FILESYS_PAGE_HELP_EXPLANATION_HIDVOL"));
}
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), szTmp);
}
break;
case SYSENC_COLLECTING_RANDOM_DATA_PAGE:
case NONSYS_INPLACE_ENC_RAND_DATA_PAGE:
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("COLLECTING_RANDOM_DATA_TITLE"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("NEXT"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV"));
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), TRUE);
mouseEntropyGathered = 0xFFFFFFFF;
mouseEventsInitialCount = 0;
bUseMask = FALSE;
{
HCRYPTPROV hRngProv;
if (CryptAcquireContext (&hRngProv, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT))
{
if (CryptGenRandom (hRngProv, sizeof (maskRandPool), maskRandPool))
bUseMask = TRUE;
CryptReleaseContext (hRngProv, 0);
}
}
SetTimer (GetParent (hwndDlg), TIMER_ID_RANDVIEW, TIMER_INTERVAL_RANDVIEW, NULL);
hRandPoolSys = GetDlgItem (hwndDlg, IDC_SYS_POOL_CONTENTS);
hEntropyBar = GetDlgItem (hwndDlg, IDC_ENTROPY_BAR);
SendMessage (hEntropyBar, PBM_SETRANGE32, 0, maxEntropyLevel);
SendMessage (hEntropyBar, PBM_SETSTEP, 1, 0);
SendMessage (GetDlgItem (hwndDlg, IDC_SYS_POOL_CONTENTS), WM_SETFONT, (WPARAM) hFixedDigitFont, (LPARAM) TRUE);
SendMessage (GetDlgItem (hwndDlg, IDC_DISPLAY_POOL_CONTENTS), BM_SETCHECK, showKeys ? BST_CHECKED : BST_UNCHECKED, 0);
DisplayRandPool (hwndDlg, hRandPoolSys, showKeys);
break;
case SYSENC_KEYS_GEN_PAGE:
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("KEYS_GEN_TITLE"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("NEXT"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV"));
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), TRUE);
hMasterKey = GetDlgItem (hwndDlg, IDC_DISK_KEY);
hHeaderKey = GetDlgItem (hwndDlg, IDC_HEADER_KEY);
SendMessage (GetDlgItem (hwndDlg, IDC_DISK_KEY), WM_SETFONT, (WPARAM) hFixedDigitFont, (LPARAM) TRUE);
SendMessage (GetDlgItem (hwndDlg, IDC_HEADER_KEY), WM_SETFONT, (WPARAM) hFixedDigitFont, (LPARAM) TRUE);
SendMessage (GetDlgItem (hwndDlg, IDC_DISPLAY_KEYS), BM_SETCHECK, showKeys ? BST_CHECKED : BST_UNCHECKED, 0);
DisplayPortionsOfKeys (hHeaderKey, hMasterKey, HeaderKeyGUIView, MasterKeyGUIView, !showKeys);
break;
case SYSENC_RESCUE_DISK_CREATION_PAGE:
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("RESCUE_DISK"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("NEXT"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV"));
SetWindowTextW (GetDlgItem (hwndDlg, IDT_RESCUE_DISK_INFO), bSystemIsGPT? GetString ("RESCUE_DISK_EFI_INFO"): GetString ("RESCUE_DISK_INFO"));
- SetWindowTextW(GetDlgItem(hwndDlg, IDT_RESCUE_DISK_INFO_2), GetString("RESCUE_DISK_INFO_2"));
-
SetCheckBox (hwndDlg, IDC_SKIP_RESCUE_VERIFICATION, bDontVerifyRescueDisk);
SetDlgItemText (hwndDlg, IDC_RESCUE_DISK_ISO_PATH, szRescueDiskISO);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), (GetWindowTextLength (GetDlgItem (hwndDlg, IDC_RESCUE_DISK_ISO_PATH)) > 1));
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), TRUE);
break;
case SYSENC_RESCUE_DISK_BURN_PAGE:
{
wchar_t szTmp[8192];
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString (bDontVerifyRescueDisk ? "RESCUE_DISK_CREATED_TITLE" : "RESCUE_DISK_RECORDING_TITLE"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("NEXT"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV"));
if (bSystemIsGPT)
{
StringCbPrintfW (szTmp, sizeof szTmp,
GetString (bDontVerifyRescueDisk ? "RESCUE_DISK_EFI_EXTRACT_INFO_NO_CHECK" : "RESCUE_DISK_EFI_EXTRACT_INFO"),
szRescueDiskISO, GetString ("RESCUE_DISK_EFI_EXTRACT_INFO_NOTE"));
}
else
{
StringCbPrintfW (szTmp, sizeof szTmp,
GetString (bDontVerifyRescueDisk ? "RESCUE_DISK_BURN_INFO_NO_CHECK" : "RESCUE_DISK_BURN_INFO"),
szRescueDiskISO, IsWindowsIsoBurnerAvailable() ? L"" : GetString ("RESCUE_DISK_BURN_INFO_NONWIN_ISO_BURNER"));
}
SetWindowTextW (GetDlgItem (hwndDlg, IDT_RESCUE_DISK_BURN_INFO), szTmp);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
- /* The 'Back' button is enabled but user can't go back, instead warning is provided */
- EnableWindow(GetDlgItem(GetParent(hwndDlg), IDC_PREV), TRUE);
-
+ /* The 'Back' button must be disabled now because the user could burn a Rescue Disk, then go back, and
+ generate a different master key, which would cause the Rescue Disk verification to fail (the result
+ would be confusion and bug reports). */
+ EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), FALSE);
+
+ if (bSystemIsGPT)
+ {
+ ShowWindow (GetDlgItem (hwndDlg, IDC_DOWNLOAD_CD_BURN_SOFTWARE), SW_HIDE);
+ }
+ else
+ {
+ if (IsWindowsIsoBurnerAvailable())
+ SetWindowTextW (GetDlgItem (hwndDlg, IDC_DOWNLOAD_CD_BURN_SOFTWARE), GetString ("LAUNCH_WIN_ISOBURN"));
+
+ ToHyperlink (hwndDlg, IDC_DOWNLOAD_CD_BURN_SOFTWARE);
+
+ if (IsWindowsIsoBurnerAvailable() && !bDontVerifyRescueDisk)
+ LaunchWindowsIsoBurner (hwndDlg, szRescueDiskISO);
+ }
}
break;
case SYSENC_RESCUE_DISK_VERIFIED_PAGE:
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("RESCUE_DISK_DISK_VERIFIED_TITLE"));
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString ("RESCUE_DISK_VERIFIED_INFO"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("NEXT"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV"));
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
// Rescue Disk has been verified, no need to go back
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), FALSE);
// Prevent losing the burned rescue disk by inadvertent exit
bConfirmQuit = TRUE;
break;
case SYSENC_WIPE_MODE_PAGE:
case NONSYS_INPLACE_ENC_WIPE_MODE_PAGE:
{
- if (SysEncInEffect ())
- {
- /* Wipe mode page is now checklist page */
- ShowWindow (GetDlgItem (hwndDlg, IDC_WIPE_MODE), SW_HIDE);
- ShowWindow (GetDlgItem (hwndDlg, IDT_WIPE_MODE), SW_HIDE);
- ShowWindow (GetDlgItem (hwndDlg, IDT_WIPE_MODE_INFO), SW_HIDE);
-
- SetWindowTextW (GetDlgItem (hwndDlg, IDC_REMEMBER_PASSWORD), GetString ("REMEMBER_PASSWORD"));
- SetWindowTextW (GetDlgItem (hwndDlg, IDC_STORE_RESCUE_DISK), GetString ("STORE_RESCUE_DISK"));
- SetWindowTextW (GetDlgItem (hwndDlg, IDC_BACKUP_DATA), GetString ("BACKUP_DATA"));
-
- SendMessage(GetDlgItem(hwndDlg, IDC_REMEMBER_PASSWORD), WM_SETFONT, (WPARAM)hUserBoldFont, (LPARAM)TRUE);
- SendMessage(GetDlgItem(hwndDlg, IDC_STORE_RESCUE_DISK), WM_SETFONT, (WPARAM)hUserBoldFont, (LPARAM)TRUE);
- SendMessage(GetDlgItem(hwndDlg, IDC_BACKUP_DATA), WM_SETFONT, (WPARAM)hUserBoldFont, (LPARAM)TRUE);
-
- bChecklistA = FALSE;
- bChecklistB = FALSE;
- bChecklistC = FALSE;
-
- SetWindowTextW(GetDlgItem(GetParent(hwndDlg), IDC_BOX_TITLE), GetString("CHECKLIST_TITLE"));
-
- SetDlgItemText(hwndDlg, IDC_BROWSE, GetString ("OPEN_PATH_CHECKLIST_PAGE"));
- SetWindowTextW (GetDlgItem (hwndDlg, IDT_STORE_RESCUE_DISK), GetString ("RESCUE_DISK_CHECKLIST_B"));
- SetWindowTextW (GetDlgItem (hwndDlg, IDT_REMEMBER_PASSWORD), GetString ("RESCUE_DISK_CHECKLIST_A"));
- SetWindowTextW (GetDlgItem (hwndDlg, IDT_BACKUP_DATA), GetString ("RESCUE_DISK_CHECKLIST_C"));
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMEMBER_PASSWORD), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_STORE_RESCUE_DISK), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BACKUP_DATA), TRUE);
-
- SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("NEXT"));
-
- SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV"));
- EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), TRUE);
- EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), FALSE);
- }
- else
- {
- /* Hide elements from Checklist page and show Wipe mode page */
- ShowWindow (GetDlgItem (hwndDlg, IDC_CHECKLIST_A), SW_HIDE);
- ShowWindow (GetDlgItem (hwndDlg, IDC_CHECKLIST_B), SW_HIDE);
- ShowWindow (GetDlgItem (hwndDlg, IDC_CHECKLIST_C), SW_HIDE);
- ShowWindow (GetDlgItem (hwndDlg, IDC_STORE_RESCUE_DISK), SW_HIDE);
- ShowWindow (GetDlgItem (hwndDlg, IDC_REMEMBER_PASSWORD), SW_HIDE);
- ShowWindow (GetDlgItem (hwndDlg, IDC_BACKUP_DATA), SW_HIDE);
- ShowWindow (GetDlgItem (hwndDlg, IDT_REMEMBER_PASSWORD), SW_HIDE);
- ShowWindow (GetDlgItem (hwndDlg, IDT_STORE_RESCUE_DISK), SW_HIDE);
- ShowWindow (GetDlgItem (hwndDlg, IDT_BACKUP_DATA), SW_HIDE);
- ShowWindow (GetDlgItem (hwndDlg, IDC_BROWSE), SW_HIDE);
- ShowWindow (GetDlgItem (hwndDlg, IDC_RESCUE_DISK_ISO_PATH), SW_HIDE);
-
- if (nWipeMode == TC_WIPE_1_RAND)
- nWipeMode = TC_WIPE_NONE;
-
- SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("WIPE_MODE_TITLE"));
- SetWindowTextW (GetDlgItem (hwndDlg, IDT_WIPE_MODE_INFO), GetString ("INPLACE_ENC_WIPE_MODE_INFO"));
-
- PopulateWipeModeCombo (GetDlgItem (hwndDlg, IDC_WIPE_MODE),
- SystemEncryptionStatus == SYSENC_STATUS_DECRYPTING && !bInPlaceEncNonSys,
- TRUE,
- FALSE);
+ if (nWipeMode == TC_WIPE_1_RAND)
+ nWipeMode = TC_WIPE_NONE;
- SelectAlgo (GetDlgItem (hwndDlg, IDC_WIPE_MODE), (int *) &nWipeMode);
+ SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("WIPE_MODE_TITLE"));
+ SetWindowTextW (GetDlgItem (hwndDlg, IDT_WIPE_MODE_INFO), GetString ("INPLACE_ENC_WIPE_MODE_INFO"));
- SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("NEXT"));
+ PopulateWipeModeCombo (GetDlgItem (hwndDlg, IDC_WIPE_MODE),
+ SystemEncryptionStatus == SYSENC_STATUS_DECRYPTING && !bInPlaceEncNonSys,
+ TRUE,
+ FALSE);
- SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV"));
- EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), TRUE);
- EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
- }
+ SelectAlgo (GetDlgItem (hwndDlg, IDC_WIPE_MODE), (int *) &nWipeMode);
+
+ SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("NEXT"));
+
+ SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV"));
+ EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), TRUE);
+ EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
}
break;
case SYSENC_PRETEST_INFO_PAGE:
if (bHiddenOS)
{
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("HIDDEN_OS_CREATION_PREINFO_TITLE"));
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString ("HIDDEN_OS_CREATION_PREINFO_HELP"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("START"));
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), FALSE);
}
else
{
wchar_t finalMsg[8024] = {0};
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("SYS_ENCRYPTION_PRETEST_TITLE"));
try
{
StringCbPrintfW (finalMsg, sizeof(finalMsg),
GetString ("SYS_ENCRYPTION_PRETEST_INFO"),
- GetSystemDriveLetter ());
+ BootEncObj->GetSystemDriveConfiguration().DriveNumber);
}
catch (Exception &e)
{
e.Show (hwndDlg);
EndMainDlg (MainDlg);
return 0;
}
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), finalMsg);
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("TEST"));
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), TRUE);
}
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV"));
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
break;
case SYSENC_PRETEST_RESULT_PAGE:
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("SYS_ENCRYPTION_PRETEST_RESULT_TITLE"));
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString ("SYS_ENCRYPTION_PRETEST_RESULT_INFO"));
- ShowWindow (GetDlgItem (hwndDlg, IDC_CHECKBOX_PRETEST), SW_SHOW);
- SetWindowTextW (GetDlgItem (hwndDlg, IDC_CHECKBOX_PRETEST), GetString ("PRETEST_CHECKBOX"));
-
- bCheckboxPretest = FALSE;
-
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("ENCRYPT"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDCANCEL), GetString ("DEFER"));
- EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), FALSE);
- EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), TRUE);
+ EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
+ EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), FALSE);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDCANCEL), TRUE);
- HWND hTooltip;
- hTooltip = GetDlgItem (GetParent (hwndDlg), IDC_PREV);
- if (hTooltip)
- {
- CreateToolTip (hwndDlg, hTooltip, GetString ("PRETEST_BACK_BUTTON"));
- }
- else
- {
- MessageBox (0, TEXT ("Cannot find dialog item for tooltip!"), 0, 0);
- }
-
break;
case SYSENC_ENCRYPTION_PAGE:
if (CreateSysEncMutex ())
{
try
{
BootEncStatus = BootEncObj->GetStatus();
bSystemEncryptionInProgress = BootEncStatus.SetupInProgress;
}
catch (Exception &e)
{
e.Show (hwndDlg);
Error ("ERR_GETTING_SYSTEM_ENCRYPTION_STATUS", MainDlg);
EndMainDlg (MainDlg);
return 0;
}
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE),
GetString (SystemEncryptionStatus != SYSENC_STATUS_DECRYPTING ? "ENCRYPTION" : "DECRYPTION"));
-
- SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP),
- GetString (SystemEncryptionStatus != SYSENC_STATUS_DECRYPTING ? "SYSENC_ENCRYPTION_PAGE_INFO" : "SYSENC_DECRYPTION_PAGE_INFO"));
+
+ SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString ("SYSENC_ENCRYPTION_PAGE_INFO"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDCANCEL), GetString ("DEFER"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT),
GetString (SystemEncryptionStatus != SYSENC_STATUS_DECRYPTING ? "ENCRYPT" : "DECRYPT"));
SetWindowTextW (GetDlgItem (hwndDlg, IDC_PAUSE),
GetString (bSystemEncryptionInProgress ? "IDC_PAUSE" : "RESUME"));
EnableWindow (GetDlgItem (hwndDlg, IDC_PAUSE), BootEncStatus.DriveEncrypted);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), FALSE);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), !BootEncStatus.SetupInProgress);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDCANCEL), TRUE);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDHELP), TRUE);
+ ToHyperlink (hwndDlg, IDC_MORE_INFO_SYS_ENCRYPTION);
+
if (SystemEncryptionStatus == SYSENC_STATUS_DECRYPTING)
{
nWipeMode = TC_WIPE_NONE;
EnableWindow (GetDlgItem (hwndDlg, IDC_WIPE_MODE), FALSE);
EnableWindow (GetDlgItem (hwndDlg, IDT_WIPE_MODE), FALSE);
PopulateWipeModeCombo (GetDlgItem (hwndDlg, IDC_WIPE_MODE), TRUE, TRUE, FALSE);
SelectAlgo (GetDlgItem (hwndDlg, IDC_WIPE_MODE), (int *) &nWipeMode);
}
else
{
EnableWindow (GetDlgItem (hwndDlg, IDC_WIPE_MODE), !bSystemEncryptionInProgress);
PopulateWipeModeCombo (GetDlgItem (hwndDlg, IDC_WIPE_MODE), FALSE, TRUE, FALSE);
SelectAlgo (GetDlgItem (hwndDlg, IDC_WIPE_MODE), (int *) &nWipeMode);
}
- if (nWipeMode == TC_WIPE_NONE)
- {
- ShowWindow (GetDlgItem(hwndDlg, IDC_WIPE_MODE), SW_HIDE);
- ShowWindow (GetDlgItem(hwndDlg, IDT_FORMAT_OPTIONS), SW_HIDE);
- ShowWindow (GetDlgItem(hwndDlg, IDT_WIPE_MODE), SW_HIDE);
- }
-
PostMessage (hwndDlg, TC_APPMSG_PERFORM_POST_SYSENC_WMINIT_TASKS, 0, 0);
}
else
{
Error ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", MainDlg);
EndMainDlg (MainDlg);
return 0;
}
return 0;
case NONSYS_INPLACE_ENC_RESUME_PARTITION_SEL_PAGE:
{
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("FILE_TITLE"));
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString ("NONSYS_INPLACE_ENC_RESUME_VOL_SELECT_HELP"));
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), TRUE);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), FALSE);
foreach (const HostDevice &device, DeferredNonSysInPlaceEncDevices)
{
SendMessage (GetDlgItem (hwndDlg, IDC_LIST_BOX), LB_ADDSTRING, 0, (LPARAM) device.Path.c_str());
}
// Deselect all
SendMessage (GetDlgItem (hwndDlg, IDC_LIST_BOX), LB_SETCURSEL, (WPARAM) -1, 0);
}
break;
case NONSYS_INPLACE_ENC_TRANSFORM_PAGE:
if (bInPlaceEncNonSysResumed)
{
WipeAlgorithmId savedWipeAlgorithm = TC_WIPE_NONE;
if (LoadNonSysInPlaceEncSettings (&savedWipeAlgorithm) != 0)
nWipeMode = savedWipeAlgorithm;
}
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString (bInPlaceDecNonSys ? "DECRYPTION" : "ENCRYPTION"));
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString (bInPlaceDecNonSys ? "NONSYS_INPLACE_DEC_DECRYPTION_PAGE_INFO" : "NONSYS_INPLACE_ENC_ENCRYPTION_PAGE_INFO"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDCANCEL), GetString (bInPlaceEncNonSysResumed ? "DEFER" : "CANCEL"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString (bInPlaceEncNonSysResumed ? "RESUME" : (bInPlaceDecNonSys ? "DECRYPT" : "ENCRYPT")));
SetWindowTextW (GetDlgItem (hwndDlg, IDC_PAUSE), GetString ("IDC_PAUSE"));
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), !bInPlaceEncNonSysResumed && !bInPlaceDecNonSys);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDCANCEL), TRUE);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDHELP), TRUE);
EnableWindow (GetDlgItem (hwndDlg, IDC_PAUSE), FALSE);
ShowWindow (GetDlgItem (hwndDlg, IDC_MORE_INFO_SYS_ENCRYPTION), SW_HIDE);
if (bInPlaceDecNonSys)
{
ShowWindow(GetDlgItem(hwndDlg, IDT_FORMAT_OPTIONS), SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDT_WIPE_MODE), SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_WIPE_MODE), SW_HIDE);
}
else
{
EnableWindow (GetDlgItem (hwndDlg, IDC_WIPE_MODE), TRUE);
PopulateWipeModeCombo (GetDlgItem (hwndDlg, IDC_WIPE_MODE), FALSE, TRUE, FALSE);
SelectAlgo (GetDlgItem (hwndDlg, IDC_WIPE_MODE), (int *) &nWipeMode);
}
break;
case NONSYS_INPLACE_ENC_TRANSFORM_FINISHED_PAGE:
bConfirmQuit = FALSE;
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString (bInPlaceDecNonSys ? "NONSYS_INPLACE_DEC_FINISHED_TITLE" : "NONSYS_INPLACE_ENC_FINISHED_TITLE"));
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString (bInPlaceDecNonSys ? "NONSYS_INPLACE_DEC_FINISHED_INFO" : "NONSYS_INPLACE_ENC_FINISHED_INFO"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("FINALIZE"));
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), FALSE);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDCANCEL), GetString ("EXIT"));
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDCANCEL), FALSE);
break;
case NONSYS_INPLACE_DEC_TRANSFORM_FINISHED_DRIVE_LETTER_PAGE:
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("NONSYS_INPLACE_DEC_FINISHED_TITLE"));
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString ("NONSYS_INPLACE_DEC_FINISHED_DRIVE_LETTER_SEL_INFO"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("FINALIZE"));
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), FALSE);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDCANCEL), GetString ("CANCEL"));
// The Cancel button and the X button must be disabled to prevent the user from forgetting to assign a drive letter to the partition by closing
// the window accidentally or clicking Cancel. The user is forced to click Finish to assign at least the pre-selected free drive letter.
// This is critical because inexperienced users would not know how to access data on the decrypted volume without a drive letter.
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDCANCEL), FALSE);
DisableCloseButton (MainDlg);
bConfirmQuit = TRUE; // Alt-F4 will still work but the user will be prompted to confirm the action.
// Decryption of non-system volume finished, no drive letter is assigned to the decrypted volume, and free drive letters are available.
// This is critical because inexperienced users would not know how to access data on the decrypted volume. We cannot allow exit
// until a drive letter is freed up and assigned to the decrypted volume.
while (GetFirstAvailableDrive () == -1)
{
Error ("NONSYS_INPLACE_DEC_FINISHED_NO_DRIVE_LETTER_AVAILABLE", hwndDlg);
}
// Populate the combobox with free drive letters
{
DWORD dwUsedDrives = GetUsedLogicalDrives();
wchar_t szDriveLetter[] = {L' ', L':', 0 };
int i;
for (i = 0; i < 26; i++)
{
if (!(dwUsedDrives & 1 << i))
{
// Add
szDriveLetter [0] = (wchar_t) (i + L'A');
AddComboPair (GetDlgItem (hCurPage, IDC_DRIVE_LETTER_LIST), szDriveLetter, i);
}
}
}
SendMessage (GetDlgItem (hwndDlg, IDC_DRIVE_LETTER_LIST), CB_SETCURSEL, 0, 0);
break;
case FORMAT_PAGE:
{
BOOL bNTFSallowed = FALSE;
BOOL bFATallowed = FALSE;
BOOL bEXFATallowed = FALSE;
BOOL bReFSallowed = FALSE;
BOOL bNoFSallowed = FALSE;
HCRYPTPROV hRngProv;
mouseEntropyGathered = 0xFFFFFFFF;
mouseEventsInitialCount = 0;
bUseMask = FALSE;
if (CryptAcquireContext (&hRngProv, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT))
{
if (CryptGenRandom (hRngProv, sizeof (maskRandPool), maskRandPool))
bUseMask = TRUE;
CryptReleaseContext (hRngProv, 0);
}
SetTimer (GetParent (hwndDlg), TIMER_ID_RANDVIEW, TIMER_INTERVAL_RANDVIEW, NULL);
hMasterKey = GetDlgItem (hwndDlg, IDC_DISK_KEY);
hHeaderKey = GetDlgItem (hwndDlg, IDC_HEADER_KEY);
hRandPool = GetDlgItem (hwndDlg, IDC_RANDOM_BYTES);
hEntropyBar = GetDlgItem (hwndDlg, IDC_ENTROPY_BAR);
SendMessage (hEntropyBar, PBM_SETRANGE32, 0, maxEntropyLevel);
SendMessage (hEntropyBar, PBM_SETSTEP, 1, 0);
SendMessage (GetDlgItem (hwndDlg, IDC_RANDOM_BYTES), WM_SETFONT, (WPARAM) hFixedDigitFont, (LPARAM) TRUE);
SendMessage (GetDlgItem (hwndDlg, IDC_DISK_KEY), WM_SETFONT, (WPARAM) hFixedDigitFont, (LPARAM) TRUE);
SendMessage (GetDlgItem (hwndDlg, IDC_HEADER_KEY), WM_SETFONT, (WPARAM) hFixedDigitFont, (LPARAM) TRUE);
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP),
GetString (bHiddenVolHost ? "FORMAT_HIDVOL_HOST_HELP" : "FORMAT_HELP"));
if (bHiddenVol)
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString (bHiddenVolHost ? "FORMAT_HIDVOL_HOST_TITLE" : "FORMAT_HIDVOL_TITLE"));
else
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("FORMAT_TITLE"));
/* Quick/Dynamic */
if (bHiddenVol)
{
quickFormat = !bHiddenVolHost;
dynamicFormat = FALSE;
bSparseFileSwitch = FALSE;
SetCheckBox (hwndDlg, SPARSE_FILE, FALSE);
EnableWindow (GetDlgItem (hwndDlg, SPARSE_FILE), FALSE);
SetCheckBox (hwndDlg, IDC_QUICKFORMAT, quickFormat);
EnableWindow (GetDlgItem (hwndDlg, IDC_QUICKFORMAT), bHiddenVolHost);
}
else
{
if (bDevice)
{
dynamicFormat = FALSE;
bSparseFileSwitch = FALSE;
SetCheckBox (hwndDlg, SPARSE_FILE, FALSE);
EnableWindow (GetDlgItem (hwndDlg, SPARSE_FILE), FALSE);
EnableWindow (GetDlgItem (hwndDlg, IDC_QUICKFORMAT), TRUE);
}
else
{
wchar_t root[TC_MAX_PATH];
DWORD fileSystemFlags = 0;
/* Check if the host file system supports sparse files */
if (GetVolumePathName (szFileName, root, array_capacity (root)))
{
GetVolumeInformation (root, NULL, 0, NULL, NULL, &fileSystemFlags, NULL, 0);
bSparseFileSwitch = fileSystemFlags & FILE_SUPPORTS_SPARSE_FILES;
}
else
bSparseFileSwitch = FALSE;
if (!bSparseFileSwitch)
{
dynamicFormat = FALSE;
SetCheckBox (hwndDlg, SPARSE_FILE, FALSE);
}
EnableWindow (GetDlgItem (hwndDlg, SPARSE_FILE), bSparseFileSwitch);
EnableWindow (GetDlgItem (hwndDlg, IDC_QUICKFORMAT), TRUE);
}
}
SendMessage (GetDlgItem (hwndDlg, IDC_SHOW_KEYS), BM_SETCHECK, showKeys ? BST_CHECKED : BST_UNCHECKED, 0);
SetWindowText (GetDlgItem (hwndDlg, IDC_RANDOM_BYTES), showKeys ? L"" : L"******************************** ");
SetWindowText (GetDlgItem (hwndDlg, IDC_HEADER_KEY), showKeys ? L"" : L"******************************** ");
SetWindowText (GetDlgItem (hwndDlg, IDC_DISK_KEY), showKeys ? L"" : L"******************************** ");
EnableWindow (GetDlgItem (hwndDlg, IDC_CLUSTERSIZE), TRUE);
/* Filesystems */
bNTFSallowed = FALSE;
bFATallowed = FALSE;
bNoFSallowed = FALSE;
SendMessage (GetDlgItem (hwndDlg, IDC_FILESYS), CB_RESETCONTENT, 0, 0);
EnableWindow (GetDlgItem (hwndDlg, IDC_FILESYS), TRUE);
uint64 dataAreaSize = GetVolumeDataAreaSize (bHiddenVol && !bHiddenVolHost, nVolumeSize);
if (!CreatingHiddenSysVol())
{
if (dataAreaSize >= TC_MIN_NTFS_FS_SIZE && dataAreaSize <= TC_MAX_NTFS_FS_SIZE)
{
AddComboPair (GetDlgItem (hwndDlg, IDC_FILESYS), L"NTFS", FILESYS_NTFS);
bNTFSallowed = TRUE;
}
if (dataAreaSize >= TC_MIN_FAT_FS_SIZE && dataAreaSize <= TC_MAX_FAT_SECTOR_COUNT * GetFormatSectorSize())
{
AddComboPair (GetDlgItem (hwndDlg, IDC_FILESYS), L"FAT", FILESYS_FAT);
bFATallowed = TRUE;
}
//exFAT support added starting from Vista SP1
if (IsOSVersionAtLeast (WIN_VISTA, 1) && dataAreaSize >= TC_MIN_EXFAT_FS_SIZE && dataAreaSize <= TC_MAX_EXFAT_FS_SIZE)
{
AddComboPair (GetDlgItem (hwndDlg, IDC_FILESYS), L"exFAT", FILESYS_EXFAT);
bEXFATallowed = TRUE;
}
//ReFS write support activated by default starting from Windows 10
//We don't support it yet for the creation of hidden volumes
if ((!bHiddenVolHost) && IsOSVersionAtLeast (WIN_10, 0) && dataAreaSize >= TC_MIN_REFS_FS_SIZE && dataAreaSize <= TC_MAX_REFS_FS_SIZE)
{
AddComboPair (GetDlgItem (hwndDlg, IDC_FILESYS), L"ReFS", FILESYS_REFS);
bReFSallowed = TRUE;
}
}
else
{
// We're creating a hidden volume for a hidden OS, so we don't need to format it with
// any filesystem (the entire OS will be copied to the hidden volume sector by sector).
EnableWindow (GetDlgItem (hwndDlg, IDC_FILESYS), FALSE);
EnableWindow (GetDlgItem (hwndDlg, IDC_CLUSTERSIZE), FALSE);
}
if (!bHiddenVolHost)
{
AddComboPair (GetDlgItem (hwndDlg, IDC_FILESYS), GetString ("NONE"), FILESYS_NONE);
bNoFSallowed = TRUE;
}
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
if (fileSystem == FILESYS_NONE) // If no file system has been previously selected
{
// Set default file system
if (bFATallowed && !(nNeedToStoreFilesOver4GB == 1 && (bNTFSallowed || bEXFATallowed || bReFSallowed)))
fileSystem = FILESYS_FAT;
else if (bEXFATallowed)
fileSystem = FILESYS_EXFAT;
else if (bNTFSallowed)
fileSystem = FILESYS_NTFS;
else if (bReFSallowed)
fileSystem = FILESYS_REFS;
else if (bNoFSallowed)
fileSystem = FILESYS_NONE;
else
{
AddComboPair (GetDlgItem (hwndDlg, IDC_FILESYS), L"---", 0);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), FALSE);
}
}
SendMessage (GetDlgItem (hwndDlg, IDC_FILESYS), CB_SETCURSEL, 0, 0);
SelectAlgo (GetDlgItem (hwndDlg, IDC_FILESYS), (int *) &fileSystem);
UpdateClusterSizeList (hwndDlg, fileSystem);
EnableWindow (GetDlgItem (hwndDlg, IDC_ABORT_BUTTON), FALSE);
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("FORMAT"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV"));
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), TRUE);
SetFocus (GetDlgItem (GetParent (hwndDlg), IDC_NEXT));
}
break;
case FORMAT_FINISHED_PAGE:
{
if (!bHiddenVolHost && bHiddenVol && !bHiddenVolFinished)
{
wchar_t msg[4096];
nNeedToStoreFilesOver4GB = -1;
if (bHiddenOS)
{
wchar_t szMaxRecomOuterVolFillSize[100];
__int64 maxRecomOuterVolFillSize = 0;
// Determine the maximum recommended total size of files that can be copied to the outer volume
// while leaving enough space for the hidden volume, which must contain a clone of the OS
maxRecomOuterVolFillSize = nVolumeSize - GetSystemPartitionSize();
// -50% reserve for filesystem "peculiarities"
maxRecomOuterVolFillSize /= 2;
StringCbPrintfW (szMaxRecomOuterVolFillSize, sizeof(szMaxRecomOuterVolFillSize), L"%I64d %s", maxRecomOuterVolFillSize / BYTES_PER_MB, GetString ("MB"));
StringCbPrintfW (msg, sizeof(msg), GetString ("HIDVOL_HOST_FILLING_HELP_SYSENC"), hiddenVolHostDriveNo + 'A', szMaxRecomOuterVolFillSize);
}
else
StringCbPrintfW (msg, sizeof(msg), GetString ("HIDVOL_HOST_FILLING_HELP"), hiddenVolHostDriveNo + 'A');
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), msg);
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("HIDVOL_HOST_FILLING_TITLE"));
}
else
{
if (bHiddenOS)
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString ("SYSENC_HIDDEN_VOL_FORMAT_FINISHED_HELP"));
else
{
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString (bInPlaceEncNonSys ? "NONSYS_INPLACE_ENC_FINISHED_INFO" : "FORMAT_FINISHED_HELP"));
bConfirmQuit = FALSE;
}
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString (bHiddenVol ? "HIDVOL_FORMAT_FINISHED_TITLE" : "FORMAT_FINISHED_TITLE"));
}
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("NEXT"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV"));
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), (!bHiddenVol || bHiddenVolFinished) && !bHiddenOS && !bInPlaceEncNonSys);
if ((!bHiddenVol || bHiddenVolFinished) && !bHiddenOS)
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDCANCEL), GetString ("EXIT"));
}
break;
case SYSENC_HIDDEN_OS_INITIAL_INFO_PAGE:
if (!IsHiddenOSRunning() || !bHiddenOS)
{
ReportUnexpectedState (SRC_POS);
EndMainDlg (MainDlg);
return 0;
}
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("SYSENC_HIDDEN_OS_INITIAL_INFO_TITLE"));
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString ("FIRST_HIDDEN_OS_BOOT_INFO"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("NEXT"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDCANCEL), GetString ("DEFER"));
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), FALSE);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDCANCEL), TRUE);
break;
case SYSENC_HIDDEN_OS_WIPE_INFO_PAGE:
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("SYSENC_HIDDEN_OS_WIPE_INFO_TITLE"));
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString ("SYSENC_HIDDEN_OS_WIPE_INFO"));
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), TRUE);
break;
case DEVICE_WIPE_MODE_PAGE:
if (nWipeMode == TC_WIPE_NONE)
nWipeMode = TC_WIPE_1_RAND;
if (bHiddenOS && IsHiddenOSRunning())
{
// Decoy system partition wipe
WipeAbort(); // In case the GUI previously crashed and the driver is still wiping
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDCANCEL), GetString ("CANCEL"));
}
else
{
// Regular device wipe (not decoy system partition wipe)
// Title bar
SetWindowText (MainDlg, _T(TC_APP_NAME));
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), FALSE);
}
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("WIPE_MODE_TITLE"));
SetWindowTextW (GetDlgItem (hwndDlg, IDT_WIPE_MODE_INFO), GetString ("WIPE_MODE_INFO"));
PopulateWipeModeCombo (GetDlgItem (hwndDlg, IDC_WIPE_MODE), FALSE, FALSE, TRUE);
SelectAlgo (GetDlgItem (hwndDlg, IDC_WIPE_MODE), (int *) &nWipeMode);
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("NEXT"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV"));
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDCANCEL), TRUE);
break;
case DEVICE_WIPE_PAGE:
if (bHiddenOS && IsHiddenOSRunning())
{
// Decoy system partition wipe
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString ("DEVICE_WIPE_PAGE_INFO_HIDDEN_OS"));
}
else
{
// Regular device wipe (not decoy system partition wipe)
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString ("DEVICE_WIPE_PAGE_INFO"));
}
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("DEVICE_WIPE_PAGE_TITLE"));
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("WIPE"));
SetWindowTextW (GetDlgItem (hCurPage, IDC_WIPE_MODE), (wstring (L" ") + GetWipeModeName (nWipeMode)).c_str());
EnableWindow (GetDlgItem (hwndDlg, IDC_ABORT_BUTTON), FALSE);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), TRUE);
break;
}
return 0;
case WM_HELP:
OpenPageHelp (GetParent (hwndDlg), nCurPageNo);
return 1;
case TC_APPMSG_PERFORM_POST_SYSENC_WMINIT_TASKS:
AfterSysEncProgressWMInitTasks (hwndDlg);
return 1;
case WM_CTLCOLORSTATIC:
{
- if ((HWND)lParam == GetDlgItem (hwndDlg, PASSWORD_METER) && iPasswordStrength == 1)
- {
- // we're about to draw the static
- // set the text colour in (HDC)lParam
- SetBkMode ((HDC)wParam, TRANSPARENT);
- SetTextColor ((HDC)wParam, RGB(255, 0, 0)); // password weak red
- return (BOOL)GetSysColorBrush(COLOR_MENU);
- }
-
- if ((HWND)lParam == GetDlgItem (hwndDlg, PASSWORD_METER) && iPasswordStrength == 2)
- {
- // we're about to draw the static
- // set the text colour in (HDC)lParam
- SetBkMode ((HDC)wParam, TRANSPARENT);
- SetTextColor ((HDC)wParam, RGB (255, 165, 0)); // password medium orange
- return (BOOL) GetSysColorBrush (COLOR_MENU);
- }
-
- if ((HWND)lParam == GetDlgItem (hwndDlg, PASSWORD_METER) && iPasswordStrength == 3)
- {
- SetBkMode ((HDC)wParam, TRANSPARENT);
- SetTextColor ((HDC)wParam, RGB (218, 218, 0)); // password strong yellow
- return (BOOL) GetSysColorBrush (COLOR_MENU);
- }
-
- if ((HWND)lParam == GetDlgItem (hwndDlg, PASSWORD_METER) && iPasswordStrength == 4)
- {
- SetBkMode((HDC)wParam, TRANSPARENT);
- SetTextColor((HDC)wParam, RGB(50, 205, 50)); // password very strong green
- return (BOOL) GetSysColorBrush (COLOR_MENU);
- }
-
if (PimValueChangedWarning && ((HWND)lParam == GetDlgItem(hwndDlg, IDC_PIM_HELP)) )
{
// we're about to draw the static
// set the text colour in (HDC)lParam
SetBkMode((HDC)wParam,TRANSPARENT);
SetTextColor((HDC)wParam, RGB(255,0,0));
// NOTE: per documentation as pointed out by selbie, GetSolidBrush would leak a GDI handle.
return (BOOL)GetSysColorBrush(COLOR_MENU);
}
}
return 0;
case WM_COMMAND:
if (nCurPageNo == INTRO_PAGE)
{
switch (lw)
{
case IDC_FILE_CONTAINER:
UpdateWizardModeControls (hwndDlg, WIZARD_MODE_FILE_CONTAINER);
return 1;
case IDC_NONSYS_DEVICE:
UpdateWizardModeControls (hwndDlg, WIZARD_MODE_NONSYS_DEVICE);
return 1;
case IDC_SYS_DEVICE:
UpdateWizardModeControls (hwndDlg, WIZARD_MODE_SYS_DEVICE);
return 1;
case IDC_MORE_INFO_ON_CONTAINERS:
Applink ("introcontainer");
return 1;
case IDC_MORE_INFO_ON_SYS_ENCRYPTION:
Applink ("introsysenc");
return 1;
}
}
if (nCurPageNo == SYSENC_TYPE_PAGE)
{
switch (lw)
{
case IDC_SYSENC_HIDDEN:
bHiddenOS = TRUE;
bHiddenVol = TRUE;
bHiddenVolHost = TRUE;
return 1;
case IDC_SYSENC_NORMAL:
bHiddenOS = FALSE;
bHiddenVol = FALSE;
bHiddenVolHost = FALSE;
return 1;
case IDC_HIDDEN_SYSENC_INFO_LINK:
Applink ("hiddensysenc");
return 1;
}
}
- if (lw == IDC_ADVANCE_INTRO && nCurPageNo == SYSENC_TYPE_PAGE)
- {
- DialogBoxParamW(hInst,
- MAKEINTRESOURCEW(IDD_ADVANCE_MBR), hwndDlg,
- (DLGPROC)AdvanceDlgProcIntro, NULL);
- return 1;
- }
-
- if (lw == IDC_ADVANCE && nCurPageNo == PASSWORD_PAGE)
- {
- DialogBoxParamW(hInst,
- MAKEINTRESOURCEW(IDD_ADVANCE), hwndDlg,
- (DLGPROC)AdvanceDlgProc, NULL);
- return 1;
- }
-
if (nCurPageNo == SYSENC_HIDDEN_OS_REQ_CHECK_PAGE && lw == IDC_HIDDEN_SYSENC_INFO_LINK)
{
Applink ("hiddensysenc");
return 1;
}
if (nCurPageNo == SYSENC_SPAN_PAGE)
{
switch (lw)
{
case IDC_WHOLE_SYS_DRIVE:
bWholeSysDrive = TRUE;
return 1;
case IDC_SYS_PARTITION:
bWholeSysDrive = FALSE;
return 1;
}
}
if (nCurPageNo == SYSENC_MULTI_BOOT_MODE_PAGE)
{
switch (lw)
{
case IDC_SINGLE_BOOT:
nMultiBoot = 1;
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
return 1;
case IDC_MULTI_BOOT:
nMultiBoot = 2;
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
return 1;
}
}
// Dual choice pages
switch (nCurPageNo)
{
case SYSENC_MULTI_BOOT_SYS_EQ_BOOT_PAGE:
case SYSENC_MULTI_BOOT_NBR_SYS_DRIVES_PAGE:
case SYSENC_MULTI_BOOT_ADJACENT_SYS_PAGE:
case SYSENC_MULTI_BOOT_NONWIN_BOOT_LOADER_PAGE:
case SYSENC_PRE_DRIVE_ANALYSIS_PAGE:
if (lw == IDC_CHOICE1 || lw == IDC_CHOICE2)
{
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
return 1;
}
break;
}
if (nCurPageNo == FILESYS_PAGE && (lw == IDC_CHOICE1 || lw == IDC_CHOICE2))
{
if (bWarnOuterVolSuitableFileSys && lw == IDC_CHOICE1 && bHiddenVolHost)
{
wchar_t szTmp [4096];
bWarnOuterVolSuitableFileSys = FALSE; // Do not show this warning anymore (this also prevents potential endless repetition due to some race conditions)
StringCbCopyW (szTmp, sizeof(szTmp), GetString ("FILESYS_PAGE_HELP_EXPLANATION_HIDVOL"));
StringCbCatW (szTmp, sizeof(szTmp), L"\n\n");
StringCbCatW (szTmp, sizeof(szTmp), GetString ("FILESYS_PAGE_HELP_EXPLANATION_HIDVOL_CONFIRM"));
if (MessageBoxW (MainDlg, szTmp, lpszTitle, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2) == IDNO)
{
nNeedToStoreFilesOver4GB = 0;
Init2RadButtonPageYesNo (nNeedToStoreFilesOver4GB);
}
}
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
return 1;
}
if (lw == IDC_HIDDEN_VOL && nCurPageNo == VOLUME_TYPE_PAGE)
{
bHiddenVol = TRUE;
bHiddenVolHost = TRUE;
bInPlaceEncNonSys = FALSE;
return 1;
}
if (lw == IDC_STD_VOL && nCurPageNo == VOLUME_TYPE_PAGE)
{
bHiddenVol = FALSE;
bHiddenVolHost = FALSE;
return 1;
}
if (nCurPageNo == SYSENC_ENCRYPTION_PAGE)
{
BootEncryptionStatus locBootEncStatus;
switch (lw)
{
case IDC_PAUSE:
try
{
locBootEncStatus = BootEncObj->GetStatus();
if (locBootEncStatus.SetupInProgress)
SysEncPause ();
else
SysEncResume ();
}
catch (Exception &e)
{
e.Show (hwndDlg);
}
return 1;
case IDC_WIPE_MODE:
if (hw == CBN_SELCHANGE)
{
nWipeMode = (WipeAlgorithmId) SendMessage (GetDlgItem (hCurPage, IDC_WIPE_MODE),
CB_GETITEMDATA,
SendMessage (GetDlgItem (hCurPage, IDC_WIPE_MODE), CB_GETCURSEL, 0, 0),
0);
return 1;
}
break;
case IDC_MORE_INFO_SYS_ENCRYPTION:
Applink ("sysencprogressinfo");
return 1;
}
}
if (bInPlaceEncNonSys)
{
switch (nCurPageNo)
{
case NONSYS_INPLACE_ENC_RESUME_PARTITION_SEL_PAGE:
if (lw == IDC_LIST_BOX
&& (hw == LBN_SELCHANGE || hw == LBN_DBLCLK))
{
BOOL tmpbDevice = FALSE;
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), FALSE);
int selPartitionItemId = (int) SendMessage (GetDlgItem (hwndDlg, IDC_LIST_BOX), LB_GETCURSEL, 0, 0);
if (selPartitionItemId == LB_ERR)
{
// Deselect all
SendMessage (GetDlgItem (hwndDlg, IDC_LIST_BOX), LB_SETCURSEL, (WPARAM) -1, 0);
SetFocus (GetDlgItem (MainDlg, IDC_NEXT));
return 1;
}
SetFocus (GetDlgItem (MainDlg, IDC_NEXT));
StringCbCopyW (szFileName, sizeof(szFileName), DeferredNonSysInPlaceEncDevices [selPartitionItemId].Path.c_str());
CreateFullVolumePath (szDiskFile, sizeof(szDiskFile), szFileName, &tmpbDevice);
nVolumeSize = GetDeviceSize (szDiskFile);
if (nVolumeSize == -1)
{
handleWin32Error (MainDlg, SRC_POS);
return 1;
}
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
return 1;
}
break;
case NONSYS_INPLACE_ENC_TRANSFORM_PAGE:
{
switch (lw)
{
case IDC_PAUSE:
// Pause/resume non-system in-place encryption
if (bVolTransformThreadRunning || bVolTransformThreadToRun)
{
EnableWindow (GetDlgItem (hCurPage, IDC_PAUSE), FALSE);
NonSysInplaceEncPause ();
}
else
NonSysInplaceEncResume ();
return 1;
case IDC_WIPE_MODE:
if (hw == CBN_SELCHANGE)
{
nWipeMode = (WipeAlgorithmId) SendMessage (GetDlgItem (hCurPage, IDC_WIPE_MODE),
CB_GETITEMDATA,
SendMessage (GetDlgItem (hCurPage, IDC_WIPE_MODE), CB_GETCURSEL, 0, 0),
0);
return 1;
}
break;
}
}
break;
}
}
if (lw == IDC_OPEN_OUTER_VOLUME && nCurPageNo == FORMAT_FINISHED_PAGE)
{
OpenVolumeExplorerWindow (hiddenVolHostDriveNo);
return 1;
}
if (lw == IDC_HIDDEN_VOL_HELP && nCurPageNo == VOLUME_TYPE_PAGE)
{
Applink ("hiddenvolume");
return 1;
}
if (lw == IDC_ABORT_BUTTON && nCurPageNo == FORMAT_PAGE)
{
if (MessageBoxW (hwndDlg, GetString ("FORMAT_ABORT"), lpszTitle, MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2 ) == IDYES)
bVolTransformThreadCancel = TRUE;
return 1;
}
if (lw == IDC_CIPHER_TEST && nCurPageNo == CIPHER_PAGE)
{
LPARAM nIndex;
int c;
nIndex = SendMessage (GetDlgItem (hCurPage, IDC_COMBO_BOX), CB_GETCURSEL, 0, 0);
nVolumeEA = (int) SendMessage (GetDlgItem (hCurPage, IDC_COMBO_BOX), CB_GETITEMDATA, nIndex, 0);
for (c = EAGetLastCipher (nVolumeEA); c != 0; c = EAGetPreviousCipher (nVolumeEA, c))
{
DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_CIPHER_TEST_DLG),
GetParent (hwndDlg), (DLGPROC) CipherTestDialogProc, (LPARAM) c);
}
return 1;
}
if (lw == IDC_BENCHMARK && nCurPageNo == CIPHER_PAGE)
{
// Reduce CPU load
bFastPollEnabled = FALSE;
bRandmixEnabled = FALSE;
DialogBoxParamW (hInst,
MAKEINTRESOURCEW (IDD_BENCHMARK_DLG), hwndDlg,
(DLGPROC) BenchmarkDlgProc, (LPARAM) bSystemIsGPT);
bFastPollEnabled = TRUE;
bRandmixEnabled = TRUE;
return 1;
}
if (lw == IDC_LINK_MORE_INFO_ABOUT_CIPHER && nCurPageNo == CIPHER_PAGE)
{
wchar_t name[100];
int nIndex = (int) SendMessage (GetDlgItem (hCurPage, IDC_COMBO_BOX), CB_GETCURSEL, 0, 0);
nIndex = (int) SendMessage (GetDlgItem (hCurPage, IDC_COMBO_BOX), CB_GETITEMDATA, nIndex, 0);
EAGetName (name, ARRAYSIZE(name),nIndex, 0);
if (wcscmp (name, L"AES") == 0)
Applink ("aes");
else if (wcscmp (name, L"Serpent") == 0)
Applink ("serpent");
else if (wcscmp (name, L"Twofish") == 0)
Applink ("twofish");
else if (wcscmp (name, L"Kuznyechik") == 0)
Applink ("kuznyechik");
else if (wcscmp (name, L"Camellia") == 0)
Applink ("camellia");
else if (EAGetCipherCount (nIndex) > 1)
Applink ("cascades");
return 1;
}
if (lw == IDC_LINK_HASH_INFO && nCurPageNo == CIPHER_PAGE)
{
Applink ("hashalgorithms");
return 1;
}
if (lw == IDC_LINK_PIM_INFO && nCurPageNo == PIM_PAGE)
{
Applink ("pim");
return 1;
}
if (hw == CBN_EDITCHANGE && nCurPageNo == VOLUME_LOCATION_PAGE)
{
BOOL bValidEntry = (GetWindowTextLength (GetDlgItem (hCurPage, IDC_COMBO_BOX)) > 0)? TRUE : FALSE;
if (bValidEntry && !bDevice)
{
/* check that the entered path is not for an existing directory */
WCHAR szEnteredFilePath[TC_MAX_PATH + 1] = {0};
GetWindowTextW (GetDlgItem (hCurPage, IDC_COMBO_BOX), szEnteredFilePath, ARRAYSIZE (szEnteredFilePath));
RelativePath2Absolute (szEnteredFilePath);
DWORD dwAttr = GetFileAttributes (szEnteredFilePath);
if ((dwAttr != INVALID_FILE_ATTRIBUTES) && (dwAttr & FILE_ATTRIBUTE_DIRECTORY))
{
/* this is a directory. Consider it as invalid */
bValidEntry = FALSE;
}
}
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT),
bValidEntry);
bDeviceTransformModeChoiceMade = FALSE;
bInPlaceEncNonSys = FALSE;
return 1;
}
if (hw == CBN_SELCHANGE && nCurPageNo == VOLUME_LOCATION_PAGE)
{
LPARAM nIndex;
nIndex = MoveEditToCombo ((HWND) lParam, bHistory);
nIndex = UpdateComboOrder (GetDlgItem (hwndDlg, IDC_COMBO_BOX));
if (nIndex != CB_ERR)
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
else
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), FALSE);
bDeviceTransformModeChoiceMade = FALSE;
bInPlaceEncNonSys = FALSE;
return 1;
}
if (hw == EN_CHANGE && nCurPageNo == SIZE_PAGE)
{
VerifySizeAndUpdate (hwndDlg, FALSE);
return 1;
}
if (hw == EN_CHANGE && nCurPageNo == PASSWORD_PAGE)
{
- // If 'Next' button was clicked (and keyboard layout is not US), don't verify
- if (!bNextButtonClicked)
- {
- VerifyPasswordAndUpdate (hwndDlg, GetDlgItem (GetParent (hwndDlg), IDC_NEXT),
- GetDlgItem(hCurPage, IDC_PASSWORD),
- GetDlgItem(hCurPage, IDC_VERIFY),
- NULL,
- NULL,
- KeyFilesEnable && FirstKeyFile != NULL && !SysEncInEffect());
-
- bNextButtonClicked = FALSE;
- }
-
+ VerifyPasswordAndUpdate (hwndDlg, GetDlgItem (GetParent (hwndDlg), IDC_NEXT),
+ GetDlgItem (hwndDlg, IDC_PASSWORD),
+ GetDlgItem (hwndDlg, IDC_VERIFY),
+ NULL,
+ NULL,
+ KeyFilesEnable && FirstKeyFile!=NULL && !SysEncInEffect());
volumePassword.Length = (unsigned __int32) strlen ((char *) volumePassword.Text);
-
- SendMessage (GetDlgItem (hwndDlg, PASSWORD_METER), WM_SETFONT, (WPARAM)hUserBoldFont, (LPARAM)TRUE);
-
- memset (&tempPassword[0], 0, sizeof (tempPassword));
-
- if (GetPassword (hCurPage, IDC_PASSWORD, tempPassword, iMaxPasswordLength + 1, FALSE, TRUE))
- iPasswordStrength = PrintStrongness (tempPassword, strlen (tempPassword));
- else
- Error ("ERROR_GETTING_PWD", hwndDlg);
-
- burn (tempPassword, sizeof (tempPassword));
- if (iPasswordStrength == very_strong)
- {
- SetWindowTextW (GetDlgItem (hwndDlg, PASSWORD_METER), GetString ("VERY_STRONG_PASSWORD"));
- EnableWindow (GetDlgItem (hwndDlg, IDC_VERIFY), TRUE);
- }
- else if (iPasswordStrength == strong)
- {
- SetWindowTextW (GetDlgItem (hwndDlg, PASSWORD_METER), GetString ("STRONG_PASSWORD"));
- EnableWindow (GetDlgItem (hwndDlg, IDC_VERIFY), TRUE);
- }
- else if (iPasswordStrength == medium)
- {
- EnableWindow (GetDlgItem (hwndDlg, IDC_VERIFY), TRUE);
- SetWindowTextW (GetDlgItem (hwndDlg, PASSWORD_METER), GetString ("MEDIUM_PASSWORD"));
- }
- else if (iPasswordStrength == weak)
- {
- EnableWindow (GetDlgItem (hwndDlg, IDC_VERIFY), FALSE);
- SetWindowTextW (GetDlgItem (hwndDlg, PASSWORD_METER), GetString ("WEAK_PASSWORD"));
- }
- else
- {
- SetWindowTextW (GetDlgItem (hwndDlg, PASSWORD_METER), GetString ("VERY_WEAK_PASSWORD"));
- }
return 1;
}
if (hw == EN_CHANGE && nCurPageNo == PIM_PAGE)
{
if (lw == IDC_PIM)
{
if(GetPim (hwndDlg, IDC_PIM, 0) != 0)
{
PimValueChangedWarning = TRUE;
SetDlgItemTextW (hwndDlg, IDC_PIM_HELP, GetString (SysEncInEffect ()? "PIM_SYSENC_CHANGE_WARNING" : "PIM_CHANGE_WARNING"));
}
else
{
PimValueChangedWarning = FALSE;
SetDlgItemTextW (hwndDlg, IDC_PIM_HELP, (wchar_t *) GetDictionaryValueByInt (IDC_PIM_HELP));
}
}
return 1;
}
if (lw == IDC_SHOW_PASSWORD && nCurPageNo == PASSWORD_PAGE)
{
HandleShowPasswordFieldAction (hwndDlg, IDC_SHOW_PASSWORD, IDC_PASSWORD, IDC_VERIFY);
return 1;
}
if (lw == IDC_SHOW_PIM && nCurPageNo == PIM_PAGE)
{
HandleShowPasswordFieldAction (hwndDlg, IDC_SHOW_PIM, IDC_PIM, 0);
return 1;
}
- if (lw == IDC_CHECKLIST_A)
- {
- bChecklistA = GetCheckBox (hwndDlg, IDC_CHECKLIST_A);
- bChecklistB = GetCheckBox (hwndDlg, IDC_CHECKLIST_B);
- bChecklistC = GetCheckBox (hwndDlg, IDC_CHECKLIST_C);
- }
-
- if (lw == IDC_CHECKLIST_B)
- {
- bChecklistA = GetCheckBox (hwndDlg, IDC_CHECKLIST_A);
- bChecklistB = GetCheckBox (hwndDlg, IDC_CHECKLIST_B);
- bChecklistC = GetCheckBox (hwndDlg, IDC_CHECKLIST_C);
- }
-
- if (lw == IDC_CHECKLIST_C)
- {
- bChecklistA = GetCheckBox (hwndDlg, IDC_CHECKLIST_A);
- bChecklistB = GetCheckBox (hwndDlg, IDC_CHECKLIST_B);
- bChecklistC = GetCheckBox (hwndDlg, IDC_CHECKLIST_C);
- }
-
- if (lw == IDC_CHECKBOX_PRETEST)
- {
- bCheckboxPretest = GetCheckBox (hwndDlg, IDC_CHECKBOX_PRETEST);
- }
-
if (lw == IDC_PIM_ENABLE)
{
PimEnable = GetCheckBox (hwndDlg, IDC_PIM_ENABLE);
if (!PimEnable)
volumePim = 0;
if (nCurPageNo == HIDDEN_VOL_HOST_PASSWORD_PAGE
|| nCurPageNo == NONSYS_INPLACE_ENC_RESUME_PASSWORD_PAGE
)
{
ShowWindow (GetDlgItem( hwndDlg, IDC_PIM_ENABLE), PimEnable? SW_HIDE : SW_SHOW);
ShowWindow (GetDlgItem( hwndDlg, IDT_PIM), PimEnable? SW_SHOW : SW_HIDE);
ShowWindow (GetDlgItem( hwndDlg, IDC_PIM), PimEnable? SW_SHOW : SW_HIDE);
ShowWindow (GetDlgItem( hwndDlg, IDC_PIM_HELP), PimEnable? SW_SHOW : SW_HIDE);
if (PimEnable)
{
SetFocus (GetDlgItem (hwndDlg, IDC_PIM));
}
}
return 1;
}
if (nCurPageNo == PASSWORD_PAGE
|| nCurPageNo == HIDDEN_VOL_HOST_PASSWORD_PAGE
|| nCurPageNo == NONSYS_INPLACE_ENC_RESUME_PASSWORD_PAGE)
{
if (lw == IDC_KEY_FILES)
{
if (SysEncInEffect())
{
Warning ("KEYFILES_NOT_SUPPORTED_FOR_SYS_ENCRYPTION", MainDlg);
return 1;
}
KeyFilesDlgParam param;
param.EnableKeyFiles = KeyFilesEnable;
param.FirstKeyFile = FirstKeyFile;
if (IDOK == DialogBoxParamW (hInst,
MAKEINTRESOURCEW (IDD_KEYFILES), hwndDlg,
(DLGPROC) KeyFilesDlgProc, (LPARAM) &param))
{
KeyFilesEnable = param.EnableKeyFiles;
FirstKeyFile = param.FirstKeyFile;
SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, KeyFilesEnable);
if (nCurPageNo != HIDDEN_VOL_HOST_PASSWORD_PAGE && nCurPageNo != NONSYS_INPLACE_ENC_RESUME_PASSWORD_PAGE)
EnableWindow (GetDlgItem (hwndDlg, IDC_KEY_FILES), KeyFilesEnable);
if (nCurPageNo != HIDDEN_VOL_HOST_PASSWORD_PAGE && nCurPageNo != NONSYS_INPLACE_ENC_RESUME_PASSWORD_PAGE)
{
VerifyPasswordAndUpdate (hwndDlg, GetDlgItem (GetParent (hwndDlg), IDC_NEXT),
GetDlgItem (hCurPage, IDC_PASSWORD),
GetDlgItem (hCurPage, IDC_VERIFY),
volumePassword.Text, szVerify, KeyFilesEnable && FirstKeyFile!=NULL);
}
}
return 1;
}
if (lw == IDC_KEYFILES_ENABLE)
{
KeyFilesEnable = GetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE);
if (nCurPageNo != HIDDEN_VOL_HOST_PASSWORD_PAGE && nCurPageNo != NONSYS_INPLACE_ENC_RESUME_PASSWORD_PAGE)
{
EnableWindow (GetDlgItem (hwndDlg, IDC_KEY_FILES), KeyFilesEnable);
VerifyPasswordAndUpdate (hwndDlg, GetDlgItem (GetParent (hwndDlg), IDC_NEXT),
GetDlgItem (hCurPage, IDC_PASSWORD),
GetDlgItem (hCurPage, IDC_VERIFY),
volumePassword.Text, szVerify, KeyFilesEnable && FirstKeyFile!=NULL);
}
return 1;
}
}
if (nCurPageNo == HIDDEN_VOL_HOST_PASSWORD_PAGE
|| nCurPageNo == NONSYS_INPLACE_ENC_RESUME_PASSWORD_PAGE)
{
if (hw == EN_CHANGE)
{
GetPassword (hCurPage, IDC_PASSWORD_DIRECT, (char*) volumePassword.Text, iMaxPasswordLength + 1, FALSE, FALSE);
volumePassword.Length = (unsigned __int32) strlen ((char *) volumePassword.Text);
return 1;
}
if (lw == IDC_SHOW_PASSWORD_SINGLE)
{
HandleShowPasswordFieldAction (hwndDlg, IDC_SHOW_PASSWORD_SINGLE, IDC_PASSWORD_DIRECT, IDC_PIM);
return 1;
}
}
if ((lw == IDC_KB || lw == IDC_MB || lw == IDC_GB || lw == IDC_TB) && nCurPageNo == SIZE_PAGE)
{
SendMessage (GetDlgItem (hwndDlg, IDC_KB), BM_SETCHECK, BST_UNCHECKED, 0);
SendMessage (GetDlgItem (hwndDlg, IDC_MB), BM_SETCHECK, BST_UNCHECKED, 0);
SendMessage (GetDlgItem (hwndDlg, IDC_GB), BM_SETCHECK, BST_UNCHECKED, 0);
SendMessage (GetDlgItem (hwndDlg, IDC_TB), BM_SETCHECK, BST_UNCHECKED, 0);
switch (lw)
{
case IDC_KB:
SendMessage (GetDlgItem (hwndDlg, IDC_KB), BM_SETCHECK, BST_CHECKED, 0);
break;
case IDC_MB:
SendMessage (GetDlgItem (hwndDlg, IDC_MB), BM_SETCHECK, BST_CHECKED, 0);
break;
case IDC_GB:
SendMessage (GetDlgItem (hwndDlg, IDC_GB), BM_SETCHECK, BST_CHECKED, 0);
break;
case IDC_TB:
SendMessage (GetDlgItem (hwndDlg, IDC_TB), BM_SETCHECK, BST_CHECKED, 0);
break;
}
VerifySizeAndUpdate (hwndDlg, FALSE);
return 1;
}
if (lw == IDC_HIDVOL_WIZ_MODE_DIRECT && nCurPageNo == HIDDEN_VOL_WIZARD_MODE_PAGE)
{
bHiddenVolDirect = TRUE;
return 1;
}
if (lw == IDC_HIDVOL_WIZ_MODE_FULL && nCurPageNo == HIDDEN_VOL_WIZARD_MODE_PAGE)
{
bHiddenVolDirect = FALSE;
return 1;
}
if (lw == IDC_SELECT_VOLUME_LOCATION && nCurPageNo == VOLUME_LOCATION_PAGE)
{
if (!bDevice)
{
// Select file
if (BrowseFiles (hwndDlg, "OPEN_TITLE", szFileName, bHistory, !bHiddenVolDirect, NULL) == FALSE)
return 1;
AddComboItem (GetDlgItem (hwndDlg, IDC_COMBO_BOX), szFileName, bHistory);
EnableDisableFileNext (GetDlgItem (hwndDlg, IDC_COMBO_BOX),
GetDlgItem (GetParent (hwndDlg), IDC_NEXT));
return 1;
}
else
{
// Select device
RawDevicesDlgParam param;
param.pszFileName = szFileName;
INT_PTR nResult = DialogBoxParamW (hInst,
MAKEINTRESOURCEW (IDD_RAWDEVICES_DLG), GetParent (hwndDlg),
(DLGPROC) RawDevicesDlgProc, (LPARAM) & param);
// Check administrator privileges
if (!wcsstr (szFileName, L"Floppy") && !IsAdmin() && !IsUacSupported ())
MessageBoxW (hwndDlg, GetString ("ADMIN_PRIVILEGES_WARN_DEVICES"), lpszTitle, MB_OK|MB_ICONWARNING);
if (nResult == IDOK && wcslen (szFileName) > 0)
{
AddComboItem (GetDlgItem (hwndDlg, IDC_COMBO_BOX), szFileName, bHistory);
EnableDisableFileNext (GetDlgItem (hwndDlg, IDC_COMBO_BOX),
GetDlgItem (GetParent (hwndDlg), IDC_NEXT));
bDeviceTransformModeChoiceMade = FALSE;
bInPlaceEncNonSys = FALSE;
}
return 1;
}
}
if (nCurPageNo == DEVICE_TRANSFORM_MODE_PAGE)
{
switch (lw)
{
case IDC_DEVICE_TRANSFORM_MODE_FORMAT:
bInPlaceEncNonSys = FALSE;
bDeviceTransformModeChoiceMade = TRUE;
return 1;
case IDC_DEVICE_TRANSFORM_MODE_INPLACE:
bInPlaceEncNonSys = TRUE;
bDeviceTransformModeChoiceMade = TRUE;
bHiddenVol = FALSE;
bHiddenVolDirect = FALSE;
bHiddenVolHost = FALSE;
bSparseFileSwitch = FALSE;
quickFormat = FALSE;
dynamicFormat = FALSE;
return 1;
}
}
if (lw == IDC_HIDVOL_WIZ_MODE_FULL && nCurPageNo == HIDDEN_VOL_WIZARD_MODE_PAGE)
{
bHiddenVolDirect = FALSE;
return 1;
}
if (hw == CBN_SELCHANGE && nCurPageNo == CIPHER_PAGE)
{
switch (lw)
{
case IDC_COMBO_BOX:
ComboSelChangeEA (hwndDlg);
break;
case IDC_COMBO_BOX_HASH_ALGO:
if (SysEncInEffect ())
{
HWND hHashAlgoItem = GetDlgItem (hwndDlg, IDC_COMBO_BOX_HASH_ALGO);
int selectedAlgo = (int) SendMessage (hHashAlgoItem, CB_GETITEMDATA, SendMessage (hHashAlgoItem, CB_GETCURSEL, 0, 0), 0);
if (!bSystemIsGPT && !HashForSystemEncryption(selectedAlgo))
{
hash_algo = DEFAULT_HASH_ALGORITHM_BOOT;
RandSetHashFunction (DEFAULT_HASH_ALGORITHM_BOOT);
Info ("ALGO_NOT_SUPPORTED_FOR_SYS_ENCRYPTION", MainDlg);
SelectAlgo (GetDlgItem (hwndDlg, IDC_COMBO_BOX_HASH_ALGO), &hash_algo);
}
}
break;
}
return 1;
}
if (lw == IDC_QUICKFORMAT)
{
if (IsButtonChecked (GetDlgItem (hCurPage, IDC_QUICKFORMAT)))
{
if (AskWarnYesNo("WARN_QUICK_FORMAT", MainDlg) == IDNO)
SetCheckBox (hwndDlg, IDC_QUICKFORMAT, FALSE);
}
else if (IsButtonChecked (GetDlgItem (hCurPage, SPARSE_FILE)))
{
/* sparse file require quick format */
SetCheckBox (hwndDlg, SPARSE_FILE, FALSE);
}
return 1;
}
if (lw == SPARSE_FILE && IsButtonChecked (GetDlgItem (hCurPage, 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)))
{
/* sparse file require quick format */
SetCheckBox (hwndDlg, IDC_QUICKFORMAT, TRUE);
}
return 1;
}
if (lw == IDC_FILESYS && hw == CBN_SELCHANGE)
{
fileSystem = (int) SendMessage (GetDlgItem (hCurPage, IDC_FILESYS), CB_GETITEMDATA,
SendMessage (GetDlgItem (hCurPage, IDC_FILESYS), CB_GETCURSEL, 0, 0) , 0);
if (nCurPageNo == FORMAT_PAGE)
{
UpdateClusterSizeList (hCurPage, fileSystem);
}
return 1;
}
if (lw == IDC_SHOW_KEYS && nCurPageNo == FORMAT_PAGE)
{
showKeys = IsButtonChecked (GetDlgItem (hCurPage, IDC_SHOW_KEYS));
SetWindowText (GetDlgItem (hCurPage, IDC_RANDOM_BYTES), showKeys ? L" " : L"******************************** ");
SetWindowText (GetDlgItem (hCurPage, IDC_HEADER_KEY), showKeys ? L"" : L"******************************** ");
SetWindowText (GetDlgItem (hCurPage, IDC_DISK_KEY), showKeys ? L"" : L"******************************** ");
return 1;
}
if (lw == IDC_DISPLAY_POOL_CONTENTS
&& (nCurPageNo == SYSENC_COLLECTING_RANDOM_DATA_PAGE || nCurPageNo == NONSYS_INPLACE_ENC_RAND_DATA_PAGE))
{
showKeys = IsButtonChecked (GetDlgItem (hCurPage, IDC_DISPLAY_POOL_CONTENTS));
DisplayRandPool (hwndDlg, hRandPoolSys, showKeys);
return 1;
}
if (lw == IDC_DISPLAY_KEYS && nCurPageNo == SYSENC_KEYS_GEN_PAGE)
{
showKeys = IsButtonChecked (GetDlgItem (hCurPage, IDC_DISPLAY_KEYS));
DisplayPortionsOfKeys (GetDlgItem (hwndDlg, IDC_HEADER_KEY), GetDlgItem (hwndDlg, IDC_DISK_KEY), HeaderKeyGUIView, MasterKeyGUIView, !showKeys);
return 1;
}
if (nCurPageNo == SYSENC_RESCUE_DISK_CREATION_PAGE)
{
if (lw == IDC_BROWSE)
{
wchar_t tmpszRescueDiskISO [TC_MAX_PATH+1];
if (!BrowseFiles (hwndDlg, "OPEN_TITLE", tmpszRescueDiskISO, FALSE, TRUE, NULL))
return 1;
StringCbCopyW (szRescueDiskISO, sizeof(szRescueDiskISO), tmpszRescueDiskISO);
SetDlgItemText (hwndDlg, IDC_RESCUE_DISK_ISO_PATH, szRescueDiskISO);
EnableWindow (GetDlgItem (MainDlg, IDC_NEXT), (GetWindowTextLength (GetDlgItem (hwndDlg, IDC_RESCUE_DISK_ISO_PATH)) > 1));
return 1;
}
if ( hw == EN_CHANGE )
{
GetDlgItemText (hwndDlg, IDC_RESCUE_DISK_ISO_PATH, szRescueDiskISO, sizeof(szRescueDiskISO));
EnableWindow (GetDlgItem (MainDlg, IDC_NEXT), (GetWindowTextLength (GetDlgItem (hwndDlg, IDC_RESCUE_DISK_ISO_PATH)) > 1));
return 1;
}
}
- /* The password and rescue checkbox have to be clicked in order to enable the next button */
- if ((nCurPageNo == SYSENC_WIPE_MODE_PAGE || nCurPageNo == NONSYS_INPLACE_ENC_WIPE_MODE_PAGE) &&
- (lw == IDC_CHECKLIST_A || lw == IDC_CHECKLIST_B || lw == IDC_CHECKLIST_C))
- {
- if (SysEncInEffect ())
- {
- if (bChecklistA && bChecklistB && bChecklistC)
- EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
- else
- EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), FALSE);
- }
- }
-
- if (lw == IDC_BROWSE && (nCurPageNo == SYSENC_WIPE_MODE_PAGE || nCurPageNo == NONSYS_INPLACE_ENC_WIPE_MODE_PAGE))
- {
- wchar_t tmpszRescueDiskISO [TC_MAX_PATH+1];
-
- StringCbCopyW (tmpszRescueDiskISO, sizeof(tmpszRescueDiskISO), szRescueDiskISO);
-
- //detects the last '\' in order to remove the name of the zip file and save file name
- for (int i = wcslen(tmpszRescueDiskISO); i > 1; i--)
- {
- if (tmpszRescueDiskISO[i] == '\\')
- {
- for (int j = i + 1; i < wcslen(tmpszRescueDiskISO); i++)
- tmpszRescueDiskISO[j] = '\0';
- break;
- }
- }
-
- if(!BrowseFile (hwndDlg, "RESCUE_DISK_PATH", tmpszRescueDiskISO))
- return 1;
-
- return 0;
- }
- if (nCurPageNo == SYSENC_PRETEST_RESULT_PAGE && lw == IDC_CHECKBOX_PRETEST)
+ if (nCurPageNo == SYSENC_RESCUE_DISK_BURN_PAGE && lw == IDC_DOWNLOAD_CD_BURN_SOFTWARE)
{
- if (bCheckboxPretest)
- EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
+ if (IsWindowsIsoBurnerAvailable())
+ LaunchWindowsIsoBurner (hwndDlg, szRescueDiskISO);
else
- EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), FALSE);
+ Applink ("isoburning");
+
+ return 1;
}
if ((nCurPageNo == SYSENC_WIPE_MODE_PAGE
|| nCurPageNo == NONSYS_INPLACE_ENC_WIPE_MODE_PAGE
|| nCurPageNo == DEVICE_WIPE_MODE_PAGE)
&& hw == CBN_SELCHANGE)
{
nWipeMode = (WipeAlgorithmId) SendMessage (GetDlgItem (hCurPage, IDC_WIPE_MODE),
CB_GETITEMDATA,
SendMessage (GetDlgItem (hCurPage, IDC_WIPE_MODE), CB_GETCURSEL, 0, 0),
0);
return 1;
}
if (nCurPageNo == DEVICE_WIPE_PAGE)
{
switch (lw)
{
case IDC_ABORT_BUTTON:
if (AskWarnNoYes ("CONFIRM_WIPE_ABORT", MainDlg) == IDYES)
WipeAbort();
return 1;
}
}
if (lw == IDC_NO_HISTORY)
{
if (!(bHistory = !IsButtonChecked (GetDlgItem (hCurPage, IDC_NO_HISTORY))))
ClearHistory (GetDlgItem (hCurPage, IDC_COMBO_BOX));
return 1;
}
return 0;
}
return 0;
}
/* Except in response to the WM_INITDIALOG and WM_ENDSESSION messages, the dialog box procedure
should return nonzero if it processes the message, and zero if it does not. - see DialogProc */
BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
WORD lw = LOWORD (wParam);
int nNewPageNo = nCurPageNo;
switch (uMsg)
{
case WM_INITDIALOG:
{
MainDlg = hwndDlg;
InitDialog (hwndDlg);
LocalizeDialog (hwndDlg, "IDD_VOL_CREATION_WIZARD_DLG");
if (IsTrueCryptInstallerRunning())
AbortProcess ("TC_INSTALLER_IS_RUNNING");
// Resize the bitmap if the user has a non-default DPI
if (ScreenDPI != USER_DEFAULT_SCREEN_DPI)
{
hbmWizardBitmapRescaled = RenderBitmap (MAKEINTRESOURCE (IDB_WIZARD),
GetDlgItem (hwndDlg, IDC_BITMAP_WIZARD),
0, 0, 0, 0, FALSE, FALSE);
}
LoadSettings (hwndDlg);
// set the maximum password length based on configuration setting
if (bUseLegacyMaxPasswordLength)
iMaxPasswordLength = MAX_LEGACY_PASSWORD;
else
iMaxPasswordLength = MAX_PASSWORD;
// Save language to XML configuration file if it has been selected in the setup
// so that other VeraCrypt programs will pick it up
if (bLanguageSetInSetup)
SaveSettings (hwndDlg);
LoadDefaultKeyFilesParam ();
RestoreDefaultKeyFilesParam ();
SysEncMultiBootCfg.NumberOfSysDrives = -1;
SysEncMultiBootCfg.MultipleSystemsOnDrive = -1;
SysEncMultiBootCfg.BootLoaderLocation = -1;
SysEncMultiBootCfg.BootLoaderBrand = -1;
SysEncMultiBootCfg.SystemOnBootDrive = -1;
try
{
BootEncStatus = BootEncObj->GetStatus();
}
catch (Exception &e)
{
e.Show (hwndDlg);
Error ("ERR_GETTING_SYSTEM_ENCRYPTION_STATUS", MainDlg);
EndMainDlg (MainDlg);
return 0;
}
try
{
bSystemIsGPT = BootEncObj->GetSystemDriveConfiguration().SystemPartition.IsGPT;
}
catch (...)
{
}
SendMessageW (GetDlgItem (hwndDlg, IDC_BOX_TITLE), WM_SETFONT, (WPARAM) hTitleFont, (LPARAM) TRUE);
SetWindowTextW (hwndDlg, lpszTitle);
ExtractCommandLine (hwndDlg, (wchar_t *) lParam);
if (EnableMemoryProtection)
{
/* Protect this process memory from being accessed by non-admin users */
EnableProcessProtection ();
}
if (ComServerMode)
{
InitDialog (hwndDlg);
if (!ComServerFormat ())
{
handleWin32Error (hwndDlg, SRC_POS);
exit (1);
}
exit (0);
}
fastCreateFile = CmdFastCreateFile;
if (DirectCreationMode)
{
wchar_t root[TC_MAX_PATH];
DWORD fileSystemFlags = 0;
uint64 dataAreaSize;
wchar_t szFileSystemNameBuffer[256];
ULARGE_INTEGER free;
showKeys = FALSE;
bGuiMode = FALSE;
if (CmdVolumePassword.Length == 0 && !FirstCmdKeyFile)
AbortProcess ("ERR_PASSWORD_MISSING");
if (CmdVolumeFileSize == 0)
AbortProcess ("ERR_SIZE_MISSING");
CreateFullVolumePath (szDiskFile, sizeof(szDiskFile), szFileName, &bDevice);
if (bDevice)
AbortProcess ("ERR_DEVICE_CLI_CREATE_NOT_SUPPORTED");
volumePassword = CmdVolumePassword;
volumePim = CmdVolumePim;
if (CmdVolumeEA > 0)
nVolumeEA = CmdVolumeEA;
if (CmdVolumePkcs5 > 0)
hash_algo = CmdVolumePkcs5;
if (CmdVolumeFilesystem > 0)
fileSystem = CmdVolumeFilesystem;
else
fileSystem = FILESYS_NTFS;
nVolumeSize = CmdVolumeFileSize;
// correct volume size to be multiple of sector size
if (bDevice && !(bHiddenVol && !bHiddenVolHost)) // If raw device but not a hidden volume
{
// do nothing. no correction is needed
}
else
{
unsigned __int64 sectorSize = (unsigned __int64) GetFormatSectorSize();
unsigned __int64 sectorSizeRem = nVolumeSize % sectorSize;
if (sectorSizeRem != 0)
nVolumeSize = nVolumeSize + (sectorSize - sectorSizeRem);
}
if (nVolumeSize < (bHiddenVolHost ? TC_MIN_HIDDEN_VOLUME_HOST_SIZE : (bHiddenVol ? TC_MIN_HIDDEN_VOLUME_SIZE : TC_MIN_VOLUME_SIZE)))
AbortProcess ("ERR_VOLUME_SIZE_TOO_SMALL");
if ( ((!bHiddenVolHost && bHiddenVol) && (nVolumeSize > (unsigned __int64) nMaximumHiddenVolSize))
|| (nVolumeSize > (unsigned __int64) (bHiddenVolHost ? TC_MAX_HIDDEN_VOLUME_HOST_SIZE : TC_MAX_VOLUME_SIZE))
)
{
AbortProcess ("ERR_VOLUME_SIZE_TOO_BIG");
}
if (!GetVolumePathName (szFileName, root, array_capacity (root)))
{
handleWin32Error (hwndDlg, SRC_POS);
exit (1);
}
if (CmdSparseFileSwitch)
{
/* Check if the host file system supports sparse files */
GetVolumeInformation (root, NULL, 0, NULL, NULL, &fileSystemFlags, NULL, 0);
bSparseFileSwitch = fileSystemFlags & FILE_SUPPORTS_SPARSE_FILES;
if (!bSparseFileSwitch)
{
AbortProcess ("ERR_DYNAMIC_NOT_SUPPORTED");
}
}
quickFormat = CmdQuickFormat;
dynamicFormat = CmdSparseFileSwitch;
if (!GetDiskFreeSpaceEx (root, &free, 0, 0))
{
wchar_t szTmp[1024];
if (translateWin32Error (szTmp, sizeof (szTmp) / sizeof(szTmp[0])))
{
wchar_t szTmp2[1024];
StringCbPrintfW (szTmp2, sizeof(szTmp2), L"%s\n%s", GetString ("CANNOT_CALC_SPACE"), szTmp);
AbortProcessDirect (szTmp2);
}
else
{
handleWin32Error (hwndDlg, SRC_POS);
}
exit (1);
}
else
{
if (!dynamicFormat && !bDontCheckFileContainerSize && (nVolumeSize > free.QuadPart))
{
AbortProcess ("ERR_CONTAINER_SIZE_TOO_BIG");
}
}
dataAreaSize = GetVolumeDataAreaSize (bHiddenVol && !bHiddenVolHost, nVolumeSize);
if ( (fileSystem == FILESYS_NTFS) &&
(dataAreaSize < TC_MIN_NTFS_FS_SIZE || dataAreaSize > TC_MAX_NTFS_FS_SIZE)
)
{
AbortProcess ("ERR_NTFS_INVALID_VOLUME_SIZE");
}
if ( (fileSystem == FILESYS_EXFAT) &&
(dataAreaSize < TC_MIN_EXFAT_FS_SIZE || dataAreaSize > TC_MAX_EXFAT_FS_SIZE)
)
{
AbortProcess ("ERR_EXFAT_INVALID_VOLUME_SIZE");
}
if ( (fileSystem == FILESYS_REFS) &&
(dataAreaSize < TC_MIN_REFS_FS_SIZE || dataAreaSize > TC_MAX_REFS_FS_SIZE)
)
{
AbortProcess ("ERR_REFS_INVALID_VOLUME_SIZE");
}
if ( (fileSystem == FILESYS_FAT) &&
(dataAreaSize < TC_MIN_FAT_FS_SIZE || dataAreaSize > (TC_MAX_FAT_SECTOR_COUNT * GetFormatSectorSize()))
)
{
AbortProcess ("ERR_FAT_INVALID_VOLUME_SIZE");
}
/* Verify that the volume would not be too large for the host file system */
if (GetVolumePathName (szDiskFile, root, ARRAYSIZE (root))
&& GetVolumeInformation (root, NULL, 0, NULL, NULL, NULL, szFileSystemNameBuffer, ARRAYSIZE(szFileSystemNameBuffer))
&& !wcsncmp (szFileSystemNameBuffer, L"FAT32", 5))
{
// The host file system is FAT32
if (nVolumeSize >= 4 * BYTES_PER_GB)
{
AbortProcess ("VOLUME_TOO_LARGE_FOR_FAT32");
}
}
/* 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).
if (!CheckPasswordLength (NULL, volumePassword.Length, volumePim, FALSE, 0, Silent, Silent))
{
exit (1);
}
}
if (!KeyFilesApply (hwndDlg, &volumePassword, FirstCmdKeyFile, NULL))
{
exit (1);
}
volTransformThreadFunction (hwndDlg);
exit (bOperationSuccess? 0 : 1);
}
SHGetFolderPath (NULL, CSIDL_MYDOCUMENTS, NULL, 0, szRescueDiskISO);
+ if (bSystemIsGPT)
+ StringCbCatW (szRescueDiskISO, sizeof(szRescueDiskISO), L"\\VeraCrypt Rescue Disk.zip");
+ else
+ StringCbCatW (szRescueDiskISO, sizeof(szRescueDiskISO), L"\\VeraCrypt Rescue Disk.iso");
- StringCbCatW (szRescueDiskISO, sizeof(szRescueDiskISO), L"\\VeraCrypt Rescue Disk.zip");
-
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;
}
#ifdef _DEBUG
// For faster testing
StringCchCopyA (szVerify, ARRAYSIZE(szVerify), "q");
StringCchCopyA (szRawPassword, ARRAYSIZE(szRawPassword), "q");
#endif
PasswordEditDropTarget* pTarget = new PasswordEditDropTarget ();
if (pTarget->Register (hwndDlg))
{
SetWindowLongPtr (hwndDlg, DWLP_USER, (LONG_PTR) pTarget);
}
else
delete pTarget;
PostMessage (hwndDlg, TC_APPMSG_PERFORM_POST_WMINIT_TASKS, 0, 0);
}
return 0;
case WM_SYSCOMMAND:
if (lw == IDC_ABOUT)
{
DialogBoxW (hInst, MAKEINTRESOURCEW (IDD_ABOUT_DLG), hwndDlg, (DLGPROC) AboutDlgProc);
return 1;
}
return 0;
case WM_TIMER:
switch (wParam)
{
case TIMER_ID_RANDVIEW:
if (WizardMode == WIZARD_MODE_SYS_DEVICE
|| bInPlaceEncNonSys)
{
DisplayRandPool (hwndDlg, hRandPoolSys, showKeys);
}
else
{
int partialLen = 16;
wchar_t tmp2[43];
int i;
DWORD mouseEventsCounter;
RandpeekBytes (hwndDlg, randPool, partialLen, &mouseEventsCounter);
ProcessEntropyEstimate (hEntropyBar, &mouseEventsInitialCount, mouseEventsCounter, maxEntropyLevel, &mouseEntropyGathered);
tmp2[0] = 0;
for (i = 0; i < partialLen; i++)
{
wchar_t tmp3[3];
if (showKeys)
{
StringCbPrintfW (tmp3, sizeof(tmp3), L"%02X", (int) randPool[i]);
}
else if (bUseMask)
{
unsigned char tmpByte = randPool[i] ^ maskRandPool[i];
tmp3[0] = (wchar_t) (((tmpByte >> 4) % 6) + L'*');
tmp3[1] = (wchar_t) (((tmpByte & 0x0F) % 6) + L'*');
tmp3[2] = 0;
}
else
StringCbCopyW (tmp3, sizeof (tmp3), L"**");
StringCbCatW (tmp2, sizeof(tmp2), tmp3);
}
tmp2[32] = 0;
SetWindowTextW (GetDlgItem (hCurPage, IDC_RANDOM_BYTES), (wstring (tmp2) + GetString ("TRIPLE_DOT_GLYPH_ELLIPSIS")).c_str());
burn (randPool, partialLen);
burn (tmp2, sizeof(tmp2));
}
return 1;
case TIMER_ID_SYSENC_PROGRESS:
{
// Manage system encryption/decryption and update related GUI
try
{
BootEncStatus = BootEncObj->GetStatus();
}
catch (Exception &e)
{
KillTimer (MainDlg, TIMER_ID_SYSENC_PROGRESS);
try
{
BootEncObj->AbortSetup ();
}
catch (Exception &e)
{
e.Show (hwndDlg);
}
e.Show (hwndDlg);
Error ("ERR_GETTING_SYSTEM_ENCRYPTION_STATUS", MainDlg);
EndMainDlg (MainDlg);
return 1;
}
if (BootEncStatus.SetupInProgress)
UpdateSysEncProgressBar ();
if (bSystemEncryptionInProgress != BootEncStatus.SetupInProgress)
{
bSystemEncryptionInProgress = BootEncStatus.SetupInProgress;
UpdateSysEncProgressBar ();
UpdateSysEncControls ();
if (!bSystemEncryptionInProgress)
{
// The driver stopped encrypting/decrypting
// Allow the OS to enter Sleep mode when idle
SetThreadExecutionState (ES_CONTINUOUS);
KillTimer (hwndDlg, TIMER_ID_SYSENC_PROGRESS);
UpdateLastDialogId ();
try
{
if (BootEncStatus.DriveMounted) // If we had been really encrypting/decrypting (not just proceeding to deinstall)
BootEncObj->CheckEncryptionSetupResult();
}
catch (SystemException &e)
{
if (!bTryToCorrectReadErrors
&& SystemEncryptionStatus == SYSENC_STATUS_ENCRYPTING
&& (IsDiskReadError (e.ErrorCode)))
{
bTryToCorrectReadErrors = (AskWarnYesNo ("ENABLE_BAD_SECTOR_ZEROING", MainDlg) == IDYES);
if (bTryToCorrectReadErrors)
{
SysEncResume();
return 1;
}
}
else if (!DiscardUnreadableEncryptedSectors
&& SystemEncryptionStatus == SYSENC_STATUS_DECRYPTING
&& (IsDiskReadError (e.ErrorCode)))
{
DiscardUnreadableEncryptedSectors = (AskWarnYesNo ("DISCARD_UNREADABLE_ENCRYPTED_SECTORS", MainDlg) == IDYES);
if (DiscardUnreadableEncryptedSectors)
{
SysEncResume();
return 1;
}
}
e.Show (hwndDlg);
}
catch (Exception &e)
{
e.Show (hwndDlg);
}
switch (SystemEncryptionStatus)
{
case SYSENC_STATUS_ENCRYPTING:
if (BootEncStatus.ConfiguredEncryptedAreaStart == BootEncStatus.EncryptedAreaStart
&& BootEncStatus.ConfiguredEncryptedAreaEnd == BootEncStatus.EncryptedAreaEnd)
{
// The partition/drive has been fully encrypted
ManageStartupSeqWiz (TRUE, L"");
SetWindowTextW (GetDlgItem (hwndDlg, IDC_NEXT), GetString ("FINALIZE"));
EnableWindow (GetDlgItem (hwndDlg, IDC_NEXT), TRUE);
EnableWindow (GetDlgItem (hwndDlg, IDCANCEL), FALSE);
EnableWindow (GetDlgItem (hCurPage, IDC_WIPE_MODE), FALSE);
EnableWindow (GetDlgItem (hCurPage, IDC_PAUSE), FALSE);
WipeHiddenOSCreationConfig(); // For extra conservative security
ChangeSystemEncryptionStatus (SYSENC_STATUS_NONE);
Info ("SYSTEM_ENCRYPTION_FINISHED", MainDlg);
return 1;
}
break;
case SYSENC_STATUS_DECRYPTING:
if (!BootEncStatus.DriveEncrypted)
{
// The partition/drive has been fully decrypted
try
{
// Finalize the process
BootEncObj->Deinstall ();
}
catch (Exception &e)
{
e.Show (hwndDlg);
}
ManageStartupSeqWiz (TRUE, L"");
ChangeSystemEncryptionStatus (SYSENC_STATUS_NONE);
SetWindowTextW (GetDlgItem (hwndDlg, IDC_NEXT), GetString ("FINALIZE"));
EnableWindow (GetDlgItem (hwndDlg, IDC_NEXT), TRUE);
EnableWindow (GetDlgItem (hwndDlg, IDCANCEL), FALSE);
EnableWindow (GetDlgItem (hCurPage, IDC_PAUSE), FALSE);
Info ("SYSTEM_DECRYPTION_FINISHED", MainDlg);
// Reboot is required to enable uninstallation and hibernation
if (AskWarnYesNo ("CONFIRM_RESTART", MainDlg) == IDYES)
{
EndMainDlg (MainDlg);
try
{
BootEncObj->RestartComputer();
}
catch (Exception &e)
{
e.Show (hwndDlg);
}
}
return 1;
}
break;
}
}
}
}
return 1;
case TIMER_ID_NONSYS_INPLACE_ENC_PROGRESS:
if (bInPlaceEncNonSys)
{
// Non-system in-place encryption
if (!bVolTransformThreadRunning && !bVolTransformThreadToRun)
{
KillTimer (hwndDlg, TIMER_ID_NONSYS_INPLACE_ENC_PROGRESS);
UpdateLastDialogId ();
}
UpdateNonSysInPlaceEncControls ();
}
return 1;
case TIMER_ID_KEYB_LAYOUT_GUARD:
if (SysEncInEffect ())
{
DWORD keybLayout = (DWORD) GetKeyboardLayout (NULL);
/* Watch the keyboard layout */
if (keybLayout != 0x00000409 && keybLayout != 0x04090409)
{
// Keyboard layout is not standard US
WipePasswordsAndKeyfiles (true);
SetPassword (hCurPage, IDC_PASSWORD, szRawPassword);
SetPassword (hCurPage, IDC_VERIFY, szVerify);
keybLayout = (DWORD) LoadKeyboardLayout (L"00000409", KLF_ACTIVATE);
- // East Asian languages are not translated to US keyboard layout so we need to change keyboard layout
if (keybLayout != 0x00000409 && keybLayout != 0x04090409)
{
KillTimer (hwndDlg, TIMER_ID_KEYB_LAYOUT_GUARD);
Error ("CANT_CHANGE_KEYB_LAYOUT_FOR_SYS_ENCRYPTION", MainDlg);
EndMainDlg (MainDlg);
return 1;
}
-
+
bKeyboardLayoutChanged = TRUE;
+
wchar_t szTmp [4096];
StringCbCopyW (szTmp, sizeof(szTmp), GetString ("KEYB_LAYOUT_CHANGE_PREVENTED"));
StringCbCatW (szTmp, sizeof(szTmp), L"\n\n");
StringCbCatW (szTmp, sizeof(szTmp), GetString ("KEYB_LAYOUT_SYS_ENC_EXPLANATION"));
MessageBoxW (MainDlg, szTmp, lpszTitle, MB_ICONWARNING | MB_SETFOREGROUND | MB_TOPMOST);
+ }
- if (bKeyboardLayoutChanged && !bKeybLayoutAltKeyWarningShown)
- {
- if (GetAsyncKeyState (VK_RMENU) < 0)
- {
- bKeybLayoutAltKeyWarningShown = TRUE;
+ /* Watch the right Alt key (which is used to enter various characters on non-US keyboards) */
+ if (bKeyboardLayoutChanged && !bKeybLayoutAltKeyWarningShown)
+ {
+ if (GetAsyncKeyState (VK_RMENU) < 0)
+ {
+ bKeybLayoutAltKeyWarningShown = TRUE;
- wchar_t szTmp [4096];
- StringCbCopyW (szTmp, sizeof(szTmp), GetString ("ALT_KEY_CHARS_NOT_FOR_SYS_ENCRYPTION"));
- StringCbCatW (szTmp, sizeof(szTmp), L"\n\n");
- StringCbCatW (szTmp, sizeof(szTmp), GetString ("KEYB_LAYOUT_SYS_ENC_EXPLANATION"));
- MessageBoxW (MainDlg, szTmp, lpszTitle, MB_ICONINFORMATION | MB_SETFOREGROUND | MB_TOPMOST);
- }
+ wchar_t szTmp [4096];
+ StringCbCopyW (szTmp, sizeof(szTmp), GetString ("ALT_KEY_CHARS_NOT_FOR_SYS_ENCRYPTION"));
+ StringCbCatW (szTmp, sizeof(szTmp), L"\n\n");
+ StringCbCatW (szTmp, sizeof(szTmp), GetString ("KEYB_LAYOUT_SYS_ENC_EXPLANATION"));
+ MessageBoxW (MainDlg, szTmp, lpszTitle, MB_ICONINFORMATION | MB_SETFOREGROUND | MB_TOPMOST);
}
}
}
return 1;
+
case TIMER_ID_SYSENC_DRIVE_ANALYSIS_PROGRESS:
if (bSysEncDriveAnalysisInProgress)
{
UpdateProgressBarProc (GetTickCount() - SysEncDriveAnalysisStart);
if (GetTickCount() - SysEncDriveAnalysisStart > SYSENC_DRIVE_ANALYSIS_ETA)
{
// It's taking longer than expected -- reinit the progress bar
SysEncDriveAnalysisStart = GetTickCount ();
InitProgressBar (SYSENC_DRIVE_ANALYSIS_ETA, 0, FALSE, FALSE, FALSE, TRUE);
}
ArrowWaitCursor ();
}
else
{
KillTimer (hwndDlg, TIMER_ID_SYSENC_DRIVE_ANALYSIS_PROGRESS);
UpdateProgressBarProc (SYSENC_DRIVE_ANALYSIS_ETA);
Sleep (1500); // User-friendly GUI
if (bSysEncDriveAnalysisTimeOutOccurred)
Warning ("SYS_DRIVE_SIZE_PROBE_TIMEOUT", MainDlg);
LoadPage (hwndDlg, SYSENC_DRIVE_ANALYSIS_PAGE + 1);
}
return 1;
case TIMER_ID_WIPE_PROGRESS:
// Manage device wipe and update related GUI
if (bHiddenOS && IsHiddenOSRunning())
{
// Decoy system partition wipe
DecoySystemWipeStatus decoySysPartitionWipeStatus;
try
{
decoySysPartitionWipeStatus = BootEncObj->GetDecoyOSWipeStatus();
BootEncStatus = BootEncObj->GetStatus();
}
catch (Exception &e)
{
KillTimer (MainDlg, TIMER_ID_WIPE_PROGRESS);
try
{
BootEncObj->AbortDecoyOSWipe ();
}
catch (Exception &e)
{
e.Show (hwndDlg);
}
e.Show (hwndDlg);
EndMainDlg (MainDlg);
return 1;
}
if (decoySysPartitionWipeStatus.WipeInProgress)
{
ArrowWaitCursor ();
UpdateWipeProgressBar ();
}
if (bDeviceWipeInProgress != decoySysPartitionWipeStatus.WipeInProgress)
{
bDeviceWipeInProgress = decoySysPartitionWipeStatus.WipeInProgress;
UpdateWipeProgressBar ();
UpdateWipeControls ();
if (!bDeviceWipeInProgress)
{
// The driver stopped wiping
KillTimer (hwndDlg, TIMER_ID_WIPE_PROGRESS);
UpdateLastDialogId ();
try
{
BootEncObj->CheckDecoyOSWipeResult();
}
catch (Exception &e)
{
e.Show (hwndDlg);
AbortProcessSilent();
}
if (BootEncStatus.ConfiguredEncryptedAreaEnd == decoySysPartitionWipeStatus.WipedAreaEnd)
{
// Decoy system partition has been fully wiped
ChangeHiddenOSCreationPhase (TC_HIDDEN_OS_CREATION_PHASE_WIPED);
SetWindowTextW (GetDlgItem (MainDlg, IDCANCEL), GetString ("EXIT"));
EnableWindow (GetDlgItem (MainDlg, IDCANCEL), TRUE);
EnableWindow (GetDlgItem (MainDlg, IDC_PREV), FALSE);
EnableWindow (GetDlgItem (MainDlg, IDC_NEXT), FALSE);
EnableWindow (GetDlgItem (hCurPage, IDC_ABORT_BUTTON), FALSE);
Info ("WIPE_FINISHED_DECOY_SYSTEM_PARTITION", MainDlg);
TextInfoDialogBox (TC_TBXID_DECOY_OS_INSTRUCTIONS);
if (BootEncObj->GetSystemDriveConfiguration().ExtraBootPartitionPresent)
Warning ("DECOY_OS_VERSION_WARNING", MainDlg);
return 1;
}
}
}
}
else
{
// Regular device wipe (not decoy system partition wipe)
//Info ("WIPE_FINISHED");
}
return 1;
}
return 0;
case TC_APPMSG_PERFORM_POST_WMINIT_TASKS:
AfterWMInitTasks (hwndDlg);
return 1;
case TC_APPMSG_FORMAT_FINISHED:
{
wchar_t tmp[RNG_POOL_SIZE*2+1];
EnableWindow (GetDlgItem (hCurPage, IDC_ABORT_BUTTON), FALSE);
EnableWindow (GetDlgItem (hwndDlg, IDC_PREV), TRUE);
EnableWindow (GetDlgItem (hwndDlg, IDHELP), TRUE);
EnableWindow (GetDlgItem (hwndDlg, IDCANCEL), TRUE);
EnableWindow (GetDlgItem (hwndDlg, IDC_NEXT), TRUE);
SetFocus (GetDlgItem (hwndDlg, IDC_NEXT));
if (nCurPageNo == FORMAT_PAGE)
KillTimer (hwndDlg, TIMER_ID_RANDVIEW);
// Attempt to wipe the GUI fields showing portions of randpool, of the master and header keys
wmemset (tmp, 'X', ARRAYSIZE(tmp));
tmp [ARRAYSIZE(tmp)-1] = 0;
SetWindowText (hRandPool, tmp);
SetWindowText (hMasterKey, tmp);
SetWindowText (hHeaderKey, tmp);
LoadPage (hwndDlg, FORMAT_FINISHED_PAGE);
}
return 1;
case TC_APPMSG_NONSYS_INPLACE_ENC_FINISHED:
// A partition has just been fully encrypted in place
KillTimer (hwndDlg, TIMER_ID_NONSYS_INPLACE_ENC_PROGRESS);
if (bInPlaceDecNonSys)
{
// Decryption of non-system volume finished and free drive letters are available. Check if a drive letter is assigned to the decrypted volume.
WCHAR deviceName[MAX_PATH + 1];
StringCbCopyW (deviceName, sizeof(deviceName), szDiskFile);
if (GetDiskDeviceDriveLetter (deviceName) < 0)
{
// No drive letter is assigned to the device
MessageBeep (MB_OK);
LoadPage (hwndDlg, NONSYS_INPLACE_DEC_TRANSFORM_FINISHED_DRIVE_LETTER_PAGE);
return 1;
}
else
{
Info ("NONSYS_INPLACE_DEC_FINISHED_INFO", hwndDlg);
}
}
LoadPage (hwndDlg, NONSYS_INPLACE_ENC_TRANSFORM_FINISHED_PAGE);
return 1;
case TC_APPMSG_VOL_TRANSFORM_THREAD_ENDED:
if (bInPlaceEncNonSys)
{
// In-place encryption was interrupted/paused (did not finish)
KillTimer (hwndDlg, TIMER_ID_NONSYS_INPLACE_ENC_PROGRESS);
UpdateNonSysInPlaceEncControls ();
}
else
{
// Format has been aborted (did not finish)
EnableWindow (GetDlgItem (hCurPage, IDC_QUICKFORMAT), !(bHiddenVol && !bHiddenVolHost));
EnableWindow (GetDlgItem (hCurPage, SPARSE_FILE), (bSparseFileSwitch) && !(bHiddenVol && !bHiddenVolHost));
EnableWindow (GetDlgItem (hCurPage, IDC_FILESYS), TRUE);
EnableWindow (GetDlgItem (hCurPage, IDC_CLUSTERSIZE), TRUE);
EnableWindow (GetDlgItem (hwndDlg, IDC_PREV), TRUE);
EnableWindow (GetDlgItem (hwndDlg, IDHELP), TRUE);
EnableWindow (GetDlgItem (hwndDlg, IDCANCEL), TRUE);
EnableWindow (GetDlgItem (hCurPage, IDC_ABORT_BUTTON), FALSE);
EnableWindow (GetDlgItem (hwndDlg, IDC_NEXT), TRUE);
SendMessage (GetDlgItem (hCurPage, IDC_PROGRESS_BAR), PBM_SETPOS, 0, 0L);
SetFocus (GetDlgItem (hwndDlg, IDC_NEXT));
}
NormalCursor ();
return 1;
case WM_HELP:
OpenPageHelp (hwndDlg, nCurPageNo);
return 1;
case TC_APPMSG_FORMAT_USER_QUIT:
if (nCurPageNo == NONSYS_INPLACE_ENC_TRANSFORM_PAGE
&& (bVolTransformThreadRunning || bVolTransformThreadToRun || bInPlaceEncNonSysResumed))
{
// Non-system encryption in progress
if (AskNoYes ("NONSYS_INPLACE_ENC_DEFER_CONFIRM", hwndDlg) == IDYES)
{
NonSysInplaceEncPause ();
EndMainDlg (hwndDlg);
return 1;
}
else
return 1; // Disallow close
}
else if (bVolTransformThreadRunning || bVolTransformThreadToRun)
{
// Format (non-in-place encryption) in progress
if (AskNoYes ("FORMAT_ABORT", hwndDlg) == IDYES)
{
bVolTransformThreadCancel = TRUE;
EndMainDlg (hwndDlg);
return 1;
}
else
return 1; // Disallow close
}
else if ((nCurPageNo == SYSENC_ENCRYPTION_PAGE || nCurPageNo == SYSENC_PRETEST_RESULT_PAGE)
&& SystemEncryptionStatus != SYSENC_STATUS_NONE
&& InstanceHasSysEncMutex ())
{
// System encryption/decryption in progress
if (AskYesNo (SystemEncryptionStatus == SYSENC_STATUS_DECRYPTING ?
"SYSTEM_DECRYPTION_DEFER_CONFIRM" : "SYSTEM_ENCRYPTION_DEFER_CONFIRM", MainDlg) == IDYES)
{
if (nCurPageNo == SYSENC_PRETEST_RESULT_PAGE)
TextInfoDialogBox (TC_TBXID_SYS_ENC_RESCUE_DISK);
try
{
BootEncStatus = BootEncObj->GetStatus();
if (BootEncStatus.SetupInProgress)
{
BootEncObj->AbortSetupWait ();
Sleep (200);
BootEncStatus = BootEncObj->GetStatus();
}
if (!BootEncStatus.SetupInProgress)
{
EndMainDlg (MainDlg);
return 1;
}
else
{
Error ("FAILED_TO_INTERRUPT_SYSTEM_ENCRYPTION", MainDlg);
return 1; // Disallow close
}
}
catch (Exception &e)
{
e.Show (hwndDlg);
}
return 1; // Disallow close
}
else
return 1; // Disallow close
}
else if (bConfirmQuitSysEncPretest)
{
if (AskWarnNoYes (bHiddenOS ? "CONFIRM_CANCEL_HIDDEN_OS_CREATION" : "CONFIRM_CANCEL_SYS_ENC_PRETEST", MainDlg) == IDNO)
return 1; // Disallow close
}
else if (bConfirmQuit)
{
if (AskWarnNoYes ("CONFIRM_EXIT_UNIVERSAL", MainDlg) == IDNO)
return 1; // Disallow close
}
if (hiddenVolHostDriveNo > -1)
{
CloseVolumeExplorerWindows (hwndDlg, hiddenVolHostDriveNo);
UnmountVolume (hwndDlg, hiddenVolHostDriveNo, TRUE);
}
EndMainDlg (hwndDlg);
return 1;
case WM_COMMAND:
if (lw == IDHELP)
{
- if (nCurPageNo == SYSENC_RESCUE_DISK_CREATION_PAGE ||
- nCurPageNo == SYSENC_RESCUE_DISK_BURN_PAGE ||
- nCurPageNo == SYSENC_RESCUE_DISK_VERIFIED_PAGE)
- {
- Applink("rescue");
- }
- else if (nCurPageNo == PASSWORD_PAGE)
- {
- Applink("passwords");
- }
- else
- {
- OpenPageHelp(hwndDlg, nCurPageNo);
- }
+ OpenPageHelp (hwndDlg, nCurPageNo);
return 1;
}
else if (lw == IDCANCEL)
{
PostMessage (hwndDlg, TC_APPMSG_FORMAT_USER_QUIT, 0, 0);
return 1;
}
else if (lw == IDC_NEXT)
{
if (nCurPageNo == INTRO_PAGE)
{
switch (GetSelectedWizardMode (hCurPage))
{
case WIZARD_MODE_FILE_CONTAINER:
if (CurrentOSMajor >= 6 && IsUacSupported() && IsAdmin() && !IsBuiltInAdmin() && !IsNonInstallMode())
{
static bool warningConfirmed = false;
if (!warningConfirmed)
{
if (AskWarnYesNo ("CONTAINER_ADMIN_WARNING", MainDlg) == IDYES)
exit (0);
warningConfirmed = true;
}
}
WaitCursor ();
CloseSysEncMutex ();
ChangeWizardMode (WIZARD_MODE_FILE_CONTAINER);
bHiddenOS = FALSE;
bInPlaceEncNonSys = FALSE;
nNewPageNo = VOLUME_TYPE_PAGE - 1; // Skip irrelevant pages
break;
case WIZARD_MODE_NONSYS_DEVICE:
WaitCursor ();
CloseSysEncMutex ();
if (!ChangeWizardMode (WIZARD_MODE_NONSYS_DEVICE))
{
NormalCursor ();
return 1;
}
bHiddenOS = FALSE;
nNewPageNo = VOLUME_TYPE_PAGE - 1; // Skip irrelevant pages
break;
case WIZARD_MODE_SYS_DEVICE:
WaitCursor ();
bHiddenVol = FALSE;
bInPlaceEncNonSys = FALSE;
SwitchWizardToSysEncMode ();
return 1;
}
}
else if (nCurPageNo == SYSENC_TYPE_PAGE)
{
if (bHiddenOS)
{
bWholeSysDrive = FALSE;
bHiddenVolDirect = FALSE;
}
if (!bHiddenOS)
- nNewPageNo = PASSWORD_PAGE - 1; // Skip irrelevant pages
+ nNewPageNo = SYSENC_SPAN_PAGE - 1; // Skip irrelevant pages
}
else if (nCurPageNo == SYSENC_HIDDEN_OS_REQ_CHECK_PAGE)
{
WaitCursor ();
try
{
BootEncObj->CheckRequirementsHiddenOS ();
if (CheckGapBetweenSysAndHiddenOS ())
Warning ("GAP_BETWEEN_SYS_AND_HIDDEN_OS_PARTITION", MainDlg);
}
catch (Exception &e)
{
e.Show (hwndDlg);
NormalCursor ();
return 1;
}
if (AskWarnYesNo ("DECOY_OS_REINSTALL_WARNING", MainDlg) == IDNO)
{
NormalCursor ();
return 1;
}
WarningDirect ((wstring (GetString ("HIDDEN_OS_WRITE_PROTECTION_BRIEF_INFO"))
+ L"\n\n"
+ GetString ("HIDDEN_OS_WRITE_PROTECTION_EXPLANATION")).c_str(), MainDlg);
if (!IsAdmin() && IsUacSupported())
{
// If UAC elevation is needed, we need to elevate the complete wizard process here, because
// we will need to switch to the non-sys-device mode, which requires the whole wizard process
// to have admin rights.
CloseSysEncMutex ();
if (!ElevateWholeWizardProcess (L"/r"))
{
// Failed to obtain admin rights
NormalCursor ();
if (!CreateSysEncMutex ())
AbortProcess ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE");
return 1;
}
}
// This check requires admin rights
try
{
BootEncObj->InitialSecurityChecksForHiddenOS ();
}
catch (Exception &e)
{
e.Show (hwndDlg);
EndMainDlg (MainDlg); // Some of the checks need the wizard to be restarted (results are cached until exit and the checks would fail even if the issues were rectified).
return 1;
}
nNewPageNo = SYSENC_MULTI_BOOT_MODE_PAGE - 1; // Skip irrelevant pages
}
else if (nCurPageNo == SYSENC_SPAN_PAGE)
{
try
{
if (bWholeSysDrive && !BootEncObj->SystemPartitionCoversWholeDrive())
{
if (BootEncObj->SystemDriveContainsNonStandardPartitions())
{
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())
bWholeSysDrive = (AskYesNo ("WHOLE_SYC_DEVICE_RECOM", hwndDlg) == IDYES);
}
catch (Exception &e)
{
e.Show (hwndDlg);
NormalCursor ();
return 1;
}
if (!bWholeSysDrive)
nNewPageNo = SYSENC_MULTI_BOOT_MODE_PAGE - 1; // Skip irrelevant pages
}
else if (nCurPageNo == SYSENC_PRE_DRIVE_ANALYSIS_PAGE)
{
if ((SysEncDetectHiddenSectors = Get2RadButtonPageAnswer()) != 1)
{
// Skip drive analysis
nNewPageNo = SYSENC_DRIVE_ANALYSIS_PAGE;
// If the user had already searched for hidden sectors, we must clear (invalidate) the
// result because now he changed his mind and no longer wishes to encrypt the hidden sectors.
try
{
BootEncObj->InvalidateCachedSysDriveProperties ();
}
catch (Exception &e)
{
e.Show (MainDlg);
EndMainDlg (MainDlg);
exit(0);
}
}
}
else if (nCurPageNo == SYSENC_MULTI_BOOT_MODE_PAGE)
{
if (nMultiBoot > 1)
{
// Multi-boot
if (AskWarnNoYes ("MULTI_BOOT_FOR_ADVANCED_ONLY", hwndDlg) == IDNO)
return 1;
if (bHiddenOS)
{
if (AskWarnNoYes ("HIDDEN_OS_MULTI_BOOT", hwndDlg) == IDNO)
{
Error ("UNSUPPORTED_HIDDEN_OS_MULTI_BOOT_CFG", hwndDlg);
return 1;
}
}
}
if (bHiddenOS)
{
if (IsOSAtLeast (WIN_7)
&& BootEncObj->GetSystemDriveConfiguration().ExtraBootPartitionPresent
&& AskWarnYesNo ("CONFIRM_HIDDEN_OS_EXTRA_BOOT_PARTITION", hwndDlg) == IDNO)
{
TextInfoDialogBox (TC_TBXID_EXTRA_BOOT_PARTITION_REMOVAL_INSTRUCTIONS);
NormalCursor ();
return 1;
}
if (AskWarnYesNo ("DECOY_OS_REQUIREMENTS", hwndDlg) == IDNO)
{
NormalCursor ();
return 1;
}
if (!ChangeWizardMode (WIZARD_MODE_NONSYS_DEVICE))
{
NormalCursor ();
return 1;
}
// Skip irrelevant pages
nNewPageNo = HIDDEN_VOL_HOST_PRE_CIPHER_PAGE - 1;
}
else if ((nMultiBoot <= 1) || bSystemIsGPT)
{
// Single-boot (not creating a hidden OS)
// Multi-boot in case of GPT
// Skip irrelevant pages
nNewPageNo = CIPHER_PAGE - 1;
}
}
else if (nCurPageNo == SYSENC_MULTI_BOOT_SYS_EQ_BOOT_PAGE)
{
SysEncMultiBootCfg.SystemOnBootDrive = Get2RadButtonPageAnswer ();
if (!SysEncMultiBootCfg.SystemOnBootDrive)
{
Error ("SYS_PARTITION_MUST_BE_ON_BOOT_DRIVE", hwndDlg);
EndMainDlg (MainDlg);
return 1;
}
}
else if (nCurPageNo == SYSENC_MULTI_BOOT_NBR_SYS_DRIVES_PAGE)
{
if (Get2RadButtonPageAnswer () == 0)
{
// 2 or more drives contain an OS
SysEncMultiBootCfg.NumberOfSysDrives = 2;
}
else if (Get2RadButtonPageAnswer () == 1)
{
// Only 1 drive contains an OS
SysEncMultiBootCfg.NumberOfSysDrives = 1;
if (bWholeSysDrive)
{
// Whole-system-drive encryption is currently not supported if the drive contains
// more than one system
Error ("WDE_UNSUPPORTED_FOR_MULTIPLE_SYSTEMS_ON_ONE_DRIVE", hwndDlg);
return 1;
}
// Ask whether there is a non-Windows boot loader in the MBR
nNewPageNo = SYSENC_MULTI_BOOT_NONWIN_BOOT_LOADER_PAGE - 1;
}
}
else if (nCurPageNo == SYSENC_MULTI_BOOT_ADJACENT_SYS_PAGE)
{
SysEncMultiBootCfg.MultipleSystemsOnDrive = Get2RadButtonPageAnswer ();
if (SysEncMultiBootCfg.MultipleSystemsOnDrive && bWholeSysDrive)
{
// Whole-system-drive encryption is currently not supported if the drive contains
// more than one system
Error ("WDE_UNSUPPORTED_FOR_MULTIPLE_SYSTEMS_ON_ONE_DRIVE", hwndDlg);
return 1;
}
}
else if (nCurPageNo == SYSENC_MULTI_BOOT_NONWIN_BOOT_LOADER_PAGE)
{
SysEncMultiBootCfg.BootLoaderBrand = Get2RadButtonPageAnswer ();
if (SysEncMultiBootCfg.BootLoaderBrand)
{
// A non-Windows boot manager in the MBR
Error ("CUSTOM_BOOT_MANAGERS_IN_MBR_UNSUPPORTED", hwndDlg);
EndMainDlg (MainDlg);
return 1;
}
else
{
// Either a standard Windows boot manager or no boot manager
StringCchCopyW (SysEncMultiBootCfgOutcome, sizeof(SysEncMultiBootCfgOutcome) / 2, GetString ("WINDOWS_BOOT_LOADER_HINTS"));
}
}
else if (nCurPageNo == SYSENC_MULTI_BOOT_OUTCOME_PAGE)
{
if (bHiddenOS)
{
if (!ChangeWizardMode (WIZARD_MODE_NONSYS_DEVICE))
{
NormalCursor ();
return 1;
}
nNewPageNo = HIDDEN_VOL_HOST_PRE_CIPHER_PAGE - 1; // Skip irrelevant pages
}
else
nNewPageNo = CIPHER_PAGE - 1; // Skip irrelevant pages
}
else if (nCurPageNo == VOLUME_TYPE_PAGE)
{
if (IsButtonChecked (GetDlgItem (hCurPage, IDC_HIDDEN_VOL)))
{
if (!IsAdmin() && !IsUacSupported ()
&& IDNO == MessageBoxW (hwndDlg, GetString ("ADMIN_PRIVILEGES_WARN_HIDVOL"),
lpszTitle, MB_ICONWARNING|MB_YESNO|MB_DEFBUTTON2))
{
return 1;
}
else
{
bHiddenVol = TRUE;
bHiddenVolHost = TRUE;
bInPlaceEncNonSys = FALSE;
}
}
else
{
bHiddenVol = FALSE;
bHiddenVolHost = FALSE;
bHiddenVolDirect = FALSE;
nNewPageNo = VOLUME_LOCATION_PAGE - 1; // Skip the hidden volume creation wizard mode selection
}
}
else if (nCurPageNo == HIDDEN_VOL_WIZARD_MODE_PAGE)
{
if (IsButtonChecked (GetDlgItem (hCurPage, IDC_HIDVOL_WIZ_MODE_DIRECT)))
bHiddenVolDirect = TRUE;
else
{
if (IsHiddenOSRunning())
{
WarningDirect ((wstring (GetString ("HIDDEN_VOL_CREATION_UNDER_HIDDEN_OS_HOWTO"))
+ L"\n\n"
+ GetString ("NOTE_BEGINNING")
+ GetString ("HIDDEN_OS_WRITE_PROTECTION_BRIEF_INFO")
+ L" "
+ GetString ("HIDDEN_OS_WRITE_PROTECTION_EXPLANATION")).c_str(), hwndDlg);
NormalCursor ();
return 1;
}
bHiddenVolDirect = FALSE;
}
}
else if (nCurPageNo == VOLUME_LOCATION_PAGE)
{
BOOL tmpbDevice;
WaitCursor();
GetWindowTextW (GetDlgItem (hCurPage, IDC_COMBO_BOX), szFileName, ARRAYSIZE (szFileName));
RelativePath2Absolute (szFileName);
CreateFullVolumePath (szDiskFile, sizeof(szDiskFile), szFileName, &tmpbDevice);
if (tmpbDevice != bDevice)
{
if (bDevice)
{
// Not a valid device path
Error ("CANNOT_CALC_SPACE", hwndDlg);
NormalCursor ();
return 1;
}
else
{
if (AskWarnYesNo ("DEVICE_SELECTED_IN_NON_DEVICE_MODE", hwndDlg) == IDNO)
{
NormalCursor ();
return 1;
}
SwitchWizardToNonSysDeviceMode ();
NormalCursor ();
return 1;
}
}
MoveEditToCombo (GetDlgItem (hCurPage, IDC_COMBO_BOX), bHistory);
if (IsMountedVolume (szDiskFile))
{
Error ("ALREADY_MOUNTED", hwndDlg);
NormalCursor ();
return 1;
}
if (bDevice)
{
switch (IsSystemDevicePath (szDiskFile, hCurPage, TRUE))
{
case 1:
case 2:
case 3:
if (AskYesNo ("CONFIRM_SYSTEM_ENCRYPTION_MODE", hwndDlg) == IDNO)
{
NormalCursor ();
return 1;
}
szFileName[0] = 0;
szDiskFile[0] = 0;
SwitchWizardToSysEncMode ();
NormalCursor ();
return 1;
case -1:
// In some environments (such as PE), the system volume is not located on a hard drive.
// Therefore, we must interpret this return code as "Not a system device path" (otherwise,
// non-system devices could not be TC-formatted in such environments). Note that this is
// rather safe, because bReliableRequired is set to TRUE.
// NOP
break;
}
}
else
{
if (CheckFileExtension(szFileName)
&& AskWarnNoYes ("EXE_FILE_EXTENSION_CONFIRM", hwndDlg) == IDNO)
{
NormalCursor ();
return 1;
}
}
bHistory = !IsButtonChecked (GetDlgItem (hCurPage, IDC_NO_HISTORY));
SaveSettings (hCurPage);
if (bHiddenVolDirect && bHiddenVolHost)
{
nNewPageNo = HIDDEN_VOL_HOST_PASSWORD_PAGE - 1;
if (bDevice)
{
if(!QueryFreeSpace (hwndDlg, GetDlgItem (hwndDlg, IDC_SPACE_LEFT), FALSE, NULL, NULL))
{
MessageBoxW (hwndDlg, GetString ("CANT_GET_VOLSIZE"), lpszTitle, ICON_HAND);
NormalCursor ();
return 1;
}
else
nHiddenVolHostSize = nVolumeSize;
}
else
{
if (!GetFileVolSize (hwndDlg, &nHiddenVolHostSize))
{
NormalCursor ();
return 1;
}
else if (IsSparseFile (hwndDlg))
{
// Hidden volumes must not be created within sparse file containers
Warning ("HIDDEN_VOL_HOST_SPARSE", hwndDlg);
NormalCursor ();
return 1;
}
}
}
else
{
if (!bHiddenVol && !bDevice)
nNewPageNo = CIPHER_PAGE - 1;
else if (bHiddenVol)
nNewPageNo = (bHiddenVolHost ? HIDDEN_VOL_HOST_PRE_CIPHER_PAGE : HIDDEN_VOL_PRE_CIPHER_PAGE) - 1;
}
}
else if (nCurPageNo == DEVICE_TRANSFORM_MODE_PAGE)
{
if (bInPlaceEncNonSys)
{
// Check requirements for non-system in-place encryption
if (!CheckRequirementsForNonSysInPlaceEnc (hwndDlg, szDiskFile, FALSE))
{
return 1;
}
// We are going to skip the Size page so we must get the size here
nVolumeSize = GetDeviceSize (szDiskFile);
if (nVolumeSize == -1)
{
handleWin32Error (MainDlg, SRC_POS);
return 1;
}
if (AskWarnYesNo ("NONSYS_INPLACE_ENC_CONFIRM_BACKUP", hwndDlg) == IDNO)
return 1;
}
nNewPageNo = CIPHER_PAGE - 1;
}
else if (nCurPageNo == HIDDEN_VOL_HOST_PRE_CIPHER_PAGE)
{
if (bHiddenVolHost)
nNewPageNo = CIPHER_PAGE - 1; // Skip the info on the hiddem volume
}
else if (nCurPageNo == CIPHER_PAGE)
{
LPARAM nIndex;
nIndex = SendMessage (GetDlgItem (hCurPage, IDC_COMBO_BOX), CB_GETCURSEL, 0, 0);
nVolumeEA = (int) SendMessage (GetDlgItem (hCurPage, IDC_COMBO_BOX), CB_GETITEMDATA, nIndex, 0);
if (!bSystemIsGPT && SysEncInEffect ()
&& EAGetCipherCount (nVolumeEA) > 1) // Cascade?
{
if (AskWarnNoYes ("CONFIRM_CASCADE_FOR_SYS_ENCRYPTION", hwndDlg) == IDNO)
return 1;
if (!bHiddenOS)
Info ("NOTE_CASCADE_FOR_SYS_ENCRYPTION", hwndDlg);
}
nIndex = SendMessage (GetDlgItem (hCurPage, IDC_COMBO_BOX_HASH_ALGO), CB_GETCURSEL, 0, 0);
hash_algo = (int) SendMessage (GetDlgItem (hCurPage, IDC_COMBO_BOX_HASH_ALGO), CB_GETITEMDATA, nIndex, 0);
RandSetHashFunction (hash_algo);
if (SysEncInEffect () || bInPlaceEncNonSys)
nNewPageNo = PASSWORD_PAGE - 1; // Skip irrelevant pages
}
else if (nCurPageNo == SIZE_PAGE)
{
wchar_t szFileSystemNameBuffer[256];
VerifySizeAndUpdate (hCurPage, TRUE);
if (!bDevice)
{
/* Verify that the volume would not be too large for the host file system */
wchar_t root[TC_MAX_PATH];
if (GetVolumePathName (szDiskFile, root, ARRAYSIZE (root))
&& GetVolumeInformation (root, NULL, 0, NULL, NULL, NULL, szFileSystemNameBuffer, ARRAYSIZE(szFileSystemNameBuffer))
&& !wcsncmp (szFileSystemNameBuffer, L"FAT32", 5))
{
// The host file system is FAT32
if (nUIVolumeSize * nMultiplier >= 4 * BYTES_PER_GB)
{
Error ("VOLUME_TOO_LARGE_FOR_FAT32", hwndDlg);
return 1;
}
}
/* 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
{
/* Ask for confirmation if the hidden volume is too large for the user to be
able to write much more data to the outer volume. */
if (((double) nUIVolumeSize / (nMaximumHiddenVolSize / nMultiplier)) > 0.85) // 85%
{
if (AskWarnNoYes ("FREE_SPACE_FOR_WRITING_TO_OUTER_VOLUME", hwndDlg) == IDNO)
return 1;
}
}
if (!(bHiddenVolDirect && bHiddenVolHost))
nNewPageNo = PASSWORD_PAGE - 1;
}
else if (nCurPageNo == PASSWORD_PAGE)
{
- if (SysEncInEffect ())
- {
- wchar_t tmpPwd[MAX_PASSWORD + 1];
- GetWindowText (GetDlgItem (hCurPage, IDC_PASSWORD), tmpPwd, iMaxPasswordLength + 1);
- }
VerifyPasswordAndUpdate (hwndDlg, GetDlgItem (MainDlg, IDC_NEXT),
GetDlgItem (hCurPage, IDC_PASSWORD),
GetDlgItem (hCurPage, IDC_VERIFY),
volumePassword.Text,
szVerify,
KeyFilesEnable && FirstKeyFile!=NULL && !SysEncInEffect());
volumePassword.Length = (unsigned __int32) strlen ((char *) volumePassword.Text);
if (volumePassword.Length > 0)
{
// Password character encoding
if (SysEncInEffect () && !CheckPasswordCharEncoding (GetDlgItem (hCurPage, IDC_PASSWORD), NULL))
{
Error ("UNSUPPORTED_CHARS_IN_PWD", hwndDlg);
return 1;
}
- // Check password length (check also done for outer volume which is not the case in TrueCrypt).
+ // Check password length (check also done for outer volume which is not the case in TrueCrypt).
else if (!CheckPasswordLength (hwndDlg, volumePassword.Length, 0, SysEncInEffect(), SysEncInEffect()? hash_algo : 0, FALSE, FALSE))
{
return 1;
}
}
// Store the password in case we need to restore it after keyfile is applied to it
if (!GetPassword (hCurPage, IDC_PASSWORD, szRawPassword, iMaxPasswordLength + 1, FALSE, TRUE))
return 1;
if (!SysEncInEffect ())
{
if (KeyFilesEnable)
{
WaitCursor ();
if (!KeyFilesApply (hwndDlg, &volumePassword, FirstKeyFile, NULL))
{
NormalCursor ();
return 1;
}
NormalCursor ();
}
}
else
{
KillTimer (hwndDlg, TIMER_ID_KEYB_LAYOUT_GUARD);
if (bKeyboardLayoutChanged)
{
// Restore the original keyboard layout
if (LoadKeyboardLayout (OrigKeyboardLayout, KLF_ACTIVATE | KLF_SUBSTITUTE_OK) == NULL)
Warning ("CANNOT_RESTORE_KEYBOARD_LAYOUT", hwndDlg);
else
bKeyboardLayoutChanged = FALSE;
}
+
}
if (!PimEnable)
{
// PIM not activated. Skip PIM page
nNewPageNo = PIM_PAGE;
volumePim = 0;
if (!CreatingHiddenSysVol() && bHiddenVol && !bHiddenVolHost)
{
if ( (volumePim == outerVolumePim)
&& (volumePassword.Length == outerVolumePassword.Length)
&& (0 == memcmp (volumePassword.Text, outerVolumePassword.Text, volumePassword.Length))
)
{
Warning ("HIDDEN_CREDS_SAME_AS_OUTER", hwndDlg);
return 1;
}
}
+ if (SysEncInEffect ())
+ {
+ nNewPageNo = SYSENC_COLLECTING_RANDOM_DATA_PAGE - 1; // Skip irrelevant pages
+ }
+
if (bInPlaceEncNonSys)
{
nNewPageNo = NONSYS_INPLACE_ENC_RAND_DATA_PAGE - 1; // Skip irrelevant pages
}
else if (WizardMode != WIZARD_MODE_SYS_DEVICE
&& !FileSize4GBLimitQuestionNeeded ()
|| CreatingHiddenSysVol()) // If we're creating a hidden volume for a hidden OS, we don't need to format it with any filesystem (the entire OS will be copied to the hidden volume sector by sector).
{
nNewPageNo = FORMAT_PAGE - 1; // Skip irrelevant pages
}
}
-
-
- if (SysEncInEffect ())
- {
- if (PimEnable)
- nNewPageNo = PIM_PAGE - 1;
- else
- {
- nNewPageNo = SYSENC_RESCUE_DISK_CREATION_PAGE - 1; // Skip irrelevant pages
-
- wchar_t tmp[RANDPOOL_DISPLAY_SIZE + 1];
- if (!bInPlaceEncNonSys)
- {
- /* Generate master key and other related data (except the rescue disk) for system encryption. */
- try
- {
- WaitCursor();
- BootEncObj->PrepareInstallation(!bWholeSysDrive, volumePassword, nVolumeEA, FIRST_MODE_OF_OPERATION_ID, hash_algo, volumePim, L"");
- }
- catch (Exception &e)
- {
- e.Show(hwndDlg);
- NormalCursor();
- return 1;
- }
- }
- KillTimer(hwndDlg, TIMER_ID_RANDVIEW);
- // Attempt to wipe the GUI field showing portions of randpool
- wmemset(tmp, L'X', ARRAYSIZE(tmp));
- tmp[ARRAYSIZE(tmp) - 1] = 0;
- SetWindowText(hRandPoolSys, tmp);
- NormalCursor();
- }
-
- }
}
else if (nCurPageNo == PIM_PAGE)
{
volumePim = GetPim (hCurPage, IDC_PIM, 0);
if (!SysEncInEffect() && (volumePim > MAX_PIM_VALUE))
{
SetFocus (GetDlgItem(hCurPage, IDC_PIM));
Error ("PIM_TOO_BIG", hwndDlg);
return 1;
}
if (!CreatingHiddenSysVol() && bHiddenVol && !bHiddenVolHost)
{
if ( (volumePim == outerVolumePim)
&& (volumePassword.Length == outerVolumePassword.Length)
&& (0 == memcmp (volumePassword.Text, outerVolumePassword.Text, volumePassword.Length))
)
{
Warning ("HIDDEN_CREDS_SAME_AS_OUTER", hwndDlg);
return 1;
}
}
if (volumePassword.Length > 0)
{
// Password character encoding
if (SysEncInEffect() && (volumePim > MAX_BOOT_PIM_VALUE))
{
SetFocus (GetDlgItem(hCurPage, IDC_PIM));
Error ("PIM_SYSENC_TOO_BIG", hwndDlg);
return 1;
}
// Check password length (check also done for outer volume which is not the case in TrueCrypt).
- else if (!CheckPasswordLength (hwndDlg, volumePassword.Length, volumePim, SysEncInEffect(), SysEncInEffect()? hash_algo : 0, FALSE, FALSE))
+ else if (!CheckPasswordLength (hwndDlg, volumePassword.Length, volumePim, SysEncInEffect(), SysEncInEffect()? hash_algo : 0, TRUE, FALSE))
{
return 1;
}
}
+ if (SysEncInEffect ())
+ {
+
+ nNewPageNo = SYSENC_COLLECTING_RANDOM_DATA_PAGE - 1; // Skip irrelevant pages
+ }
+
if (bInPlaceEncNonSys)
{
nNewPageNo = NONSYS_INPLACE_ENC_RAND_DATA_PAGE - 1; // Skip irrelevant pages
}
else if (WizardMode != WIZARD_MODE_SYS_DEVICE
&& !FileSize4GBLimitQuestionNeeded ()
|| CreatingHiddenSysVol()) // If we're creating a hidden volume for a hidden OS, we don't need to format it with any filesystem (the entire OS will be copied to the hidden volume sector by sector).
{
nNewPageNo = FORMAT_PAGE - 1; // Skip irrelevant pages
}
-
- if (SysEncInEffect ())
- {
- nNewPageNo = SYSENC_RESCUE_DISK_CREATION_PAGE - 1; // Skip irrelevant pages
-
- wchar_t tmp[RANDPOOL_DISPLAY_SIZE + 1];
- if (!bInPlaceEncNonSys)
- {
- /* Generate master key and other related data (except the rescue disk) for system encryption. */
- try
- {
- WaitCursor();
- BootEncObj->PrepareInstallation(!bWholeSysDrive, volumePassword, nVolumeEA, FIRST_MODE_OF_OPERATION_ID, hash_algo, volumePim, L"");
- }
- catch (Exception &e)
- {
- e.Show(hwndDlg);
- NormalCursor();
- return 1;
- }
- }
- KillTimer(hwndDlg, TIMER_ID_RANDVIEW);
- // Attempt to wipe the GUI field showing portions of randpool
- wmemset(tmp, L'X', ARRAYSIZE(tmp));
- tmp[ARRAYSIZE(tmp) - 1] = 0;
- SetWindowText(hRandPoolSys, tmp);
- NormalCursor();
- }
}
else if (nCurPageNo == HIDDEN_VOL_HOST_PASSWORD_PAGE
|| nCurPageNo == NONSYS_INPLACE_ENC_RESUME_PASSWORD_PAGE)
{
WaitCursor ();
if (!GetPassword (hCurPage, IDC_PASSWORD_DIRECT, (char*) volumePassword.Text, iMaxPasswordLength + 1, FALSE, TRUE))
{
NormalCursor ();
return 1;
}
volumePassword.Length = (unsigned __int32) strlen ((char *) volumePassword.Text);
hash_algo = (int) SendMessage (GetDlgItem (hCurPage, IDC_PKCS5_PRF_ID), CB_GETITEMDATA, SendMessage (GetDlgItem (hCurPage, IDC_PKCS5_PRF_ID), CB_GETCURSEL, 0, 0), 0);
volumePim = GetPim (hCurPage, IDC_PIM, 0);
// Store the password in case we need to restore it after keyfile is applied to it
if (!GetPassword (hCurPage, IDC_PASSWORD_DIRECT, szRawPassword, iMaxPasswordLength + 1, FALSE, TRUE))
{
NormalCursor ();
return 1;
}
if (KeyFilesEnable)
{
KeyFilesApply (hwndDlg, &volumePassword, FirstKeyFile, NULL);
}
if (!bInPlaceEncNonSys)
{
/* Mount the volume which is to host the new hidden volume as read only */
if (hiddenVolHostDriveNo >= 0) // If the hidden volume host is currently mounted (e.g. after previous unsuccessful dismount attempt)
{
BOOL tmp_result;
// Dismount the hidden volume host (in order to remount it as read-only subsequently)
while (!(tmp_result = UnmountVolume (hwndDlg, hiddenVolHostDriveNo, TRUE)))
{
if (MessageBoxW (hwndDlg, GetString ("CANT_DISMOUNT_OUTER_VOL"), lpszTitle, MB_RETRYCANCEL) != IDRETRY)
{
// Cancel
NormalCursor();
return 1;
}
}
if (tmp_result) // If dismounted
hiddenVolHostDriveNo = -1;
}
if (hiddenVolHostDriveNo < 0) // If the hidden volume host is not mounted
{
int retCode;
// Mount the hidden volume host as read-only (to ensure consistent and secure
// results of the volume bitmap scanning)
switch (MountHiddenVolHost (hwndDlg, szDiskFile, &hiddenVolHostDriveNo, &volumePassword, hash_algo, volumePim, TRUE))
{
case ERR_NO_FREE_DRIVES:
NormalCursor ();
MessageBoxW (hwndDlg, GetString ("NO_FREE_DRIVE_FOR_OUTER_VOL"), lpszTitle, ICON_HAND);
return 1;
case ERR_VOL_MOUNT_FAILED:
case ERR_PASSWORD_WRONG:
NormalCursor ();
return 1;
case 0:
/* Hidden volume host successfully mounted as read-only */
// Verify that the outer volume contains a suitable file system, retrieve cluster size, and
// scan the volume bitmap
if (!IsAdmin () && IsUacSupported ())
retCode = UacAnalyzeHiddenVolumeHost (hwndDlg, &hiddenVolHostDriveNo, GetVolumeDataAreaSize (FALSE, nHiddenVolHostSize), &realClusterSize, &nbrFreeClusters);
else
retCode = AnalyzeHiddenVolumeHost (hwndDlg, &hiddenVolHostDriveNo, GetVolumeDataAreaSize (FALSE, nHiddenVolHostSize), &realClusterSize, &nbrFreeClusters);
switch (retCode)
{
case -1: // Fatal error
CloseVolumeExplorerWindows (hwndDlg, hiddenVolHostDriveNo);
if (UnmountVolume (hwndDlg, hiddenVolHostDriveNo, TRUE))
hiddenVolHostDriveNo = -1;
AbortProcessSilent ();
break;
case 0: // Unsupported file system (or other non-fatal error which has already been reported)
if (bHiddenVolDirect)
{
CloseVolumeExplorerWindows (hwndDlg, hiddenVolHostDriveNo);
if (UnmountVolume (hwndDlg, hiddenVolHostDriveNo, TRUE))
hiddenVolHostDriveNo = -1;
}
NormalCursor ();
return 1;
case 1:
// Determine the maximum possible size of the hidden volume
if (DetermineMaxHiddenVolSize (hwndDlg) < 1)
{
// Non-fatal error while determining maximum possible size of the hidden volume
NormalCursor();
return 1;
}
else
{
BOOL tmp_result;
/* Maximum possible size of the hidden volume successfully determined */
// Dismount the hidden volume host
while (!(tmp_result = UnmountVolume (hwndDlg, hiddenVolHostDriveNo, TRUE)))
{
if (MessageBoxW (hwndDlg, GetString ("CANT_DISMOUNT_OUTER_VOL"), lpszTitle, MB_RETRYCANCEL) != IDRETRY)
{
// Cancel
NormalCursor();
return 1;
}
}
if (tmp_result) // If dismounted
{
hiddenVolHostDriveNo = -1;
bHiddenVolHost = FALSE;
bHiddenVolFinished = FALSE;
// save the outer volume password to use it for comparison with hidden volume one
memcpy (&outerVolumePassword, &volumePassword, sizeof (volumePassword));
outerVolumePim = volumePim;
// Clear the outer volume password
WipePasswordsAndKeyfiles (false);
RestoreDefaultKeyFilesParam ();
EnableWindow (GetDlgItem (MainDlg, IDC_NEXT), TRUE);
NormalCursor ();
nNewPageNo = HIDDEN_VOL_HOST_PRE_CIPHER_PAGE;
}
}
break;
}
break;
}
}
}
else if (bInPlaceEncNonSysResumed)
{
/* Scan all available partitions to discover all partitions where non-system in-place
encryption/decryption has been interrupted. */
BOOL tmpbDevice;
NormalCursor ();
ShowWaitDialog (hwndDlg, TRUE, ResumeInPlaceEncWaitThreadProc, NULL);
WaitCursor();
if (DeferredNonSysInPlaceEncDevices.empty())
{
Warning ("FOUND_NO_PARTITION_W_DEFERRED_INPLACE_ENC", hwndDlg);
NormalCursor();
return 1;
}
else if (DeferredNonSysInPlaceEncDevices.size() == 1)
{
CreateFullVolumePath (szDiskFile, sizeof(szDiskFile), DeferredNonSysInPlaceEncDevices.front().Path.c_str(), &tmpbDevice);
nVolumeSize = GetDeviceSize (szDiskFile);
if (nVolumeSize == -1)
{
handleWin32Error (MainDlg, SRC_POS);
NormalCursor();
return 1;
}
nNewPageNo = NONSYS_INPLACE_ENC_TRANSFORM_PAGE - 1; // Skip irrelevant pages
}
NormalCursor();
}
else
{
/* Try to mount the non-system volume to decrypt in place (the process has not started yet, we are NOT trying to resume it).
We will try to mount it using the backup header, which we require to work (i.e. be non-damaged) before we start writing
to the volume (the primary header will be overwritten by decrypted data soon after the decryption process begins, so the
backup header will contain the only copy of the master key). */
int driveNo = -1;
// The volume may already be mounted. We need to dismount it first in order to verify the supplied password/keyfile(s) is/are correct.
if (IsMountedVolume (szFileName))
{
driveNo = GetMountedVolumeDriveNo (szFileName);
if (driveNo == -1
|| !UnmountVolume (hwndDlg, driveNo, TRUE))
{
handleWin32Error (MainDlg, SRC_POS);
AbortProcess ("CANT_DISMOUNT_VOLUME");
}
}
driveNo = GetLastAvailableDrive ();
if (driveNo < 0)
AbortProcess ("NO_FREE_DRIVES");
MountOptions mountOptions;
ZeroMemory (&mountOptions, sizeof (mountOptions));
mountOptions.UseBackupHeader = FALSE; // This must be FALSE at this point because otherwise we wouldn't be able to detect a legacy volume
mountOptions.ReadOnly = TRUE;
mountOptions.Removable = ConfigReadInt ("MountVolumesRemovable", FALSE);
// 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)
{
NormalCursor();
return 1;
}
{
DWORD dwResult;
VOLUME_PROPERTIES_STRUCT volProp;
memset (&volProp, 0, sizeof(volProp));
volProp.driveNo = driveNo;
if (!DeviceIoControl (hDriver, TC_IOCTL_GET_VOLUME_PROPERTIES, &volProp, sizeof (volProp), &volProp, sizeof (volProp), &dwResult, NULL) || dwResult == 0)
{
handleWin32Error (hwndDlg, SRC_POS);
UnmountVolume (hwndDlg, driveNo, TRUE);
AbortProcess ("CANT_GET_VOL_INFO");
}
if (volProp.volFormatVersion == TC_VOLUME_FORMAT_VERSION_PRE_6_0)
{
UnmountVolume (hwndDlg, driveNo, TRUE);
AbortProcess ("NONSYS_INPLACE_DECRYPTION_BAD_VOL_FORMAT");
}
if (volProp.hiddenVolume)
{
UnmountVolume (hwndDlg, driveNo, TRUE);
AbortProcess ("NONSYS_INPLACE_DECRYPTION_CANT_DECRYPT_HID_VOL");
}
}
// Remount the volume using the backup header to verify it is working
if (!UnmountVolume (hwndDlg, driveNo, TRUE))
{
handleWin32Error (MainDlg, SRC_POS);
AbortProcess ("CANT_DISMOUNT_VOLUME");
}
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)
{
NormalCursor();
return 1;
}
if (!UnmountVolume (hwndDlg, driveNo, TRUE))
{
handleWin32Error (MainDlg, SRC_POS);
AbortProcess ("CANT_DISMOUNT_VOLUME");
}
BOOL tmpbDevice;
CreateFullVolumePath (szDiskFile, sizeof(szDiskFile), szFileName, &tmpbDevice);
nVolumeSize = GetDeviceSize (szDiskFile);
if (nVolumeSize == -1)
{
handleWin32Error (MainDlg, SRC_POS);
AbortProcessSilent ();
}
nNewPageNo = NONSYS_INPLACE_ENC_TRANSFORM_PAGE - 1; // Skip irrelevant pages
NormalCursor();
}
}
else if (nCurPageNo == FILESYS_PAGE)
{
if (!bHiddenVol && IsHiddenOSRunning() && Get2RadButtonPageAnswer() == 1)
{
// The user wants to store files larger than 4GB on the non-hidden volume about to be created and a hidden OS is running
WarningDirect ((wstring (GetString ("CANNOT_SATISFY_OVER_4G_FILE_SIZE_REQ"))
+ L" "
+ GetString ("CANNOT_CREATE_NON_HIDDEN_NTFS_VOLUMES_UNDER_HIDDEN_OS")
+ L"\n\n"
+ GetString ("NOTE_BEGINNING")
+ GetString ("HIDDEN_OS_WRITE_PROTECTION_BRIEF_INFO")
+ L" "
+ GetString ("HIDDEN_OS_WRITE_PROTECTION_EXPLANATION")).c_str(), hwndDlg);
return 1;
}
if (nNeedToStoreFilesOver4GB != Get2RadButtonPageAnswer())
fileSystem = FILESYS_NONE; // The user may have gone back and changed the answer, so default file system must be reselected
nNeedToStoreFilesOver4GB = Get2RadButtonPageAnswer();
nNewPageNo = FORMAT_PAGE - 1; // Skip irrelevant pages
}
else if (nCurPageNo == SYSENC_COLLECTING_RANDOM_DATA_PAGE
|| nCurPageNo == NONSYS_INPLACE_ENC_RAND_DATA_PAGE)
{
wchar_t tmp[RANDPOOL_DISPLAY_SIZE+1];
if (!bInPlaceEncNonSys)
{
/* Generate master key and other related data (except the rescue disk) for system encryption. */
try
{
WaitCursor();
BootEncObj->PrepareInstallation (!bWholeSysDrive, volumePassword, nVolumeEA, FIRST_MODE_OF_OPERATION_ID, hash_algo, volumePim, L"");
}
catch (Exception &e)
{
e.Show (hwndDlg);
NormalCursor ();
return 1;
}
}
KillTimer (hwndDlg, TIMER_ID_RANDVIEW);
// Attempt to wipe the GUI field showing portions of randpool
wmemset (tmp, L'X', ARRAYSIZE(tmp));
tmp [ARRAYSIZE(tmp)-1] = 0;
SetWindowText (hRandPoolSys, tmp);
NormalCursor ();
}
else if (nCurPageNo == SYSENC_KEYS_GEN_PAGE)
{
wchar_t tmp[KEY_GUI_VIEW_SIZE+1];
// Attempt to wipe the GUI fields showing portions of the master and header keys
wmemset (tmp, L'X', ARRAYSIZE(tmp));
tmp [ARRAYSIZE(tmp)-1] = 0;
SetWindowText (hMasterKey, tmp);
SetWindowText (hHeaderKey, tmp);
}
else if (nCurPageNo == SYSENC_RESCUE_DISK_CREATION_PAGE)
{
/* Generate rescue disk for boot encryption */
GetWindowText (GetDlgItem (hCurPage, IDC_RESCUE_DISK_ISO_PATH), szRescueDiskISO, ARRAYSIZE (szRescueDiskISO));
bDontVerifyRescueDisk = GetCheckBox (hCurPage, IDC_SKIP_RESCUE_VERIFICATION);
try
{
WaitCursor();
BootEncObj->CreateRescueIsoImage (true, szRescueDiskISO);
}
catch (Exception &e)
{
e.Show (hwndDlg);
NormalCursor ();
return 1;
}
if (!bSystemIsGPT)
{
retryCDDriveCheck:
if (!bDontVerifyRescueDisk && !BootEncObj->IsCDRecorderPresent())
{
char *multiChoiceStr[] = { 0, "CD_BURNER_NOT_PRESENT",
"CD_BURNER_NOT_PRESENT_WILL_STORE_ISO",
"CD_BURNER_NOT_PRESENT_WILL_CONNECT_LATER",
"CD_BURNER_NOT_PRESENT_CONNECTED_NOW",
0 };
switch (AskMultiChoice ((void **) multiChoiceStr, FALSE, hwndDlg))
{
case 1:
wchar_t msg[8192];
StringCchPrintfW (msg, array_capacity (msg), GetString ("CD_BURNER_NOT_PRESENT_WILL_STORE_ISO_INFO"), szRescueDiskISO);
WarningDirect (msg, hwndDlg);
Warning ("RESCUE_DISK_BURN_NO_CHECK_WARN", hwndDlg);
bDontVerifyRescueDisk = TRUE;
nNewPageNo = SYSENC_RESCUE_DISK_VERIFIED_PAGE;
break;
case 2:
AbortProcessSilent();
case 3:
break;
default:
goto retryCDDriveCheck;
}
}
if (IsWindowsIsoBurnerAvailable() && !bDontVerifyRescueDisk)
Info ("RESCUE_DISK_WIN_ISOBURN_PRELAUNCH_NOTE", hwndDlg);
}
NormalCursor ();
}
else if (nCurPageNo == SYSENC_RESCUE_DISK_BURN_PAGE)
{
if (!bDontVerifyRescueDisk)
{
/* Verify that the rescue disk has been written correctly */
try
{
WaitCursor();
if (!BootEncObj->VerifyRescueDisk ())
{
wchar_t szTmp[8000];
if (bSystemIsGPT)
{
StringCbCopyW (szTmp, sizeof(szTmp), GetString ("RESCUE_DISK_EFI_CHECK_FAILED"));
}
else
{
StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("RESCUE_DISK_CHECK_FAILED"),
IsWindowsIsoBurnerAvailable () ? L"" : GetString ("RESCUE_DISK_CHECK_FAILED_SENTENCE_APPENDIX"));
}
ErrorDirect (szTmp, hwndDlg);
NormalCursor ();
#ifndef _DEBUG
return 1;
#endif
}
}
catch (Exception &e)
{
e.Show (hwndDlg);
NormalCursor ();
return 1;
}
NormalCursor ();
}
else
{
Warning ("RESCUE_DISK_BURN_NO_CHECK_WARN", hwndDlg);
nNewPageNo = SYSENC_RESCUE_DISK_VERIFIED_PAGE; // Skip irrelevant pages
}
}
else if (nCurPageNo == SYSENC_WIPE_MODE_PAGE
|| nCurPageNo == NONSYS_INPLACE_ENC_WIPE_MODE_PAGE)
{
if (nWipeMode > 0
&& AskWarnYesNo ("WIPE_MODE_WARN", hwndDlg) == IDNO)
return 1;
}
else if (nCurPageNo == SYSENC_PRETEST_INFO_PAGE)
{
if (LocalizationActive
&& AskWarnYesNo ("PREBOOT_NOT_LOCALIZED", hwndDlg) == IDNO)
return 1;
bConfirmQuitSysEncPretest = TRUE;
if (!bHiddenOS) // This text is not tailored to hidden OS
TextInfoDialogBox (TC_TBXID_SYS_ENCRYPTION_PRETEST);
if (AskWarnYesNo ("CONFIRM_RESTART", hwndDlg) == IDNO)
return 1;
/* Install the pre-boot authentication component and initiate the system encryption pretest.
If we are creating a hidden OS, pretest is omitted and OS cloning will follow. */
try
{
WaitCursor();
#if 0
// Make sure the Rescue Disk is not in the drive
while (BootEncObj->VerifyRescueDisk ())
{
Error ("REMOVE_RESCUE_DISK_FROM_DRIVE");
}
#endif
BootEncObj->Install (bHiddenOS ? true : false, hash_algo);
}
catch (Exception &e)
{
e.Show (hwndDlg);
Error (bHiddenOS ? "CANNOT_INITIATE_HIDDEN_OS_CREATION" : "CANNOT_INITIATE_SYS_ENCRYPTION_PRETEST", hwndDlg);
NormalCursor ();
return 1;
}
/* Add the main TrueCrypt app to the system startup sequence (the TrueCrypt Background Task), which
we need e.g. for notifications about prevented hibernation, about hidden OS leak protection, about
inconsistent hidden OS installs (TrueCrypt upgraded in the decoy system but not in the hidden one), etc.
Note that this must be done before calling ChangeSystemEncryptionStatus(), which broadcasts the change,
so that the main app (if it's running with different cached settings) will not overwrite our new
settings when it exits. */
bStartOnLogon = TRUE;
SaveSettings (NULL);
ManageStartupSeq ();
if (bHiddenOS)
{
/* When we are going to create a hidden OS, the system encryption status is set
to SYSENC_STATUS_PRETEST (not to any special hidden-OS status), in case the XML
configuration file and its properties somehow leaks somewhere outside the system
partition (which will be wiped later on) indicating that a hidden OS has been created
on the computer. Instead, we update our raw config flags in the master boot record
(which is also altered when our boot loader is installed). */
if (!ChangeSystemEncryptionStatus (SYSENC_STATUS_PRETEST)
|| !ChangeHiddenOSCreationPhase (TC_HIDDEN_OS_CREATION_PHASE_CLONING))
{
ChangeSystemEncryptionStatus (SYSENC_STATUS_NONE);
Error ("CANNOT_INITIATE_HIDDEN_OS_CREATION", hwndDlg);
NormalCursor ();
return 1;
}
}
else if (!ChangeSystemEncryptionStatus (SYSENC_STATUS_PRETEST))
{
Error ("CANNOT_INITIATE_SYS_ENCRYPTION_PRETEST", hwndDlg);
NormalCursor ();
return 1;
}
// Add the wizard to the system startup sequence
ManageStartupSeqWiz (FALSE, L"/acsysenc");
EndMainDlg (MainDlg);
try
{
BootEncObj->RestartComputer ();
}
catch (Exception &e)
{
e.Show (hwndDlg);
}
return 1;
}
else if (nCurPageNo == SYSENC_PRETEST_RESULT_PAGE)
{
TextInfoDialogBox (TC_TBXID_SYS_ENC_RESCUE_DISK);
// Begin the actual encryption process
ChangeSystemEncryptionStatus (SYSENC_STATUS_ENCRYPTING);
}
else if (nCurPageNo == SYSENC_ENCRYPTION_PAGE
&& CreateSysEncMutex ())
{
// The 'Next' button functions as Finish or Resume
if (SystemEncryptionStatus != SYSENC_STATUS_NONE)
{
try
{
// Resume
SysEncResume ();
}
catch (Exception &e)
{
e.Show (hwndDlg);
}
}
else
{
// Finish
PostMessage (hwndDlg, TC_APPMSG_FORMAT_USER_QUIT, 0, 0);
}
return 1;
}
else if (nCurPageNo == NONSYS_INPLACE_ENC_RESUME_PARTITION_SEL_PAGE)
{
nNewPageNo = NONSYS_INPLACE_ENC_TRANSFORM_PAGE - 1; // Skip irrelevant pages
}
else if (nCurPageNo == NONSYS_INPLACE_ENC_TRANSFORM_PAGE)
{
/* In-place encryption start (the 'Next' button has been clicked) */
if (bInPlaceDecNonSys
&& !bInPlaceEncNonSysResumed
&& AskWarnYesNo ("NONSYS_INPLACE_ENC_CONFIRM_BACKUP", hwndDlg) == IDNO)
{
// Cancel
return 1;
}
NonSysInplaceEncResume ();
return 1;
}
else if (nCurPageNo == NONSYS_INPLACE_ENC_TRANSFORM_FINISHED_PAGE)
{
PostMessage (hwndDlg, TC_APPMSG_FORMAT_USER_QUIT, 0, 0);
return 1;
}
else if (nCurPageNo == NONSYS_INPLACE_DEC_TRANSFORM_FINISHED_DRIVE_LETTER_PAGE)
{
BOOL bDrvLetterAssignResult = FALSE;
int tmpDriveLetter = (int) SendMessage (GetDlgItem (hCurPage, IDC_DRIVE_LETTER_LIST),
CB_GETITEMDATA,
SendMessage (GetDlgItem (hCurPage, IDC_DRIVE_LETTER_LIST), CB_GETCURSEL, 0, 0),
0);
if (tmpDriveLetter < 0)
tmpDriveLetter = GetFirstAvailableDrive ();
do
{
wchar_t szDriveLetter[] = {L'A', L':', 0 };
wchar_t rootPath[] = {L'A', L':', L'\\', 0 };
wchar_t uniqVolName[MAX_PATH+1] = { 0 };
rootPath[0] += (wchar_t) tmpDriveLetter;
szDriveLetter[0] += (wchar_t) tmpDriveLetter;
if (DefineDosDevice (DDD_RAW_TARGET_PATH, szDriveLetter, szDiskFile))
{
bDrvLetterAssignResult = GetVolumeNameForVolumeMountPoint (rootPath, uniqVolName, MAX_PATH);
DefineDosDevice (DDD_RAW_TARGET_PATH|DDD_REMOVE_DEFINITION|DDD_EXACT_MATCH_ON_REMOVE,
szDriveLetter,
szDiskFile);
if (bDrvLetterAssignResult)
{
if (SetVolumeMountPoint (rootPath, uniqVolName) == 0)
bDrvLetterAssignResult = FALSE;
}
}
if (!bDrvLetterAssignResult)
{
if (AskErrYesNo ("ERR_CANNOT_ASSIGN_DRIVE_LETTER_NONSYS_DEC", hwndDlg) == IDNO)
break;
}
} while (bDrvLetterAssignResult == FALSE);
bConfirmQuit = FALSE;
PostMessage (hwndDlg, TC_APPMSG_FORMAT_USER_QUIT, 0, 0);
return 1;
}
else if (nCurPageNo == FORMAT_PAGE)
{
/* Format start (the 'Next' button has been clicked on the Format page) */
static BOOL g_bFastStartupCheckDone = FALSE;
if (bVolTransformThreadRunning || bVolTransformThreadToRun)
return 1;
bVolTransformThreadCancel = FALSE;
bVolTransformThreadToRun = TRUE;
// check if Fast Startup is enabled and if yes then offer to disable it
if (!g_bFastStartupCheckDone)
{
BOOL bHibernateEnabled = FALSE, bHiberbootEnabled = FALSE;
if (GetHibernateStatus (bHibernateEnabled, bHiberbootEnabled) && bHiberbootEnabled)
{
if (AskWarnYesNo ("CONFIRM_DISABLE_FAST_STARTUP", hwndDlg) == IDYES)
{
if (!IsAdmin () && IsUacSupported ())
UacWriteLocalMachineRegistryDword (hwndDlg, L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Power", L"HiberbootEnabled", 0);
else
WriteLocalMachineRegistryDword (L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Power", L"HiberbootEnabled", 0);
}
}
g_bFastStartupCheckDone = true;
}
fileSystem = (int) SendMessage (GetDlgItem (hCurPage, IDC_FILESYS), CB_GETITEMDATA,
SendMessage (GetDlgItem (hCurPage, IDC_FILESYS), CB_GETCURSEL, 0, 0) , 0);
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));
dynamicFormat = IsButtonChecked (GetDlgItem (hCurPage, SPARSE_FILE));
if (!dynamicFormat && !bDevice && !(bHiddenVol && !bHiddenVolHost) && (nVolumeSize > (ULONGLONG) nAvailableFreeSpace))
{
Error("VOLUME_TOO_LARGE_FOR_HOST", hwndDlg);
bVolTransformThreadToRun = FALSE;
return 1;
}
if (!bHiddenVol && IsHiddenOSRunning())
{
// Creating a non-hidden volume under a hidden OS
if (fileSystem == FILESYS_NTFS || fileSystem == FILESYS_EXFAT || fileSystem == FILESYS_REFS)
{
WarningDirect ((wstring (GetString ("CANNOT_CREATE_NON_HIDDEN_NTFS_VOLUMES_UNDER_HIDDEN_OS"))
+ L"\n\n"
+ GetString ("NOTE_BEGINNING")
+ GetString ("HIDDEN_OS_WRITE_PROTECTION_BRIEF_INFO")
+ L" "
+ GetString ("HIDDEN_OS_WRITE_PROTECTION_EXPLANATION")).c_str(), hwndDlg);
if (GetVolumeDataAreaSize (FALSE, nVolumeSize) <= TC_MAX_FAT_SECTOR_COUNT * GetFormatSectorSize()
&& AskYesNo("OFFER_FAT_FORMAT_ALTERNATIVE", hwndDlg) == IDYES)
{
fileSystem = FILESYS_FAT;
SelectAlgo (GetDlgItem (hCurPage, IDC_FILESYS), (int *) &fileSystem);
}
else
{
if (GetVolumeDataAreaSize (FALSE, nVolumeSize) > TC_MAX_FAT_SECTOR_COUNT * GetFormatSectorSize())
Info ("FAT_NOT_AVAILABLE_FOR_SO_LARGE_VOLUME", hwndDlg);
bVolTransformThreadToRun = FALSE;
return 1;
}
}
}
if (bHiddenVolHost)
{
hiddenVolHostDriveNo = -1;
nMaximumHiddenVolSize = 0;
if (fileSystem == FILESYS_NTFS || fileSystem == FILESYS_EXFAT)
{
if (bHiddenOS && (fileSystem == FILESYS_NTFS)
&& (double) nVolumeSize / GetSystemPartitionSize() < MIN_HIDDENOS_DECOY_PARTITION_SIZE_RATIO_NTFS)
{
Error("OUTER_VOLUME_TOO_SMALL_FOR_HIDDEN_OS_NTFS", hwndDlg);
if (GetVolumeDataAreaSize (FALSE, nVolumeSize) <= TC_MAX_FAT_SECTOR_COUNT * GetFormatSectorSize()
&& AskYesNo("OFFER_FAT_FORMAT_ALTERNATIVE", hwndDlg) == IDYES)
{
fileSystem = FILESYS_FAT;
SelectAlgo (GetDlgItem (hCurPage, IDC_FILESYS), (int *) &fileSystem);
}
else
{
if (GetVolumeDataAreaSize (FALSE, nVolumeSize) > TC_MAX_FAT_SECTOR_COUNT * GetFormatSectorSize())
Info ("FAT_NOT_AVAILABLE_FOR_SO_LARGE_VOLUME", hwndDlg);
bVolTransformThreadToRun = FALSE;
return 1;
}
}
if (fileSystem == FILESYS_NTFS || fileSystem == FILESYS_EXFAT) // The file system may have been changed in the previous block
{
if ((fileSystem == FILESYS_NTFS) && (GetVolumeDataAreaSize (FALSE, nVolumeSize) <= TC_MAX_FAT_SECTOR_COUNT * GetFormatSectorSize())
&& AskYesNo("HIDDEN_VOL_HOST_NTFS_ASK", hwndDlg) == IDNO)
{
bVolTransformThreadToRun = FALSE;
return 1;
}
}
}
}
else if (bHiddenVol)
{
// Hidden volume is always quick-formatted.
quickFormat = TRUE;
dynamicFormat = FALSE;
}
if (fileSystem == FILESYS_FAT
&& nNeedToStoreFilesOver4GB == 1
&& AskWarnNoYes("CONFIRM_FAT_FOR_FILES_OVER_4GB", hwndDlg) == IDNO)
{
bVolTransformThreadToRun = FALSE;
return 1;
}
EnableWindow (GetDlgItem (hwndDlg, IDC_PREV), FALSE);
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, SPARSE_FILE), FALSE);
EnableWindow (GetDlgItem (hCurPage, IDC_CLUSTERSIZE), FALSE);
EnableWindow (GetDlgItem (hCurPage, IDC_FILESYS), FALSE);
EnableWindow (GetDlgItem (hCurPage, IDC_ABORT_BUTTON), TRUE);
SetFocus (GetDlgItem (hCurPage, IDC_ABORT_BUTTON));
// Increase cluster size if it's too small for this volume size (causes size of
// free space to be 0). Note that the below constant 0x2000000 is based on
// results of tests performed under Windows XP.
if (fileSystem == FILESYS_FAT && clusterSize > 0)
{
BOOL fixed = FALSE;
while (clusterSize < 128
&& nVolumeSize / (clusterSize * GetFormatSectorSize()) > 0x2000000)
{
clusterSize *= 2;
fixed = TRUE;
}
if (fixed)
MessageBoxW (hwndDlg, GetString ("CLUSTER_TOO_SMALL"), lpszTitle, MB_ICONWARNING);
}
LastDialogId = "FORMAT_IN_PROGRESS";
ArrowWaitCursor ();
_beginthread (volTransformThreadFunction, 0, MainDlg);
return 1;
}
else if (nCurPageNo == FORMAT_FINISHED_PAGE)
{
if (!bHiddenVol || bHiddenVolFinished)
{
/* Wizard loop restart */
if (bHiddenOS)
{
if (!ChangeWizardMode (WIZARD_MODE_SYS_DEVICE))
return 1;
// Hidden volume for hidden OS has been created. Now we will prepare our boot loader
// that will handle the OS cloning.
try
{
WaitCursor();
BootEncObj->PrepareHiddenOSCreation (nVolumeEA, FIRST_MODE_OF_OPERATION_ID, hash_algo);
}
catch (Exception &e)
{
e.Show (MainDlg);
NormalCursor();
return 1;
}
bHiddenVol = FALSE;
LoadPage (hwndDlg, SYSENC_PRETEST_INFO_PAGE);
}
else
LoadPage (hwndDlg, INTRO_PAGE);
SetWindowTextW (GetDlgItem (MainDlg, IDCANCEL), GetString ("CANCEL"));
bHiddenVolFinished = FALSE;
WipePasswordsAndKeyfiles (true);
return 1;
}
else
{
/* We're going to scan the bitmap of the hidden volume host (in the non-Direct hidden volume wizard mode) */
int retCode;
WaitCursor ();
if (hiddenVolHostDriveNo != -1) // If the hidden volume host is mounted
{
BOOL tmp_result;
// Dismount the hidden volume host (in order to remount it as read-only subsequently)
CloseVolumeExplorerWindows (hwndDlg, hiddenVolHostDriveNo);
while (!(tmp_result = UnmountVolume (hwndDlg, hiddenVolHostDriveNo, TRUE)))
{
if (MessageBoxW (hwndDlg, GetString ("CANT_DISMOUNT_OUTER_VOL"), lpszTitle, MB_RETRYCANCEL | MB_ICONERROR | MB_SETFOREGROUND) != IDRETRY)
{
// Cancel
NormalCursor();
return 1;
}
}
if (tmp_result) // If dismounted
hiddenVolHostDriveNo = -1;
}
if (hiddenVolHostDriveNo < 0) // If the hidden volume host is not mounted
{
// Remount the hidden volume host as read-only (to ensure consistent and secure
// results of the volume bitmap scanning)
switch (MountHiddenVolHost (hwndDlg, szDiskFile, &hiddenVolHostDriveNo, &volumePassword, hash_algo, volumePim, TRUE))
{
case ERR_NO_FREE_DRIVES:
MessageBoxW (hwndDlg, GetString ("NO_FREE_DRIVE_FOR_OUTER_VOL"), lpszTitle, ICON_HAND);
NormalCursor ();
return 1;
case ERR_VOL_MOUNT_FAILED:
case ERR_PASSWORD_WRONG:
NormalCursor ();
return 1;
case 0:
/* Hidden volume host successfully mounted as read-only */
// Verify that the outer volume contains a suitable file system, retrieve cluster size, and
// scan the volume bitmap
if (!IsAdmin () && IsUacSupported ())
retCode = UacAnalyzeHiddenVolumeHost (hwndDlg, &hiddenVolHostDriveNo, GetVolumeDataAreaSize (FALSE, nHiddenVolHostSize), &realClusterSize, &nbrFreeClusters);
else
retCode = AnalyzeHiddenVolumeHost (hwndDlg, &hiddenVolHostDriveNo, GetVolumeDataAreaSize (FALSE, nHiddenVolHostSize), &realClusterSize, &nbrFreeClusters);
switch (retCode)
{
case -1: // Fatal error
CloseVolumeExplorerWindows (hwndDlg, hiddenVolHostDriveNo);
if (UnmountVolume (hwndDlg, hiddenVolHostDriveNo, TRUE))
hiddenVolHostDriveNo = -1;
AbortProcessSilent ();
break;
case 0: // Unsupported file system (or other non-fatal error which has already been reported)
NormalCursor ();
return 1;
case 1: // Success
{
BOOL tmp_result;
// Determine the maximum possible size of the hidden volume
if (DetermineMaxHiddenVolSize (hwndDlg) < 1)
{
NormalCursor ();
goto ovf_end;
}
/* Maximum possible size of the hidden volume successfully determined */
// Dismount the hidden volume host
while (!(tmp_result = UnmountVolume (hwndDlg, hiddenVolHostDriveNo, TRUE)))
{
if (MessageBoxW (hwndDlg, GetString ("CANT_DISMOUNT_OUTER_VOL"), lpszTitle, MB_RETRYCANCEL) != IDRETRY)
{
// Cancel
NormalCursor ();
goto ovf_end;
}
}
// Prevent having to recreate the outer volume due to inadvertent exit
bConfirmQuit = TRUE;
hiddenVolHostDriveNo = -1;
nNewPageNo = HIDDEN_VOL_HOST_PRE_CIPHER_PAGE;
// save the outer volume password to use it for comparison with hidden volume one
memcpy (&outerVolumePassword, &volumePassword, sizeof (volumePassword));
outerVolumePim = volumePim;
// Clear the outer volume password
WipePasswordsAndKeyfiles (false);
EnableWindow (GetDlgItem (MainDlg, IDC_NEXT), TRUE);
NormalCursor ();
}
break;
}
break;
}
}
}
}
else if (nCurPageNo == DEVICE_WIPE_PAGE)
{
if (AskWarnOkCancel (bHiddenOS && IsHiddenOSRunning() ? "CONFIRM_WIPE_START_DECOY_SYS_PARTITION" : "CONFIRM_WIPE_START", hwndDlg) == IDOK)
{
WipeStart ();
ArrowWaitCursor();
}
return 1;
}
LoadPage (hwndDlg, nNewPageNo + 1);
ovf_end:
return 1;
}
else if (lw == IDC_PREV)
{
if (nCurPageNo == SYSENC_SPAN_PAGE)
{
// Skip irrelevant pages when going back
if (!bHiddenOS)
nNewPageNo = SYSENC_TYPE_PAGE + 1;
}
-
- if (nCurPageNo == SYSENC_RESCUE_DISK_CREATION_PAGE)
- {
- if (SysEncInEffect ())
- {
- nNewPageNo = (PimEnable? PIM_PAGE : PASSWORD_PAGE) + 1;
- }
- }
-
- if (nCurPageNo == SYSENC_RESCUE_DISK_BURN_PAGE)
- {
- nNewPageNo = SYSENC_RESCUE_DISK_BURN_PAGE + 1; // Stay on the same page
- Warning("RESCUE_DISK_BACK_BUTTON", hwndDlg);
- }
-
- if (nCurPageNo == SYSENC_PRETEST_RESULT_PAGE)
- {
- nNewPageNo = SYSENC_PRETEST_RESULT_PAGE + 1; // Stay on the same page
- }
-
if (nCurPageNo == SYSENC_MULTI_BOOT_MODE_PAGE)
{
// Skip the drive analysis page(s) or other irrelevant pages when going back
if (bHiddenOS)
nNewPageNo = SYSENC_HIDDEN_OS_REQ_CHECK_PAGE + 1;
else if (bWholeSysDrive)
nNewPageNo = SYSENC_PRE_DRIVE_ANALYSIS_PAGE + 1;
else
nNewPageNo = SYSENC_SPAN_PAGE + 1;
}
else if (nCurPageNo == SYSENC_MULTI_BOOT_NONWIN_BOOT_LOADER_PAGE)
{
if (SysEncMultiBootCfg.NumberOfSysDrives == 1)
{
// We can skip SYSENC_MULTI_BOOT_ADJACENT_SYS_PAGE (it is implied that there are multiple systems on the drive)
nNewPageNo = SYSENC_MULTI_BOOT_NBR_SYS_DRIVES_PAGE + 1;
}
}
else if (nCurPageNo == HIDDEN_VOL_HOST_PRE_CIPHER_PAGE)
{
if (bHiddenOS)
{
if (!ChangeWizardMode (WIZARD_MODE_SYS_DEVICE))
{
NormalCursor ();
return 1;
}
// Skip irrelevant pages.
// Note that we're ignoring nMultiBoot here, as the multi-boot question pages are skipped
// when creating a hidden OS (only a single message box is displayed with requirements).
nNewPageNo = SYSENC_MULTI_BOOT_MODE_PAGE + 1;
}
else
{
nNewPageNo = VOLUME_LOCATION_PAGE + 1;
}
}
else if (nCurPageNo == HIDDEN_VOL_WIZARD_MODE_PAGE)
{
if (IsButtonChecked (GetDlgItem (hCurPage, IDC_HIDVOL_WIZ_MODE_DIRECT)))
bHiddenVolDirect = TRUE;
else
bHiddenVolDirect = FALSE;
}
else if (nCurPageNo == VOLUME_TYPE_PAGE)
{
if (WizardMode != WIZARD_MODE_SYS_DEVICE)
nNewPageNo = INTRO_PAGE + 1; // Skip irrelevant pages
}
else if (nCurPageNo == VOLUME_LOCATION_PAGE)
{
BOOL tmpbDevice;
GetWindowText (GetDlgItem (hCurPage, IDC_COMBO_BOX), szFileName, ARRAYSIZE (szFileName));
CreateFullVolumePath (szDiskFile, sizeof(szDiskFile), szFileName, &tmpbDevice);
if (tmpbDevice == bDevice)
{
MoveEditToCombo (GetDlgItem (hCurPage, IDC_COMBO_BOX), bHistory);
SaveSettings (hCurPage);
}
if (!bHiddenVol)
nNewPageNo = VOLUME_TYPE_PAGE + 1; // Skip the hidden volume creation wizard mode selection
}
else if (nCurPageNo == CIPHER_PAGE)
{
LPARAM nIndex;
nIndex = SendMessage (GetDlgItem (hCurPage, IDC_COMBO_BOX), CB_GETCURSEL, 0, 0);
nVolumeEA = (int) SendMessage (GetDlgItem (hCurPage, IDC_COMBO_BOX), CB_GETITEMDATA, nIndex, 0);
nIndex = SendMessage (GetDlgItem (hCurPage, IDC_COMBO_BOX_HASH_ALGO), CB_GETCURSEL, 0, 0);
hash_algo = (int) SendMessage (GetDlgItem (hCurPage, IDC_COMBO_BOX_HASH_ALGO), CB_GETITEMDATA, nIndex, 0);
RandSetHashFunction (hash_algo);
if (WizardMode == WIZARD_MODE_SYS_DEVICE)
{
if ((nMultiBoot > 1) && !bSystemIsGPT)
nNewPageNo = SYSENC_MULTI_BOOT_OUTCOME_PAGE + 1; // Skip irrelevant pages
else
nNewPageNo = SYSENC_MULTI_BOOT_MODE_PAGE + 1; // Skip irrelevant pages
}
else if (!bHiddenVol)
nNewPageNo = (bDevice ? DEVICE_TRANSFORM_MODE_PAGE : VOLUME_LOCATION_PAGE) + 1;
else if (bHiddenVolHost)
nNewPageNo = HIDDEN_VOL_HOST_PRE_CIPHER_PAGE + 1; // Skip the info on the hidden volume
}
else if (nCurPageNo == SIZE_PAGE)
{
VerifySizeAndUpdate (hCurPage, TRUE);
}
else if (nCurPageNo == FILESYS_PAGE)
{
if (nNeedToStoreFilesOver4GB != Get2RadButtonPageAnswer())
fileSystem = FILESYS_NONE; // The user may have gone back and changed the answer, so default file system must be reselected
nNeedToStoreFilesOver4GB = Get2RadButtonPageAnswer();
nNewPageNo = (PimEnable? PIM_PAGE : PASSWORD_PAGE) + 1; // Skip PIM page if it is not enabled
}
else if (nCurPageNo == PASSWORD_PAGE)
{
// Store the password in case we need to restore it after keyfile is applied to it
GetPassword (hCurPage, IDC_PASSWORD, szRawPassword, iMaxPasswordLength + 1, FALSE, FALSE);
VerifyPasswordAndUpdate (hwndDlg, GetDlgItem (MainDlg, IDC_NEXT),
GetDlgItem (hCurPage, IDC_PASSWORD),
GetDlgItem (hCurPage, IDC_VERIFY),
volumePassword.Text,
szVerify,
KeyFilesEnable && FirstKeyFile!=NULL && !SysEncInEffect ());
volumePassword.Length = (unsigned __int32) strlen ((char *) volumePassword.Text);
nNewPageNo = SIZE_PAGE + 1; // Skip the hidden volume host password page
if (SysEncInEffect ())
{
- if (!bHiddenOS)
- nNewPageNo = SYSENC_TYPE_PAGE + 1; // Skip irrelevant pages
- else
- nNewPageNo = CIPHER_PAGE + 1; // Skip irrelevant pages
+ nNewPageNo = CIPHER_PAGE + 1; // Skip irrelevant pages
KillTimer (hwndDlg, TIMER_ID_KEYB_LAYOUT_GUARD);
if (bKeyboardLayoutChanged)
{
// Restore the original keyboard layout
if (LoadKeyboardLayout (OrigKeyboardLayout, KLF_ACTIVATE | KLF_SUBSTITUTE_OK) == NULL)
Warning ("CANNOT_RESTORE_KEYBOARD_LAYOUT", hwndDlg);
else
bKeyboardLayoutChanged = FALSE;
}
}
else if (bInPlaceEncNonSys)
nNewPageNo = CIPHER_PAGE + 1;
}
else if (nCurPageNo == PIM_PAGE)
{
volumePim = GetPim (hCurPage, IDC_PIM, 0);
}
else if (nCurPageNo == HIDDEN_VOL_HOST_PASSWORD_PAGE
|| nCurPageNo == NONSYS_INPLACE_ENC_RESUME_PASSWORD_PAGE)
{
// Store the password in case we need to restore it after keyfile is applied to it
GetPassword (hCurPage, IDC_PASSWORD_DIRECT, szRawPassword, iMaxPasswordLength + 1, FALSE, FALSE);
memcpy (volumePassword.Text, szRawPassword, iMaxPasswordLength + 1);
volumePassword.Length = (unsigned __int32) strlen ((char *) volumePassword.Text);
if (!bInPlaceEncNonSys)
nNewPageNo = VOLUME_LOCATION_PAGE + 1;
}
else if (nCurPageNo == SYSENC_COLLECTING_RANDOM_DATA_PAGE
|| nCurPageNo == NONSYS_INPLACE_ENC_RAND_DATA_PAGE)
{
wchar_t tmp[RANDPOOL_DISPLAY_SIZE+1];
KillTimer (hwndDlg, TIMER_ID_RANDVIEW);
// Attempt to wipe the GUI field showing portions of randpool
wmemset (tmp, L'X', ARRAYSIZE(tmp));
tmp [ARRAYSIZE(tmp)-1] = 0;
SetWindowText (hRandPoolSys, tmp);
nNewPageNo = (PimEnable? PIM_PAGE : PASSWORD_PAGE) + 1; // Skip irrelevant pages
}
else if (nCurPageNo == SYSENC_KEYS_GEN_PAGE)
{
wchar_t tmp[KEY_GUI_VIEW_SIZE+1];
// Attempt to wipe the GUI fields showing portions of the master and header keys
wmemset (tmp, L'X', ARRAYSIZE(tmp));
tmp [ARRAYSIZE(tmp)-1] = 0;
SetWindowText (hMasterKey, tmp);
SetWindowText (hHeaderKey, tmp);
}
else if (nCurPageNo == SYSENC_WIPE_MODE_PAGE)
{
if (bDontVerifyRescueDisk)
nNewPageNo = SYSENC_RESCUE_DISK_VERIFIED_PAGE; // Skip irrelevant pages
}
else if (nCurPageNo == FORMAT_PAGE)
{
wchar_t tmp[RNG_POOL_SIZE*2+1];
KillTimer (hwndDlg, TIMER_ID_RANDVIEW);
// Attempt to wipe the GUI fields showing portions of randpool, of the master and header keys
wmemset (tmp, L'X', ARRAYSIZE(tmp));
tmp [ARRAYSIZE(tmp)-1] = 0;
SetWindowText (hRandPool, tmp);
SetWindowText (hMasterKey, tmp);
SetWindowText (hHeaderKey, tmp);
if (WizardMode != WIZARD_MODE_SYS_DEVICE)
{
// Skip irrelevant pages
if (FileSize4GBLimitQuestionNeeded ()
&& !CreatingHiddenSysVol() // If we're creating a hidden volume for a hidden OS, we don't need to format it with any filesystem (the entire OS will be copied to the hidden volume sector by sector).
&& !bInPlaceEncNonSys)
{
nNewPageNo = FILESYS_PAGE + 1;
}
else
nNewPageNo = (PimEnable? PIM_PAGE : PASSWORD_PAGE) + 1;
}
}
LoadPage (hwndDlg, nNewPageNo - 1);
return 1;
}
return 0;
case WM_ENDSESSION:
EndMainDlg (MainDlg);
localcleanup ();
return 0;
case WM_CLOSE:
PostMessage (hwndDlg, TC_APPMSG_FORMAT_USER_QUIT, 0, 0);
return 1;
case WM_NCDESTROY:
{
hPasswordInputField = NULL;
hVerifyPasswordInputField = NULL;
/* 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;
}
void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine)
{
wchar_t **lpszCommandLineArgs = NULL; /* Array of command line arguments */
int nNoCommandLineArgs; /* The number of arguments in the array */
if (_wcsicmp (lpszCommandLine, L"-Embedding") == 0)
{
ComServerMode = TRUE;
return;
}
/* Extract command line arguments */
nNoCommandLineArgs = Win32CommandLine (&lpszCommandLineArgs);
if (nNoCommandLineArgs > 0)
{
int i;
for (i = 0; i < nNoCommandLineArgs; i++)
{
enum
{
OptionHistory,
OptionNoIsoCheck,
OptionQuit,
OptionTokenLib,
OptionTokenPin,
CommandResumeSysEncLogOn,
CommandResumeSysEnc,
CommandDecryptSysEnc,
CommandEncDev,
CommandHiddenSys,
CommandResumeNonSysInplaceLogOn,
CommandResumeHiddenSys,
CommandSysEnc,
CommandInplaceDec,
CommandResumeInplaceDec,
CommandResumeInplace,
OptionEncryption,
OptionFilesystem,
OptionPkcs5,
OptionPassword,
OptionPim,
OptionSize,
OptionCreate,
OptionSilent,
OptionDynamic,
OptionForce,
OptionNoSizeCheck,
OptionQuickFormat,
OptionFastCreateFile,
OptionEnableMemoryProtection,
OptionKeyfile,
OptionSecureDesktop,
};
argument args[]=
{
// Public
{ OptionHistory, L"/history", L"/h", FALSE },
{ OptionNoIsoCheck, L"/noisocheck", L"/n", FALSE },
{ OptionTokenLib, L"/tokenlib", NULL, FALSE },
{ OptionTokenPin, L"/tokenpin", NULL, FALSE },
{ OptionQuit, L"/quit", L"/q", FALSE },
{ OptionEncryption, L"/encryption", NULL , FALSE },
{ OptionFilesystem, L"/filesystem", NULL , FALSE },
{ OptionPkcs5, L"/hash", NULL , FALSE },
{ OptionPassword, L"/password", NULL, FALSE },
{ OptionPim, L"/pim", NULL, FALSE },
{ OptionSize, L"/size", NULL, FALSE },
{ OptionCreate, L"/create", NULL, FALSE },
{ OptionSilent, L"/silent", NULL, FALSE },
{ OptionDynamic, L"/dynamic", NULL, FALSE },
{ OptionForce, L"/force", NULL, FALSE },
{ OptionNoSizeCheck, L"/nosizecheck", NULL, FALSE },
{ OptionQuickFormat, L"/quick", NULL, FALSE },
{ OptionFastCreateFile, L"/fastcreatefile", NULL, FALSE },
{ OptionEnableMemoryProtection, L"/protectMemory", NULL, FALSE },
{ OptionKeyfile, L"/keyfile", L"/k", FALSE },
{ OptionSecureDesktop, L"/secureDesktop", NULL, FALSE },
// Internal
{ CommandResumeSysEncLogOn, L"/acsysenc", L"/a", TRUE },
{ CommandResumeSysEnc, L"/csysenc", L"/c", TRUE },
{ CommandDecryptSysEnc, L"/dsysenc", L"/d", TRUE },
{ CommandEncDev, L"/encdev", L"/e", TRUE },
{ CommandHiddenSys, L"/isysenc", L"/i", TRUE },
{ CommandResumeNonSysInplaceLogOn, L"/prinplace", L"/p", TRUE },
{ CommandResumeHiddenSys, L"/risysenc", L"/r", TRUE },
{ CommandSysEnc, L"/sysenc", L"/s", TRUE },
{ CommandInplaceDec, L"/inplacedec", NULL, TRUE },
{ CommandResumeInplaceDec, L"/resumeinplacedec",NULL, TRUE },
{ CommandResumeInplace, L"/zinplace", L"/z", TRUE }
};
argumentspec as;
int x;
if (lpszCommandLineArgs[i] == NULL)
continue;
as.args = args;
as.arg_cnt = sizeof(args)/ sizeof(args[0]);
x = GetArgumentID (&as, lpszCommandLineArgs[i]);
switch (x)
{
case OptionCreate:
{
DirectCreationMode = TRUE;
if (HAS_ARGUMENT == GetArgumentValue (lpszCommandLineArgs, &i, nNoCommandLineArgs,
szFileName, ARRAYSIZE (szFileName)))
{
RelativePath2Absolute (szFileName);
}
else
AbortProcess ("COMMAND_LINE_ERROR");
}
break;
case OptionEncryption:
{
wchar_t szTmp[64] = {0};
if (HAS_ARGUMENT == GetArgumentValue (lpszCommandLineArgs,
&i, nNoCommandLineArgs, szTmp, ARRAYSIZE (szTmp)))
{
CmdVolumeEA = EAGetByName (szTmp);
if (CmdVolumeEA == 0)
AbortProcess ("COMMAND_LINE_ERROR");
}
else
AbortProcess ("COMMAND_LINE_ERROR");
}
break;
case OptionFilesystem:
{
wchar_t szTmp[8] = {0};
if (HAS_ARGUMENT == GetArgumentValue (lpszCommandLineArgs,
&i, nNoCommandLineArgs, szTmp, ARRAYSIZE (szTmp)))
{
if (_wcsicmp(szTmp, L"NONE") == 0)
CmdVolumeFilesystem = FILESYS_NONE;
else if (_wcsicmp(szTmp, L"FAT32") == 0 || _wcsicmp(szTmp, L"FAT") == 0)
CmdVolumeFilesystem = FILESYS_FAT;
else if (_wcsicmp(szTmp, L"NTFS") == 0)
CmdVolumeFilesystem = FILESYS_NTFS;
else if (IsOSVersionAtLeast (WIN_VISTA, 1) && _wcsicmp(szTmp, L"EXFAT") == 0)
CmdVolumeFilesystem = FILESYS_EXFAT;
else if (IsOSVersionAtLeast (WIN_10, 0) && _wcsicmp(szTmp, L"ReFS") == 0)
CmdVolumeFilesystem = FILESYS_REFS;
else
{
AbortProcess ("COMMAND_LINE_ERROR");
}
}
else
AbortProcess ("COMMAND_LINE_ERROR");
}
break;
case OptionPassword:
{
wchar_t szTmp[MAX_PASSWORD + 1];
if (HAS_ARGUMENT == GetArgumentValue (lpszCommandLineArgs, &i, nNoCommandLineArgs,
szTmp, ARRAYSIZE (szTmp)))
{
int iLen = WideCharToMultiByte (CP_UTF8, 0, szTmp, -1, (LPSTR) CmdVolumePassword.Text, iMaxPasswordLength + 1, NULL, NULL);
burn (szTmp, sizeof (szTmp));
if (iLen > 0)
CmdVolumePassword.Length = (unsigned __int32) (iLen - 1);
else
AbortProcess ("COMMAND_LINE_ERROR");
}
else
AbortProcess ("COMMAND_LINE_ERROR");
}
break;
case OptionPkcs5:
{
wchar_t szTmp[32] = {0};
if (HAS_ARGUMENT == GetArgumentValue (lpszCommandLineArgs,
&i, nNoCommandLineArgs, szTmp, ARRAYSIZE (szTmp)))
{
/* match against special names first */
if (_wcsicmp(szTmp, L"sha512") == 0)
CmdVolumePkcs5 = SHA512;
else if (_wcsicmp(szTmp, L"sha256") == 0)
CmdVolumePkcs5 = SHA256;
else if ((_wcsicmp(szTmp, L"blake2s") == 0) || (_wcsicmp(szTmp, L"blake2s-256") == 0))
CmdVolumePkcs5 = BLAKE2S;
else
{
/* match using internal hash names */
CmdVolumePkcs5 = HashGetIdByName (szTmp);
if (0 == CmdVolumePkcs5)
{
AbortProcess ("COMMAND_LINE_ERROR");
}
}
}
else
AbortProcess ("COMMAND_LINE_ERROR");
}
break;
case OptionPim:
{
wchar_t szTmp[32] = {0};
if (HAS_ARGUMENT == GetArgumentValue (lpszCommandLineArgs,
&i, nNoCommandLineArgs, szTmp, ARRAYSIZE (szTmp)))
{
wchar_t* endPtr = NULL;
CmdVolumePim = (int) wcstol(szTmp, &endPtr, 0);
if (CmdVolumePim < 0 || CmdVolumePim > MAX_PIM_VALUE || endPtr == szTmp || *endPtr != L'\0')
{
CmdVolumePim = 0;
AbortProcess ("COMMAND_LINE_ERROR");
}
}
else
AbortProcess ("COMMAND_LINE_ERROR");
}
break;
case OptionSilent:
Silent = TRUE;
break;
case OptionDynamic:
CmdSparseFileSwitch = TRUE;
break;
case OptionForce:
bForceOperation = TRUE;
break;
case OptionSize:
{
wchar_t szTmp[32] = {0};
if (HAS_ARGUMENT == GetArgumentValue (lpszCommandLineArgs,
&i, nNoCommandLineArgs, szTmp, ARRAYSIZE (szTmp))
&& (wcslen (szTmp) >= 2)
)
{
/* size can be expressed in bytes or with suffixes K, M,G or T
* to indicate the unit to use
*/
unsigned __int64 multiplier;
wchar_t* endPtr = NULL;
wchar_t lastChar = szTmp [wcslen (szTmp) - 1];
if (lastChar >= L'0' && lastChar <= L'9')
multiplier = 1;
else if (lastChar == L'K' || lastChar == L'k')
multiplier = BYTES_PER_KB;
else if (lastChar == L'M' || lastChar == L'm')
multiplier = BYTES_PER_MB;
else if (lastChar == L'G' || lastChar == L'g')
multiplier = BYTES_PER_GB;
else if (lastChar == L'T' || lastChar == L't')
multiplier = BYTES_PER_TB;
else
AbortProcess ("COMMAND_LINE_ERROR");
if (multiplier != 1)
szTmp [wcslen (szTmp) - 1] = 0;
CmdVolumeFileSize = _wcstoui64(szTmp, &endPtr, 0);
if (CmdVolumeFileSize == 0 || CmdVolumeFileSize == _UI64_MAX
|| endPtr == szTmp || *endPtr != L'\0')
{
AbortProcess ("COMMAND_LINE_ERROR");
}
CmdVolumeFileSize *= multiplier;
}
else
AbortProcess ("COMMAND_LINE_ERROR");
}
break;
case CommandSysEnc:
// Encrypt system partition/drive (passed by Mount if system encryption hasn't started or to reverse decryption)
// From now on, we should be the only instance of the TC wizard allowed to deal with system encryption
if (CreateSysEncMutex ())
{
bDirectSysEncMode = TRUE;
bDirectSysEncModeCommand = SYSENC_COMMAND_ENCRYPT;
ChangeWizardMode (WIZARD_MODE_SYS_DEVICE);
}
else
{
Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", hwndDlg);
exit(0);
}
break;
case CommandDecryptSysEnc:
// Decrypt system partition/drive (passed by Mount, also to reverse encryption in progress, when paused)
// From now on, we should be the only instance of the TC wizard allowed to deal with system encryption
if (CreateSysEncMutex ())
{
bDirectSysEncMode = TRUE;
bDirectSysEncModeCommand = SYSENC_COMMAND_DECRYPT;
ChangeWizardMode (WIZARD_MODE_SYS_DEVICE);
}
else
{
Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", hwndDlg);
exit(0);
}
break;
case CommandHiddenSys:
// Create a hidden operating system (passed by Mount when the user selects System -> Create Hidden Operating System)
// From now on, we should be the only instance of the TC wizard allowed to deal with system encryption
if (CreateSysEncMutex ())
{
bDirectSysEncMode = TRUE;
bDirectSysEncModeCommand = SYSENC_COMMAND_CREATE_HIDDEN_OS;
ChangeWizardMode (WIZARD_MODE_SYS_DEVICE);
}
else
{
Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", hwndDlg);
exit(0);
}
break;
case CommandResumeHiddenSys:
// Resume process of creation of a hidden operating system (passed by Wizard when the user needs to UAC-elevate the whole wizard process)
// From now on, we should be the only instance of the TC wizard allowed to deal with system encryption
if (CreateSysEncMutex ())
{
bDirectSysEncMode = TRUE;
bDirectSysEncModeCommand = SYSENC_COMMAND_CREATE_HIDDEN_OS_ELEV;
ChangeWizardMode (WIZARD_MODE_SYS_DEVICE);
}
else
{
Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", hwndDlg);
exit(0);
}
break;
case CommandResumeSysEnc:
// Resume previous system-encryption operation (passed by Mount) e.g. encryption, decryption, or pretest
// From now on, we should be the only instance of the TC wizard allowed to deal with system encryption
if (CreateSysEncMutex ())
{
bDirectSysEncMode = TRUE;
bDirectSysEncModeCommand = SYSENC_COMMAND_RESUME;
ChangeWizardMode (WIZARD_MODE_SYS_DEVICE);
}
else
{
Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", hwndDlg);
exit(0);
}
break;
case CommandResumeSysEncLogOn:
// Same as csysenc but passed only by the system (from the startup sequence)
// From now on, we should be the only instance of the TC wizard allowed to deal with system encryption
if (CreateSysEncMutex ())
{
bDirectSysEncMode = TRUE;
bDirectSysEncModeCommand = SYSENC_COMMAND_STARTUP_SEQ_RESUME;
ChangeWizardMode (WIZARD_MODE_SYS_DEVICE);
}
else
{
Warning ("SYSTEM_ENCRYPTION_IN_PROGRESS_ELSEWHERE", hwndDlg);
exit(0);
}
break;
case CommandEncDev:
// Resume process of creation of a non-sys-device-hosted volume (passed by Wizard when the user needs to UAC-elevate)
DirectDeviceEncMode = TRUE;
break;
case CommandInplaceDec:
// Start (not resume) decrypting the specified non-system volume in place
{
wchar_t szTmp [TC_MAX_PATH + 8000] = {0};
if ((HAS_ARGUMENT == GetArgumentValue (lpszCommandLineArgs, &i, nNoCommandLineArgs, szTmp, ARRAYSIZE (szTmp)))
&& (wcslen (szTmp) >= 1)
)
{
memset (szFileName, 0, sizeof (szFileName));
StringCbCopyW (szFileName, sizeof (szFileName), szTmp);
DirectNonSysInplaceDecStartMode = TRUE;
}
else
{
// No valid volume path specified as command-line parameter
AbortProcess ("ERR_PARAMETER_INCORRECT");
}
}
break;
case CommandResumeInplace:
// Resume interrupted process of non-system in-place encryption of a partition
DirectNonSysInplaceEncResumeMode = TRUE;
break;
case CommandResumeInplaceDec:
// Resume interrupted process of non-system in-place decryption of a partition
DirectNonSysInplaceDecResumeMode = TRUE;
break;
case CommandResumeNonSysInplaceLogOn:
// Ask the user whether to resume interrupted process of non-system in-place encryption of a partition
// This switch is passed only by the system (from the startup sequence).
DirectPromptNonSysInplaceEncResumeMode = TRUE;
break;
case OptionNoIsoCheck:
bDontVerifyRescueDisk = TRUE;
break;
case OptionNoSizeCheck:
bDontCheckFileContainerSize = TRUE;
break;
case OptionQuickFormat:
CmdQuickFormat = TRUE;
break;
case OptionFastCreateFile:
CmdFastCreateFile = TRUE;
break;
case OptionEnableMemoryProtection:
EnableMemoryProtection = TRUE;
break;
case OptionHistory:
{
wchar_t szTmp[8] = {0};
bHistory = bHistoryCmdLine = TRUE;
if (HAS_ARGUMENT == GetArgumentValue (lpszCommandLineArgs, &i, nNoCommandLineArgs,
szTmp, ARRAYSIZE (szTmp)))
{
if (!_wcsicmp(szTmp,L"y") || !_wcsicmp(szTmp,L"yes"))
{
bHistory = TRUE;
}
else if (!_wcsicmp(szTmp,L"n") || !_wcsicmp(szTmp,L"no"))
{
bHistory = FALSE;
}
else
AbortProcess ("COMMAND_LINE_ERROR");
}
}
break;
case OptionTokenLib:
if (GetArgumentValue (lpszCommandLineArgs, &i, nNoCommandLineArgs, SecurityTokenLibraryPath, ARRAYSIZE (SecurityTokenLibraryPath)) == HAS_ARGUMENT)
InitSecurityTokenLibrary(hwndDlg);
else
AbortProcess ("COMMAND_LINE_ERROR");
break;
case OptionTokenPin:
{
wchar_t szTmp[SecurityToken::MaxPasswordLength + 1] = {0};
if (GetArgumentValue (lpszCommandLineArgs, &i, nNoCommandLineArgs, szTmp, ARRAYSIZE (szTmp)) == HAS_ARGUMENT)
{
if (0 == WideCharToMultiByte (CP_UTF8, 0, szTmp, -1, CmdTokenPin, TC_MAX_PATH, nullptr, nullptr))
AbortProcess ("COMMAND_LINE_ERROR");
}
else
AbortProcess ("COMMAND_LINE_ERROR");
}
break;
case OptionQuit:
{
// Used to indicate non-install elevation
wchar_t szTmp[32];
if (GetArgumentValue (lpszCommandLineArgs, &i, nNoCommandLineArgs, szTmp, ARRAYSIZE (szTmp)) != HAS_ARGUMENT)
AbortProcess ("COMMAND_LINE_ERROR");
}
break;
case OptionKeyfile:
{
wchar_t tmpPath [2 * TC_MAX_PATH] = {0};
if (HAS_ARGUMENT == GetArgumentValue (lpszCommandLineArgs, &i,
nNoCommandLineArgs, tmpPath, ARRAYSIZE (tmpPath)))
{
KeyFile *kf;
RelativePath2Absolute (tmpPath);
kf = (KeyFile *) malloc (sizeof (KeyFile));
if (kf)
{
StringCchCopyW (kf->FileName, ARRAYSIZE(kf->FileName), tmpPath);
FirstCmdKeyFile = KeyFileAdd (FirstCmdKeyFile, kf);
}
}
else
AbortProcess ("COMMAND_LINE_ERROR");
}
break;
case OptionSecureDesktop:
{
wchar_t szTmp[16] = {0};
bCmdUseSecureDesktop = TRUE;
bCmdUseSecureDesktopValid = TRUE;
if (HAS_ARGUMENT == GetArgumentValue (lpszCommandLineArgs, &i, nNoCommandLineArgs,
szTmp, ARRAYSIZE (szTmp)))
{
if (!_wcsicmp(szTmp,L"n") || !_wcsicmp(szTmp,L"no"))
bCmdUseSecureDesktop = FALSE;
else if (!_wcsicmp(szTmp,L"y") || !_wcsicmp(szTmp,L"yes"))
bCmdUseSecureDesktop = TRUE;
else
AbortProcess ("COMMAND_LINE_ERROR");
}
}
break;
default:
DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_COMMANDHELP_DLG), hwndDlg, (DLGPROC)
CommandHelpDlgProc, (LPARAM) &as);
exit(0);
}
}
}
/* Free up the command line arguments */
while (--nNoCommandLineArgs >= 0)
{
free (lpszCommandLineArgs[nNoCommandLineArgs]);
}
if (lpszCommandLineArgs)
free (lpszCommandLineArgs);
}
int DetermineMaxHiddenVolSize (HWND hwndDlg)
{
__int64 nbrReserveBytes;
if (nbrFreeClusters * realClusterSize < TC_MIN_HIDDEN_VOLUME_SIZE)
{
MessageBoxW (hwndDlg, GetString ("NO_SPACE_FOR_HIDDEN_VOL"), lpszTitle, ICON_HAND);
UnmountVolume (hwndDlg, hiddenVolHostDriveNo, TRUE);
AbortProcessSilent ();
}
// Add a reserve (in case the user mounts the outer volume and creates new files
// on it by accident or OS writes some new data behind his or her back, such as
// System Restore etc.)
nbrReserveBytes = GetVolumeDataAreaSize (FALSE, nHiddenVolHostSize) / 200;
if (nbrReserveBytes > BYTES_PER_MB * 10)
nbrReserveBytes = BYTES_PER_MB * 10;
// Compute the final value
nMaximumHiddenVolSize = nbrFreeClusters * realClusterSize - TC_HIDDEN_VOLUME_HOST_FS_RESERVED_END_AREA_SIZE - nbrReserveBytes;
nMaximumHiddenVolSize -= nMaximumHiddenVolSize % realClusterSize; // Must be a multiple of the sector size
if (nMaximumHiddenVolSize < TC_MIN_HIDDEN_VOLUME_SIZE)
{
MessageBoxW (hwndDlg, GetString ("NO_SPACE_FOR_HIDDEN_VOL"), lpszTitle, ICON_HAND);
UnmountVolume (hwndDlg, hiddenVolHostDriveNo, TRUE);
AbortProcessSilent ();
}
// Prepare the hidden volume size parameters
if (nMaximumHiddenVolSize < BYTES_PER_MB)
nMultiplier = BYTES_PER_KB;
else if (nMaximumHiddenVolSize < BYTES_PER_GB)
nMultiplier = BYTES_PER_MB;
else if (nMaximumHiddenVolSize < BYTES_PER_TB)
nMultiplier = BYTES_PER_GB;
else
nMultiplier = BYTES_PER_TB;
nUIVolumeSize = 0; // Set the initial value for the hidden volume size input field to the max
nVolumeSize = nUIVolumeSize * nMultiplier; // Chop off possible remainder
return 1;
}
// Tests whether the file system of the given volume is suitable to host a hidden volume,
// retrieves the cluster size, and scans the volume cluster bitmap. In addition, checks
// the TrueCrypt volume format version and the type of volume.
int AnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 hiddenVolHostSize, int *realClusterSize, __int64 *pnbrFreeClusters)
{
HANDLE hDevice;
DWORD bytesReturned;
DWORD dwSectorsPerCluster, dwBytesPerSector, dwNumberOfFreeClusters, dwTotalNumberOfClusters;
DWORD dwResult;
int result;
wchar_t szFileSystemNameBuffer[256];
wchar_t tmpPath[7] = {L'\\',L'\\',L'.',L'\\',(wchar_t) *driveNo + L'A',L':',0};
wchar_t szRootPathName[4] = {(wchar_t) *driveNo + L'A', L':', L'\\', 0};
BYTE readBuffer[TC_MAX_VOLUME_SECTOR_SIZE * 2];
LARGE_INTEGER offset, offsetNew;
VOLUME_PROPERTIES_STRUCT volProp;
memset (&volProp, 0, sizeof(volProp));
volProp.driveNo = *driveNo;
if (!DeviceIoControl (hDriver, TC_IOCTL_GET_VOLUME_PROPERTIES, &volProp, sizeof (volProp), &volProp, sizeof (volProp), &dwResult, NULL) || dwResult == 0)
{
handleWin32Error (hwndDlg, SRC_POS);
Error ("CANT_ACCESS_OUTER_VOL", hwndDlg);
goto efsf_error;
}
if (volProp.volFormatVersion < TC_VOLUME_FORMAT_VERSION)
{
// We do not support creating hidden volumes within volumes created by TrueCrypt 5.1a or earlier.
Error ("ERR_VOL_FORMAT_BAD", hwndDlg);
return 0;
}
if (volProp.hiddenVolume)
{
// The user entered a password for a hidden volume
Error ("ERR_HIDDEN_NOT_NORMAL_VOLUME", hwndDlg);
return 0;
}
if (volProp.volumeHeaderFlags & TC_HEADER_FLAG_NONSYS_INPLACE_ENC
|| volProp.volumeHeaderFlags & TC_HEADER_FLAG_ENCRYPTED_SYSTEM)
{
Warning ("ERR_HIDDEN_VOL_HOST_ENCRYPTED_INPLACE", hwndDlg);
return 0;
}
hDevice = CreateFile (tmpPath, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (hDevice == INVALID_HANDLE_VALUE)
{
MessageBoxW (hwndDlg, GetString ("CANT_ACCESS_OUTER_VOL"), lpszTitle, ICON_HAND);
goto efsf_error;
}
offset.QuadPart = 0;
if (SetFilePointerEx (hDevice, offset, &offsetNew, FILE_BEGIN) == 0)
{
handleWin32Error (hwndDlg, SRC_POS);
goto efs_error;
}
result = ReadFile (hDevice, &readBuffer, TC_MAX_VOLUME_SECTOR_SIZE, &bytesReturned, NULL);
if (result == 0)
{
handleWin32Error (hwndDlg, SRC_POS);
MessageBoxW (hwndDlg, GetString ("CANT_ACCESS_OUTER_VOL"), lpszTitle, ICON_HAND);
goto efs_error;
}
CloseHandle (hDevice);
hDevice = INVALID_HANDLE_VALUE;
// Determine file system type
GetVolumeInformation(szRootPathName, NULL, 0, NULL, NULL, NULL, szFileSystemNameBuffer, ARRAYSIZE(szFileSystemNameBuffer));
// The Windows API sometimes fails to indentify the file system correctly so we're using "raw" analysis too.
if (!wcsncmp (szFileSystemNameBuffer, L"FAT", 3)
|| (readBuffer[0x36] == 'F' && readBuffer[0x37] == 'A' && readBuffer[0x38] == 'T')
|| (readBuffer[0x52] == 'F' && readBuffer[0x53] == 'A' && readBuffer[0x54] == 'T'))
{
// FAT12/FAT16/FAT32
// Retrieve the cluster size
*realClusterSize = ((int) readBuffer[0xb] + ((int) readBuffer[0xc] << 8)) * (int) readBuffer[0xd];
// Get the map of the clusters that are free and in use on the outer volume.
// The map will be scanned to determine the size of the uninterrupted block of free
// space (provided there is any) whose end is aligned with the end of the volume.
// The value will then be used to determine the maximum possible size of the hidden volume.
if (*realClusterSize > 0)
{
return ScanVolClusterBitmap (hwndDlg,
driveNo,
hiddenVolHostSize / *realClusterSize,
pnbrFreeClusters);
}
else
{
// should never happen
return -1;
}
}
else if (!wcsncmp (szFileSystemNameBuffer, L"NTFS", 4) || !_wcsnicmp (szFileSystemNameBuffer, L"exFAT", 5))
{
// NTFS
bool bIsNtfs = (0 == wcsncmp (szFileSystemNameBuffer, L"NTFS", 4));
if (bIsNtfs && bHiddenVolDirect && GetVolumeDataAreaSize (FALSE, hiddenVolHostSize) <= TC_MAX_FAT_SECTOR_COUNT * GetFormatSectorSize())
Info ("HIDDEN_VOL_HOST_NTFS", hwndDlg);
if (!GetDiskFreeSpace(szRootPathName,
&dwSectorsPerCluster,
&dwBytesPerSector,
&dwNumberOfFreeClusters,
&dwTotalNumberOfClusters))
{
handleWin32Error (hwndDlg, SRC_POS);
Error ("CANT_GET_OUTER_VOL_INFO", hwndDlg);
return -1;
};
*realClusterSize = dwBytesPerSector * dwSectorsPerCluster;
// Get the map of the clusters that are free and in use on the outer volume.
// The map will be scanned to determine the size of the uninterrupted block of free
// space (provided there is any) whose end is aligned with the end of the volume.
// The value will then be used to determine the maximum possible size of the hidden volume.
return ScanVolClusterBitmap (hwndDlg,
driveNo,
hiddenVolHostSize / *realClusterSize,
pnbrFreeClusters);
}
else
{
// Unsupported file system
Error ("HIDDEN_VOL_HOST_UNSUPPORTED_FILESYS", hwndDlg);
return 0;
}
efs_error:
CloseHandle (hDevice);
efsf_error:
CloseVolumeExplorerWindows (hwndDlg, *driveNo);
return -1;
}
// Mounts a volume within which the user intends to create a hidden volume
int MountHiddenVolHost (HWND hwndDlg, wchar_t *volumePath, int *driveNo, Password *password, int pkcs5_prf, int pim, BOOL bReadOnly)
{
MountOptions mountOptions;
ZeroMemory (&mountOptions, sizeof (mountOptions));
*driveNo = GetLastAvailableDrive ();
if (*driveNo == -1)
{
*driveNo = -2;
return ERR_NO_FREE_DRIVES;
}
mountOptions.ReadOnly = bReadOnly;
mountOptions.Removable = ConfigReadInt ("MountVolumesRemovable", FALSE);
mountOptions.ProtectHiddenVolume = FALSE;
mountOptions.PreserveTimestamp = bPreserveTimestamp;
mountOptions.PartitionInInactiveSysEncScope = FALSE;
mountOptions.UseBackupHeader = FALSE;
if (MountVolume (hwndDlg, *driveNo, volumePath, password, pkcs5_prf, pim, FALSE, FALSE, FALSE, TRUE, &mountOptions, FALSE, TRUE) < 1)
{
*driveNo = -3;
return ERR_VOL_MOUNT_FAILED;
}
return 0;
}
/* Gets the map of the clusters that are free and in use on a volume that is to host
a hidden volume. The map is scanned to determine the size of the uninterrupted
area of free space (provided there is any) whose end is aligned with the end
of the volume. The value will then be used to determine the maximum possible size
of the hidden volume. */
int ScanVolClusterBitmap (HWND hwndDlg, int *driveNo, __int64 nbrClusters, __int64 *nbrFreeClusters)
{
PVOLUME_BITMAP_BUFFER lpOutBuffer;
STARTING_LCN_INPUT_BUFFER lpInBuffer;
HANDLE hDevice;
DWORD lBytesReturned;
BYTE rmnd;
wchar_t tmpPath[7] = {L'\\',L'\\',L'.',L'\\', (wchar_t) *driveNo + L'A', L':', 0};
DWORD bufLen;
__int64 bitmapCnt;
hDevice = CreateFile (tmpPath, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (hDevice == INVALID_HANDLE_VALUE)
{
MessageBoxW (hwndDlg, GetString ("CANT_ACCESS_OUTER_VOL"), lpszTitle, ICON_HAND);
goto vcmf_error;
}
bufLen = (DWORD) (nbrClusters / 8 + 2 * sizeof(LARGE_INTEGER));
bufLen += 100000 + bufLen/10; // Add reserve
lpOutBuffer = (PVOLUME_BITMAP_BUFFER) malloc (bufLen);
if (lpOutBuffer == NULL)
{
MessageBoxW (hwndDlg, GetString ("ERR_MEM_ALLOC"), lpszTitle, ICON_HAND);
goto vcm_error;
}
lpInBuffer.StartingLcn.QuadPart = 0;
if ( !DeviceIoControl (hDevice,
FSCTL_GET_VOLUME_BITMAP,
&lpInBuffer,
sizeof(lpInBuffer),
lpOutBuffer,
bufLen,
&lBytesReturned,
NULL))
{
handleWin32Error (hwndDlg, SRC_POS);
MessageBoxW (hwndDlg, GetString ("CANT_GET_CLUSTER_BITMAP"), lpszTitle, ICON_HAND);
goto vcm_error;
}
rmnd = (BYTE) (lpOutBuffer->BitmapSize.QuadPart % 8);
if ((rmnd != 0)
&& ((lpOutBuffer->Buffer[lpOutBuffer->BitmapSize.QuadPart / 8] & ((1 << rmnd)-1) ) != 0))
{
*nbrFreeClusters = 0;
}
else
{
*nbrFreeClusters = lpOutBuffer->BitmapSize.QuadPart;
bitmapCnt = lpOutBuffer->BitmapSize.QuadPart / 8;
// Scan the bitmap from the end
while (--bitmapCnt >= 0)
{
if (lpOutBuffer->Buffer[bitmapCnt] != 0)
{
// There might be up to 7 extra free clusters in this byte of the bitmap.
// These are ignored because there is always a cluster reserve added anyway.
*nbrFreeClusters = lpOutBuffer->BitmapSize.QuadPart - ((bitmapCnt + 1) * 8);
break;
}
}
}
CloseHandle (hDevice);
free(lpOutBuffer);
return 1;
vcm_error:
CloseHandle (hDevice);
if (lpOutBuffer) free(lpOutBuffer);
vcmf_error:
return -1;
}
// Wipe the hidden OS config flag bits in the MBR
static BOOL WipeHiddenOSCreationConfig (void)
{
if (!IsHiddenOSRunning())
{
try
{
WaitCursor();
finally_do ({ NormalCursor(); });
BootEncObj->WipeHiddenOSCreationConfig();
}
catch (Exception &e)
{
e.Show (MainDlg);
return FALSE;
}
}
return TRUE;
}
// Tasks that need to be performed after the WM_INITDIALOG message for the SYSENC_ENCRYPTION_PAGE dialog is
// handled should be done here (otherwise the UAC prompt causes the GUI to be only half-rendered).
static void AfterSysEncProgressWMInitTasks (HWND hwndDlg)
{
try
{
switch (SystemEncryptionStatus)
{
case SYSENC_STATUS_ENCRYPTING:
if (BootEncStatus.ConfiguredEncryptedAreaStart == BootEncStatus.EncryptedAreaStart
&& BootEncStatus.ConfiguredEncryptedAreaEnd == BootEncStatus.EncryptedAreaEnd)
{
// The partition/drive had been fully encrypted
ManageStartupSeqWiz (TRUE, L"");
WipeHiddenOSCreationConfig(); // For extra conservative security
ChangeSystemEncryptionStatus (SYSENC_STATUS_NONE);
Info ("SYSTEM_ENCRYPTION_FINISHED", hwndDlg);
EndMainDlg (MainDlg);
return;
}
else
{
SysEncResume ();
}
break;
case SYSENC_STATUS_DECRYPTING:
SysEncResume ();
break;
default:
// Unexpected mode here -- fix the inconsistency
ManageStartupSeqWiz (TRUE, L"");
ChangeSystemEncryptionStatus (SYSENC_STATUS_NONE);
EndMainDlg (MainDlg);
InconsistencyResolved (SRC_POS);
return;
}
}
catch (Exception &e)
{
e.Show (hwndDlg);
EndMainDlg (MainDlg);
return;
}
InitSysEncProgressBar ();
UpdateSysEncProgressBar ();
UpdateSysEncControls ();
}
// Tasks that need to be performed after the WM_INITDIALOG message is handled must be done here.
// For example, any tasks that may invoke the UAC prompt (otherwise the UAC dialog box would not be on top).
static void AfterWMInitTasks (HWND hwndDlg)
{
// Note that if bDirectSysEncModeCommand is not SYSENC_COMMAND_NONE, we already have the mutex.
// SYSENC_COMMAND_DECRYPT has the highest priority because it also performs uninstallation (restores the
// original contents of the first drive cylinder, etc.) so it must be attempted regardless of the phase
// or content of configuration files.
if (bDirectSysEncModeCommand == SYSENC_COMMAND_DECRYPT)
{
if (IsHiddenOSRunning())
{
Warning ("CANNOT_DECRYPT_HIDDEN_OS", hwndDlg);
AbortProcessSilent();
}
// Add the wizard to the system startup sequence
ManageStartupSeqWiz (FALSE, L"/acsysenc");
ChangeSystemEncryptionStatus (SYSENC_STATUS_DECRYPTING);
LoadPage (hwndDlg, SYSENC_ENCRYPTION_PAGE);
return;
}
if (SystemEncryptionStatus == SYSENC_STATUS_ENCRYPTING
|| SystemEncryptionStatus == SYSENC_STATUS_DECRYPTING)
{
try
{
BootEncStatus = BootEncObj->GetStatus();
if (!BootEncStatus.DriveMounted)
{
if (!BootEncStatus.DeviceFilterActive)
{
// This is an inconsistent state. SystemEncryptionStatus should never be SYSENC_STATUS_ENCRYPTING
// or SYSENC_STATUS_DECRYPTING when the drive filter is not active. Possible causes: 1) corrupted
// or stale config file, 2) corrupted system
// Fix the inconsistency
ManageStartupSeqWiz (TRUE, L"");
ChangeSystemEncryptionStatus (SYSENC_STATUS_NONE);
EndMainDlg (MainDlg);
InconsistencyResolved (SRC_POS);
return;
}
else if (bDirectSysEncMode)
{
// This is an inconsistent state. We have a direct system encryption command,
// SystemEncryptionStatus is SYSENC_STATUS_ENCRYPTING or SYSENC_STATUS_DECRYPTING, the
// system drive is not 'mounted' and drive filter is active. Possible causes: 1) The drive had
// been decrypted in the pre-boot environment. 2) The OS is not located on the lowest partition,
// the drive is to be fully encrypted, but the user rebooted before encryption reached the
// system partition and then pressed Esc in the boot loader screen. 3) Corrupted or stale config
// file. 4) Damaged system.
Warning ("SYSTEM_ENCRYPTION_SCHEDULED_BUT_PBA_FAILED", hwndDlg);
EndMainDlg (MainDlg);
return;
}
}
}
catch (Exception &e)
{
e.Show (MainDlg);
}
}
if (SystemEncryptionStatus != SYSENC_STATUS_PRETEST)
{
// Handle system encryption command line arguments (if we're not in the Pretest phase).
// Note that if bDirectSysEncModeCommand is not SYSENC_COMMAND_NONE, we already have the mutex.
// Also note that SYSENC_COMMAND_DECRYPT is handled above.
switch (bDirectSysEncModeCommand)
{
case SYSENC_COMMAND_RESUME:
case SYSENC_COMMAND_STARTUP_SEQ_RESUME:
if (bDirectSysEncModeCommand == SYSENC_COMMAND_STARTUP_SEQ_RESUME
&& AskWarnYesNo ("SYSTEM_ENCRYPTION_RESUME_PROMPT", hwndDlg) == IDNO)
{
EndMainDlg (MainDlg);
return;
}
if (SysEncryptionOrDecryptionRequired ())
{
if (SystemEncryptionStatus != SYSENC_STATUS_ENCRYPTING
&& SystemEncryptionStatus != SYSENC_STATUS_DECRYPTING)
{
// If the config file with status was lost or not written correctly, we
// don't know whether to encrypt or decrypt (but we know that encryption or
// decryption is required). Ask the user to select encryption, decryption,
// or cancel
if (!ResolveUnknownSysEncDirection ())
{
EndMainDlg (MainDlg);
return;
}
}
LoadPage (hwndDlg, SYSENC_ENCRYPTION_PAGE);
return;
}
else
{
// Nothing to resume
Warning ("NO_SYS_ENC_PROCESS_TO_RESUME", hwndDlg);
EndMainDlg (MainDlg);
return;
}
break;
case SYSENC_COMMAND_ENCRYPT:
if (SysDriveOrPartitionFullyEncrypted (FALSE))
{
Info ("SYS_PARTITION_OR_DRIVE_APPEARS_FULLY_ENCRYPTED", hwndDlg);
EndMainDlg (MainDlg);
return;
}
if (SysEncryptionOrDecryptionRequired ())
{
// System partition/drive encryption process already initiated but is incomplete.
// If we were encrypting, resume the process directly. If we were decrypting, reverse
// the process and start encrypting.
ChangeSystemEncryptionStatus (SYSENC_STATUS_ENCRYPTING);
LoadPage (hwndDlg, SYSENC_ENCRYPTION_PAGE);
return;
}
else
{
// Initiate the Pretest preparation phase
if (!SwitchWizardToSysEncMode ())
{
bDirectSysEncMode = FALSE;
EndMainDlg (MainDlg);
}
return;
}
break;
case SYSENC_COMMAND_CREATE_HIDDEN_OS_ELEV:
case SYSENC_COMMAND_CREATE_HIDDEN_OS:
if (!SwitchWizardToHiddenOSMode ())
{
bDirectSysEncMode = FALSE;
EndMainDlg (MainDlg);
}
return;
}
}
if (!bDirectSysEncMode
|| bDirectSysEncMode && SystemEncryptionStatus == SYSENC_STATUS_NONE)
{
// Handle system encryption cases where the wizard did not start even though it
// was added to the startup sequence, as well as other weird cases and "leftovers"
if (SystemEncryptionStatus != SYSENC_STATUS_NONE
&& SystemEncryptionStatus != SYSENC_STATUS_PRETEST
&& SysEncryptionOrDecryptionRequired ())
{
// System encryption/decryption had been in progress and did not finish
if (CreateSysEncMutex ()) // If no other instance is currently taking care of system encryption
{
if (AskWarnYesNo ("SYSTEM_ENCRYPTION_RESUME_PROMPT", hwndDlg) == IDYES)
{
bDirectSysEncMode = TRUE;
ChangeWizardMode (WIZARD_MODE_SYS_DEVICE);
LoadPage (hwndDlg, SYSENC_ENCRYPTION_PAGE);
return;
}
else
CloseSysEncMutex ();
}
}
else if (SystemEncryptionStatus == SYSENC_STATUS_PRETEST)
{
// System pretest had been in progress but we were not launched during the startup seq
if (CreateSysEncMutex ()) // If no other instance is currently taking care of system encryption
{
// The pretest has "priority handling"
bDirectSysEncMode = TRUE;
ChangeWizardMode (WIZARD_MODE_SYS_DEVICE);
/* Do not return yet -- the principal pretest handler is below. */
}
}
else if ((SystemEncryptionStatus == SYSENC_STATUS_NONE || SystemEncryptionStatus == SYSENC_STATUS_DECRYPTING)
&& !BootEncStatus.DriveEncrypted
&& (BootEncStatus.DriveMounted || BootEncStatus.VolumeHeaderPresent))
{
// The pretest may have been in progress but we can't be sure (it is not in the config file).
// Another possibility is that the user had finished decrypting the drive, but the config file
// was not correctly updated. In both cases the best thing we can do is remove the header and
// deinstall. Otherwise, the result might be some kind of deadlock.
if (CreateSysEncMutex ()) // If no other instance is currently taking care of system encryption
{
WaitCursor ();
ForceRemoveSysEnc();
InconsistencyResolved (SRC_POS);
NormalCursor();
CloseSysEncMutex ();
}
}
}
if (bDirectSysEncMode && CreateSysEncMutex ())
{
// We were launched either by Mount or by the system (startup sequence). Most of such cases should have
// been handled above already. Here we handle only the pretest phase (which can also be a hidden OS
// creation phase actually) and possible inconsistencies.
switch (SystemEncryptionStatus)
{
case SYSENC_STATUS_PRETEST:
{
unsigned int hiddenOSCreationPhase = DetermineHiddenOSCreationPhase();
bHiddenOS = (hiddenOSCreationPhase != TC_HIDDEN_OS_CREATION_PHASE_NONE);
// Evaluate the results of the system encryption pretest (or of the hidden OS creation process)
try
{
BootEncStatus = BootEncObj->GetStatus();
}
catch (Exception &e)
{
e.Show (hwndDlg);
Error ("ERR_GETTING_SYSTEM_ENCRYPTION_STATUS", hwndDlg);
EndMainDlg (MainDlg);
return;
}
if (BootEncStatus.DriveMounted)
{
/* Pretest successful or hidden OS has been booted during the process of hidden OS creation. */
switch (hiddenOSCreationPhase)
{
case TC_HIDDEN_OS_CREATION_PHASE_NONE:
// Pretest successful (or the hidden OS has been booted for the first time since the user started installing a new decoy OS)
if (IsHiddenOSRunning())
{
// The hidden OS has been booted for the first time since the user started installing a
// new decoy OS (presumably, our MBR config flags have been erased).
// As for things we are responsible for, the process of hidden OS creation is completed
// (the rest is up to the user).
ManageStartupSeqWiz (TRUE, L"");
ChangeSystemEncryptionStatus (SYSENC_STATUS_NONE);
EndMainDlg (MainDlg);
return;
}
// Pretest successful (no hidden operating system involved)
LoadPage (hwndDlg, SYSENC_PRETEST_RESULT_PAGE);
return;
case TC_HIDDEN_OS_CREATION_PHASE_WIPING:
// Hidden OS has been booted when we are supposed to wipe the original OS
LoadPage (hwndDlg, SYSENC_HIDDEN_OS_INITIAL_INFO_PAGE);
return;
case TC_HIDDEN_OS_CREATION_PHASE_WIPED:
// Hidden OS has been booted and the original OS wiped. Now the user is required to install a new, decoy, OS.
TextInfoDialogBox (TC_TBXID_DECOY_OS_INSTRUCTIONS);
EndMainDlg (MainDlg);
return;
default:
// Unexpected/unknown status
ReportUnexpectedState (SRC_POS);
EndMainDlg (MainDlg);
return;
}
}
else
{
BOOL bAnswerTerminate = FALSE, bAnswerRetry = FALSE;
/* Pretest failed
or hidden OS cloning has been interrupted (and non-hidden OS is running)
or wiping of the original OS has not been started (and non-hidden OS is running) */
if (hiddenOSCreationPhase == TC_HIDDEN_OS_CREATION_PHASE_NONE)
{
// Pretest failed (no hidden operating system involved)
if (AskWarnYesNo ("BOOT_PRETEST_FAILED_RETRY", hwndDlg) == IDYES)
{
// User wants to retry the pretest
bAnswerTerminate = FALSE;
bAnswerRetry = TRUE;
}
else
{
// User doesn't want to retry the pretest
bAnswerTerminate = TRUE;
bAnswerRetry = FALSE;
}
}
else
{
// Hidden OS cloning was interrupted or wiping of the original OS has not been started
char *tmpStr[] = {0,
hiddenOSCreationPhase == TC_HIDDEN_OS_CREATION_PHASE_WIPING ? "OS_WIPING_NOT_FINISHED_ASK" : "HIDDEN_OS_CREATION_NOT_FINISHED_ASK",
"HIDDEN_OS_CREATION_NOT_FINISHED_CHOICE_RETRY",
"HIDDEN_OS_CREATION_NOT_FINISHED_CHOICE_TERMINATE",
"HIDDEN_OS_CREATION_NOT_FINISHED_CHOICE_ASK_LATER",
0};
switch (AskMultiChoice ((void **) tmpStr, FALSE, hwndDlg))
{
case 1:
// User wants to restart and continue/retry
bAnswerTerminate = FALSE;
bAnswerRetry = TRUE;
break;
case 2:
// User doesn't want to retry but wants to terminate the entire process of hidden OS creation
bAnswerTerminate = TRUE;
bAnswerRetry = FALSE;
break;
default:
// User doesn't want to do anything now
bAnswerTerminate = FALSE;
bAnswerRetry = FALSE;
}
}
if (bAnswerRetry)
{
// User wants to restart and retry the pretest (or hidden OS creation)
// We re-register the driver for boot because the user may have selected
// "Last Known Good Configuration" from the Windows boot menu.
// Note that we need to do this even when creating a hidden OS (because
// the hidden OS needs our boot driver and it will be a clone of this OS).
try
{
BootEncObj->RegisterBootDriver (bHiddenOS ? true : false);
}
catch (Exception &e)
{
e.Show (NULL);
}
if (AskWarnYesNo ("CONFIRM_RESTART", hwndDlg) == IDYES)
{
EndMainDlg (MainDlg);
try
{
BootEncObj->RestartComputer ();
}
catch (Exception &e)
{
e.Show (hwndDlg);
}
return;
}
EndMainDlg (MainDlg);
return;
}
else if (bAnswerTerminate)
{
// User doesn't want to retry pretest (or OS cloning), but to terminate the entire process
try
{
BootEncObj->Deinstall (true);
}
catch (Exception &e)
{
e.Show (hwndDlg);
AbortProcessSilent();
}
ManageStartupSeqWiz (TRUE, L"");
ChangeSystemEncryptionStatus (SYSENC_STATUS_NONE);
EndMainDlg (MainDlg);
return;
}
else
{
// User doesn't want to take any action now
AbortProcessSilent();
}
}
}
break;
default:
// Unexpected progress status -- fix the inconsistency
ManageStartupSeqWiz (TRUE, L"");
ChangeSystemEncryptionStatus (SYSENC_STATUS_NONE);
EndMainDlg (MainDlg);
InconsistencyResolved (SRC_POS);
return;
}
}
else
{
if (DirectDeviceEncMode)
{
SwitchWizardToNonSysDeviceMode();
return;
}
if (DirectPromptNonSysInplaceEncResumeMode
&& !bInPlaceEncNonSysPending)
{
// This instance of the wizard has been launched via the system startup sequence to prompt for resume of
// a non-system in-place encryption/decryption process. However, no config file indicates that any such process
// has been interrupted. This inconsistency may occur, for example, when the process is finished
// but the wizard is not removed from the startup sequence because system encryption is in progress.
// Therefore, we remove it from the startup sequence now if possible.
if (!IsNonInstallMode () && SystemEncryptionStatus == SYSENC_STATUS_NONE)
ManageStartupSeqWiz (TRUE, L"");
AbortProcessSilent ();
}
BOOL bDecrypt = FALSE;
if (DirectNonSysInplaceDecStartMode)
{
SwitchWizardToNonSysInplaceDecStartMode (szFileName);
return;
}
else if (DirectNonSysInplaceEncResumeMode || DirectNonSysInplaceDecResumeMode)
{
SwitchWizardToNonSysInplaceEncResumeMode (DirectNonSysInplaceDecResumeMode);
return;
}
else if (DirectPromptNonSysInplaceEncResumeMode)
{
if (NonSysInplaceEncInProgressElsewhere ())
AbortProcessSilent ();
if (AskNonSysInPlaceEncryptionResume(hwndDlg, &bDecrypt) == IDYES)
SwitchWizardToNonSysInplaceEncResumeMode(bDecrypt);
else
AbortProcessSilent ();
return;
}
else if (bInPlaceEncNonSysPending
&& !NonSysInplaceEncInProgressElsewhere ()
&& AskNonSysInPlaceEncryptionResume(hwndDlg, &bDecrypt) == IDYES)
{
SwitchWizardToNonSysInplaceEncResumeMode(bDecrypt);
return;
}
LoadPage (hwndDlg, INTRO_PAGE);
}
}
int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpszCommandLine, int nCmdShow)
{
int status;
atexit (localcleanup);
VirtualLock (&volumePassword, sizeof(volumePassword));
VirtualLock (&outerVolumePassword, sizeof(outerVolumePassword));
VirtualLock (szVerify, sizeof(szVerify));
VirtualLock (szRawPassword, sizeof(szRawPassword));
VirtualLock (&volumePim, sizeof(volumePim));
VirtualLock (&outerVolumePim, sizeof(outerVolumePim));
VirtualLock (&CmdVolumePassword, sizeof (CmdVolumePassword));
VirtualLock (MasterKeyGUIView, sizeof(MasterKeyGUIView));
VirtualLock (HeaderKeyGUIView, sizeof(HeaderKeyGUIView));
VirtualLock (randPool, sizeof(randPool));
VirtualLock (lastRandPool, sizeof(lastRandPool));
VirtualLock (outRandPoolDispBuffer, sizeof(outRandPoolDispBuffer));
VirtualLock (&mouseEntropyGathered, sizeof(mouseEntropyGathered));
VirtualLock (&mouseEventsInitialCount, sizeof(mouseEventsInitialCount));
VirtualLock (maskRandPool, sizeof(maskRandPool));
VirtualLock (&szFileName, sizeof(szFileName));
VirtualLock (&szDiskFile, sizeof(szDiskFile));
DetectX86Features ();
try
{
BootEncObj = new BootEncryption (NULL);
}
catch (Exception &e)
{
e.Show (NULL);
}
if (BootEncObj == NULL)
AbortProcess ("INIT_SYS_ENC");
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
nPbar = IDC_PROGRESS_BAR;
if (Randinit ())
{
DWORD dwLastError = GetLastError ();
wchar_t szTmp[4096];
if (CryptoAPILastError == ERROR_SUCCESS)
StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("INIT_RAND"), SRC_POS, dwLastError);
else
StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("CAPI_RAND"), SRC_POS, CryptoAPILastError);
AbortProcessDirect (szTmp);
}
RegisterRedTick(hInstance);
/* Allocate, dup, then store away the application title */
lpszTitle = GetString ("IDD_VOL_CREATION_WIZARD_DLG");
status = DriverAttach ();
if (status != 0)
{
if (status == ERR_OS_ERROR)
handleWin32Error (NULL, SRC_POS);
else
handleError (NULL, status, SRC_POS);
AbortProcess ("NODRIVER");
}
if (!AutoTestAlgorithms())
AbortProcess ("ERR_SELF_TESTS_FAILED");
/* Create the main dialog box */
DialogBoxParamW (hInstance, MAKEINTRESOURCEW (IDD_VOL_CREATION_WIZARD_DLG), NULL, (DLGPROC) MainDialogProc,
(LPARAM)lpszCommandLine);
FinalizeApp ();
return 0;
}
static DWORD GetFormatSectorSize ()
{
if (!bDevice)
return TC_SECTOR_SIZE_FILE_HOSTED_VOLUME;
DISK_GEOMETRY_EX geometry;
if (!GetDriveGeometry (szDiskFile, &geometry))
{
handleWin32Error (MainDlg, SRC_POS);
AbortProcessSilent();
}
return geometry.Geometry.BytesPerSector;
}
-
-/* This function is called when advanced dialog in intro page is open */
-BOOL CALLBACK AdvanceDlgProcIntro (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- WORD lw = LOWORD(wParam);
-
- switch (msg)
- {
- case WM_INITDIALOG:
-
- bHiddenVolHost = bHiddenVol = bHiddenOS;
-
- SendMessage (GetDlgItem (hwndDlg, IDC_SYSENC_HIDDEN), WM_SETFONT, (WPARAM) hUserBoldFont, (LPARAM) TRUE);
- SendMessage (GetDlgItem (hwndDlg, IDC_SYSENC_NORMAL), WM_SETFONT, (WPARAM) hUserBoldFont, (LPARAM) TRUE);
-
- CheckButton (GetDlgItem (hwndDlg, bHiddenOS ? IDC_SYSENC_HIDDEN : IDC_SYSENC_NORMAL));
-
- return 1;
- case WM_COMMAND:
- {
- if (lw == IDCANCEL)
- {
- EndDialog(hwndDlg, lw);
- return 1;
- }
-
- if(lw == IDOK)
- {
- if (bHiddenOS)
- {
- bWholeSysDrive = FALSE;
- bHiddenVolDirect = FALSE;
- }
- EndDialog(hwndDlg, lw);
- return 1;
- }
-
- if (lw == IDC_SYSENC_HIDDEN)
- {
- SendMessage (GetDlgItem (hwndDlg, IDC_SYSENC_NORMAL), BM_SETCHECK, BST_UNCHECKED, 0);
-
- bHiddenOS = TRUE;
- bHiddenVol = TRUE;
- bHiddenVolHost = TRUE;
- return 1;
- }
-
- if (lw == IDC_SYSENC_NORMAL)
- {
- SendMessage (GetDlgItem (hwndDlg, IDC_SYSENC_HIDDEN), BM_SETCHECK, BST_UNCHECKED, 0);
-
- bHiddenOS = FALSE;
- bHiddenVol = FALSE;
- bHiddenVolHost = FALSE;
- return 1;
- }
-
- if(lw == IDHELP)
- {
- Applink ("hiddensysenc");
- return 1;
- }
- }
- }
- return 0;
-}
-
-/* AES, HASH, Pim and Wipe mode can be selected here */
-BOOL CALLBACK AdvanceDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- WORD lw = LOWORD(wParam);
- WORD hw = HIWORD(wParam);
- int ea, hid;
- wchar_t buf[100];
- BOOL bNTFSallowed = FALSE;
- BOOL bFATallowed = FALSE;
- BOOL bEXFATallowed = FALSE;
- BOOL bReFSallowed = FALSE;
- BOOL bNoFSallowed = FALSE;
- hCurPage = hwndDlg;
-
- switch (msg)
- {
- case WM_INITDIALOG:
- {
- SetWindowTextW ( GetDlgItem (hwndDlg, IDT_IMPORTANT_NOTE), GetString ("ADV_FEATURES_NOTE"));
- SetWindowTextW ( GetDlgItem (hwndDlg, IDT_PIM_INFO), GetString ("PIM_INFO"));
- SetWindowTextW ( GetDlgItem (hwndDlg, IDT_WIPE_INFO), GetString ("WIPE_INFO"));
-
- /* Encryption algorithms */
-
- SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_BOX), CB_RESETCONTENT, 0, 0);
-
- for (ea = EAGetFirst (); ea != 0; ea = EAGetNext (ea))
- {
- if (EAIsFormatEnabled (ea) && (!SysEncInEffect () || bSystemIsGPT || EAIsMbrSysEncEnabled (ea)))
- AddComboPair (GetDlgItem (hwndDlg, IDC_COMBO_BOX), EAGetName (buf, ARRAYSIZE(buf), ea, 1), ea);
- }
-
- SelectAlgo (GetDlgItem (hwndDlg, IDC_COMBO_BOX), &nVolumeEA);
- ComboSelChangeEA (hwndDlg);
- SetFocus (GetDlgItem (hwndDlg, IDC_COMBO_BOX));
-
- /* Hash algorithms */
- if (SysEncInEffect())
- {
- RandSetHashFunction(hash_algo);
- for (hid = FIRST_PRF_ID; hid <= LAST_PRF_ID; hid++)
- {
- // Use blake2s for hashing
- if (((hid == BLAKE2S) || !HashIsDeprecated(hid)) && (bSystemIsGPT || HashForSystemEncryption(hid)))
- AddComboPair(GetDlgItem(hwndDlg, IDC_COMBO_BOX_HASH_ALGO), HashGetName(hid), hid);
- }
- }
- else
- {
- hash_algo = RandGetHashFunction();
- for (hid = FIRST_PRF_ID; hid <= LAST_PRF_ID; hid++)
- {
- if (!HashIsDeprecated(hid))
- AddComboPair(GetDlgItem(hwndDlg, IDC_COMBO_BOX_HASH_ALGO), HashGetName(hid), hid);
- }
- }
-
- if (CreatingHiddenSysVol())
- Warning ("HIDDEN_OS_PRE_CIPHER_WARNING", MainDlg);
-
- SetWindowText(GetDlgItem(hwndDlg, IDC_SHA512_HELP), GetString("SHA512_HELP"));
- SelectAlgo(GetDlgItem(hwndDlg, IDC_COMBO_BOX_HASH_ALGO), &hash_algo);
-
- /* file system options */
- SetTimer(GetParent(hwndDlg), TIMER_ID_RANDVIEW, TIMER_INTERVAL_RANDVIEW, NULL);
-
- hMasterKey = GetDlgItem(hwndDlg, IDC_DISK_KEY);
- hHeaderKey = GetDlgItem(hwndDlg, IDC_HEADER_KEY);
- hRandPool = GetDlgItem(hwndDlg, IDC_RANDOM_BYTES);
-
- SendMessage(GetDlgItem(hwndDlg, IDC_RANDOM_BYTES), WM_SETFONT, (WPARAM)hFixedDigitFont, (LPARAM)TRUE);
- SendMessage(GetDlgItem(hwndDlg, IDC_DISK_KEY), WM_SETFONT, (WPARAM)hFixedDigitFont, (LPARAM)TRUE);
- SendMessage(GetDlgItem(hwndDlg, IDC_HEADER_KEY), WM_SETFONT, (WPARAM)hFixedDigitFont, (LPARAM)TRUE);
-
- /* Quick/Dynamic */
-
- if (bHiddenVol)
- {
- quickFormat = !bHiddenVolHost;
- dynamicFormat = FALSE;
- bSparseFileSwitch = FALSE;
- }
- else
- {
- if (bDevice)
- {
- dynamicFormat = FALSE;
- bSparseFileSwitch = FALSE;
- }
- else
- {
- wchar_t root[TC_MAX_PATH];
- DWORD fileSystemFlags = 0;
-
- /* Check if the host file system supports sparse files */
-
- if (GetVolumePathName (szFileName, root, array_capacity (root)))
- {
- GetVolumeInformation (root, NULL, 0, NULL, NULL, &fileSystemFlags, NULL, 0);
- bSparseFileSwitch = fileSystemFlags & FILE_SUPPORTS_SPARSE_FILES;
- }
- else
- bSparseFileSwitch = FALSE;
- if (!bSparseFileSwitch)
- {
- dynamicFormat = FALSE;
- }
- }
- }
- SendMessage (GetDlgItem (hwndDlg, IDC_SHOW_KEYS), BM_SETCHECK, showKeys ? BST_CHECKED : BST_UNCHECKED, 0);
- SetWindowText (GetDlgItem (hwndDlg, IDC_RANDOM_BYTES), showKeys ? L"" : L"******************************** ");
- SetWindowText (GetDlgItem (hwndDlg, IDC_HEADER_KEY), showKeys ? L"" : L"******************************** ");
- SetWindowText (GetDlgItem (hwndDlg, IDC_DISK_KEY), showKeys ? L"" : L"******************************** ");
-
- SendMessage(GetDlgItem(hwndDlg, IDC_CLUSTERSIZE), CB_RESETCONTENT, 0, 0);
- AddComboPairW(GetDlgItem(hwndDlg, IDC_CLUSTERSIZE), GetString("DEFAULT"), 0);
- SendMessage(GetDlgItem(hwndDlg, IDC_CLUSTERSIZE), CB_SETCURSEL, 0, 0);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CLUSTERSIZE), TRUE);
-
- /* Filesystems */
- bNTFSallowed = FALSE;
- bFATallowed = FALSE;
- bEXFATallowed = FALSE;
- bReFSallowed = FALSE;
- bNoFSallowed = FALSE;
-
- SendMessage(GetDlgItem(hwndDlg, IDC_FILESYS), CB_RESETCONTENT, 0, 0);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FILESYS), TRUE);
-
- uint64 dataAreaSize = GetVolumeDataAreaSize (bHiddenVol && !bHiddenVolHost, nVolumeSize);
-
- if (!CreatingHiddenSysVol())
- {
- if (dataAreaSize >= TC_MIN_NTFS_FS_SIZE && dataAreaSize <= TC_MAX_NTFS_FS_SIZE)
- {
- AddComboPair (GetDlgItem (hwndDlg, IDC_FILESYS), L"NTFS", FILESYS_NTFS);
- bNTFSallowed = TRUE;
- }
-
- if (dataAreaSize >= TC_MIN_FAT_FS_SIZE && dataAreaSize <= TC_MAX_FAT_SECTOR_COUNT * GetFormatSectorSize())
- {
- AddComboPair (GetDlgItem (hwndDlg, IDC_FILESYS), L"FAT", FILESYS_FAT);
- bFATallowed = TRUE;
- }
-
- //exFAT support added starting from Vista SP1
- if (IsOSVersionAtLeast (WIN_VISTA, 1) && dataAreaSize >= TC_MIN_EXFAT_FS_SIZE && dataAreaSize <= TC_MAX_EXFAT_FS_SIZE)
- {
- AddComboPair (GetDlgItem (hwndDlg, IDC_FILESYS), L"exFAT", FILESYS_EXFAT);
- bEXFATallowed = TRUE;
- }
-
- //ReFS write support activated by default starting from Windows 10
- //We don't support it yet for the creation of hidden volumes
- if ((!bHiddenVolHost) && IsOSVersionAtLeast (WIN_10, 0) && dataAreaSize >= TC_MIN_REFS_FS_SIZE && dataAreaSize <= TC_MAX_REFS_FS_SIZE)
- {
- AddComboPair (GetDlgItem (hwndDlg, IDC_FILESYS), L"ReFS", FILESYS_REFS);
- bReFSallowed = TRUE;
- }
- }
- else
- {
- // We're creating a hidden volume for a hidden OS, so we don't need to format it with
- // any filesystem (the entire OS will be copied to the hidden volume sector by sector).
- EnableWindow (GetDlgItem (hwndDlg, IDC_FILESYS), FALSE);
- EnableWindow (GetDlgItem (hwndDlg, IDC_CLUSTERSIZE), FALSE);
- }
- if (!bHiddenVolHost)
- {
- AddComboPairW(GetDlgItem(hwndDlg, IDC_FILESYS), GetString("NONE"), FILESYS_NONE);
- bNoFSallowed = TRUE;
- }
- if (fileSystem == FILESYS_NONE) // If no file system has been previously selected
- {
- // Set default file system
-
- if (bFATallowed && !(nNeedToStoreFilesOver4GB == 1 && (bNTFSallowed || bEXFATallowed || bReFSallowed)))
- fileSystem = FILESYS_FAT;
- else if (bEXFATallowed)
- fileSystem = FILESYS_EXFAT;
- else if (bNTFSallowed)
- fileSystem = FILESYS_NTFS;
- else if (bReFSallowed)
- fileSystem = FILESYS_REFS;
- else if (bNoFSallowed)
- fileSystem = FILESYS_NONE;
- else
- {
- AddComboPair (GetDlgItem (hwndDlg, IDC_FILESYS), L"---", 0);
- }
- }
-
- SendMessage(GetDlgItem(hwndDlg, IDC_FILESYS), CB_SETCURSEL, 0, 0);
- SelectAlgo(GetDlgItem(hwndDlg, IDC_FILESYS), (int *)&fileSystem);
-
- /* PIM and Wipe mode */
- SetCheckBox(hwndDlg, IDC_PIM_ENABLE, PimEnable);
-
- PopulateWipeModeCombo(GetDlgItem(hwndDlg, IDC_WIPE_MODE),
- SystemEncryptionStatus == SYSENC_STATUS_DECRYPTING && !bInPlaceEncNonSys,
- TRUE,
- FALSE);
- SelectAlgo(GetDlgItem(hwndDlg, IDC_WIPE_MODE), (int *)&nWipeMode);
- SetFocus(GetDlgItem(GetParent(hwndDlg), IDOK));
- }
- return 1;
- case WM_COMMAND:
- if (lw == IDCANCEL)
- {
- EndDialog(hwndDlg, lw);
- return 1;
- }
- if (lw == IDOK)
- {
- /* Save hash and encryption algo */
- LPARAM nIndex;
- nIndex = SendMessage (GetDlgItem (hCurPage, IDC_COMBO_BOX), CB_GETCURSEL, 0, 0);
- nVolumeEA = (int) SendMessage (GetDlgItem (hCurPage, IDC_COMBO_BOX), CB_GETITEMDATA, nIndex, 0);
-
- if (!bSystemIsGPT && SysEncInEffect ()
- && EAGetCipherCount (nVolumeEA) > 1) // Cascade?
- {
- if (AskWarnNoYes ("CONFIRM_CASCADE_FOR_SYS_ENCRYPTION", hwndDlg) == IDNO)
- return 1;
-
- if (!bHiddenOS)
- Info ("NOTE_CASCADE_FOR_SYS_ENCRYPTION", hwndDlg);
- }
-
- nIndex = SendMessage (GetDlgItem (hCurPage, IDC_COMBO_BOX_HASH_ALGO), CB_GETCURSEL, 0, 0);
- hash_algo = (int) SendMessage (GetDlgItem (hCurPage, IDC_COMBO_BOX_HASH_ALGO), CB_GETITEMDATA, nIndex, 0);
-
- RandSetHashFunction (hash_algo);
-
- /* Save PIM and Wipe mode */
- nWipeMode = (WipeAlgorithmId)SendMessage(GetDlgItem(hwndDlg, IDC_WIPE_MODE),
- CB_GETITEMDATA,
- SendMessage(GetDlgItem(hwndDlg, IDC_WIPE_MODE), CB_GETCURSEL, 0, 0),
- 0);
-
- PimEnable = GetCheckBox(hwndDlg, IDC_PIM_ENABLE);
- SetCheckBox(hwndDlg, IDC_PIM_ENABLE, PimEnable);
-
- EndDialog(hwndDlg, lw);
- return 1;
- }
- if (lw == IDC_CIPHER_TEST)
- {
- LPARAM nIndex;
- int c;
-
- nIndex = SendMessage (GetDlgItem (hCurPage, IDC_COMBO_BOX), CB_GETCURSEL, 0, 0);
- nVolumeEA = (int) SendMessage (GetDlgItem (hCurPage, IDC_COMBO_BOX), CB_GETITEMDATA, nIndex, 0);
-
- for (c = EAGetLastCipher (nVolumeEA); c != 0; c = EAGetPreviousCipher (nVolumeEA, c))
- {
- DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_CIPHER_TEST_DLG),
- GetParent (hwndDlg), (DLGPROC) CipherTestDialogProc, (LPARAM) c);
- }
-
- return 1;
- }
-
- if (lw == IDC_BENCHMARK)
- {
- // Reduce CPU load
- bFastPollEnabled = FALSE;
- bRandmixEnabled = FALSE;
-
- DialogBoxParamW (hInst,
- MAKEINTRESOURCEW (IDD_BENCHMARK_DLG), hwndDlg,
- (DLGPROC) BenchmarkDlgProc, (LPARAM) bSystemIsGPT);
-
- bFastPollEnabled = TRUE;
- bRandmixEnabled = TRUE;
- return 1;
- }
-
- if (lw == IDC_WIPE_MODE && hw == CBN_SELCHANGE)
- {
- Warning ("WIPE_WARNING", hwndDlg);
- return 1;
- }
-
- if (hw == CBN_SELCHANGE && lw == IDC_COMBO_BOX)
- {
- ComboSelChangeEA (hwndDlg);
- SetWindowTextW (GetDlgItem (hCurPage, IDC_BENCHMARK), GetString ("IDC_BENCHMARK"));
- return 1;
- }
-
- if (hw == CBN_SELCHANGE && lw == IDC_COMBO_BOX_HASH_ALGO)
- {
- ShowWindow (GetDlgItem (hwndDlg, IDT_HASH_ALGO), SW_SHOW);
- if (SysEncInEffect())
- {
- HWND hHashAlgoItem = GetDlgItem (hCurPage, IDC_COMBO_BOX_HASH_ALGO);
- int selectedAlgo = (int)SendMessage (hHashAlgoItem, CB_GETITEMDATA, SendMessage (hHashAlgoItem, CB_GETCURSEL, 0, 0), 0);
-
- if (!bSystemIsGPT && !HashForSystemEncryption (selectedAlgo))
- {
- hash_algo = DEFAULT_HASH_ALGORITHM_BOOT;
- RandSetHashFunction (DEFAULT_HASH_ALGORITHM_BOOT);
- Info ("ALGO_NOT_SUPPORTED_FOR_SYS_ENCRYPTION", MainDlg);
- SelectAlgo (GetDlgItem (hCurPage, IDC_COMBO_BOX_HASH_ALGO), &hash_algo);
- }
- }
- return 1;
- }
-
- if (lw == IDC_PIM_ENABLE)
- {
- PimEnable = GetCheckBox (hwndDlg, IDC_PIM_ENABLE);
- if (!PimEnable)
- volumePim = 0;
- return 1;
- }
- }
- return 0;
-}
-
-void
-AddComboPairW (HWND hComboBox, const wchar_t *lpszItem, int value)
-{
- LPARAM nIndex;
- nIndex = SendMessageW(hComboBox, CB_ADDSTRING, 0, (LPARAM)lpszItem);
- nIndex = SendMessage(hComboBox, CB_SETITEMDATA, nIndex, (LPARAM)value);
-}
-
-/* Acording to NIST, only a blacklist check and at least 8 character should be compulsary, no special character check... */
-int PrintStrongness (char input[], unsigned int length)
-{
- unsigned int n = length;
- int iReturnValue = 0;
- if (n < 10)
- {
- burn (input, sizeof(input));
- return iReturnValue = weak;
- }
- else if (CheckWord(input))
- {
- burn (input, sizeof(input));
- return iReturnValue = weak;
- }
- //Tetermine the strength of the passsord
- if ((n >= 13))
- {
- iReturnValue = very_strong;
- }
- //if 3 out of 4 paramters are true
- else if (n >= 10)
- {
- iReturnValue = strong;
- }
- //if 2 out of 4 values are true
- else if (n >= 8)
- {
- iReturnValue = medium;
- }
- else
- {
- iReturnValue = weak;
- }
- burn (input, sizeof(input));
- return iReturnValue;
-}
-
-/* Check if password is in list
-Credits go Martin York from https://codereview.stackexchange.com/questions/52702/how-to-search-for-a-word-in-a-sorted-text-file-efficiently */
-BOOL CheckWord (char* search)
-{
-
- bool isWordInDict(std::string const& word);
- {
- struct MyDict : std::set<std::string>
- {
- typedef std::set<std::string>::const_iterator const_iterator;
- MyDict()
- {
- wchar_t path[TC_MAX_PATH];
- wchar_t tmp[TC_MAX_PATH];
- wchar_t destFileName[TC_MAX_PATH] = L"password1000000.txt";
-
- if (GetModuleFileName (NULL, path, ARRAYSIZE (path)) == 0)
- {
- Error ("ERROR_GETTING_PATH", MainDlg);
- }
-
- StringCbCopyW(tmp, ARRAYSIZE(tmp), path);
-
- //detects the last '\' in order to remove the name of the exe file. Afterwards add .txt file in the path
- for (int i = wcslen(path); i > 1; i--)
- {
- if (tmp[i] == '\\')
- {
- for(unsigned int j = i + 1; j < wcslen(path); j++)
- {
- tmp[j] = '\0';
- }
- break;
- }
- }
- StringCbCatW(tmp, sizeof(tmp), destFileName);
-
- std::ifstream fin(tmp);
- std::copy(std::istream_iterator<std::string>(fin), std::istream_iterator<std::string>(),
- std::inserter(*this, end()));
- }
- };
- static const MyDict dict;
- MyDict::const_iterator find = dict.find(search);
-
- return find != dict.end();
- }
-}
-
-/* Credits go to Barmak Shemirani from https://stackoverflow.com/questions/31407492/c-tooltip-function-for-checkbox */
-void CreateToolTip(HWND hWndParent, HWND hControlItem, PTSTR pszText)
-{
- if (!hControlItem || !hWndParent || !pszText)
- return;
-
- HWND hwndTip = CreateWindowEx(NULL, TOOLTIPS_CLASS, NULL,
- WS_POPUP | TTS_NOFADE | TTS_ALWAYSTIP /*| TTS_BALLOON*/,
- CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
- hWndParent, NULL, GetModuleHandle(NULL), NULL);
-
- if (!hwndTip)
- return;
-
- TOOLINFO toolInfo = { 0 };
- toolInfo.cbSize = sizeof(toolInfo);
- toolInfo.hwnd = hWndParent;
- toolInfo.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
- toolInfo.uId = (UINT_PTR)hControlItem;
- toolInfo.lpszText = pszText;
- GetClientRect(hWndParent, &toolInfo.rect);
- if (!SendMessage(hwndTip, TTM_ADDTOOL, 0, (LPARAM)&toolInfo))
- {
- MessageBox(0, TEXT("TTM_ADDTOOL failed\nWrong project manifest!"), 0, 0);
- }
-}
diff --git a/src/Format/Tcformat.h b/src/Format/Tcformat.h
index a8237521..f9328afd 100644
--- a/src/Format/Tcformat.h
+++ b/src/Format/Tcformat.h
@@ -1,117 +1,109 @@
/*
Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses'
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. */
#include "Common/Common.h"
#ifdef __cplusplus
extern "C" {
#endif
#define NBR_KEY_BYTES_TO_DISPLAY 16
#define KEY_GUI_VIEW_SIZE 64 // Max characters of the key hex dump to display
enum timer_ids
{
TIMER_ID_RANDVIEW = 0xff,
TIMER_ID_SYSENC_PROGRESS,
TIMER_ID_NONSYS_INPLACE_ENC_PROGRESS,
TIMER_ID_WIPE_PROGRESS,
TIMER_ID_SYSENC_DRIVE_ANALYSIS_PROGRESS,
TIMER_ID_KEYB_LAYOUT_GUARD
};
static void localcleanup ( void );
static void LoadSettings ( HWND hwndDlg );
void SaveSettings ( HWND hwndDlg );
static void EndMainDlg ( HWND hwndDlg );
void ComboSelChangeEA ( HWND hwndDlg );
static void VerifySizeAndUpdate ( HWND hwndDlg , BOOL bUpdate );
static void __cdecl sysEncDriveAnalysisThread (void *hwndDlgArg);
static void __cdecl volTransformThreadFunction ( void *hwndDlg );
static void LoadPage ( HWND hwndDlg , int nPageNo );
__int64 PrintFreeSpace ( HWND hwndTextBox , wchar_t *lpszDrive , PLARGE_INTEGER lDiskFree );
void DisplaySizingErrorText ( HWND hwndTextBox );
void EnableDisableFileNext ( HWND hComboBox , HWND hMainButton );
BOOL QueryFreeSpace (HWND hwndDlg, HWND hwndTextBox, BOOL display, LONGLONG *pFreeSpaceValue, BOOL* pbIsSparseFilesSupported);
static BOOL FinalPreTransformPrompts (void);
void UpdateLastDialogId (void);
void HandleOldAssignedDriveLetter (void);
void AddCipher ( HWND hComboBox , char *lpszCipher , int nCipher );
BOOL CALLBACK PageDialogProc ( HWND hwndDlg , UINT uMsg , WPARAM wParam , LPARAM lParam );
BOOL CALLBACK MainDialogProc ( HWND hwndDlg , UINT uMsg , WPARAM wParam , LPARAM lParam );
void ExtractCommandLine ( HWND hwndDlg , wchar_t *lpszCommandLine );
void DisplayRandPool (HWND hwndDlg, HWND hPoolDisplay, BOOL bShow);
void DisplayPortionsOfKeys (HWND headerKeyHandle, HWND masterKeyHandle, wchar_t *headerKeyStr, wchar_t *masterKeyStr, BOOL hideKeys);
int DetermineMaxHiddenVolSize (HWND hwndDlg);
BOOL IsSparseFile (HWND hwndDlg);
BOOL GetFileVolSize (HWND hwndDlg, unsigned __int64 *size);
BOOL SwitchWizardToSysEncMode (void);
void SwitchWizardToFileContainerMode (void);
static BOOL ResolveUnknownSysEncDirection (void);
static BOOL WipeHiddenOSCreationConfig (void);
static void AfterWMInitTasks (HWND hwndDlg);
static void AfterSysEncProgressWMInitTasks (HWND hwndDlg);
static void InitSysEncProgressBar (void);
static void InitNonSysInplaceEncProgressBar (void);
static void UpdateNonSysInplaceEncProgressBar (void);
static BOOL SysEncInEffect (void);
static BOOL CreatingHiddenSysVol(void);
static void NonSysInplaceEncPause (void);
static void NonSysInplaceEncResume (void);
void ShowNonSysInPlaceEncUIStatus (void);
void UpdateNonSysInPlaceEncControls (void);
int MountHiddenVolHost ( HWND hwndDlg, wchar_t *volumePath, int *driveNo, Password *password, int pkcs5_prf, int pim, BOOL bReadOnly );
int AnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 hiddenVolHostSize, int *realClusterSize, __int64 *pnbrFreeClusters);
int ScanVolClusterBitmap ( HWND hwndDlg, int *driveNo, __int64 nbrClusters, __int64 *nbrFreeClusters);
static void WipeStart (void);
static void WipeAbort (void);
static void UpdateWipeProgressBar (void);
static void InitWipeProgressBar (void);
static void UpdateWipeControls (void);
static DWORD GetFormatSectorSize ();
extern BOOL showKeys;
extern volatile HWND hMasterKey;
extern volatile HWND hHeaderKey;
extern volatile BOOL bHiddenVolHost;
extern volatile BOOL bHiddenVolDirect;
extern BOOL bRemovableHostDevice;
extern BOOL bWarnDeviceFormatAdvanced;
extern HWND hCurPage;
extern HWND hProgressBar;
extern volatile BOOL bVolTransformThreadCancel;
extern volatile BOOL bInPlaceEncNonSysResumed;
extern volatile BOOL bFirstNonSysInPlaceEncResumeDone;
extern volatile BOOL bInPlaceEncNonSys;
extern volatile BOOL bInPlaceDecNonSys;
extern __int64 NonSysInplaceEncBytesDone;
extern __int64 NonSysInplaceEncTotalSize;
extern int nPbar;
extern volatile int WizardMode;
extern volatile BOOL bInPlaceEncNonSysResumed;
extern wchar_t HeaderKeyGUIView [KEY_GUI_VIEW_SIZE];
extern wchar_t MasterKeyGUIView [KEY_GUI_VIEW_SIZE];
extern volatile int NonSysInplaceEncStatus;
-BOOL CALLBACK AdvanceDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-BOOL CALLBACK FinishDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-void AddComboPairW (HWND hComboBox, const wchar_t *lpszItem, int value);
-int PrintStrongness (char* input, unsigned int length);
-BOOL CheckWord (char search[]);
-BOOL CALLBACK AdvanceDlgProcIntro (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-void CreateToolTip (HWND hWndParent, HWND hControlItem, PTSTR pszText);
-
#ifdef __cplusplus
}
#endif
diff --git a/src/Release/Setup Files/Product64.wxs b/src/Release/Setup Files/Product64.wxs
index 2f43edd1..e20fd1dc 100644
--- a/src/Release/Setup Files/Product64.wxs
+++ b/src/Release/Setup Files/Product64.wxs
@@ -1,1705 +1,1709 @@
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<!-- 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.ProductName = VeraCrypt $(var.FullProductVersion)?>
<!-- Unique GUID identifying this family of product (32-bit and 64-bit have the same) -->
<?define var.UpgradeCode = {298F5D2B-3B01-4A13-BEFD-4B3C7BE43BC6}?>
<!-- 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}?>
<!-- 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 -->
<?define var.PackageCode = "*"?>
<!-- Set path to License file -->
<?define var.licenseRtf = "$(sys.CURRENTDIR)\License.rtf"?>
<!-- See https://wixtoolset.org/documentation/manual/v3/xsd/wix/product.html -->
<!-- Lang will be defined in a .wxl file which will be passed to the WIX linker 'light' -->
<Product Id="$(var.ProductGuid)"
Language="!(loc.Lang)"
Manufacturer="IDRIX"
Name="$(var.ProductName)"
Version="$(var.FullProductVersion)"
UpgradeCode="$(var.UpgradeCode)">
<!-- See https://wixtoolset.org/documentation/manual/v3/xsd/wix/package.html -->
<!-- InstallerVersion="500"(v5.0) Released with Windows 7 and later, see https://en.wikipedia.org/wiki/Windows_Installer -->
<!-- Language IDs (LCIDs) can be found here https://docs.microsoft.com/en-us/previous-versions/windows/embedded/ms912047(v=winembedded.10)?redirectedfrom=MSDN -->
<!-- InstallScope="perMachine" sets <Property Id="ALLUSERS" Value="1". Because we set it manually from checkbox, we do not set InstallScope. /> -->
<!-- InstallPrivileges="elevated" makes it so that Install button has little shield which prompts for Admin password if needed.
If the MSI is installed from an elevated cmd, no password is asked -->
<!-- Languages is optional ; We set it to 0 to avoid LGHT0309 : Failed to open merge module for validation -->
<Package Compressed="yes"
Id="$(var.PackageCode)"
InstallerVersion="500"
InstallPrivileges="elevated"
Keywords="VeraCrypt MSI Installer"
Manufacturer="IDRIX"
Languages="0"
Platform="x64"
Description="VeraCrypt $(var.FullProductVersion) 64-bit MSI Installer"
Comments="MSI Installer of VeraCrypt for Windows 64-bit editions"
/>
<!-- Major upgrade -->
<!-- Prevent downgrades -->
<!-- Prevent same versions upgrades to avoid having 2 products -->
<!-- Since the Windows Installer only uses the first 3 parts of the version in upgrade scenarios,
versions a.b.c.d and a.b.c.e are treated as being the same version.
By setting 'AllowSameVersionUpgrades' to 'yes', version a.b.c.d and a.b.c.e can upgrade each other :
this fixes the issue for a.b.c.e upgrading a.b.c.d but also enables downgrades from a.b.c.e to a.b.c.d.
Therefore, this property is not set to 'yes' -->
<!-- We guarantee that two different x.y.z versions will have a different ProductId, so
everything is always a MajorUpgrade. MinorUpdates and Patches have many requirements
for Feature and Component changes, which we will no doubt forget about in the future.
A MajorUpgrade is a small price to pay to prevent any mishaps.
Since we strictly follow component rules, we use afterInstallExecute to speed things up a bit. -->
<!-- We schedule RemoveExistingProducts after InstallExecute, so that, the install of the new version's files precedes the
removal of obsolete files. In this scenario files are only replaced if they are versioned and newer than installed files,
and for unversioned files, the file replacement rules basically states that the file will only be
overwritten if it has not been changed on disk, meaning it will keep files that have been changed.
So, what happens is MSI will PreInst, InstallFiles and PostInst first, as if 'NOT Installed' is true.
Here, UPGRADINGPRODUCTCODE is not set.
Then, it will execute RemoveExistingProducts where the ACTUAL upgrade happens.
Here, UPGRADINGPRODUCTCODE is set.
We do this to avoid the following :
- Windows Installer determines which files to install. It decides that some files don't need to be installed
(possibly because they already exist and are of the same or newer versions as the ones in the MSI).
- The previous version of software is removed, including the files Windows Installer determined didn't need to be installed.
- Windows installer installs files for the new installation, but does not install files that it determined did not need to be installed.
The end result is that a bunch of files are missing after upgrading the software. -->
<MajorUpgrade
AllowSameVersionUpgrades="no"
DowngradeErrorMessage="!(loc.NoDowngrade)"
Schedule="afterInstallExecute"
/>
<!-- Windows 7 (601) is our Min OS -->
<!-- See https://docs.microsoft.com/en-us/windows/win32/msi/operating-system-property-values -->
<!-- 'Installed' is a Windows Installer property that is set only if the product is installed per-machine or for the current user.
Using !Installed ensures the check is only done when the user is installing the application, rather than on a repair or remove -->
<!-- Notice the ! : If Not Installed AND VersionNT < 601 => Show error message -->
<Condition Message="!(loc.MinOs)">
<![CDATA[
Installed
OR (VersionNT = 601)
OR (VersionNT > 601)
]]>
</Condition>
<!-- This installer can only be executed under 64bit, never under 32-bit -->
<Condition Message="!(loc.OS64Bitness)">
<![CDATA[
Installed
OR (VersionNT64)
]]>
</Condition>
<!-- Uncomment the following if you want the installer to only be runnable by Admin.
This means that, in order to be be run, an elevated cmd must be used or it must be run using "run as admin".
Otherwise, an error message is shown.
-->
<!--
<Property Id="MSIUSEREALADMINDETECTION" Value="1" />
<Condition Message="!(loc.AdminNeeded)">
NOT Installed AND NOT Privileged
</Condition>
-->
<!-- Media describes a disk that makes up the source media for the installation -->
<!-- For DiskId and compression -->
<Media Id="1" Cabinet="VeraCrypt.cab" EmbedCab="yes" />
<!-- Icon used for Add/Remove Programs icon -->
<Icon Id="Setup.ico" SourceFile="$(sys.CURRENTDIR)\Setup.ico"/>
<!-- Icon used for Shortcut, ProgId, or Class elements (but not UI controls) -->
<Icon Id="VeraCrypt.ico" SourceFile="$(sys.CURRENTDIR)\VeraCrypt.ico"/>
<!-- Top banner -->
<WixVariable Id="WixUIBannerBmp" Value="$(sys.CURRENTDIR)\VeraCrypt_setup.bmp" />
<!-- Background bitmap used on the welcome and completion dialogs -->
<WixVariable Id="WixUIDialogBmp" Value="$(sys.CURRENTDIR)\VeraCrypt_setup_background.bmp" />
<!-- The primary icon displayed in Add/Remove Programs -->
<!-- Cannot set the MSI Installer exe icon, only possible using Bundle and IconSourceFile -->
<Property Id="ARPPRODUCTICON" Value="Setup.ico" />
<!-- URL for the link to the publishers home page or the application's home page -->
<Property Id="ARPURLINFOABOUT" Value="https://www.idrix.fr"/>
<!-- Following properties are meant to install the Desktop and StartMenu shortcuts -->
<!-- They make it possible to give the user checkboxes to choose whether to install or not -->
<!-- By default, we install all the shortcuts -->
<Property Id="INSTALLDESKTOPSHORTCUT" Value ="1" />
<Property Id="INSTALLSTARTMENUSHORTCUT" Value ="1" />
<!-- Following property is meant to install the RegKeys -->
<!-- They make it possible to give the user checkboxes to choose whether to install or not -->
<!-- By default, we install all the RegKeys -->
<Property Id="REGISTERVCFILEEXT" Value ="1" />
<!-- Following property is meant to set whether to install for All users or just the current one -->
<!-- They make it possible to give the user checkboxes to choose what to do -->
<!-- By default, we install all for all users -->
<Property Id="ALLUSERS" Value="1" />
<!-- Following property sets the default acceptance of the license.
In UI mode, the user needs to check the license box in order to accept
the license, which sets 'LicenseAccepted' to '1', but not 'ACCEPTLICENSE'.
Therefore, for UI mode, we need to set 'ACCEPTLICENSE' manually when
we detect that 'LicenseAccepted' is set, and only in UI sequence.
In silent mode, 'LicenseAccepted' is by default set to '1', therefore,
the user must only specify 'ACCEPTLICENSE' to 'YES' in msiexec.
By default, the license is not accepted. -->
<Property Id="ACCEPTLICENSE" Value="NO"/>
<!-- Directory layout / structure for the product -->
<!-- Windows Installer expects the Directory tree to always be rooted in a
Directory row where the primary key (Directory/@Id) is "TARGETDIR"
and the DefaultDir column (Directory/@Name) is "SourceDir" -->
<!-- During an install, TARGETDIR will default to the largest drive on the machine.
SourceDir will be set to the location where the MSI is being executed -->
<!-- See https://wixtoolset.org/documentation/manual/v3/bundle/bundle_built_in_variables.html -->
<Directory Id="TARGETDIR" Name="SourceDir">
<!-- Reference DesktopFolder to create a Desktop Shortcut -->
<Directory Id="DesktopFolder" Name="Desktop"/>
<!-- Reference APPLICATIONPROGRAMSFOLDER to create a Start Menu Shortcut -->
<!-- See https://wixtoolset.org/documentation/manual/v3/howtos/files_and_registry/create_start_menu_shortcut.html -->
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="$(var.ProductName)"/>
</Directory>
<!-- We do not Reference QuickLaunchFolder under AppDataFolder to create a Quick Launch Shortcut -->
<!-- The shortcut is installed under C:/Users/<user>/AppData/Roaming/Microsoft/Internet Explorer/QuickLaunch
which is not created for all users (only for the one under which the install occurred) because of
perMachine installation (sets ALLUSERS to 1)
Also, when uninstalling, and if the user that uninstalls is not the same that has installed,
the shortcut is not cleared from the quick launch of the installing user.
Therefore, we avoid this.
-->
<!-- Reference C:\Windows\System32 -->
<Directory Id="System64Folder">
<!-- Reference C:\Windows\System32\Drivers -->
<!-- The directory is not created here, instead if is implicitly created when we add install using { Component, Files } ... -->
<!-- The creation can be forced without installing files by setting CreateFolder inside Component -->
<Directory Id="DRIVERSFOLDER" Name="Drivers"/>
</Directory>
<!-- Reference C:\Program Files (only 64-bit) -->
<Directory Id="ProgramFiles64Folder">
<!-- Reference C:\Program Files\VeraCrypt -->
<!-- The directory is not created here, instead if is implicitly created when we install files using { Component, Files } ... -->
<!-- The creation can be forced without installing files by setting CreateFolder inside Component -->
<Directory Id="APPLICATIONROOTFOLDER" Name="VeraCrypt">
<!-- Reference C:\Program Files\VeraCrypt\Languages -->
<Directory Id="LANGUAGESFOLDER" Name="Languages"/>
<!-- Reference C:\Program Files\VeraCrypt\docs -->
<Directory Id="DOCSFOLDER" Name="docs">
<!-- Reference C:\Program Files\VeraCrypt\docs\EFI-DCS -->
<Directory Id="EFIDOCSFOLDER" Name="EFI-DCS"/>
<!-- Reference C:\Program Files\VeraCrypt\docs\html -->
<Directory Id="HTMLDOCSFOLDER" Name="html">
<!-- Reference C:\Program Files\VeraCrypt\docs\html\en -->
<Directory Id="ENHTMLDOCSFOLDER" Name="en"/>
</Directory>
</Directory>
</Directory>
</Directory>
</Directory>
<!-- Directories referencing to install components -->
<!-- Refer to C:\Windows\System32\Drivers in order to install files in it -->
<DirectoryRef Id="DRIVERSFOLDER">
<!-- Add files to the installer package inside components -->
<!-- We restrict ourselves to a single file per component to avoid any problems -->
<!-- Generatable guids are supported only for components with a single file as the component's keypath or no files and a registry value as the keypath -->
<!-- The KeyPath for a Component is a single resource that the Windows Installer uses to determine if a Component "exists" on a machine -->
<Component Id="veracryptDriverSys" Guid="{6A1833A1-8A99-42B0-8ABF-9601EFE54DB8}" >
<File Id="veracryptDriver.sys" Name="veracrypt.sys" Source="$(sys.CURRENTDIR)\veracrypt-x64.sys" KeyPath="yes" DiskId="1" />
</Component>
</DirectoryRef>
<!-- Refer to C:\Program Files\VeraCrypt in order to install files in it -->
<DirectoryRef Id="APPLICATIONROOTFOLDER">
<Component Id="LICENSEFile" Guid="{370D29C4-3A58-4B9E-A0D6-A06430FCCA6D}">
<File Id="LICENSE" Name="LICENSE" Source="$(sys.CURRENTDIR)\LICENSE" KeyPath="yes" DiskId="1" />
</Component>
<Component Id="LicenseTxt" Guid="{14F0F218-FBA2-4C68-820B-376345AB9D33}">
<File Id="License.txt" Name="License.txt" Source="$(sys.CURRENTDIR)\License.txt" KeyPath="yes" DiskId="1" />
</Component>
<Component Id="NOTICEFile" Guid="{56980D3E-9568-446D-8518-CA381EBE56C4}">
<File Id="NOTICE" Name="NOTICE" Source="$(sys.CURRENTDIR)\NOTICE" KeyPath="yes" DiskId="1" />
</Component>
<Component Id="VeraCrypt_FormatExe" Guid="{55F89F55-62A6-40D0-A7B4-BC2505C118AA}">
<File Id="VeraCrypt_Format.exe" Name="VeraCrypt Format.exe" Source="$(sys.CURRENTDIR)\VeraCrypt Format-x64.exe" KeyPath="yes" DiskId="1" />
</Component>
<Component Id="veracryptCat" Guid="{F1910CF2-3DA7-471D-845E-1A1C20AD3076}">
<File Id="veracrypt.cat" Name="veracrypt.cat" Source="$(sys.CURRENTDIR)\veracrypt-x64.cat" KeyPath="yes" DiskId="1" />
</Component>
<Component Id="VeraCryptExe" Guid="{9C13F7BE-6ACE-48DE-BD44-714F421ADC2C}">
<File Id="VeraCrypt.exe" Name="VeraCrypt.exe" Source="$(sys.CURRENTDIR)\VeraCrypt-x64.exe" KeyPath="yes" DiskId="1" />
</Component>
<Component Id="veracryptInf" Guid="{955B99DC-74C3-476D-8ECE-52FD0916EA34}">
<File Id="veracrypt.inf" Name="veracrypt.inf" Source="$(sys.CURRENTDIR)\veracrypt.inf" KeyPath="yes" DiskId="1" />
</Component>
<Component Id="veracryptSys" Guid="{5CE01773-01EA-417C-BBA4-8363881763DC}">
<File Id="veracrypt.sys" Name="veracrypt.sys" Source="$(sys.CURRENTDIR)\veracrypt-x64.sys" KeyPath="yes" DiskId="1" />
</Component>
<Component Id="VeraCryptExpanderExe" Guid="{FF1F4376-9025-4124-808E-1C4B58024F14}">
<File Id="VeraCryptExpander.exe" Name="VeraCryptExpander.exe" Source="$(sys.CURRENTDIR)\VeraCryptExpander-x64.exe" KeyPath="yes" DiskId="1" />
</Component>
<Component Id="VeraCryptComRegExe" Guid="{A922CAA3-5D78-49BC-92C9-B317FD7050A7}">
<!-- Needed only to be able to perform RegisterComServers() & UnregisterComServers -->
<File Id="VeraCryptComReg.exe" Name="VeraCrypt COMReg.exe" Source="$(sys.CURRENTDIR)\VeraCrypt COMReg.exe" Hidden="yes" KeyPath="yes" DiskId="1" />
</Component>
</DirectoryRef>
<!-- Refer to C:\Program Files\VeraCrypt\Languages in order to install files in it -->
<!-- Components generated using 'heat dir ".\Translations" -gg -sfrag -template:fragment -out directory.wxs -var "sys.CURRENTDIR"' -->
<DirectoryRef Id="LANGUAGESFOLDER">
<Component Id="cmpF27E43A4E59E04A5B095C5101B229139" Guid="{8EB22F2F-AFE2-45E5-92C3-AB50B377935E}">
<File Id="fil1B0F0BB59C5EE9FC44F8DA3BA57CB272" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.ar.xml" DiskId="1" />
</Component>
<Component Id="cmp4350812363930B900E24C845940DF416" Guid="{52F707BF-2C0D-4690-84E8-8C1806BFC740}">
<File Id="fil7E02C9035678F667086D2D483D8FDF35" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.be.xml" DiskId="1" />
</Component>
<Component Id="cmp1DD254125CF07901EACECC70930818B0" Guid="{AD31462E-039E-41CF-B2CF-D73FD4075C76}">
<File Id="filA52BE38FF2164268AA9562C09281D09B" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.bg.xml" DiskId="1" />
</Component>
<Component Id="cmp8C9E97CFD69D3BCB44B84D886720F3FC" Guid="{A328C74D-C352-4406-8C75-8BA159210936}">
<File Id="fil2A31F450F9C022901212461A240C5D17" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.ca.xml" DiskId="1" />
</Component>
<Component Id="cmp2BC45D6EC406DDC470E8501442A7AF68" Guid="{5E99CB8F-33E2-430C-A0B2-A31058D6D449}">
<File Id="fil0F3AB0CD6266BA1530A0253F059A85DD" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.cs.xml" DiskId="1" />
</Component>
<Component Id="cmp74A0CA1914A6C6FE33D76DE1C01C676D" Guid="{F1E82507-7C31-41F0-A643-69BB53F3CD41}">
<File Id="filDED1A10C5657065D291DC62CA9A32FAE" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.da.xml" DiskId="1" />
</Component>
<Component Id="cmpC186D3472CE1EC872FF1B0CF3682B3B6" Guid="{C23FC0D1-A6B7-4AB1-BA05-EBDC1B4328F9}">
<File Id="filF4D7849840B295D75BA68B5F6C12F7B3" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.de.xml" DiskId="1" />
</Component>
<Component Id="cmp2AB0B613D25DDEF3466CBC86BD6B878B" Guid="{3757C2DE-FCC8-4970-8CB8-A0D9B2404A1C}">
<File Id="fil7AECCD25826C51216C12F09DC87F1B22" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.el.xml" DiskId="1" />
</Component>
<Component Id="cmpB09224EB45E097BF511CBC5DBE3E251C" Guid="{70B91FFF-BDB7-48AE-A664-243A057F1EA7}">
<File Id="filC426C0D58EE0FC49743BDB8AEDA3C6BE" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.es.xml" DiskId="1" />
</Component>
<Component Id="cmpF24BBBEB613F893CBC5FBF6533CB48C9" Guid="{F578356A-16E1-42CF-8DB2-2DC21B4C154B}">
<File Id="fil38AB8BFA030ACBECA75C821E3574759A" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.et.xml" DiskId="1" />
</Component>
<Component Id="cmp50E1DEF37599D2900447B13FC285B7B7" Guid="{1FDF2F45-97F1-40C0-A450-A2342BBF913C}">
<File Id="fil1BCCDEC84EB4D85DB0380FCD6153D1FA" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.eu.xml" DiskId="1" />
</Component>
<Component Id="cmp46E5A0DB48A03A91267C97A664BD9BD4" Guid="{07165ABB-1B3C-4C0F-A73E-E3A85AB37B58}">
<File Id="fil1AC953E5BA23EC81206D212369F1544D" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.fa.xml" DiskId="1" />
</Component>
<Component Id="cmp95BAB91FA0B7E37D5B9343478899CC75" Guid="{F0ADBE30-225D-4EF9-B0F4-1ADEFEF07625}">
<File Id="filEEF3EF4EEE97747B255238CFB88EAF9C" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.fi.xml" DiskId="1" />
</Component>
<Component Id="cmpE73E4CCF9F6EC39998B9BE35E43768CC" Guid="{EA4FADF0-BF20-40FD-9BAA-D1023357FD28}">
<File Id="filFB10C722F275051A8DDB25D4D9AF43E5" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.fr.xml" DiskId="1" />
</Component>
<Component Id="cmp28EEAA4B2230460BDDA61DEFBC71A905" Guid="{68D7B2E5-273B-4782-AF3D-65F255BBF9B2}">
<File Id="filD03BE3868262DD16654690ED91BC89C8" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.hu.xml" DiskId="1" />
</Component>
<Component Id="cmpCFF4CB46421F1A713D45607393ED9B90" Guid="{F96AF79F-0364-4A68-8790-209C751C37FB}">
<File Id="fil040570D344D75F6A57E5DD5ECB94BD8B" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.id.xml" DiskId="1" />
</Component>
<Component Id="cmp31601B4199D0CD3977758A3F2B63CDE7" Guid="{9F347364-2673-4184-A069-342A88BAF90C}">
<File Id="fil5A7288C1B9CC498419FC14D5B12B1D8D" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.it.xml" DiskId="1" />
</Component>
<Component Id="cmp8E2E0489348A190B00532591CE0AC325" Guid="{BE526CC3-99F7-4F94-AFC4-C86FCF0D742C}">
<File Id="fil9DF155D4A63D3AAAFDBF3BEF8C47BBEA" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.ja.xml" DiskId="1" />
</Component>
<Component Id="cmpEE57E2901F12294E638E66C39F1B39BB" Guid="{C2CAFD97-84B7-4053-A8D0-DE21F4D8F741}">
<File Id="filFD48E7A9628E7FF9B3D96BD222A3A0D9" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.ka.xml" DiskId="1" />
</Component>
<Component Id="cmp2F1F644C870AFF8970FE18AF2CD151C4" Guid="{96564F4E-7D92-40B3-84F6-84B357EB4F41}">
<File Id="filF68A13BECFA9D8DD21B371298AF93B5B" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.ko.xml" DiskId="1" />
</Component>
<Component Id="cmp4B8E0B5A7B7A8BE4267C722B1434E4CF" Guid="{E9AD4FA0-9CD7-43B9-8099-69AD6EB1A305}">
<File Id="fil23F177B7621D7D78240CAA60E6AB1048" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.lv.xml" DiskId="1" />
</Component>
<Component Id="cmp84BB49D30BDBB4212707D14B7A9C13F1" Guid="{B63CC062-CD52-463F-8B30-1E611A90EDA9}">
<File Id="filA7135961859CF705E28FFF4DA79A28C2" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.my.xml" DiskId="1" />
</Component>
<Component Id="cmp406E3BE632055CDDE1E42F45E31318DC" Guid="{627980E8-F6BE-4794-B9BC-68F96267D721}">
<File Id="filF46FDB7781620EB1D7491039E4029463" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.nl.xml" DiskId="1" />
</Component>
<Component Id="cmp4E363AF94947A27A4E9CF57C69E6DE54" Guid="{9D17F34C-4475-4995-A696-FE3EA54F2FBB}">
<File Id="fil24BA52B3E3209F48021C1D75AF5BBDB4" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.nn.xml" DiskId="1" />
</Component>
<Component Id="cmp562F7970AF2F9EF535AC21A84C7229D1" Guid="{9F36CA4F-BF14-40D7-81A2-8ADFCC0EF30B}">
<File Id="fil8C40C1C5E3776F4C0FCF8BD02D742D70" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.pl.xml" DiskId="1" />
</Component>
<Component Id="cmp19EF976916B5E207A32BA08C3143A281" Guid="{B0EAEA97-9176-4613-9338-41B63B85CB18}">
<File Id="fil6CC66A3690F008524FCCB68FA1EE1176" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.pt-br.xml" DiskId="1" />
</Component>
<Component Id="cmp4C9B5090256B2E88D27C9CF7E6CFD9EF" Guid="{8D783A02-023C-4018-8315-79A82BA593E2}">
<File Id="filA3239DE9C316B9C04171EB42F4F9653D" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.ro.xml" DiskId="1" />
</Component>
<Component Id="cmp91165C08D5943C21F132A349F8CBAAE7" Guid="{0C3290FF-8000-42CF-8329-92C828AE5A53}">
<File Id="fil77375796E780F641C2FF5E6E3D4CAFDB" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.ru.xml" DiskId="1" />
</Component>
<Component Id="cmp4A51B27F9D8DBBABFE4581EC2B162832" Guid="{FB8CCAC7-0EAC-4C1A-B5E5-BEFD8F7B47E6}">
<File Id="fil414686FD325EB0C5D03FC4693978451D" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.sk.xml" DiskId="1" />
</Component>
<Component Id="cmp041827E393D8777802256FD480D377FC" Guid="{7FEB72AD-48CA-4330-A4C9-A22218EC5D8F}">
<File Id="fil4EABC40F288E8289D4888EB0BE6F07B1" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.sl.xml" DiskId="1" />
</Component>
<Component Id="cmp68CC2DB5FA70FC1F6CA959FB5E1B78BF" Guid="{00D9FB47-120C-4061-B2DB-8F3D5D94F221}">
<File Id="fil90E6ABC4A98B19C0ECCDCC9712928162" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.sv.xml" DiskId="1" />
</Component>
<Component Id="cmpFF128AFA659D8C2E65E0BE55E0943F83" Guid="{5AB50FC2-867A-4239-850F-AD2C0FCDA2DE}">
<File Id="fil5BF14221A225DAB25A02463BBC92DC37" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.th.xml" DiskId="1" />
</Component>
<Component Id="cmp1896040764F0DF6F89280C428013ECE7" Guid="{3A2D27E8-4AB3-471A-A574-F148DCDF8D8C}">
<File Id="filE839661CD956C44F0E95C85AAA11D6FF" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.tr.xml" DiskId="1" />
</Component>
<Component Id="cmpA52EAD237A44CBD337E302185BE12FB2" Guid="{4D7A4A01-5AFB-4B37-93C7-91B9DA96BA30}">
<File Id="fil9E3A6DE502ECEF2025129A97D3F98CA2" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.uk.xml" DiskId="1" />
</Component>
<Component Id="cmpBBB82A6228B54372ACAF9B1310CB2025" Guid="{939C9CDD-0CEA-4161-9812-96B77B643C2E}">
<File Id="fil4B209843380976D1FBEB96B21EB849B5" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.uz.xml" DiskId="1" />
</Component>
<Component Id="cmp4A275EC29DB9B5ECD56CD9C62D358750" Guid="{0E29F3C1-2D27-4F1F-BEC0-C39CA1B4EAAF}">
<File Id="fil1FD00998B7A757165A03FDFD6D241F14" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.vi.xml" DiskId="1" />
</Component>
<Component Id="cmp8DF0B84F470901D8800F8CAB88A90656" Guid="{7B9A6F50-C242-4DAE-BD10-CDF2D63FB4AC}">
<File Id="fil4EC683D0A468CAA1D4B8FC6FFCBFEAD6" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.zh-cn.xml" DiskId="1" />
</Component>
<Component Id="cmp529250BEE557732B5B8CBC47914A0F2A" Guid="{2D4E3902-96E9-4C8B-BF8C-623D10FF7B57}">
<File Id="fil915C308602F025646FC5A874F74AA475" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.zh-hk.xml" DiskId="1" />
</Component>
<Component Id="cmp38274F8F5E4F600A9AC5225A0472D656" Guid="{74B65782-BFB6-42CD-B3BA-D736C7B0B3BE}">
<File Id="filFD4B1ECAE9F0FF855503D800C1A2891A" KeyPath="yes" Source="$(sys.CURRENTDIR)\Languages\Language.zh-tw.xml" DiskId="1" />
</Component>
</DirectoryRef>
<!-- Refer to C:\Program Files\VeraCrypt\docs in order to install files in it -->
<DirectoryRef Id="DOCSFOLDER">
<Component Id="VCUserGuideChm" Guid="{8CBE67F1-D493-4B33-9141-DB221021C59B}">
<File Id="VeraCrypt_User_Guide.chm" Name="VeraCrypt User Guide.chm" Source="$(sys.CURRENTDIR)\docs\VeraCrypt User Guide.chm" KeyPath="yes" DiskId="1" />
</Component>
</DirectoryRef>
<!-- Refer to C:\Program Files\VeraCrypt\docs\EFI-DCS in order to install files in it -->
<DirectoryRef Id="EFIDOCSFOLDER">
<Component Id="dcs_tpm_owner_02_pdf" Guid="{DC75D11E-8250-4DDD-9BD2-451194F8717D}">
<File Id="dcs_tpm_owner_02.pdf" Name="dcs_tpm_owner_02.pdf" Source="$(sys.CURRENTDIR)\docs\EFI-DCS\dcs_tpm_owner_02.pdf" KeyPath="yes" DiskId="1" />
</Component>
<Component Id="disk_encryption_v1_2_pdf" Guid="{DFD46CE4-B65B-468A-B236-3E5C43090235}">
<File Id="disk_encryption_v1_2.pdf" Name="disk_encryption_v1_2.pdf" Source="$(sys.CURRENTDIR)\docs\EFI-DCS\disk_encryption_v1_2.pdf" KeyPath="yes" DiskId="1" />
</Component>
</DirectoryRef>
<!-- Refer to C:\Program Files\VeraCrypt\docs\html\en in order to install files in it -->
<!-- Components generated using 'heat dir ".\html" -gg -sfrag -template:fragment -out directory.wxs -var "sys.CURRENTDIR"' -->
<DirectoryRef Id="ENHTMLDOCSFOLDER">
<Component Id="cmp5A2505C1E4CE33EAC578A8D1C8C505D2" Guid="{EB5FB334-0E04-4DC8-BCA7-9233982B0FF8}">
<File Id="fil2FC60DD03A8AFECD3E1FB3B2F358CDF5" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Acknowledgements.html" DiskId="1" />
</Component>
<Component Id="cmpE985CD1A96188861286D758A12A1D0A1" Guid="{25ED8C45-E6AF-4582-ADDE-5EDF51BF4EC2}">
<File Id="fil81B62ADB5DD42B4C9666C61A4F59E00C" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Additional Security Requirements and Precautions.html" DiskId="1" />
</Component>
<Component Id="cmp310514F655B6D66F5308A5823B0AB691" Guid="{B18F4EA7-2A2E-4DB2-BA72-E1AE3C090C4D}">
<File Id="fil8194761219752C0F565AAD6F30B00920" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\AES.html" DiskId="1" />
</Component>
<Component Id="cmp0664DF8B1FE440C02B1E20D2F23C2CDF" Guid="{2A048A0F-A19B-4EE2-A1FA-2761C8931A29}">
<File Id="fil6B563B1A4AA551468283EEB5872DD176" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\arrow_right.gif" DiskId="1" />
</Component>
<Component Id="cmp2934E77CB835216789F88BD686160A94" Guid="{084CDB58-6A9F-4985-9818-727FBFF0D95B}">
<File Id="fil960742ACFA2D79EEC2E6D45D7A93047B" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Authenticity and Integrity.html" DiskId="1" />
</Component>
<Component Id="cmp688E76C9A297923D616068E33A6A4F49" Guid="{63DABE8B-7EE0-479E-890F-701C7E890647}">
<File Id="filCC9CD11F958A26366B700B8EE8812A65" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Authors.html" DiskId="1" />
</Component>
<Component Id="cmp2ABB10C0A5AC0F1084EDF94E0FDFFD09" Guid="{034D6A64-B712-49C1-9450-5585B207C8AD}">
<File Id="fil63E5CE3D0A91ACFF543B523A58476CCF" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\bank_30x30.png" DiskId="1" />
</Component>
<Component Id="cmp32E7F4F5C0F44D00B53E3946E7E1FCF9" Guid="{4A9AD9E2-8ADA-41BF-B2EC-643579DF9B35}">
<File Id="filD1052E711F1CD089D66C27B04EDD6113" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\BCH_Logo_48x30.png" DiskId="1" />
</Component>
<Component Id="cmp989B890D94671F634D04D8F945090F21" Guid="{4C123649-753C-404B-908D-AF1B48CBB844}">
<File Id="fil02D4C60C8A30C22AE1F14E33DA3DA38C" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\BC_Logo_30x30.png" DiskId="1" />
</Component>
<Component Id="cmp109BF0667C5A7B7036CCAAD9B29D9449" Guid="{5951DADE-1544-4213-A018-E33CC10AFA5C}">
<File Id="fil07FA1CE512F8C8605304C23C4DFE264D" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Beginner's Tutorial.html" DiskId="1" />
</Component>
<Component Id="cmp82ABD3094B751094F3A49CD338A3713D" Guid="{1D02B8D8-92E6-4E2E-B29B-1C3633C625BB}">
<File Id="fil4431451829FDF5841BC97BA0A0CA8133" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Beginner's Tutorial_Image_001.jpg" DiskId="1" />
</Component>
<Component Id="cmpE6A18205CB9F847CD7C4375AED2196D5" Guid="{D84BA05D-74CB-47CE-8098-C3C27E9292BA}">
<File Id="fil89FAEFEC223673825DC022EED971C0E0" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Beginner's Tutorial_Image_002.jpg" DiskId="1" />
</Component>
<Component Id="cmpAA4D61C5E17E2A8513EC120AC9B1DB8A" Guid="{62C84C2A-D459-4BE2-84B4-7D43F3C5726E}">
<File Id="filE334137ACF34B80CE263C7A3868862FE" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Beginner's Tutorial_Image_003.jpg" DiskId="1" />
</Component>
<Component Id="cmp39251BC13DA4AD6508E18D90D86DF06D" Guid="{E4095A6D-EAD5-429C-A75F-39758A7F1C87}">
<File Id="fil924A6AEB99A9EF73D5240117A35F4A73" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Beginner's Tutorial_Image_004.jpg" DiskId="1" />
</Component>
<Component Id="cmpBABB0BD95FD763E9C72D2F51C325CF15" Guid="{0905EB74-CB03-4479-8D47-D5F1071E6D1C}">
<File Id="fil2C527AD0D6FF9D8991263AEAEF0028C1" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Beginner's Tutorial_Image_005.jpg" DiskId="1" />
</Component>
<Component Id="cmp2FE3B3719DCC4362AFF8BF7B4CADFF80" Guid="{8F29956A-6555-45C9-B254-F277FD9D0230}">
<File Id="fil1CCA48715513D4C909E9B413C8D1DDD0" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Beginner's Tutorial_Image_007.jpg" DiskId="1" />
</Component>
<Component Id="cmp2FC8BD312D06FEC4E244604E27117B62" Guid="{22F89049-FED2-46D8-A298-E43ECE3226B9}">
<File Id="fil4F7DCD31A2B30BC40BCC4E76DDCE58C1" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Beginner's Tutorial_Image_008.jpg" DiskId="1" />
</Component>
<Component Id="cmpAE99FB30CC29DF92E71A31EC39E61EF5" Guid="{C125C0FE-AEC0-455B-A7A6-BD216E712F11}">
<File Id="fil3E632F1EA36028C0146D810EB2A994BB" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Beginner's Tutorial_Image_009.jpg" DiskId="1" />
</Component>
<Component Id="cmp535B1A9BACA231F518973D620DC23779" Guid="{35958B4E-683D-4F34-B510-04E5801B4A1C}">
<File Id="fil820662B184499949D0F2AF8C702010BF" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Beginner's Tutorial_Image_010.jpg" DiskId="1" />
</Component>
<Component Id="cmpD2ED5F6D8C0A4CA0D26F9F1BB34AB8BA" Guid="{E3CDE6DA-DCC0-418C-926F-406962D00BB7}">
<File Id="fil0377513CEC808B0549D7B1D3AC22DED8" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Beginner's Tutorial_Image_011.jpg" DiskId="1" />
</Component>
<Component Id="cmp5F7E0D8587039E1BA0F236F228C163BD" Guid="{B3E56E0C-7368-42D8-9EEC-56FC2568A649}">
<File Id="fil07880CC54CBA150765E18E78D707B361" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Beginner's Tutorial_Image_012.jpg" DiskId="1" />
</Component>
<Component Id="cmpF4DA2D3DABC768C2040A67A993C53E9E" Guid="{817105D4-7E68-417B-9592-F664A20AD861}">
<File Id="filA63E7BA341C510BB5F5BE441475173A0" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Beginner's Tutorial_Image_013.jpg" DiskId="1" />
</Component>
<Component Id="cmpC0AD9100DE0F43E8149F8D3271B02D17" Guid="{81CFCB27-3F21-493C-AA7A-836E05157AC3}">
<File Id="fil1872F82E98E3D4AAE017F70E311912DE" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Beginner's Tutorial_Image_014.jpg" DiskId="1" />
</Component>
<Component Id="cmp32646E8087D106AE2B62E5DCF2419EDD" Guid="{54C078C1-1641-4A06-BBCA-D6A2C0389695}">
<File Id="fil0C921426CF20987C0ED9364F11F534F0" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Beginner's Tutorial_Image_015.jpg" DiskId="1" />
</Component>
<Component Id="cmpB3C777FAF214F7D304EE7CF907D7FF57" Guid="{C44D9DD8-7803-41C1-9323-4CFD516C2DEB}">
<File Id="filE9FA9200D40A4970139496FD4D09CC9C" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Beginner's Tutorial_Image_016.jpg" DiskId="1" />
</Component>
<Component Id="cmp338115DF524F0B412A21AB64F59240DD" Guid="{D4B1FD10-580F-4889-95F4-EDFFFC3C1309}">
<File Id="fil74DD6EA64196A3168E669A1FF7AE3E0A" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Beginner's Tutorial_Image_017.jpg" DiskId="1" />
</Component>
<Component Id="cmp2F24E0C7B7175D60257F6D01231C8373" Guid="{BF43A78C-C0A8-498E-A3EF-7D0265F1E312}">
<File Id="fil37771854D19D4FEC1E9E8DB377B24B8D" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Beginner's Tutorial_Image_018.jpg" DiskId="1" />
</Component>
<Component Id="cmpAE9D52ADD94D3A2711AA79FA0C91CA00" Guid="{3EF7862C-7D09-4662-BF1C-67D05EBF9711}">
<File Id="filEC84ED23804D7FD220C90FF50B92FD7C" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Beginner's Tutorial_Image_019.jpg" DiskId="1" />
</Component>
<Component Id="cmp0A6270FD26128E8D1CC83E392E91A772" Guid="{5252F18E-BFB7-4FCC-865E-809BBD431C22}">
<File Id="filBB21339DA6F921A2596897061F9C1F7E" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Beginner's Tutorial_Image_020.jpg" DiskId="1" />
</Component>
<Component Id="cmpEDB0E152195A7EB91BBB28631B689E0B" Guid="{C3750B19-85AF-4B35-98C9-969168C0C19F}">
<File Id="fil23F7783C38C515A1DAA07F85B306D695" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Beginner's Tutorial_Image_021.jpg" DiskId="1" />
</Component>
<Component Id="cmpFD76EB6B5546D1C38CC33FABA95FAA15" Guid="{AA874CBC-A2B7-48C6-AC23-654C190C65B0}">
<File Id="fil769661E570AC147356DE7C8AD17F9F76" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Beginner's Tutorial_Image_022.jpg" DiskId="1" />
</Component>
<Component Id="cmpDC4FD19F507A5152351B9F71C8691486" Guid="{5B95B2F6-EF6F-4D08-9014-F4C621EA49D3}">
<File Id="fil6AD3B2642AC17EBF625FEBC38F376F96" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Beginner's Tutorial_Image_023.gif" DiskId="1" />
</Component>
<Component Id="cmp9E45BE754042F9DD742A0B7B9F27E786" Guid="{7DD3EFD4-E5DC-4D5A-BCE0-5E2F6FA86E9C}">
<File Id="fil29A133B2F2F200139A6F8BA5753FD673" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Beginner's Tutorial_Image_024.gif" DiskId="1" />
</Component>
<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="cmp053692809BD5B3F5682AFCC539A767A3" Guid="{C99F1ECB-6AAB-4D06-B4C7-134CD2502104}">
<File Id="fil9D6A859E5E76057E4E64E35D03BF1739" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Camellia.html" DiskId="1" />
</Component>
<Component Id="cmp9049A791E9E1AB7FF01BD7F08D1CB069" Guid="{F9B7E6CD-6AAB-4FD2-9CCC-8D13191057FA}">
<File Id="fil768C59AC95806B46E5921E83E17DF406" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Cascades.html" DiskId="1" />
</Component>
<Component Id="cmp4E6F9484484A40645D519F688ED9C21E" Guid="{5231376B-B4D8-4733-8EA9-ECA11DD034BF}">
<File Id="fil45397F2F396BA3408992A437902E6951" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Changing Passwords and Keyfiles.html" DiskId="1" />
</Component>
<Component Id="cmp3CF724F2A2347A2A30C85CB76490F687" Guid="{BB072BB5-3F7F-4F18-B00F-0A75D3AC0F49}">
<File Id="filF949C326CAEAC18B9572844C807C9D19" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Choosing Passwords and Keyfiles.html" DiskId="1" />
</Component>
<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="cmp90AB4CF273108F47223E3432838CDE37" Guid="{9510EAF5-F452-4991-9BA2-F1F641C1D697}">
<File Id="fil1DAD595818432F019735F37E86305500" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Contact.html" DiskId="1" />
</Component>
<Component Id="cmpB9A0461BF7CF75538111B088C986A62F" Guid="{EC931A38-5F11-4C02-AA88-3A072E802C0B}">
<File Id="fil8ABFD40EA9A1BE1765D794C2B8EAF909" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Contributed Resources.html" DiskId="1" />
</Component>
<Component Id="cmpD8C7B52BC03709FAB2642B93BFE4FFE8" Guid="{1592BAD3-086F-4DDE-8970-199B44FFBD6E}">
<File Id="filE99ED4C6D87549A1F623A37A5C47552A" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Converting TrueCrypt volumes and partitions.html" DiskId="1" />
</Component>
<Component Id="cmpFD6EB163EA6B74C4F59FF04D2B3796CC" Guid="{60D5BA7E-7466-4F09-ADB4-571A7502DD7B}">
<File Id="filBD6D90F11807407F91F2F7AEA5DDC8EA" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Converting TrueCrypt volumes and partitions_truecrypt_convertion.jpg" DiskId="1" />
</Component>
<Component Id="cmp612D2E75E857D164665BE8CA37570D04" Guid="{6D667BD9-F8C1-4C46-BEA0-6AAA44B838CA}">
<File Id="fil14C75587323CCC7F69E32786D82A5BD6" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Creating New Volumes.html" DiskId="1" />
</Component>
<Component Id="cmpF65BF759DA7F65BAD6D74A83FEF9D205" Guid="{08FEF348-778B-42C7-81B9-F62EA5F658A6}">
<File Id="filDAF1BCFE93CF42677E91DCF5E515D861" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Data Leaks.html" DiskId="1" />
</Component>
<Component Id="cmpA6A249B42C89657DE664B9D88D04DB3F" Guid="{76F64E31-ED27-46A8-8A0D-6CFB4A79B856}">
<File Id="fil58A7A13A2773C5CDDBF9D85254395A75" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Default Mount Parameters.html" DiskId="1" />
</Component>
<Component Id="cmpEE8A03DA56EF1B35979430E8711A6960" Guid="{034B338B-7719-4E70-B08E-C118CBCD2432}">
<File Id="fil7D0C9ABA361EB2D263FA1F2EDB839223" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Default Mount Parameters_VeraCrypt_password_using_default_parameters.png" DiskId="1" />
</Component>
<Component Id="cmp628E75C5DD0F38348B6F8694D5D5149C" Guid="{B4CA9CED-3087-4115-AC8C-A8E12C3A4383}">
<File Id="filAFAAE965983C249FC9A818A28333DFA4" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Defragmenting.html" DiskId="1" />
</Component>
<Component Id="cmp40BDD4F3CA20DEE006E087930EF3847C" Guid="{696CB75F-F832-4E11-9617-E4F05B6CA29A}">
<File Id="fil7887EE82BC26C1CFAAC5CD3A29EF5049" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Digital Signatures.html" DiskId="1" />
</Component>
<Component Id="cmp7AEEABAF151FCE92735664A55F7B8FFA" Guid="{40361F33-E50C-492C-8D5F-9B32B2318FBF}">
<File Id="filE430D3D4AD453AD90952510D4194438A" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Disclaimers.html" DiskId="1" />
</Component>
<Component Id="cmp9380DDE2560B4D8EE9CC363AF4BC7B5F" Guid="{787E2CF2-DF61-4341-94A2-497BCF9882C8}">
<File Id="fil04BCDEC7438B23A6BBF1C95ACF126266" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Documentation.html" DiskId="1" />
</Component>
<Component Id="cmp84A94F04CD486338F57C03B316145945" Guid="{44F12D12-3BB4-4FE5-B829-5D471C05A2AF}">
<File Id="fil07C7557AAF506EE9095B8C76E9C56776" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Donation.html" DiskId="1" />
</Component>
<Component Id="cmpDF544847A4B1F86B3BA3468336CD73FE" Guid="{8E46CB17-1956-4E28-B8F4-30DEFCEA1CF6}">
<File Id="filD27301F6F853ABFC08499D4085599774" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Donation_Bank.html" DiskId="1" />
</Component>
<Component Id="cmp9A6A861B59A23E534C7407EF95500AA5" Guid="{044EF38F-E86C-4A28-B675-CA7E8E318559}">
<File Id="fil87AEAF6DE829555C03BF7888DDD40D8F" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Donation_donate.gif" DiskId="1" />
</Component>
<Component Id="cmp09C34B1CBDE9F2F4E897340B1C67728E" Guid="{CEA5EA37-6E8B-4DC0-A4DC-F95A050D36A1}">
<File Id="fil2E4790AC38717B6E5E9B77A926CA98C4" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Donation_donate_CHF.gif" DiskId="1" />
</Component>
<Component Id="cmpD3183A7373751A19B4B7C9B041F9035D" Guid="{23A3ADFD-3BC8-4F77-9281-EED6A67CAFFD}">
<File Id="fil12198C69AEB78A4CDE5C4343E8EE27A7" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Donation_donate_Dollars.gif" DiskId="1" />
</Component>
<Component Id="cmp3DED9073AB120DC026C48E9CDF9283EB" Guid="{8F9DA5BB-3BFE-4D21-8B79-65AFBFC93ECF}">
<File Id="filDA4E4CC3AAE26E3ADE9CFF4940975500" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Donation_donate_Euros.gif" DiskId="1" />
</Component>
<Component Id="cmp0FF3027C2662D967ACB4B01BA7BC85F9" Guid="{1B9D2475-C2D0-4695-B51D-AE53BFF05A46}">
<File Id="filF7C4F27359F58FD995B964FF3B5AAAFF" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Donation_donate_GBP.gif" DiskId="1" />
</Component>
<Component Id="cmp3FC9C0126A2074CAABCF73197358F824" Guid="{7AD29EC1-38EF-4F2A-8038-E70A6D360CA0}">
<File Id="fil0D75D569E37C808031A4217294796BC7" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Donation_donate_PLN.gif" DiskId="1" />
</Component>
<Component Id="cmp1830E220882FBA276350032258B478AA" Guid="{A1A3410C-6B91-44FF-AC33-BDB18F4F2022}">
<File Id="fil7779997A454E1C0068F2DF292319AA6A" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Donation_donate_YEN.gif" DiskId="1" />
</Component>
<Component Id="cmpE5D6E9DF3EE1301C6D5A4F44362BCE96" Guid="{0811DEAF-F857-4839-A31B-C1B3A2C932FE}">
<File Id="fil83A3E2E3996B9CC933A606F6E4661FD5" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Donation_VeraCrypt_BitcoinCash.png" DiskId="1" />
</Component>
<Component Id="cmpB7B429D414CF1DD05A4B70CE94E343F7" Guid="{04490FFA-387E-4FD7-9449-AB6C99886EA9}">
<File Id="fil25C86292E018E61CB762731F14261986" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Donation_VeraCrypt_Bitcoin_small.png" DiskId="1" />
</Component>
<Component Id="cmp00845B9781D5633702C834BCB4EB93D1" Guid="{A41BFAC5-42BF-45DB-BFF9-703F9DBE7346}">
<File Id="filAD426632459DB7AB1528AC311CE28870" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Donation_VeraCrypt_Ethereum.png" DiskId="1" />
</Component>
<Component Id="cmp47F92D029E335F7865F8ACB30763FED2" Guid="{A6C96C85-D0E8-442B-8C84-8705F17EE4C7}">
<File Id="fil155C2578FFCBDBD39679AB6AF62EEA7B" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Donation_VeraCrypt_Litecoin.png" DiskId="1" />
</Component>
<Component Id="cmpF3B90B0C1F316854E9142B22783ACF19" Guid="{A369FF58-377C-47B9-A2A6-B222CA95898C}">
<File Id="filBE9E8FB59340806B67751E8BC2E00071" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Donation_VeraCrypt_Monero.png" DiskId="1" />
</Component>
<Component Id="cmp2EC17F48BC15C5405D2DB40FC6E01745" Guid="{700262B3-5BB2-4482-B96B-A511EA875986}">
<File Id="filACA26698300072DB7F917CA47A8AB6B3" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Encryption Algorithms.html" DiskId="1" />
</Component>
<Component Id="cmpE00F8980768E14DF59474B5CB3D84041" Guid="{45C099F3-92B5-4514-9049-BEA244F0C942}">
<File Id="fil0B06214692CAA0ACCACC01D1372A93B5" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Encryption Scheme.html" DiskId="1" />
</Component>
<Component Id="cmpD17B73F5892E45458E960025558B3452" Guid="{F974B54B-B964-4B65-A718-DF09BE96F106}">
<File Id="filAEB57F6A5B5C2593D13AEF942A2C721C" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Ethereum_Logo_19x30.png" DiskId="1" />
</Component>
<Component Id="cmpF45A8248FAFA80A8DF62989C477E7C0F" Guid="{9184BA24-53AB-4753-907C-E88D7F56B3FE}">
<File Id="filA72BC6DCFD81551D166437E20BA8224F" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\FAQ.html" DiskId="1" />
</Component>
<Component Id="cmpD066CBBD66E8CABB4AD4B928F823A5D2" Guid="{A8B260B0-505C-4948-801F-A03236A0D61D}">
<File Id="filACB34BF3CCD1B081CBA230C962B4023D" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Favorite Volumes.html" DiskId="1" />
</Component>
<Component Id="cmpACFE3B967BB844C3FD0FE21C9E87EE5B" Guid="{46D1B528-C7B7-4AEC-B5AE-0A3F91D4312E}">
<File Id="fil88A41060BD4F57CB6135E162D4AB5CD7" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\flag-au-small.png" DiskId="1" />
</Component>
<Component Id="cmpFAA171DECE81EA4EA99B5570C9FF7D0E" Guid="{6EC15848-F7A8-40B3-88DF-52010E89E634}">
<File Id="fil16558379B1C9116103DF96CB9C5C36AD" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\flag-au.png" DiskId="1" />
</Component>
<Component Id="cmp7C1E782A2C12520E4CACF0D8FD4EAA4E" Guid="{625A778A-7F8A-42D8-A725-85973721DFF0}">
<File Id="filA16A3EF20ACB7C21ACD09A4D1593A6F1" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\flag-eu-small.png" DiskId="1" />
</Component>
<Component Id="cmpE9009D51D7CF4AA8BBA735E91F1D6044" Guid="{58D024BC-047D-44AA-9818-9E68C256D84D}">
<File Id="filCEC0006C74C3A5D4FB0CDA60EEE61C91" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\flag-eu.png" DiskId="1" />
</Component>
<Component Id="cmp5D46BFDD0D54DD715695756148C22028" Guid="{42A27E61-0190-4654-8996-91B092CC314F}">
<File Id="filE84495221B2E5A505F3AA4CA4595C7A9" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\flag-gb-small.png" DiskId="1" />
</Component>
<Component Id="cmpE34BBB4D255F23D71B0143270915E6D7" Guid="{5E95AE9C-8807-4E4D-81DA-1A83DACDC8A1}">
<File Id="filECFBF3D126ECCB088B3B313A370D71ED" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\flag-gb.png" DiskId="1" />
</Component>
<Component Id="cmpEB665F1BFDB30B20C90142CCD1DA7664" Guid="{DB6617B7-2FEE-4FDB-A2DA-834B33B29C3E}">
<File Id="fil968867F284C9559835DFF02CFA106E13" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\flag-nz-small.png" DiskId="1" />
</Component>
<Component Id="cmpFDCC994071E7ADACE3EB2CBACC60E34A" Guid="{0494762C-CFB8-4CF7-85AA-0650B2B4E813}">
<File Id="filF5C5A9923D299431406A6B5D8D2BF34D" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\flag-nz.png" DiskId="1" />
</Component>
<Component Id="cmp21A3A9B1C7FAA004EF937114F0F41C61" Guid="{2F88A1FE-94B5-46E0-93C2-DE9F9BEE58FF}">
<File Id="filC1071DD08F53BDD0249A4E15993448D6" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\flag-us-small.png" DiskId="1" />
</Component>
<Component Id="cmpFD4A149B4654FEF0542A5ECE211A86B8" Guid="{CC1D951A-2C70-4AE4-AC3C-E2D56789B981}">
<File Id="fil1120ADD37C4E5039A94D7442675B202D" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\flag-us.png" DiskId="1" />
</Component>
<Component Id="cmpE7CDDDCDA7CD20F1150F2879E0293D1D" Guid="{67630C6C-178E-41CF-A74A-AA086E5B4553}">
<File Id="filA42CDEA93CCFE721C2569FA3D0786D57" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\flattr-badge-large.png" DiskId="1" />
</Component>
<Component Id="cmp9CDBE7ACC2D5393535D2981C3DD73682" Guid="{97414D97-9C51-419A-9FE2-392223B7600A}">
<File Id="fil901AA5AF4A010844A1F50A5881B8FD16" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\gf2_mul.gif" DiskId="1" />
</Component>
<Component Id="cmpF09EAA16502FCF137AAD38D70D50B200" Guid="{95BBE9B0-AB65-43FF-A3C4-0D347BE43DF0}">
<File Id="fil3E73719A927F1E24178C1E3C05DC1384" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Hardware Acceleration.html" DiskId="1" />
</Component>
<Component Id="cmp62D4B7B5DACB58D3EEA9E6D3385769A7" Guid="{285C17A2-418E-4ACD-B0E8-A3940A9E9E61}">
<File Id="fil05C2A8A0846F0288FDC2580173316E05" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Hash Algorithms.html" DiskId="1" />
</Component>
<Component Id="cmpBF36D06FA293DFD3AFA1543C43A54E17" Guid="{EC20DE1B-F10D-4F9E-9CEA-8E06170EE71C}">
<File Id="fil12E28B4819EEC3590C5CFA611E8BAF01" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Header Key Derivation.html" DiskId="1" />
</Component>
<Component Id="cmp7345D3EE0CFEA227E8AA9ADADF95E623" Guid="{F5E2342E-2879-48B1-B3CE-5C626AEDC366}">
<File Id="fil25DB00F86CBD631E7750B8050A9CC9CD" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Hibernation File.html" DiskId="1" />
</Component>
<Component Id="cmpE92C5D4B774B7214B49931528F7EDCF6" Guid="{44B9627E-29EC-4B8E-9B20-3D0ECCC77C1E}">
<File Id="filA094EFE79FB6AAAEDCCC3C997972E35E" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Hidden Operating System.html" DiskId="1" />
</Component>
<Component Id="cmpB6A3927A1BE4D2836C1007D3CC989C4B" Guid="{13D8AB5D-0F73-4C29-AB08-9086313EF010}">
<File Id="filC7CDBCEC9B1D4BA6BCFC0362CE353D51" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Hidden Volume.html" DiskId="1" />
</Component>
<Component Id="cmp28666EA10A3DCEC7D2583ADD52785FDC" Guid="{55E58038-C992-4683-AA9F-9CA4111884FF}">
<File Id="fil707007462E284E1048B6AB488EFFD466" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Home_facebook_veracrypt.png" DiskId="1" />
</Component>
<Component Id="cmp08768A6308C114126260614CCDF6F72E" Guid="{30FDB2BD-5E5B-421E-97AE-F819944A4B57}">
<File Id="filFA4C178FEBD09C0A4D38AA90B4523E9E" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Home_reddit.png" DiskId="1" />
</Component>
<Component Id="cmpF00E284DEEE43B341D12987E20DB76C5" Guid="{A2160846-E461-4C23-BC88-64531B3D2C59}">
<File Id="fil4A9EA521DBB6DD5E280E4186CD34FA11" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Home_utilities-file-archiver-3.png" DiskId="1" />
</Component>
<Component Id="cmpB75BD74E0F63097DC1777FF4BF440479" Guid="{E2C9732A-0FD0-4A33-9B69-0BCD132AB427}">
<File Id="filDABCE60F828DEEE9AE5064EA3F71EC67" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Home_VeraCrypt_Default_Mount_Parameters.png" DiskId="1" />
</Component>
<Component Id="cmp1745256A6ECE8FB1779B0DA82CEECAB9" Guid="{1A5FBC9F-430E-4F8D-AEA4-7391D85F2E27}">
<File Id="fil9C3B9E9CFB06A1F7C162B4941656906A" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Home_VeraCrypt_menu_Default_Mount_Parameters.png" DiskId="1" />
</Component>
<Component Id="cmp3F248F4BDDB12D98D3CF173FEA01CE24" Guid="{1B2E6370-1DD1-42D8-9E84-6D85922DFA07}">
<File Id="fil9E39BB9774782EA2337679D8B86AB1A5" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Hot Keys.html" DiskId="1" />
</Component>
<Component Id="cmp1209E63998A1D1504B062C4ECC45EE07" Guid="{ED60D316-7B35-4622-90B5-938260E9E150}">
<File Id="fil2B4301AD5F5E385426DEEE0DE166D557" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\How to Back Up Securely.html" DiskId="1" />
</Component>
<Component Id="cmp035C544DF9B46B9DD7871AD7898B7D36" Guid="{44C5611E-FF00-41F3-B744-E18801513D89}">
<File Id="filF60B07EAEE2B63ECAA396508EC68858F" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Incompatibilities.html" DiskId="1" />
</Component>
<Component Id="cmpA891AF32EF72B7AC80533FC31773B604" Guid="{305DB86E-AE27-4634-9CE1-C4C875EF9569}">
<File Id="fil8F60E744AB05081B8929E635DDF7B733" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Introduction.html" DiskId="1" />
</Component>
<Component Id="cmp1FC684D1C3742A927228DE9A669A2895" Guid="{EE9D3F20-7EB4-4628-ADE6-51238E60A998}">
<File Id="fil9BA13C18F0927CFB3AFBFBDA5944B166" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Issues and Limitations.html" DiskId="1" />
</Component>
<Component Id="cmp265116FC4778248E01BADFB30A2C32A7" Guid="{37C6EB1F-7A7D-4F00-9204-51240EB7FB81}">
<File Id="filC57676C07D244DB5A336F1D52D978004" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Journaling File Systems.html" DiskId="1" />
</Component>
<Component Id="cmpB2A3FFEE7A15E23A2835A843438E3669" Guid="{BF14B9BF-8AFB-4E5E-80E4-CA2F3D132F51}">
<File Id="filF08A4DB40EFF11FE0784034B3D70B750" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Keyfiles in VeraCrypt.html" DiskId="1" />
</Component>
<Component Id="cmpFC8FB415783E0AA424FBD685EFACF54E" Guid="{01FCB5FD-953B-49D6-B993-6AC117052F6B}">
<File Id="fil6DA5794E0BA3F26779AFE828D4E41AAC" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Keyfiles in VeraCrypt_Image_040.gif" DiskId="1" />
</Component>
<Component Id="cmp2BCEA21755E1C812ACCF15A09210FCCD" Guid="{0CECEA1A-AB6B-49B6-8D07-8D86B452995A}">
<File Id="fil5450B4F3DD747980B87B30ACEC318F6E" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Keyfiles.html" DiskId="1" />
</Component>
<Component Id="cmp9EC1750F7CD9717D3A761FC2930C509D" Guid="{980F49E8-EBCD-4720-8466-C03DC2B3BBD7}">
<File Id="fil780042F951150166D5D328C10993CE7E" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Kuznyechik.html" DiskId="1" />
</Component>
<Component Id="cmp4298A84BD6956E2A2742B5678BCFF173" Guid="{2809427F-697F-48A4-853B-5BE4AE1E720A}">
<File Id="fil01E37EFCBAF6AB983418B79E3DD75E88" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Language Packs.html" DiskId="1" />
</Component>
<Component Id="cmp2D9F7D88EF1F843BDEA5A39D13330B8A" Guid="{7A515A66-AD7E-4B89-8935-62C7B3FCF0A7}">
<File Id="fil587E308C1A86BF1B8DA5BEFF409C509E" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Legal Information.html" DiskId="1" />
</Component>
<Component Id="cmp58EAECCB29CB9ABDDDB72F9378E4EE77" Guid="{03CB945A-4EE1-4EC6-8360-56B00FD8C7E8}">
<File Id="fil76CDD0FA0D1CFE86ABAFDF8ED174B7D5" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\liberapay_donate.svg" DiskId="1" />
</Component>
<Component Id="cmp61C660976A230AD4AD8B42A90D4BCC7C" Guid="{7B5EFF52-9EBF-4A15-8117-684E0B40EC9E}">
<File Id="filE7AA75571211982F69DEE42B8A42D2BA" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\LTC_Logo_30x30.png" DiskId="1" />
</Component>
<Component Id="cmp29A0605ED3FB7D4E2EAC833D56411563" Guid="{A65BBFC8-1956-4F8E-A0C8-74D32230342F}">
<File Id="fil9DB1C5CAE05C434550F18FEFC614D725" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Main Program Window.html" DiskId="1" />
</Component>
<Component Id="cmp4A0EF1CFD1E1DE8B4E7BF698E05680E9" Guid="{273E1197-B7FC-40E4-AFB0-317D1D0AD816}">
<File Id="fil8F40D01C235606BC89A05FF0956B7146" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Malware.html" DiskId="1" />
</Component>
<Component Id="cmp1E4F8137AD337BEA1B902E6B003AB953" Guid="{6FF05277-1E0B-4885-8AC4-9B3044DA19CA}">
<File Id="fil1C19C87ED25856F0A34F96A3AA92D695" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Memory Dump Files.html" DiskId="1" />
</Component>
<Component Id="cmp8D35F7D61B2B7DF0EDEAE2E56031E7CB" Guid="{41103C48-5692-4593-8042-75B847917265}">
<File Id="fil03685445FCFED7E0BA2CA91812337283" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Miscellaneous.html" DiskId="1" />
</Component>
<Component Id="cmpDE2C66707086A509EABD0F9F6E8BDB1A" Guid="{077B9131-7B76-4E56-9895-0A34F2B7DB5A}">
<File Id="fil52FBC994010BF4A06B7C78261E002986" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Modes of Operation.html" DiskId="1" />
</Component>
<Component Id="cmpA80443C3767E3E51F3DE88BFD0D7A33B" Guid="{221A050D-548A-42F2-9555-7ECA43D71CB6}">
<File Id="filD4C6BB0CDA1B086217E6C8B6E4930DEE" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Monero_Logo_30x30.png" DiskId="1" />
</Component>
<Component Id="cmp214446AAABEBAC0C3827B8977083FAE2" Guid="{76AB42FF-2CD5-4CC2-9E32-640FFA611F17}">
<File Id="fil82C85BB54B2E986169D519B2AAF71A46" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Mounting VeraCrypt Volumes.html" DiskId="1" />
</Component>
<Component Id="cmp4AF022868FE6883520C700676C43B15D" Guid="{DE7F786D-2B71-4654-86F1-C02CCDA23E23}">
<File Id="fil1B5039BFF40C7C3BAA602D9AE17668E6" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Multi-User Environment.html" DiskId="1" />
</Component>
<Component Id="cmpC27AA2C4496C9EFA95DCD663B031B5D0" Guid="{23C15FAB-969E-491A-802E-ADE3255F9002}">
<File Id="fil5FA8E7B0268E1EF7F9FAFA478FE0C8B1" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Notation.html" DiskId="1" />
</Component>
<Component Id="cmp9CBBC8311BBFC54C8DC1162BB17E5AED" Guid="{9C5C22CF-AB15-4D0C-B715-AF1E31B0AFD0}">
<File Id="fil7A50CAD8D98A751781AF007ABEE22CD2" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Paging File.html" DiskId="1" />
</Component>
<Component Id="cmp033461B0777614621A2ED7B4E2B08D55" Guid="{1A3135F7-200E-4563-90C3-79E5511394CD}">
<File Id="fil45662024A9E5B2BEBA51908F9478105E" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Parallelization.html" DiskId="1" />
</Component>
<Component Id="cmp0E43CDBBAE343957423AE2907AC16883" Guid="{5C63387F-3BB8-405A-BA0A-10F87C828F9A}">
<File Id="fil70B46565AEC42A408480FE289D55EA5E" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\paypal_30x30.png" DiskId="1" />
</Component>
<Component Id="cmp8A8526D2061A14810E1B7A8A6E527DCD" Guid="{F46FE563-00F0-465E-A7E7-901B1B3F412E}">
<File Id="filF33DCC20E8AA63F4190D46B9D22D71C6" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Personal Iterations Multiplier (PIM).html" DiskId="1" />
</Component>
<Component Id="cmpAE2DADEF126C59D8CCD3A18D8CDC49C8" Guid="{EF70E2B7-4109-4327-BE89-0D411119AC4D}">
<File Id="fil357A891A8A012F17A7B040E444D36B5F" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Personal Iterations Multiplier (PIM)_VeraCrypt_ChangePIM_Step1.png" DiskId="1" />
</Component>
<Component Id="cmp2F972A5C99F7EE708B7C232EE8647672" Guid="{3190ECDC-675E-4845-A885-F12A1DF98B80}">
<File Id="filF8BC3136E117642C05A9DE926C174FAF" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Personal Iterations Multiplier (PIM)_VeraCrypt_ChangePIM_Step2.png" DiskId="1" />
</Component>
<Component Id="cmpB21F7D781FE7B006ABCA7974A21F29E2" Guid="{E07A247C-4600-4FAD-9766-585D2385EA6B}">
<File Id="fil559077BE31FD160F8A07CC74414D0B6A" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Personal Iterations Multiplier (PIM)_VeraCrypt_ChangePIM_System_Step1.png" DiskId="1" />
</Component>
<Component Id="cmpF345174585735CD7A31AE138DDE8B439" Guid="{516094A0-18EA-4AA4-806C-DAFC7BAF1245}">
<File Id="fil191704A44DE6065F1A5919C5EB1D49E1" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Personal Iterations Multiplier (PIM)_VeraCrypt_ChangePIM_System_Step2.png" DiskId="1" />
</Component>
<Component Id="cmp06772C03A0ECA40F11F1D5C5ACD607D8" Guid="{9235C68E-30B0-4B4C-94EB-6BDBC4057677}">
<File Id="filF226612AEE0B01C8ECE40DDF61B34478" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Personal Iterations Multiplier (PIM)_VeraCrypt_UsePIM_Step1.png" DiskId="1" />
</Component>
<Component Id="cmp79E890B8891FA87AA5B10A67E15E7E8E" Guid="{E0EA3C67-4624-47E1-A528-9859B868C7A5}">
<File Id="fil6351515AD3FA423CD458336ABC480500" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Personal Iterations Multiplier (PIM)_VeraCrypt_UsePIM_Step2.png" DiskId="1" />
</Component>
<Component Id="cmp89C46AE8EC4175E62A9CFE3DF9DF924A" Guid="{0A572658-4C6A-4F2A-8302-FF92CCEA3FB4}">
<File Id="fil0435E327F9A0E86EC58E465ED1474BBB" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Physical Security.html" DiskId="1" />
</Component>
<Component Id="cmpC8F860B10D41961424874F69C6D84ED3" Guid="{ED207B14-7958-4933-BF3A-1A1F85ECBA4E}">
<File Id="fil3B718B54EE1655F0A905435EE96043B9" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Pipelining.html" DiskId="1" />
</Component>
<Component Id="cmp285021B8CBC8E92B1CBCE4C88731083C" Guid="{86BDBC99-AC0B-4542-B14E-99908DD27628}">
<File Id="filB7C15B9F7B056DB59B2E536B74F5F1AE" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Plausible Deniability.html" DiskId="1" />
</Component>
<Component Id="cmpABE9B0A93A9B14C0732EBD8CD17A11AE" Guid="{5EE9BF82-FFB8-4511-B967-3383965953FB}">
<File Id="filE75832AA56BFC08BDB777474186CECD6" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Portable Mode.html" DiskId="1" />
</Component>
<Component Id="cmpD9B960879A3227B971E33222CE13BC18" Guid="{BD467209-9DA1-4383-BE25-E2EC8C9616ED}">
<File Id="filFBF0DB894794EFB2376487A579DFED67" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Preface.html" DiskId="1" />
</Component>
<Component Id="cmp3B3BB414D13FDBF2B0C7A9CEBD7D98F5" Guid="{2CF8409E-3423-44A2-96FA-54D793EEB3F0}">
<File Id="fil7F7441447BC07C288597FEFA0D495255" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Program Menu.html" DiskId="1" />
</Component>
<Component Id="cmpB39B1096387C2617720F515D24953B37" Guid="{48233666-96CF-4C73-9284-259EC39EA2B7}">
<File Id="filBE0C2BED7FB2DD3D2FC511AC4D7D385A" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Protection of Hidden Volumes.html" DiskId="1" />
</Component>
<Component Id="cmp493A37205039E2A3A476A1A4F5360EBF" Guid="{3D92A6B0-B03F-4C86-8020-F756FBAADDC8}">
<File Id="filC70F6B9415FAADA8160DB4529D0BE54D" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Protection of Hidden Volumes_Image_027.jpg" DiskId="1" />
</Component>
<Component Id="cmpF36A771DF9B1C4CD8E82C08A6D3D0786" Guid="{C0D77203-5FAC-4052-A490-ABB0346384AF}">
<File Id="filE1423115AD04FF5AEC6F63AA963CB4D6" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Protection of Hidden Volumes_Image_028.jpg" DiskId="1" />
</Component>
<Component Id="cmp63F6A68C5538B45661168554BC3B93D1" Guid="{252A5E82-AD3A-49A7-8185-421735A09DCE}">
<File Id="fil5286E3B666BFB60D10FBA4CF8D8F6925" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Protection of Hidden Volumes_Image_029.jpg" DiskId="1" />
</Component>
<Component Id="cmp0158A6D8BED6391AC7150B6C6AE2A9F9" Guid="{5A0D3271-1439-4E71-B7F6-D645FEC8FD49}">
<File Id="fil2C5151D680BC4575AC607487970F87D8" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Protection of Hidden Volumes_Image_030.jpg" DiskId="1" />
</Component>
<Component Id="cmpDE45667E9E3CD9F800EAC1E02B57AAB7" Guid="{333167EF-38B6-49E2-A24A-04E08F7D87BE}">
<File Id="fil1B03C5F8575364F36A893E5EE4723659" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Protection of Hidden Volumes_Image_031.jpg" DiskId="1" />
</Component>
<Component Id="cmp632453049391BAACDD117A40EC442743" Guid="{75B50C72-2495-4A22-BFDA-5BFE041EB265}">
<File Id="fil37E6C8BC6738BF93446E4F2D13E312EC" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Random Number Generator.html" DiskId="1" />
</Component>
<Component Id="cmpCE16E453CAD75A461B4FEBF451A51B7B" Guid="{E68D3F57-0A30-4492-9088-F2D1B0C7934A}">
<File Id="filC3043FC38C97C7B8038FF12DD7882D85" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Reallocated Sectors.html" DiskId="1" />
</Component>
<Component Id="cmpC741D187A28A87BD33866C9AC09A1298" Guid="{FB850461-6BD1-495F-9C10-19A34CFA0F16}">
<File Id="filFFB70B91C00A69849F9E36950C6606B3" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\References.html" DiskId="1" />
</Component>
<Component Id="cmpB313B00E647A121B2CBE47F3048A18A7" Guid="{5985576D-6F6C-4D96-9B3E-9E0961CF9FAF}">
<File Id="fil2EB5F87C05CCC55D3964D595C85EF19E" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Release Notes.html" DiskId="1" />
</Component>
<Component Id="cmp400428F6494DE58618E3B92539548C39" Guid="{0A1869ED-25F1-4430-97A5-4C6EA8CDA7FC}">
<File Id="filEDEDEF956F04F36B4163989F9AB9285F" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Removable Medium Volume.html" DiskId="1" />
</Component>
<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>
<Component Id="cmp00540BF93A805E0B9996945B61E1BC2F" Guid="{1D5B7A85-87F3-45AF-9C09-BA7E088A835D}">
<File Id="filA7A29851126AC571C090BB0FBEE83CB5" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Security Requirements and Precautions.html" DiskId="1" />
</Component>
<Component Id="cmp4C46C6668AD830D543AFE593D51676B3" Guid="{4CD21E9D-243F-4A58-A535-AA8EF9D2BFD1}">
<File Id="fil440C5158A3CD96689918C976DC917325" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Security Requirements for Hidden Volumes.html" DiskId="1" />
</Component>
<Component Id="cmp6EE914124966E3A0F695359116413DD4" Guid="{724FA79D-49BC-4075-ABF4-0C318AE39855}">
<File Id="filD229058EB41E2E150C0CA4D0EC1DF39B" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Security Tokens &amp; Smart Cards.html" DiskId="1" />
</Component>
<Component Id="cmp28E29B4CA17AB51913B756CD9397EEFE" Guid="{1B9083B9-8E76-44CA-AE3E-0771B1ABA62B}">
<File Id="filC173058120D357E87951F41755A9210B" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Serpent.html" DiskId="1" />
</Component>
<Component Id="cmp5DF24509F284FABC600232197F803DE5" Guid="{120A40CF-E44A-4F4F-9072-93248DABACA2}">
<File Id="fil01F3ACD810057C4A059A5C424E1B79E1" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\SHA-256.html" DiskId="1" />
</Component>
<Component Id="cmp09E31B885345FBEA1F473AF7A10FD88D" Guid="{1B1C80CF-6C3C-4C7D-BE7B-579042701D0F}">
<File Id="fil2E702CC679444D8DDB66A3FBDB32C807" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\SHA-512.html" DiskId="1" />
</Component>
<Component Id="cmpAE05C79A35A43ECCAC995A711DC4D60B" Guid="{151A493F-38A5-4EF1-9740-255B610B4117}">
<File Id="fil167B9CF3B9CD2FA5458778733095F780" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Sharing over Network.html" DiskId="1" />
</Component>
<Component Id="cmpB6D91209A93313D08150643F1738DED8" Guid="{270DF8A0-8859-49F3-BF05-2F155C3CA428}">
<File Id="filF3B75776C2FEC0F4397274BCA02330DB" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Source Code.html" DiskId="1" />
</Component>
<Component Id="cmpDB66E821EC13977824FB1069DF5DAA69" Guid="{D08B0614-2B88-4445-9B47-52BEA0E29E77}">
<File Id="filA67FBF7D25BFBA155A0E4570F404CBEE" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Standard Compliance.html" DiskId="1" />
</Component>
<Component Id="cmp159AB26E32632FC87229090B3AA89BF8" Guid="{B35B4FD4-D82C-47E9-BB2A-5539115F40CC}">
<File Id="filBFED47E502C7539F724D68EAF73A554D" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Streebog.html" DiskId="1" />
</Component>
<Component Id="cmp5BE3E12343551B853E1B143371CBEBE6" Guid="{5ACC0589-AD8D-4BAC-BD40-201BAD7D07BC}">
<File Id="filA40C816E149FB745F49DAF482DF97F3B" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\styles.css" DiskId="1" />
</Component>
<Component Id="cmp0E081D9499DA225BB788494A1D86893D" Guid="{A79816FA-0683-4097-988B-75FB49DF3265}">
<File Id="filB5B2E158090CD673A8FE9D55020AFC48" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Supported Operating Systems.html" DiskId="1" />
</Component>
<Component Id="cmpBC7134AF21BAE309E9FD1A52ADF92527" Guid="{9570C06B-324A-4216-8D39-57AE06CAC70A}">
<File Id="fil6D85A49AF2B16D6EE47465F315B140EF" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Supported Systems for System Encryption.html" DiskId="1" />
</Component>
<Component Id="cmpB586F01E9F9657C498F2AB64E1F51BD7" Guid="{9E7FE222-18AC-48E5-ADAD-2A45BD498DAB}">
<File Id="fil4943B1ACB69010EBD9EC4E9D4E010E11" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\System Encryption.html" DiskId="1" />
</Component>
<Component Id="cmp6EB049078039C276CADA69E7B79FDFA8" Guid="{8BDEFB8D-9143-45EE-8095-65B5F4C95417}">
<File Id="fil5A3E287172F44E471AE59AE8AB15B797" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\System Favorite Volumes.html" DiskId="1" />
</Component>
<Component Id="cmp3135BB68A1F44DDD9FE19B7D5FB4ED7B" Guid="{00ED20A0-F1D4-443F-91EE-646A14B229BA}">
<File Id="fil2C3C74388CBEB07327ED4D549C0067FE" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Technical Details.html" DiskId="1" />
</Component>
<Component Id="cmp98ECAD990DF7B535B05EF6E840B7B2DF" Guid="{1827AFAB-C8B0-46BF-B281-88662B87E583}">
<File Id="filAB4D4629FE812B0E1CDB1E3CBFB4A297" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Trim Operation.html" DiskId="1" />
</Component>
<Component Id="cmpFE417CCCB859A1C3E4FB90A9C4E132F0" Guid="{A03D9719-6170-4239-9E67-5857521417C3}">
<File Id="filECA5FD7DEC2F3112CF19DB201F4DD774" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Troubleshooting.html" DiskId="1" />
</Component>
<Component Id="cmpD91C00B1B2AACF38761B45D0574884D7" Guid="{52CD1733-C124-401A-9830-56AECD35F8DF}">
<File Id="fil524C8D572AD8121392C6584496A57345" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\TrueCrypt Support.html" DiskId="1" />
</Component>
<Component Id="cmp590EDE3CE6E09D0D43B35287E849B75A" Guid="{5A433701-05CD-4972-9B85-B318BFD5D8DD}">
<File Id="fil35D6691D20085B8A5F8941864C44EC0C" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\TrueCrypt Support_truecrypt_mode_gui.jpg" DiskId="1" />
</Component>
<Component Id="cmp9D6F95F912C3B9C95E92E39BA1CE6BC9" Guid="{95929E0A-1AB1-44BC-A86D-F4F4B552121F}">
<File Id="filE04EC2E8B20706A01283B31462E0DB0F" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\twitter_veracrypt.PNG" DiskId="1" />
</Component>
<Component Id="cmpAD429D8A050A0D31B661626BDCA9C952" Guid="{6437B9F6-6024-4ACA-8FF1-23A613E2373E}">
<File Id="filC71BF1DDF8EB4C886801C1E95CD42F31" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Twofish.html" DiskId="1" />
</Component>
<Component Id="cmp3BDE199844AB81673ABB0E5E61E9B7B5" Guid="{95B5F172-3BBE-4620-B68A-F2D3473C066C}">
<File Id="filD2BC6D56B2FF1A44DB6FF7B24B594430" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Unencrypted Data in RAM.html" DiskId="1" />
</Component>
<Component Id="cmp0A4AB9AEF0D351FA5E63BCD67DC00607" Guid="{CF5B6BB4-4263-4354-BA4F-ADF283A0F238}">
<File Id="fil82416621AEEFEB29EFA3DE265214EA14" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Uninstalling VeraCrypt.html" DiskId="1" />
</Component>
<Component Id="cmpCC25F1CB6A1C9D8B47C407B818F73B59" Guid="{5E74CF1D-85A3-4A4F-B1D8-E965912E00DA}">
<File Id="fil9D6D114ED531555871AD956FCBA5B7DC" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Using VeraCrypt Without Administrator Privileges.html" DiskId="1" />
</Component>
<Component Id="cmpE0F5E8A2D6FEF181686370F0E1EAC632" Guid="{FDF54DAD-73B4-4D06-A292-353E3AFC27F7}">
<File Id="fil980276E3BC07E82993537096C68872EF" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\VeraCrypt Background Task.html" DiskId="1" />
</Component>
<Component Id="cmp46B2E8BCD50BD668153E793EB737BC39" Guid="{A899B8CF-2847-4BC2-BDD5-4B9C77EC13F9}">
<File Id="filF1064BAE73402AAE56CBD0BED505159D" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\VeraCrypt Hidden Operating System.html" DiskId="1" />
</Component>
<Component Id="cmp0305CC2824E44F697B402E56A0CD1754" Guid="{4A81FE38-C1CE-430D-855B-2126B865A643}">
<File Id="filB279C24D2499DFD0899469188292D02E" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\VeraCrypt License.html" DiskId="1" />
</Component>
<Component Id="cmp0E00CBDCB82A904FD6AD82E458CA6AA7" Guid="{54998F1F-E717-4881-B63E-A3493B3EB7FD}">
<File Id="fil069503600DD8A66DCDA448933183871D" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\VeraCrypt Rescue Disk.html" DiskId="1" />
</Component>
<Component Id="cmp594B5E68E63675F4986F6717BC1F5950" Guid="{1216918B-2AEE-48BE-B956-9BF6F9AA568E}">
<File Id="fil3AB9FDA0E3D8D0A0BD0C321E1779EC14" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\VeraCrypt System Files.html" DiskId="1" />
</Component>
<Component Id="cmp62748E79EC04EBE33DC46770AD65CDCE" Guid="{6A32F378-04F7-42B4-A9B2-7A500BB34071}">
<File Id="filB21E0ACBD1948FFB662842F1F6A86DAB" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\VeraCrypt Volume Format Specification.html" DiskId="1" />
</Component>
<Component Id="cmpE1265CF3CC5E0B487E99D9D5936BB3F4" Guid="{ADFAD315-C3D8-4084-A7F3-FA957429C5F1}">
<File Id="filDFCE636A6439CD7F236E004E67DBCD23" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\VeraCrypt Volume.html" DiskId="1" />
</Component>
<Component Id="cmp1C162513D52824629D7C9FAF96054182" Guid="{8772B5F9-85B5-4DB9-AD86-AF6FB0FECF13}">
<File Id="fil0CC62FF0B0565DF602BDF277B36D1696" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\VeraCrypt128x128.png" DiskId="1" />
</Component>
<Component Id="cmpB5FA2A488D2C7E59E0B52D18820CE00A" Guid="{CF1BAE7D-281D-49DB-A096-51C3B3DFC40F}">
<File Id="filCEA5B6C14C18E120FCFF7BBD6791B9FD" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Volume Clones.html" DiskId="1" />
</Component>
<Component Id="cmpBB1A4A1EB3FBBE5B2BF2752C302CDC2D" Guid="{69F8D869-FB10-436B-8D13-DBBA92BA4B29}">
<File Id="fil78A530A8C9B138112029FBCC58AE22E7" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Wear-Leveling.html" DiskId="1" />
</Component>
<Component Id="cmp9D908DF026E6297D51B6C4A6700092F1" Guid="{567314CF-BEA8-4AA7-A9EF-F0C776EF80E1}">
<File Id="fil21EEF98CAEE8AF1A7263353EE9D83C38" KeyPath="yes" Source="$(sys.CURRENTDIR)\docs\html\en\Whirlpool.html" DiskId="1" />
</Component>
</DirectoryRef>
<!-- Refer to Desktop folder in order to install files in it (shortcut) -->
<DirectoryRef Id="DesktopFolder">
<!-- Creating an advertised shortcut : enhances resiliency by verifying that all the components in the feature are installed when the shortcut is activated -->
<Component Id="VCShortcutDesktop" Guid="C7EBBEFB-8E9C-48D6-8014-2BBA1C7D1957">
<Condition>INSTALLDESKTOPSHORTCUT</Condition>
<Shortcut Id="VCDesktopShortcut"
Name="VeraCrypt"
Description="!(loc.VeraCryptDesc)"
Target="[APPLICATIONROOTFOLDER]VeraCrypt.exe"
WorkingDirectory="APPLICATIONROOTFOLDER"
Icon="VeraCrypt.ico">
</Shortcut>
<RemoveFolder Id="CleanupDesktopShortcut" On="uninstall"/>
<RegistryValue
Root="HKCU"
Key="Software\VeraCrypt_MSI"
Name="VCDesktopShortcutInstalled"
Type="integer"
Value="1"
KeyPath="yes"/>
</Component>
</DirectoryRef>
<!-- Refer to ApplicationProgramsFolder folder in order to install files in it (shortcut) -->
<DirectoryRef Id="ApplicationProgramsFolder">
<!-- Creating an advertised shortcut : enhances resiliency by verifying that all the components in the feature are installed when the shortcut is activated -->
<Component Id="VCShortcutStartMenu" Guid="{9CA5F425-0268-4424-8E41-A94D90F1118D}">
<Condition>INSTALLSTARTMENUSHORTCUT</Condition>
<Shortcut Id="VCMenuShortcut"
Name="VeraCrypt"
Description="!(loc.VeraCryptDesc)"
Target="[APPLICATIONROOTFOLDER]VeraCrypt.exe"
WorkingDirectory="APPLICATIONROOTFOLDER"
Icon="VeraCrypt.ico">
</Shortcut>
<RemoveFolder Id="CleanupVCStartMenuShortcut" On="uninstall"/>
<RegistryValue
Root="HKCU"
Key="Software\VeraCrypt_MSI"
Name="VCStartMenuShortcutInstalled"
Type="integer"
Value="1"
KeyPath="yes"/>
</Component>
<!-- Creating an advertised shortcut : enhances resiliency by verifying that all the components in the feature are installed when the shortcut is activated -->
<Component Id="VCExpanderShortcutStartMenu" Guid="9BA70A97-CB6D-4ED4-A0F7-A4CF9885DC33">
<Condition>INSTALLSTARTMENUSHORTCUT</Condition>
<Shortcut Id="VCExpanderStartMenuShortcut"
Name="VeraCryptExpander"
Description="!(loc.VeraCryptExpanderDesc)"
Target="[APPLICATIONROOTFOLDER]VeraCryptExpander.exe"
WorkingDirectory="APPLICATIONROOTFOLDER"
Icon="VeraCrypt.ico">
</Shortcut>
<RemoveFolder Id="CleanupVCExpanderStartMenuShortcut" On="uninstall"/>
<RegistryValue
Root="HKCU"
Key="Software\VeraCrypt_MSI"
Name="VCEexpanderStartMenuShortcutInstalled"
Type="integer"
Value="1"
KeyPath="yes"/>
</Component>
<!-- Creating an advertised shortcut : enhances resiliency by verifying that all the components in the feature are installed when the shortcut is activated -->
<Component Id="VCWebsiteShortcutStartMenu" Guid="{D5AA7FFE-5256-4234-AEE1-F9F1EB6ECA4A}">
<Condition>INSTALLSTARTMENUSHORTCUT</Condition>
<util:InternetShortcut Id="VCWebsiteStartMenuShortcut"
Name="VeraCrypt Website"
Target="https://www.veracrypt.fr"
Type="url"
IconFile="VeraCrypt.ico">
</util:InternetShortcut>
<RemoveFolder Id="CleanupVCWebsiteStartMenuShortcut" On="uninstall"/>
<RegistryValue
Root="HKCU"
Key="Software\VeraCrypt_MSI"
Name="VCWebsiteStartMenuShortcutInstalled"
Type="integer"
Value="1"
KeyPath="yes"/>
</Component>
</DirectoryRef>
<!-- Registry Keys -->
<!-- When Name is not provided the default value for the registry key will be set instead. -->
<!-- We use &quot; for when a " is needed in a Value -->
<DirectoryRef Id="TARGETDIR">
<!-- Win64="no" means the RegKey / RegValue will be created in the 32-bit node of HKLM (HKLM32) -->
<!-- By default, on 64-bit, Win64 is set to "yes" ; On 32-bit, there are no 64-bit regkeys / regvalues -->
<Component Id="VeraCryptVolume_Main_64" Guid="{C0C6A818-7D7B-483C-98B5-D2BDFF35A84D}" Win64="yes">
<!-- Create only if user checks "Associate .hc to VC" -->
<Condition>REGISTERVCFILEEXT</Condition>
<!-- MSI already removes all values and subkeys that it creates : no need to set Action="createAndRemoveOnUninstall" -->
<RegistryKey Root="HKLM" Key="SOFTWARE\Classes\VeraCryptVolume" >
<RegistryValue Type="string" Value="VeraCrypt Volume" KeyPath="yes" />
<RegistryValue Type="string" Name="AppUserModelID" Value="IDRIX.VeraCrypt" KeyPath="no" />
</RegistryKey>
</Component>
<Component Id="VeraCryptVolume_DefaultIcon_64" Guid="{4A30C85F-935B-4EE6-98BC-5FAE89621C54}" Win64="yes">
<!-- Create only if user checks "Associate .hc to VC" -->
<Condition>REGISTERVCFILEEXT</Condition>
<!-- MSI already removes all values and subkeys that it creates : no need to set Action="createAndRemoveOnUninstall" -->
<RegistryKey Root="HKLM" Key="SOFTWARE\Classes\VeraCryptVolume\DefaultIcon" >
<RegistryValue Type="string" Value="[APPLICATIONROOTFOLDER]VeraCrypt.exe,1" KeyPath="yes" />
</RegistryKey>
</Component>
<Component Id="VeraCryptVolume_Open_64" Guid="{99300DB4-5A81-44C1-B358-3CA356169BAB}" Win64="yes">
<!-- Create only if user checks "Associate .hc to VC" -->
<Condition>REGISTERVCFILEEXT</Condition>
<!-- MSI already removes all values and subkeys that it creates : no need to set Action="createAndRemoveOnUninstall" -->
<RegistryKey Root="HKLM" Key="SOFTWARE\Classes\VeraCryptVolume\Shell\open\command" >
<RegistryValue Type="string" Value="&quot;[APPLICATIONROOTFOLDER]VeraCrypt.exe&quot; /v &quot;%1&quot;" KeyPath="yes" />
</RegistryKey>
</Component>
<Component Id="VeraCryptVolume_Extension_64" Guid="{89EC023F-4BB3-446E-A2A6-FD7BFC5B4962}" Win64="yes">
<!-- Create only if user checks "Associate .hc to VC" -->
<Condition>REGISTERVCFILEEXT</Condition>
<!-- MSI already removes all values and subkeys that it creates : no need to set Action="createAndRemoveOnUninstall" -->
<RegistryKey Root="HKLM" Key="SOFTWARE\Classes\.hc" >
<RegistryValue Type="string" Value="VeraCryptVolume" KeyPath="yes" />
</RegistryKey>
</Component>
<Component Id="VeraCrypt_ProductGUID" Guid="{C8F09E5D-47CE-4FCE-BF4D-853C56AA20C6}" Win64="yes">
<!-- MSI already removes all values and subkeys that it creates : no need to set Action="createAndRemoveOnUninstall" -->
<RegistryKey Root="HKLM" Key="SOFTWARE\VeraCrypt_MSI" >
<RegistryValue Type="string" Name="ProductGuid" Value="$(var.ProductGuid)" KeyPath="yes" />
</RegistryKey>
</Component>
</DirectoryRef>
<!-- Smallest installable units ; Regroups Components to be installed in the same unit into one Feature -->
<!-- Tell Windows Installer to install -->
<Feature Id="Install_System"
Absent="disallow"
Level="1">
<!-- C:\Windows\System32\Drivers -->
<ComponentRef Id="veracryptDriverSys" />
</Feature>
<Feature Id="Install_Exe"
Absent="disallow"
Level="1">
<!-- C:\Program Files\VeraCrypt -->
<ComponentRef Id="LICENSEFile" />
<ComponentRef Id="LicenseTxt" />
<ComponentRef Id="NOTICEFile" />
<ComponentRef Id="VeraCrypt_FormatExe" />
<ComponentRef Id="veracryptCat" />
<ComponentRef Id="VeraCryptExe" />
<ComponentRef Id="veracryptInf" />
<ComponentRef Id="veracryptSys" />
<ComponentRef Id="VeraCryptExpanderExe" />
<ComponentRef Id="VeraCryptComRegExe" />
</Feature>
<Feature Id="Install_Lang"
Absent="disallow"
Level="1">
<!-- C:\Program Files\VeraCrypt\Languages -->
<ComponentRef Id="cmpF27E43A4E59E04A5B095C5101B229139" />
<ComponentRef Id="cmp4350812363930B900E24C845940DF416" />
<ComponentRef Id="cmp1DD254125CF07901EACECC70930818B0" />
<ComponentRef Id="cmp8C9E97CFD69D3BCB44B84D886720F3FC" />
<ComponentRef Id="cmp2BC45D6EC406DDC470E8501442A7AF68" />
<ComponentRef Id="cmp74A0CA1914A6C6FE33D76DE1C01C676D" />
<ComponentRef Id="cmpC186D3472CE1EC872FF1B0CF3682B3B6" />
<ComponentRef Id="cmp2AB0B613D25DDEF3466CBC86BD6B878B" />
<ComponentRef Id="cmpB09224EB45E097BF511CBC5DBE3E251C" />
<ComponentRef Id="cmpF24BBBEB613F893CBC5FBF6533CB48C9" />
<ComponentRef Id="cmp50E1DEF37599D2900447B13FC285B7B7" />
<ComponentRef Id="cmp46E5A0DB48A03A91267C97A664BD9BD4" />
<ComponentRef Id="cmp95BAB91FA0B7E37D5B9343478899CC75" />
<ComponentRef Id="cmpE73E4CCF9F6EC39998B9BE35E43768CC" />
<ComponentRef Id="cmp28EEAA4B2230460BDDA61DEFBC71A905" />
<ComponentRef Id="cmpCFF4CB46421F1A713D45607393ED9B90" />
<ComponentRef Id="cmp31601B4199D0CD3977758A3F2B63CDE7" />
<ComponentRef Id="cmp8E2E0489348A190B00532591CE0AC325" />
<ComponentRef Id="cmpEE57E2901F12294E638E66C39F1B39BB" />
<ComponentRef Id="cmp2F1F644C870AFF8970FE18AF2CD151C4" />
<ComponentRef Id="cmp4B8E0B5A7B7A8BE4267C722B1434E4CF" />
<ComponentRef Id="cmp84BB49D30BDBB4212707D14B7A9C13F1" />
<ComponentRef Id="cmp406E3BE632055CDDE1E42F45E31318DC" />
<ComponentRef Id="cmp4E363AF94947A27A4E9CF57C69E6DE54" />
<ComponentRef Id="cmp562F7970AF2F9EF535AC21A84C7229D1" />
<ComponentRef Id="cmp19EF976916B5E207A32BA08C3143A281" />
<ComponentRef Id="cmp4C9B5090256B2E88D27C9CF7E6CFD9EF" />
<ComponentRef Id="cmp91165C08D5943C21F132A349F8CBAAE7" />
<ComponentRef Id="cmp4A51B27F9D8DBBABFE4581EC2B162832" />
<ComponentRef Id="cmp041827E393D8777802256FD480D377FC" />
<ComponentRef Id="cmp68CC2DB5FA70FC1F6CA959FB5E1B78BF" />
<ComponentRef Id="cmpFF128AFA659D8C2E65E0BE55E0943F83" />
<ComponentRef Id="cmp1896040764F0DF6F89280C428013ECE7" />
<ComponentRef Id="cmpA52EAD237A44CBD337E302185BE12FB2" />
<ComponentRef Id="cmpBBB82A6228B54372ACAF9B1310CB2025" />
<ComponentRef Id="cmp4A275EC29DB9B5ECD56CD9C62D358750" />
<ComponentRef Id="cmp8DF0B84F470901D8800F8CAB88A90656" />
<ComponentRef Id="cmp529250BEE557732B5B8CBC47914A0F2A" />
<ComponentRef Id="cmp38274F8F5E4F600A9AC5225A0472D656" />
</Feature>
<Feature Id="Install_Help"
Absent="disallow"
Level="1">
<!-- C:\Program Files\VeraCrypt\docs -->
<ComponentRef Id="VCUserGuideChm" />
<!-- C:\Program Files\VeraCrypt\docs\EFI-DCS -->
<ComponentRef Id="dcs_tpm_owner_02_pdf" />
<ComponentRef Id="disk_encryption_v1_2_pdf" />
<ComponentRef Id="cmp5A2505C1E4CE33EAC578A8D1C8C505D2" />
<ComponentRef Id="cmpE985CD1A96188861286D758A12A1D0A1" />
<ComponentRef Id="cmp310514F655B6D66F5308A5823B0AB691" />
<ComponentRef Id="cmp0664DF8B1FE440C02B1E20D2F23C2CDF" />
<ComponentRef Id="cmp2934E77CB835216789F88BD686160A94" />
<ComponentRef Id="cmp688E76C9A297923D616068E33A6A4F49" />
<ComponentRef Id="cmp2ABB10C0A5AC0F1084EDF94E0FDFFD09" />
<ComponentRef Id="cmp32E7F4F5C0F44D00B53E3946E7E1FCF9" />
<ComponentRef Id="cmp989B890D94671F634D04D8F945090F21" />
<ComponentRef Id="cmp109BF0667C5A7B7036CCAAD9B29D9449" />
<ComponentRef Id="cmp82ABD3094B751094F3A49CD338A3713D" />
<ComponentRef Id="cmpE6A18205CB9F847CD7C4375AED2196D5" />
<ComponentRef Id="cmpAA4D61C5E17E2A8513EC120AC9B1DB8A" />
<ComponentRef Id="cmp39251BC13DA4AD6508E18D90D86DF06D" />
<ComponentRef Id="cmpBABB0BD95FD763E9C72D2F51C325CF15" />
<ComponentRef Id="cmp2FE3B3719DCC4362AFF8BF7B4CADFF80" />
<ComponentRef Id="cmp2FC8BD312D06FEC4E244604E27117B62" />
<ComponentRef Id="cmpAE99FB30CC29DF92E71A31EC39E61EF5" />
<ComponentRef Id="cmp535B1A9BACA231F518973D620DC23779" />
<ComponentRef Id="cmpD2ED5F6D8C0A4CA0D26F9F1BB34AB8BA" />
<ComponentRef Id="cmp5F7E0D8587039E1BA0F236F228C163BD" />
<ComponentRef Id="cmpF4DA2D3DABC768C2040A67A993C53E9E" />
<ComponentRef Id="cmpC0AD9100DE0F43E8149F8D3271B02D17" />
<ComponentRef Id="cmp32646E8087D106AE2B62E5DCF2419EDD" />
<ComponentRef Id="cmpB3C777FAF214F7D304EE7CF907D7FF57" />
<ComponentRef Id="cmp338115DF524F0B412A21AB64F59240DD" />
<ComponentRef Id="cmp2F24E0C7B7175D60257F6D01231C8373" />
<ComponentRef Id="cmpAE9D52ADD94D3A2711AA79FA0C91CA00" />
<ComponentRef Id="cmp0A6270FD26128E8D1CC83E392E91A772" />
<ComponentRef Id="cmpEDB0E152195A7EB91BBB28631B689E0B" />
<ComponentRef Id="cmpFD76EB6B5546D1C38CC33FABA95FAA15" />
<ComponentRef Id="cmpDC4FD19F507A5152351B9F71C8691486" />
<ComponentRef Id="cmp9E45BE754042F9DD742A0B7B9F27E786" />
<ComponentRef Id="cmpB6AC414023A6BDBF855F4A807DAE138C" />
<ComponentRef Id="cmp053692809BD5B3F5682AFCC539A767A3" />
<ComponentRef Id="cmp9049A791E9E1AB7FF01BD7F08D1CB069" />
<ComponentRef Id="cmp4E6F9484484A40645D519F688ED9C21E" />
<ComponentRef Id="cmp3CF724F2A2347A2A30C85CB76490F687" />
<ComponentRef Id="cmp3858A4BB7577362DE87F4485575DFC99" />
<ComponentRef Id="cmp90AB4CF273108F47223E3432838CDE37" />
<ComponentRef Id="cmpB9A0461BF7CF75538111B088C986A62F" />
<ComponentRef Id="cmpD8C7B52BC03709FAB2642B93BFE4FFE8" />
<ComponentRef Id="cmpFD6EB163EA6B74C4F59FF04D2B3796CC" />
<ComponentRef Id="cmp612D2E75E857D164665BE8CA37570D04" />
<ComponentRef Id="cmpF65BF759DA7F65BAD6D74A83FEF9D205" />
<ComponentRef Id="cmpA6A249B42C89657DE664B9D88D04DB3F" />
<ComponentRef Id="cmpEE8A03DA56EF1B35979430E8711A6960" />
<ComponentRef Id="cmp628E75C5DD0F38348B6F8694D5D5149C" />
<ComponentRef Id="cmp40BDD4F3CA20DEE006E087930EF3847C" />
<ComponentRef Id="cmp7AEEABAF151FCE92735664A55F7B8FFA" />
<ComponentRef Id="cmp9380DDE2560B4D8EE9CC363AF4BC7B5F" />
<ComponentRef Id="cmp84A94F04CD486338F57C03B316145945" />
<ComponentRef Id="cmpDF544847A4B1F86B3BA3468336CD73FE" />
<ComponentRef Id="cmp9A6A861B59A23E534C7407EF95500AA5" />
<ComponentRef Id="cmp09C34B1CBDE9F2F4E897340B1C67728E" />
<ComponentRef Id="cmpD3183A7373751A19B4B7C9B041F9035D" />
<ComponentRef Id="cmp3DED9073AB120DC026C48E9CDF9283EB" />
<ComponentRef Id="cmp0FF3027C2662D967ACB4B01BA7BC85F9" />
<ComponentRef Id="cmp3FC9C0126A2074CAABCF73197358F824" />
<ComponentRef Id="cmp1830E220882FBA276350032258B478AA" />
<ComponentRef Id="cmpE5D6E9DF3EE1301C6D5A4F44362BCE96" />
<ComponentRef Id="cmpB7B429D414CF1DD05A4B70CE94E343F7" />
<ComponentRef Id="cmp00845B9781D5633702C834BCB4EB93D1" />
<ComponentRef Id="cmp47F92D029E335F7865F8ACB30763FED2" />
<ComponentRef Id="cmpF3B90B0C1F316854E9142B22783ACF19" />
<ComponentRef Id="cmp2EC17F48BC15C5405D2DB40FC6E01745" />
<ComponentRef Id="cmpE00F8980768E14DF59474B5CB3D84041" />
<ComponentRef Id="cmpD17B73F5892E45458E960025558B3452" />
<ComponentRef Id="cmpF45A8248FAFA80A8DF62989C477E7C0F" />
<ComponentRef Id="cmpD066CBBD66E8CABB4AD4B928F823A5D2" />
<ComponentRef Id="cmpACFE3B967BB844C3FD0FE21C9E87EE5B" />
<ComponentRef Id="cmpFAA171DECE81EA4EA99B5570C9FF7D0E" />
<ComponentRef Id="cmp7C1E782A2C12520E4CACF0D8FD4EAA4E" />
<ComponentRef Id="cmpE9009D51D7CF4AA8BBA735E91F1D6044" />
<ComponentRef Id="cmp5D46BFDD0D54DD715695756148C22028" />
<ComponentRef Id="cmpE34BBB4D255F23D71B0143270915E6D7" />
<ComponentRef Id="cmpEB665F1BFDB30B20C90142CCD1DA7664" />
<ComponentRef Id="cmpFDCC994071E7ADACE3EB2CBACC60E34A" />
<ComponentRef Id="cmp21A3A9B1C7FAA004EF937114F0F41C61" />
<ComponentRef Id="cmpFD4A149B4654FEF0542A5ECE211A86B8" />
<ComponentRef Id="cmpE7CDDDCDA7CD20F1150F2879E0293D1D" />
<ComponentRef Id="cmp9CDBE7ACC2D5393535D2981C3DD73682" />
<ComponentRef Id="cmpF09EAA16502FCF137AAD38D70D50B200" />
<ComponentRef Id="cmp62D4B7B5DACB58D3EEA9E6D3385769A7" />
<ComponentRef Id="cmpBF36D06FA293DFD3AFA1543C43A54E17" />
<ComponentRef Id="cmp7345D3EE0CFEA227E8AA9ADADF95E623" />
<ComponentRef Id="cmpE92C5D4B774B7214B49931528F7EDCF6" />
<ComponentRef Id="cmpB6A3927A1BE4D2836C1007D3CC989C4B" />
<ComponentRef Id="cmp28666EA10A3DCEC7D2583ADD52785FDC" />
<ComponentRef Id="cmp08768A6308C114126260614CCDF6F72E" />
<ComponentRef Id="cmpF00E284DEEE43B341D12987E20DB76C5" />
<ComponentRef Id="cmpB75BD74E0F63097DC1777FF4BF440479" />
<ComponentRef Id="cmp1745256A6ECE8FB1779B0DA82CEECAB9" />
<ComponentRef Id="cmp3F248F4BDDB12D98D3CF173FEA01CE24" />
<ComponentRef Id="cmp1209E63998A1D1504B062C4ECC45EE07" />
<ComponentRef Id="cmp035C544DF9B46B9DD7871AD7898B7D36" />
<ComponentRef Id="cmpA891AF32EF72B7AC80533FC31773B604" />
<ComponentRef Id="cmp1FC684D1C3742A927228DE9A669A2895" />
<ComponentRef Id="cmp265116FC4778248E01BADFB30A2C32A7" />
<ComponentRef Id="cmpB2A3FFEE7A15E23A2835A843438E3669" />
<ComponentRef Id="cmpFC8FB415783E0AA424FBD685EFACF54E" />
<ComponentRef Id="cmp2BCEA21755E1C812ACCF15A09210FCCD" />
<ComponentRef Id="cmp9EC1750F7CD9717D3A761FC2930C509D" />
<ComponentRef Id="cmp4298A84BD6956E2A2742B5678BCFF173" />
<ComponentRef Id="cmp2D9F7D88EF1F843BDEA5A39D13330B8A" />
<ComponentRef Id="cmp58EAECCB29CB9ABDDDB72F9378E4EE77" />
<ComponentRef Id="cmp61C660976A230AD4AD8B42A90D4BCC7C" />
<ComponentRef Id="cmp29A0605ED3FB7D4E2EAC833D56411563" />
<ComponentRef Id="cmp4A0EF1CFD1E1DE8B4E7BF698E05680E9" />
<ComponentRef Id="cmp1E4F8137AD337BEA1B902E6B003AB953" />
<ComponentRef Id="cmp8D35F7D61B2B7DF0EDEAE2E56031E7CB" />
<ComponentRef Id="cmpDE2C66707086A509EABD0F9F6E8BDB1A" />
<ComponentRef Id="cmpA80443C3767E3E51F3DE88BFD0D7A33B" />
<ComponentRef Id="cmp214446AAABEBAC0C3827B8977083FAE2" />
<ComponentRef Id="cmp4AF022868FE6883520C700676C43B15D" />
<ComponentRef Id="cmpC27AA2C4496C9EFA95DCD663B031B5D0" />
<ComponentRef Id="cmp9CBBC8311BBFC54C8DC1162BB17E5AED" />
<ComponentRef Id="cmp033461B0777614621A2ED7B4E2B08D55" />
<ComponentRef Id="cmp0E43CDBBAE343957423AE2907AC16883" />
<ComponentRef Id="cmp8A8526D2061A14810E1B7A8A6E527DCD" />
<ComponentRef Id="cmpAE2DADEF126C59D8CCD3A18D8CDC49C8" />
<ComponentRef Id="cmp2F972A5C99F7EE708B7C232EE8647672" />
<ComponentRef Id="cmpB21F7D781FE7B006ABCA7974A21F29E2" />
<ComponentRef Id="cmpF345174585735CD7A31AE138DDE8B439" />
<ComponentRef Id="cmp06772C03A0ECA40F11F1D5C5ACD607D8" />
<ComponentRef Id="cmp79E890B8891FA87AA5B10A67E15E7E8E" />
<ComponentRef Id="cmp89C46AE8EC4175E62A9CFE3DF9DF924A" />
<ComponentRef Id="cmpC8F860B10D41961424874F69C6D84ED3" />
<ComponentRef Id="cmp285021B8CBC8E92B1CBCE4C88731083C" />
<ComponentRef Id="cmpABE9B0A93A9B14C0732EBD8CD17A11AE" />
<ComponentRef Id="cmpD9B960879A3227B971E33222CE13BC18" />
<ComponentRef Id="cmp3B3BB414D13FDBF2B0C7A9CEBD7D98F5" />
<ComponentRef Id="cmpB39B1096387C2617720F515D24953B37" />
<ComponentRef Id="cmp493A37205039E2A3A476A1A4F5360EBF" />
<ComponentRef Id="cmpF36A771DF9B1C4CD8E82C08A6D3D0786" />
<ComponentRef Id="cmp63F6A68C5538B45661168554BC3B93D1" />
<ComponentRef Id="cmp0158A6D8BED6391AC7150B6C6AE2A9F9" />
<ComponentRef Id="cmpDE45667E9E3CD9F800EAC1E02B57AAB7" />
<ComponentRef Id="cmp632453049391BAACDD117A40EC442743" />
<ComponentRef Id="cmpCE16E453CAD75A461B4FEBF451A51B7B" />
<ComponentRef Id="cmpC741D187A28A87BD33866C9AC09A1298" />
<ComponentRef Id="cmpB313B00E647A121B2CBE47F3048A18A7" />
<ComponentRef Id="cmp400428F6494DE58618E3B92539548C39" />
<ComponentRef Id="cmpFB2313AB16EF2467366ED136C0E61CE6" />
+ <ComponentRef Id="cmp960F36632D3FB602421D1195E4EB6FE1" />
<ComponentRef Id="cmpB4C7B1A7A3EC0CB2DE805AC5CC5FC0D7" />
<ComponentRef Id="cmp00540BF93A805E0B9996945B61E1BC2F" />
<ComponentRef Id="cmp4C46C6668AD830D543AFE593D51676B3" />
<ComponentRef Id="cmp6EE914124966E3A0F695359116413DD4" />
<ComponentRef Id="cmp28E29B4CA17AB51913B756CD9397EEFE" />
<ComponentRef Id="cmp5DF24509F284FABC600232197F803DE5" />
<ComponentRef Id="cmp09E31B885345FBEA1F473AF7A10FD88D" />
<ComponentRef Id="cmpAE05C79A35A43ECCAC995A711DC4D60B" />
<ComponentRef Id="cmpB6D91209A93313D08150643F1738DED8" />
<ComponentRef Id="cmpDB66E821EC13977824FB1069DF5DAA69" />
<ComponentRef Id="cmp159AB26E32632FC87229090B3AA89BF8" />
<ComponentRef Id="cmp5BE3E12343551B853E1B143371CBEBE6" />
<ComponentRef Id="cmp0E081D9499DA225BB788494A1D86893D" />
<ComponentRef Id="cmpBC7134AF21BAE309E9FD1A52ADF92527" />
<ComponentRef Id="cmpB586F01E9F9657C498F2AB64E1F51BD7" />
<ComponentRef Id="cmp6EB049078039C276CADA69E7B79FDFA8" />
<ComponentRef Id="cmp3135BB68A1F44DDD9FE19B7D5FB4ED7B" />
<ComponentRef Id="cmp98ECAD990DF7B535B05EF6E840B7B2DF" />
<ComponentRef Id="cmpFE417CCCB859A1C3E4FB90A9C4E132F0" />
<ComponentRef Id="cmpD91C00B1B2AACF38761B45D0574884D7" />
<ComponentRef Id="cmp590EDE3CE6E09D0D43B35287E849B75A" />
<ComponentRef Id="cmp9D6F95F912C3B9C95E92E39BA1CE6BC9" />
<ComponentRef Id="cmpAD429D8A050A0D31B661626BDCA9C952" />
<ComponentRef Id="cmp3BDE199844AB81673ABB0E5E61E9B7B5" />
<ComponentRef Id="cmp0A4AB9AEF0D351FA5E63BCD67DC00607" />
<ComponentRef Id="cmpCC25F1CB6A1C9D8B47C407B818F73B59" />
<ComponentRef Id="cmpE0F5E8A2D6FEF181686370F0E1EAC632" />
<ComponentRef Id="cmp46B2E8BCD50BD668153E793EB737BC39" />
<ComponentRef Id="cmp0305CC2824E44F697B402E56A0CD1754" />
<ComponentRef Id="cmp0E00CBDCB82A904FD6AD82E458CA6AA7" />
<ComponentRef Id="cmp594B5E68E63675F4986F6717BC1F5950" />
<ComponentRef Id="cmp62748E79EC04EBE33DC46770AD65CDCE" />
<ComponentRef Id="cmpE1265CF3CC5E0B487E99D9D5936BB3F4" />
<ComponentRef Id="cmp1C162513D52824629D7C9FAF96054182" />
<ComponentRef Id="cmpB5FA2A488D2C7E59E0B52D18820CE00A" />
<ComponentRef Id="cmpBB1A4A1EB3FBBE5B2BF2752C302CDC2D" />
<ComponentRef Id="cmp9D908DF026E6297D51B6C4A6700092F1" />
</Feature>
<Feature Id="Install_Registry"
Absent="disallow"
Level="1">
<!-- Registry Keys and Values -->
<ComponentRef Id="VeraCryptVolume_Main_64" />
<ComponentRef Id="VeraCryptVolume_DefaultIcon_64" />
<ComponentRef Id="VeraCryptVolume_Open_64" />
<ComponentRef Id="VeraCryptVolume_Extension_64" />
<ComponentRef Id="VeraCrypt_ProductGUID" />
</Feature>
<Feature Id="Install_Shortcuts"
Absent="disallow"
Level="1">
<!-- Shortcuts : Desktop and StartMenu -->
<ComponentRef Id="VCShortcutDesktop" />
<ComponentRef Id="VCShortcutStartMenu" />
<ComponentRef Id="VCExpanderShortcutStartMenu" />
<ComponentRef Id="VCWebsiteShortcutStartMenu" />
</Feature>
<!-- Tell Wix that WixUILicenseRtf was overrided by our definition of var.licenseRtf -->
<WixVariable Id="WixUILicenseRtf" Overridable="yes" Value="$(var.licenseRtf)"/>
<!-- UI specifications -->
<UI>
<!-- In order to have a list of Features, we need to reference WixUI_FeatureTree, which we do not do here -->
<!-- Set the default installation directory to [APPLICATIONROOTFOLDER] -->
<Property Id="WIXUI_INSTALLDIR" Value="APPLICATIONROOTFOLDER" />
<!-- Reference our custom UI which contains checkboxes for creating shortcuts -->
<UIRef Id="Custom_InstallDir" />
<!-- Reference 'WixUI_ErrorProgressText' to include translated errors and progress text -->
<UIRef Id="WixUI_ErrorProgressText" />
</UI>
<!-- Import our Custom Action DLL into the installer's executable -->
<Binary Id="VeraCryptCustomActions"
SourceFile="$(sys.CURRENTDIR)\VeraCryptSetup.dll" />
<!-- The UILEVEL MSI property is simply not available when running a deferred Custom Action.
Therefore, we work around this limitation by explicitly passing it on Custom Action Data using WiX -->
<!-- Custom actions that run after InstallFinalize or before InstallInitialize will not run elevated -->
<!-- Create a Custom Action which checks whether the license was accepted and throws an error if not -->
<CustomAction Id="CheckLicense"
Error="!(loc.AcceptVCLicenseDesc)" />
<!-- Create a Custom Action which executes only in UI sequence (not in silent mode)
right after the user checks License Agreeemnt Dialog checkbox and clicks on next.
It sets 'ACCEPTLICENSE' to 'YES' as a consequence so that 'CheckLicense' CA does not
fail in UI install.
See 'Custom_InstallDir.wxs' for details. -->
<CustomAction Id="SetAcceptLicense"
Property="ACCEPTLICENSE"
Value="YES"/>
<!-- Create a Custom Action which sets the CustomActionData property
for DoPreInstall Deferred Custom Action.
Its Property must be set to the Id of the Deferred Custom Action
DoPreInstall which is goind to catch it as a CustomActionData property. -->
<CustomAction Id="PreInst_SetData"
Property="DoPreInstall"
Value="UILEVEL=[UILevel]?INSTALLDIR=[APPLICATIONROOTFOLDER]?REINSTALL=[REINSTALL]" />
<!-- Create a Custom Action which sets the CustomActionData property
for DoPreUninstall Deferred Custom Action.
Its Property must be set to the Id of the Deferred Custom Action
DoPreInstall which is goind to catch it as a CustomActionData property. -->
<CustomAction Id="PreUninst_SetData"
Property="DoPreUninstall"
Value="UILEVEL=[UILevel]?INSTALLDIR=[APPLICATIONROOTFOLDER]?REINSTALL=[REINSTALL]" />
<!-- Create a Custom Action which sets the CustomActionData property
for DoPostInstall Deferred Custom Action.
Its Property must be set to the Id of the Deferred Custom Action
DoPostInstall which is goind to catch it as a CustomActionData property. -->
<CustomAction Id="PostInst_SetData"
Property="DoPostInstall"
Value="INSTALLDIR=[APPLICATIONROOTFOLDER]" />
<!-- Create a Custom Action which sets the CustomActionData property
for DoPostUninstall Deferred Custom Action.
Its Property must be set to the Id of the Deferred Custom Action
DoPostInstall which is goind to catch it as a CustomActionData property. -->
<CustomAction Id="PostUninst_SetData"
Property="DoPostUninstall"
Value="INSTALLDIR=[APPLICATIONROOTFOLDER]" />
<!-- Create our Pre-Install Custom Action.
We need to run it as deferred so that it runs
with admin privileges.
When it finishes, this CA creates RegKeys which
tell, for example, whether a reboot is required or not. -->
<CustomAction Id="DoPreInstall"
Execute="deferred"
Impersonate="no"
Return="check"
BinaryKey="VeraCryptCustomActions"
DllEntry="VC_CustomAction_PreInstall" />
<!-- Create our Post-Install Custom Action.
We need to run it as deferred so that it runs
with admin privileges. -->
<CustomAction Id="DoPostInstall"
Execute="deferred"
Impersonate="no"
Return="check"
BinaryKey="VeraCryptCustomActions"
DllEntry="VC_CustomAction_PostInstall" />
<!-- Create our Pre-Uninstall Custom Action.
We need to run it as deferred so that it runs
with admin privileges.
When it finishes, this CA creates RegKeys which
tell, for example, whether a reboot is required or not. -->
<CustomAction Id="DoPreUninstall"
Execute="deferred"
Impersonate="no"
Return="check"
BinaryKey="VeraCryptCustomActions"
DllEntry="VC_CustomAction_PreUninstall" />
<!-- Create our Post-Uninstall Custom Action.
We need to run it as deferred so that it runs
with admin privileges.
When it finishes, this CA creates RegKeys which
tell, for example, whether a reboot is required or not. -->
<CustomAction Id="DoPostUninstall"
Execute="deferred"
Impersonate="no"
Return="check"
BinaryKey="VeraCryptCustomActions"
DllEntry="VC_CustomAction_PostUninstall" />
<!-- Create our Custom Action which does all kinds of checks
(including reboot check).
Note that we MUST NOT create ISREBOOTREQUIRED as a Property
in Wix, we only set it with MsiSetProperty in CA.
Note that using properties (with all uppercase names,
otherwise Windows Installer will not treat them as public properties)
is the only way to pass arguments to and from the custom action. -->
<CustomAction Id="DoChecks"
Return="check"
BinaryKey="VeraCryptCustomActions"
DllEntry="VC_CustomAction_DoChecks" />
<!-- SetARPINSTALLLOCATION sets the property (Programs and Features) which specifies the install location in the registry entries of the Add & Remove Panel -->
<CustomAction Id="SetARPINSTALLLOCATION" Property="ARPINSTALLLOCATION" Value="[APPLICATIONROOTFOLDER]" />
<!-- Cancel install if one of VC's apps is running -->
<util:CloseApplication Id="CheckVCFormatRunning"
Target="VeraCrypt Format.exe"
Property="VCISRUNNING"
RebootPrompt="no" />
<util:CloseApplication Id="CheckVCRunning"
Target="VeraCrypt.exe"
Property="VCISRUNNING"
RebootPrompt="no" />
<util:CloseApplication Id="CheckVCExpanderRunning"
Target="VeraCryptExpander.exe"
Property="VCISRUNNING"
RebootPrompt="no" />
<util:CloseApplication Id="CheckVCFormat86Running"
Target="VeraCrypt Format-x86.exe"
Property="VCISRUNNING"
RebootPrompt="no" />
<util:CloseApplication Id="CheckVC86Running"
Target="VeraCrypt-x86.exe"
Property="VCISRUNNING"
RebootPrompt="no" />
<util:CloseApplication Id="CheckVCExpander86Running"
Target="VeraCryptExpander-x86.exe"
Property="VCISRUNNING"
RebootPrompt="no" />
<util:CloseApplication Id="CheckVCFormat64Running"
Target="VeraCrypt Format-x64.exe"
Property="VCISRUNNING"
RebootPrompt="no" />
<util:CloseApplication Id="CheckVC64Running"
Target="VeraCrypt-x64.exe"
Property="VCISRUNNING"
RebootPrompt="no" />
<util:CloseApplication Id="CheckVCExpander64Running"
Target="VeraCryptExpander-x64.exe"
Property="VCISRUNNING"
RebootPrompt="no" />
<util:CloseApplication Id="CheckVCSetupRunning"
Target="VeraCrypt Setup.exe"
Property="VCISRUNNING"
RebootPrompt="no" />
<util:CloseApplication Id="CheckVCCOMRegRunning"
Target="VeraCrypt COMReg.exe"
Property="VCISRUNNING"
RebootPrompt="no" />
<InstallUISequence>
<!-- Try to close all VC apps before launching installer, fail in case VC running, only at repair / upgrade / uninstall -->
<Custom Action="WixCloseApplications" Before="LaunchConditions">REINSTALL OR UPGRADINGPRODUCTCODE OR REMOVE~="ALL"</Custom>
</InstallUISequence>
<InstallExecuteSequence>
<!-- Execute CheckLicense (show license error) before LaunchConditions only if license not accepted at first install -->
<Custom Action="CheckLicense" Before="LaunchConditions"><![CDATA[ ACCEPTLICENSE ~<> "YES" AND NOT Installed ]]></Custom>
<!-- Try to close all VC apps before launching installer, fail in case VC running, only at repair / upgrade / uninstall -->
<Custom Action="WixCloseApplications" Before="LaunchConditions">REINSTALL OR UPGRADINGPRODUCTCODE OR REMOVE~="ALL"</Custom>
<!-- INSTALLATION / REPAIR / UPGRADE ONLY CAs -->
<!-- Execute PreInst_SetData before InstallFiles action of first installation ONLY OR repair ONLY
and before DoPreInstall to set the DoPreInstall's Custom Action Data.
Since we schedule RemoveExistingProducts after InstallExecute, if we execute this CA at UPGRADINGPRODUCTCODE,
it will execute it twice : once when it installs new files (NOT Installed), and then when it removes unnecessary files (actual upgrade: UPGRADINGPRODUCTCODE).
Therefore, we do not need to execute it at UPGRADINGPRODUCTCODE. -->
<Custom Action="PreInst_SetData" Before="DoPreInstall">(NOT Installed AND NOT REMOVE) OR REINSTALL</Custom>
<!-- Execute DoPreInstall before InstallFiles action of first installation ONLY OR repair ONLY.
Since we schedule RemoveExistingProducts after InstallExecute, if we execute this CA at UPGRADINGPRODUCTCODE,
it will execute it twice : once when it installs new files (NOT Installed), and then when it removes unnecessary files (actual upgrade: UPGRADINGPRODUCTCODE).
Therefore, we do not need to execute it at UPGRADINGPRODUCTCODE. -->
<Custom Action="DoPreInstall" Before="InstallFiles">(NOT Installed AND NOT REMOVE) OR REINSTALL</Custom>
<!-- Execute PostInst_SetData after InstallFiles action of first installation ONLY OR repair ONLY
and before DoPostInstall to set the DoPostInstall's Custom Action Data.
Since we schedule RemoveExistingProducts after InstallExecute, if we execute this CA at UPGRADINGPRODUCTCODE,
it will execute it twice : once when it installs new files (NOT Installed), and then when it removes unnecessary files (actual upgrade: UPGRADINGPRODUCTCODE).
Therefore, we do not need to execute it at UPGRADINGPRODUCTCODE. -->
<Custom Action="PostInst_SetData" Before="DoPostInstall">(NOT Installed AND NOT REMOVE) OR REINSTALL</Custom>
<!-- Execute DoPostInstall after InstallFiles action of first installation ONLY OR repair ONLY.
Since we schedule RemoveExistingProducts after InstallExecute, if we execute this CA at UPGRADINGPRODUCTCODE,
it will execute it twice : once when it installs new files (NOT Installed), and then when it removes unnecessary files (actual upgrade: UPGRADINGPRODUCTCODE).
Therefore, we do not need to execute it at UPGRADINGPRODUCTCODE. -->
<Custom Action="DoPostInstall" After="InstallFiles">(NOT Installed AND NOT REMOVE) OR REINSTALL</Custom>
<!-- UNINSTALLATION ONLY CAs -->
<!-- Execute PreUninst_SetData before RemoveFiles action when uninstalling ONLY
and before DoPreUninstall to set the DoPreUninstall's Custom Action Data -->
<Custom Action="PreUninst_SetData" Before="DoPreUninstall">REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE</Custom>
<!-- Execute DoPreUninstall before RemoveFiles when uninstalling ONLY -->
<Custom Action="DoPreUninstall" Before="RemoveFiles">REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE</Custom>
<!-- Execute PostUninst_SetData after RemoveFiles action when uninstalling ONLY
and before DoPostUninstall to set the DoPostUninstall's Custom Action Data -->
<Custom Action="PostUninst_SetData" Before="DoPostUninstall">REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE</Custom>
<!-- Execute DoPostUninstall after RemoveFiles action when uninstalling ONLY -->
<Custom Action="DoPostUninstall" After="RemoveFiles">REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE</Custom>
<!-- Execute DoChecks after InstallFinalize action of first installation or repair or uninstall.
Since we schedule RemoveExistingProducts after InstallExecute, if we execute this CA at UPGRADINGPRODUCTCODE,
it will execute it twice : once when it installs new files (NOT Installed), and then when it removes unnecessary files (actual upgrade: UPGRADINGPRODUCTCODE).
Since the first time it executes, it will delete the RegKeys, the second time it executes will fail, and with
it the whole upgrade.
Therefore, we do not need to execute it at UPGRADINGPRODUCTCODE. -->
<Custom Action="DoChecks" After="InstallFinalize">(NOT Installed AND NOT REMOVE) OR REINSTALL OR (REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE)</Custom>
<!-- Set the ARP -->
<Custom Action="SetARPINSTALLLOCATION" After="InstallValidate"></Custom>
<!-- ScheduleReboot only after DoChecks, which sets ISREBOOTREQUIRED -->
<ScheduleReboot After="DoChecks">ISREBOOTREQUIRED = "1"</ScheduleReboot>
</InstallExecuteSequence>
</Product>
-</Wix>
+</Wix> \ No newline at end of file
diff --git a/src/Release/Setup Files/password1000000.txt b/src/Release/Setup Files/password1000000.txt
deleted file mode 100644
index e6e50bf5..00000000
--- a/src/Release/Setup Files/password1000000.txt
+++ /dev/null