1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2026-06-10 06:46:59 -05:00

Avoid conflict with C++17 features std::byte by using uint8 type instead of byte

This commit is contained in:
Mounir IDRASSI
2024-06-12 12:30:04 +02:00
parent bf9f3ec4f0
commit 455a4f2176
132 changed files with 1032 additions and 1035 deletions
+23 -23
View File
@@ -84,7 +84,7 @@ static void PrintMainMenu ()
}
static bool IsMenuKey (byte scanCode)
static bool IsMenuKey (uint8 scanCode)
{
#ifdef TC_WINDOWS_BOOT_RESCUE_DISK_MODE
return scanCode == TC_MENU_KEY_REPAIR;
@@ -149,12 +149,12 @@ static int AskSelection (const char *options[], size_t optionCount)
}
static byte AskPassword (Password &password, int& pim)
static uint8 AskPassword (Password &password, int& pim)
{
size_t pos = 0;
byte scanCode;
byte asciiCode;
byte hidePassword = 1;
uint8 scanCode;
uint8 asciiCode;
uint8 hidePassword = 1;
pim = 0;
@@ -312,7 +312,7 @@ static byte AskPassword (Password &password, int& pim)
}
static void ExecuteBootSector (byte drive, byte *sectorBuffer)
static void ExecuteBootSector (uint8 drive, uint8 *sectorBuffer)
{
Print ("Booting...\r\n");
CopyMemory (sectorBuffer, 0x0000, 0x7c00, TC_LB_SIZE);
@@ -338,7 +338,7 @@ static void ExecuteBootSector (byte drive, byte *sectorBuffer)
}
static bool OpenVolume (byte drive, Password &password, int pim, CRYPTO_INFO **cryptoInfo, uint32 *headerSaltCrc32, bool skipNormal, bool skipHidden)
static bool OpenVolume (uint8 drive, Password &password, int pim, CRYPTO_INFO **cryptoInfo, uint32 *headerSaltCrc32, bool skipNormal, bool skipHidden)
{
int volumeType;
bool hiddenVolume;
@@ -420,7 +420,7 @@ static bool CheckMemoryRequirements ()
}
static bool MountVolume (byte drive, byte &exitKey, bool skipNormal, bool skipHidden)
static bool MountVolume (uint8 drive, uint8 &exitKey, bool skipNormal, bool skipHidden)
{
BootArguments *bootArguments = (BootArguments *) TC_BOOT_LOADER_ARGS_OFFSET;
int incorrectPasswordCount = 0, pim = 0;
@@ -499,7 +499,7 @@ static bool MountVolume (byte drive, byte &exitKey, bool skipNormal, bool skipHi
}
static bool GetSystemPartitions (byte drive)
static bool GetSystemPartitions (uint8 drive)
{
size_t partCount;
@@ -524,10 +524,10 @@ static bool GetSystemPartitions (byte drive)
}
static byte BootEncryptedDrive ()
static uint8 BootEncryptedDrive ()
{
BootArguments *bootArguments = (BootArguments *) TC_BOOT_LOADER_ARGS_OFFSET;
byte exitKey;
uint8 exitKey;
BootCryptoInfo = NULL;
if (!GetSystemPartitions (BootDrive))
@@ -556,7 +556,7 @@ static byte BootEncryptedDrive ()
if (!InstallInterruptFilters())
goto err;
bootArguments->BootArgumentsCrc32 = GetCrc32 ((byte *) bootArguments, (byte *) &bootArguments->BootArgumentsCrc32 - (byte *) bootArguments);
bootArguments->BootArgumentsCrc32 = GetCrc32 ((uint8 *) bootArguments, (uint8 *) &bootArguments->BootArgumentsCrc32 - (uint8 *) bootArguments);
while (true)
{
@@ -587,7 +587,7 @@ err:
EncryptedVirtualPartition.Drive = TC_INVALID_BIOS_DRIVE;
EraseMemory ((void *) TC_BOOT_LOADER_ARGS_OFFSET, sizeof (BootArguments));
byte scanCode;
uint8 scanCode;
GetKeyboardChar (&scanCode);
return scanCode;
}
@@ -601,7 +601,7 @@ static void BootMenu ()
size_t partitionCount;
size_t bootablePartitionCount = 0;
for (byte drive = TC_FIRST_BIOS_DRIVE; drive <= TC_LAST_BIOS_DRIVE; ++drive)
for (uint8 drive = TC_FIRST_BIOS_DRIVE; drive <= TC_LAST_BIOS_DRIVE; ++drive)
{
if (GetDrivePartitions (drive, partitions, array_capacity (partitions), partitionCount, false, nullptr, true) == BiosResultSuccess)
{
@@ -689,7 +689,7 @@ static void BootMenu ()
#ifndef TC_WINDOWS_BOOT_RESCUE_DISK_MODE
static bool CopySystemPartitionToHiddenVolume (byte drive, byte &exitKey)
static bool CopySystemPartitionToHiddenVolume (uint8 drive, uint8 &exitKey)
{
bool status = false;
@@ -812,9 +812,9 @@ ret:
#else // TC_WINDOWS_BOOT_RESCUE_DISK_MODE
static void DecryptDrive (byte drive)
static void DecryptDrive (uint8 drive)
{
byte exitKey;
uint8 exitKey;
if (!MountVolume (drive, exitKey, false, true))
return;
@@ -925,7 +925,7 @@ askBadSectorSkip:
for (int i = 7; i >= 0; --i)
{
SectorBuffer[TC_HEADER_OFFSET_ENCRYPTED_AREA_LENGTH + i] = (byte) encryptedAreaLength.LowPart;
SectorBuffer[TC_HEADER_OFFSET_ENCRYPTED_AREA_LENGTH + i] = (uint8) encryptedAreaLength.LowPart;
encryptedAreaLength = encryptedAreaLength >> 8;
}
@@ -933,7 +933,7 @@ askBadSectorSkip:
for (i = 3; i >= 0; --i)
{
SectorBuffer[TC_HEADER_OFFSET_HEADER_CRC + i] = (byte) headerCrc32;
SectorBuffer[TC_HEADER_OFFSET_HEADER_CRC + i] = (uint8) headerCrc32;
headerCrc32 >>= 8;
}
@@ -1020,7 +1020,7 @@ static void RepairMenu ()
sector.HighPart = 0;
ChsAddress chs;
byte mbrPartTable[TC_LB_SIZE - TC_MAX_MBR_BOOT_CODE_SIZE];
uint8 mbrPartTable[TC_LB_SIZE - TC_MAX_MBR_BOOT_CODE_SIZE];
AcquireSectorBuffer();
for (int i = (selection == RestoreVolumeHeader ? TC_BOOT_VOLUME_HEADER_SECTOR : TC_MBR_SECTOR);
@@ -1073,7 +1073,7 @@ static void RepairMenu ()
Password password;
int pim;
byte exitKey = AskPassword (password, pim);
uint8 exitKey = AskPassword (password, pim);
if (exitKey != TC_BIOS_KEY_ENTER)
goto abort;
@@ -1221,13 +1221,13 @@ void main ()
while (true)
{
byte exitKey;
uint8 exitKey;
InitScreen();
#ifndef TC_WINDOWS_BOOT_RESCUE_DISK_MODE
// Hidden system setup
byte hiddenSystemCreationPhase = BootSectorFlags & TC_BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE;
uint8 hiddenSystemCreationPhase = BootSectorFlags & TC_BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE;
if (hiddenSystemCreationPhase != TC_HIDDEN_OS_CREATION_PHASE_NONE)
{