VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Boot/Windows/BootMain.cpp
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2024-06-12 12:30:04 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2024-06-12 12:30:04 +0200
commit455a4f2176a5cfbe325e1e40cea20dd3e466b64c (patch)
tree7a84d0f768ee375ea9f648bbbdeac7a4906f13fb /src/Boot/Windows/BootMain.cpp
parentbf9f3ec4f0a987ae1591ab5466f6eee599203c85 (diff)
downloadVeraCrypt-455a4f2176a5cfbe325e1e40cea20dd3e466b64c.tar.gz
VeraCrypt-455a4f2176a5cfbe325e1e40cea20dd3e466b64c.zip
Avoid conflict with C++17 features std::byte by using uint8 type instead of byte
Diffstat (limited to 'src/Boot/Windows/BootMain.cpp')
-rw-r--r--src/Boot/Windows/BootMain.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/Boot/Windows/BootMain.cpp b/src/Boot/Windows/BootMain.cpp
index 8bfbe4b3..e85f2be5 100644
--- a/src/Boot/Windows/BootMain.cpp
+++ b/src/Boot/Windows/BootMain.cpp
@@ -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)
{