VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Boot
diff options
context:
space:
mode:
Diffstat (limited to 'src/Boot')
-rw-r--r--src/Boot/Windows/Bios.h2
-rw-r--r--src/Boot/Windows/BootCommon.h8
-rw-r--r--src/Boot/Windows/BootConfig.cpp10
-rw-r--r--src/Boot/Windows/BootConfig.h8
-rw-r--r--src/Boot/Windows/BootConsoleIo.cpp24
-rw-r--r--src/Boot/Windows/BootConsoleIo.h8
-rw-r--r--src/Boot/Windows/BootDebug.cpp8
-rw-r--r--src/Boot/Windows/BootDebug.h4
-rw-r--r--src/Boot/Windows/BootDiskIo.cpp58
-rw-r--r--src/Boot/Windows/BootDiskIo.h66
-rw-r--r--src/Boot/Windows/BootEncryptedIo.cpp4
-rw-r--r--src/Boot/Windows/BootEncryptedIo.h4
-rw-r--r--src/Boot/Windows/BootMain.cpp46
-rw-r--r--src/Boot/Windows/BootMain.h12
-rw-r--r--src/Boot/Windows/IntFilter.cpp14
-rw-r--r--src/Boot/Windows/Platform.cpp2
16 files changed, 139 insertions, 139 deletions
diff --git a/src/Boot/Windows/Bios.h b/src/Boot/Windows/Bios.h
index 7085e7a2..0282fad7 100644
--- a/src/Boot/Windows/Bios.h
+++ b/src/Boot/Windows/Bios.h
@@ -28,6 +28,6 @@ enum
BiosResultTimeout = 0x80
};
-typedef byte BiosResult;
+typedef uint8 BiosResult;
#endif // TC_HEADER_Boot_Bios
diff --git a/src/Boot/Windows/BootCommon.h b/src/Boot/Windows/BootCommon.h
index d2ee42a1..45a1a650 100644
--- a/src/Boot/Windows/BootCommon.h
+++ b/src/Boot/Windows/BootCommon.h
@@ -43,7 +43,7 @@
typedef struct
{
- byte Flags;
+ uint8 Flags;
} BootSectorConfiguration;
@@ -120,7 +120,7 @@ typedef struct {
uint32 Data1;
uint16 Data2;
uint16 Data3;
- byte Data4[8];
+ uint8 Data4[8];
} DCS_GUID;
// DE types
@@ -155,7 +155,7 @@ typedef struct _DCS_DISK_ENTRY {
struct {
uint32 Type;
uint32 Offset;
- byte reserved[16];
+ uint8 reserved[16];
uint64 Length; // size of structure at Offset
};
DCS_DISK_ENTRY_SECTORS Sectors;
@@ -208,7 +208,7 @@ typedef struct _DCS_DEP_PWD_CACHE {
uint32 Count;
PasswordLegacy Pwd[4];
int32 Pim[4];
- byte pad[512 - 8 - 4 - 4 - (sizeof(PasswordLegacy) + 4) * 4];
+ uint8 pad[512 - 8 - 4 - 4 - (sizeof(PasswordLegacy) + 4) * 4];
} DCS_DEP_PWD_CACHE;
CSTATIC_ASSERT(sizeof(DCS_DEP_PWD_CACHE) == 512, Wrong_size_DCS_DEP_PWD_CACHE);
#pragma pack()
diff --git a/src/Boot/Windows/BootConfig.cpp b/src/Boot/Windows/BootConfig.cpp
index 0412d082..948dfd93 100644
--- a/src/Boot/Windows/BootConfig.cpp
+++ b/src/Boot/Windows/BootConfig.cpp
@@ -12,10 +12,10 @@
#include "BootConfig.h"
-byte BootSectorFlags;
+uint8 BootSectorFlags;
-byte BootLoaderDrive;
-byte BootDrive;
+uint8 BootLoaderDrive;
+uint8 BootDrive;
bool BootDriveGeometryValid = false;
bool PreventNormalSystemBoot = false;
bool PreventBootMenu = false;
@@ -39,7 +39,7 @@ uint64 HiddenVolumeStartSector;
void ReadBootSectorUserConfiguration ()
{
- byte userConfig;
+ uint8 userConfig;
AcquireSectorBuffer();
@@ -83,7 +83,7 @@ ret:
}
-BiosResult UpdateBootSectorConfiguration (byte drive)
+BiosResult UpdateBootSectorConfiguration (uint8 drive)
{
uint64 mbrSector;
mbrSector.HighPart = 0;
diff --git a/src/Boot/Windows/BootConfig.h b/src/Boot/Windows/BootConfig.h
index b66dc233..5338109f 100644
--- a/src/Boot/Windows/BootConfig.h
+++ b/src/Boot/Windows/BootConfig.h
@@ -17,10 +17,10 @@
#include "Platform.h"
#include "BootDiskIo.h"
-extern byte BootSectorFlags;
+extern uint8 BootSectorFlags;
-extern byte BootLoaderDrive;
-extern byte BootDrive;
+extern uint8 BootLoaderDrive;
+extern uint8 BootDrive;
extern bool BootDriveGeometryValid;
extern DriveGeometry BootDriveGeometry;
extern bool PreventNormalSystemBoot;
@@ -41,6 +41,6 @@ extern uint64 HiddenVolumeStartSector;
void ReadBootSectorUserConfiguration ();
-BiosResult UpdateBootSectorConfiguration (byte drive);
+BiosResult UpdateBootSectorConfiguration (uint8 drive);
#endif // TC_HEADER_Boot_BootConfig
diff --git a/src/Boot/Windows/BootConsoleIo.cpp b/src/Boot/Windows/BootConsoleIo.cpp
index 706e36f6..046f580b 100644
--- a/src/Boot/Windows/BootConsoleIo.cpp
+++ b/src/Boot/Windows/BootConsoleIo.cpp
@@ -101,7 +101,7 @@ void Print (const uint64 &number)
}
-void PrintHex (byte b)
+void PrintHex (uint8 b)
{
PrintChar (((b >> 4) >= 0xA ? 'A' - 0xA : '0') + (b >> 4));
PrintChar (((b & 0xF) >= 0xA ? 'A' - 0xA : '0') + (b & 0xF));
@@ -110,8 +110,8 @@ void PrintHex (byte b)
void PrintHex (uint16 data)
{
- PrintHex (byte (data >> 8));
- PrintHex (byte (data));
+ PrintHex (uint8 (data >> 8));
+ PrintHex (uint8 (data));
}
@@ -219,9 +219,9 @@ void PrintErrorNoEndl (const char *message)
}
-byte GetShiftFlags ()
+uint8 GetShiftFlags ()
{
- byte flags;
+ uint8 flags;
__asm
{
mov ah, 2
@@ -233,7 +233,7 @@ byte GetShiftFlags ()
}
-byte GetKeyboardChar ()
+uint8 GetKeyboardChar ()
{
return GetKeyboardChar (nullptr);
}
@@ -253,7 +253,7 @@ inline void Sleep ()
}
*/
-byte GetKeyboardChar (byte *scanCode)
+uint8 GetKeyboardChar (uint8 *scanCode)
{
// Work around potential BIOS bugs (Windows boot manager polls the keystroke buffer)
while (!IsKeyboardCharAvailable())
@@ -265,8 +265,8 @@ byte GetKeyboardChar (byte *scanCode)
}
}
- byte asciiCode;
- byte scan;
+ uint8 asciiCode;
+ uint8 scan;
__asm
{
mov ah, 0
@@ -302,7 +302,7 @@ bool EscKeyPressed ()
{
if (IsKeyboardCharAvailable ())
{
- byte keyScanCode;
+ uint8 keyScanCode;
GetKeyboardChar (&keyScanCode);
return keyScanCode == TC_BIOS_KEY_ESC;
}
@@ -346,8 +346,8 @@ bool IsDigit (char c)
int GetString (char *buffer, size_t bufferSize)
{
- byte c;
- byte scanCode;
+ uint8 c;
+ uint8 scanCode;
size_t pos = 0;
while (pos < bufferSize)
diff --git a/src/Boot/Windows/BootConsoleIo.h b/src/Boot/Windows/BootConsoleIo.h
index 349782eb..cf10d2c6 100644
--- a/src/Boot/Windows/BootConsoleIo.h
+++ b/src/Boot/Windows/BootConsoleIo.h
@@ -45,9 +45,9 @@ void ClearScreen ();
void DisableScreenOutput ();
void EnableScreenOutput ();
bool EscKeyPressed ();
-byte GetKeyboardChar ();
-byte GetKeyboardChar (byte *scanCode);
-byte GetShiftFlags ();
+uint8 GetKeyboardChar ();
+uint8 GetKeyboardChar (uint8 *scanCode);
+uint8 GetShiftFlags ();
int GetString (char *buffer, size_t bufferSize);
void InitVideoMode ();
bool IsKeyboardCharAvailable ();
@@ -64,7 +64,7 @@ void PrintEndl (int cnt);
void PrintRepeatedChar (char c, int n);
void PrintError (const char *message);
void PrintErrorNoEndl (const char *message);
-void PrintHex (byte b);
+void PrintHex (uint8 b);
void PrintHex (uint16 data);
void PrintHex (uint32 data);
void PrintHex (const uint64 &data);
diff --git a/src/Boot/Windows/BootDebug.cpp b/src/Boot/Windows/BootDebug.cpp
index bea063c1..b490f5e8 100644
--- a/src/Boot/Windows/BootDebug.cpp
+++ b/src/Boot/Windows/BootDebug.cpp
@@ -34,7 +34,7 @@ void InitDebugPort ()
}
-void WriteDebugPort (byte dataByte)
+void WriteDebugPort (uint8 dataByte)
{
__asm
{
@@ -82,7 +82,7 @@ void PrintVal (const char *message, const uint64 &value, bool newLine, bool hex)
}
-void PrintHexDump (byte *mem, size_t size, uint16 *memSegment)
+void PrintHexDump (uint8 *mem, size_t size, uint16 *memSegment)
{
const size_t width = 16;
for (size_t pos = 0; pos < size; )
@@ -92,7 +92,7 @@ void PrintHexDump (byte *mem, size_t size, uint16 *memSegment)
size_t i;
for (i = 0; i < width && pos < size; ++i)
{
- byte dataByte;
+ uint8 dataByte;
if (memSegment)
{
__asm
@@ -134,7 +134,7 @@ void PrintHexDump (byte *mem, size_t size, uint16 *memSegment)
void PrintHexDump (uint16 memSegment, uint16 memOffset, size_t size)
{
- PrintHexDump ((byte *) memOffset, size, &memSegment);
+ PrintHexDump ((uint8 *) memOffset, size, &memSegment);
}
#endif // TC_BOOT_DEBUG_ENABLED
diff --git a/src/Boot/Windows/BootDebug.h b/src/Boot/Windows/BootDebug.h
index f94ab900..35fce41f 100644
--- a/src/Boot/Windows/BootDebug.h
+++ b/src/Boot/Windows/BootDebug.h
@@ -51,8 +51,8 @@
void InitDebugPort ();
void InitStackChecker ();
-void WriteDebugPort (byte dataByte);
-void PrintHexDump (byte *mem, size_t size, uint16 *memSegment = nullptr);
+void WriteDebugPort (uint8 dataByte);
+void PrintHexDump (uint8 *mem, size_t size, uint16 *memSegment = nullptr);
void PrintHexDump (uint16 memSegment, uint16 memOffset, size_t size);
void PrintVal (const char *message, const uint32 value, bool newLine = true, bool hex = false);
void PrintVal (const char *message, const uint64 &value, bool newLine = true, bool hex = false);
diff --git a/src/Boot/Windows/BootDiskIo.cpp b/src/Boot/Windows/BootDiskIo.cpp
index 437c462e..ddd00e1c 100644
--- a/src/Boot/Windows/BootDiskIo.cpp
+++ b/src/Boot/Windows/BootDiskIo.cpp
@@ -19,7 +19,7 @@
#include "BootStrings.h"
-byte SectorBuffer[TC_LB_SIZE];
+uint8 SectorBuffer[TC_LB_SIZE];
#ifdef TC_BOOT_DEBUG_ENABLED
static bool SectorBufferInUse = false;
@@ -41,9 +41,9 @@ void ReleaseSectorBuffer ()
#endif
-bool IsLbaSupported (byte drive)
+bool IsLbaSupported (uint8 drive)
{
- static byte CachedDrive = TC_INVALID_BIOS_DRIVE;
+ static uint8 CachedDrive = TC_INVALID_BIOS_DRIVE;
static bool CachedStatus;
uint16 result = 0;
@@ -68,7 +68,7 @@ ret:
}
-void PrintDiskError (BiosResult error, bool write, byte drive, const uint64 *sector, const ChsAddress *chs)
+void PrintDiskError (BiosResult error, bool write, uint8 drive, const uint64 *sector, const ChsAddress *chs)
{
PrintEndl();
Print (write ? "Write" : "Read"); Print (" error:");
@@ -109,17 +109,17 @@ void PrintSectorCountInMB (const uint64 &sectorCount)
}
-BiosResult ReadWriteSectors (bool write, uint16 bufferSegment, uint16 bufferOffset, byte drive, const ChsAddress &chs, byte sectorCount, bool silent)
+BiosResult ReadWriteSectors (bool write, uint16 bufferSegment, uint16 bufferOffset, uint8 drive, const ChsAddress &chs, uint8 sectorCount, bool silent)
{
CheckStack();
- byte cylinderLow = (byte) chs.Cylinder;
- byte sector = chs.Sector;
- sector |= byte (chs.Cylinder >> 2) & 0xc0;
- byte function = write ? 0x03 : 0x02;
+ uint8 cylinderLow = (uint8) chs.Cylinder;
+ uint8 sector = chs.Sector;
+ sector |= uint8 (chs.Cylinder >> 2) & 0xc0;
+ uint8 function = write ? 0x03 : 0x02;
BiosResult result;
- byte tryCount = TC_MAX_BIOS_DISK_IO_RETRIES;
+ uint8 tryCount = TC_MAX_BIOS_DISK_IO_RETRIES;
do
{
@@ -159,20 +159,20 @@ BiosResult ReadWriteSectors (bool write, uint16 bufferSegment, uint16 bufferOffs
#ifdef TC_WINDOWS_BOOT_RESCUE_DISK_MODE
-BiosResult ReadWriteSectors (bool write, byte *buffer, byte drive, const ChsAddress &chs, byte sectorCount, bool silent)
+BiosResult ReadWriteSectors (bool write, uint8 *buffer, uint8 drive, const ChsAddress &chs, uint8 sectorCount, bool silent)
{
uint16 codeSeg;
__asm mov codeSeg, cs
return ReadWriteSectors (write, codeSeg, (uint16) buffer, drive, chs, sectorCount, silent);
}
-BiosResult ReadSectors (byte *buffer, byte drive, const ChsAddress &chs, byte sectorCount, bool silent)
+BiosResult ReadSectors (uint8 *buffer, uint8 drive, const ChsAddress &chs, uint8 sectorCount, bool silent)
{
return ReadWriteSectors (false, buffer, drive, chs, sectorCount, silent);
}
#if 0
-BiosResult WriteSectors (byte *buffer, byte drive, const ChsAddress &chs, byte sectorCount, bool silent)
+BiosResult WriteSectors (uint8 *buffer, uint8 drive, const ChsAddress &chs, uint8 sectorCount, bool silent)
{
return ReadWriteSectors (true, buffer, drive, chs, sectorCount, silent);
}
@@ -180,7 +180,7 @@ BiosResult WriteSectors (byte *buffer, byte drive, const ChsAddress &chs, byte s
#endif
-static BiosResult ReadWriteSectors (bool write, BiosLbaPacket &dapPacket, byte drive, const uint64 &sector, uint16 sectorCount, bool silent)
+static BiosResult ReadWriteSectors (bool write, BiosLbaPacket &dapPacket, uint8 drive, const uint64 &sector, uint16 sectorCount, bool silent)
{
CheckStack();
@@ -202,10 +202,10 @@ static BiosResult ReadWriteSectors (bool write, BiosLbaPacket &dapPacket, byte d
dapPacket.SectorCount = sectorCount;
dapPacket.Sector = sector;
- byte function = write ? 0x43 : 0x42;
+ uint8 function = write ? 0x43 : 0x42;
BiosResult result;
- byte tryCount = TC_MAX_BIOS_DISK_IO_RETRIES;
+ uint8 tryCount = TC_MAX_BIOS_DISK_IO_RETRIES;
do
{
@@ -237,7 +237,7 @@ static BiosResult ReadWriteSectors (bool write, BiosLbaPacket &dapPacket, byte d
}
-BiosResult ReadWriteSectors (bool write, byte *buffer, byte drive, const uint64 &sector, uint16 sectorCount, bool silent)
+BiosResult ReadWriteSectors (bool write, uint8 *buffer, uint8 drive, const uint64 &sector, uint16 sectorCount, bool silent)
{
BiosLbaPacket dapPacket;
dapPacket.Buffer = (uint32) buffer;
@@ -245,20 +245,20 @@ BiosResult ReadWriteSectors (bool write, byte *buffer, byte drive, const uint64
}
-BiosResult ReadWriteSectors (bool write, uint16 bufferSegment, uint16 bufferOffset, byte drive, const uint64 &sector, uint16 sectorCount, bool silent)
+BiosResult ReadWriteSectors (bool write, uint16 bufferSegment, uint16 bufferOffset, uint8 drive, const uint64 &sector, uint16 sectorCount, bool silent)
{
BiosLbaPacket dapPacket;
dapPacket.Buffer = ((uint32) bufferSegment << 16) | bufferOffset;
return ReadWriteSectors (write, dapPacket, drive, sector, sectorCount, silent);
}
-BiosResult ReadSectors (uint16 bufferSegment, uint16 bufferOffset, byte drive, const uint64 &sector, uint16 sectorCount, bool silent)
+BiosResult ReadSectors (uint16 bufferSegment, uint16 bufferOffset, uint8 drive, const uint64 &sector, uint16 sectorCount, bool silent)
{
return ReadWriteSectors (false, bufferSegment, bufferOffset, drive, sector, sectorCount, silent);
}
-BiosResult ReadSectors (byte *buffer, byte drive, const uint64 &sector, uint16 sectorCount, bool silent)
+BiosResult ReadSectors (uint8 *buffer, uint8 drive, const uint64 &sector, uint16 sectorCount, bool silent)
{
BiosResult result;
uint16 codeSeg;
@@ -274,17 +274,17 @@ BiosResult ReadSectors (byte *buffer, byte drive, const uint64 &sector, uint16 s
}
-BiosResult WriteSectors (byte *buffer, byte drive, const uint64 &sector, uint16 sectorCount, bool silent)
+BiosResult WriteSectors (uint8 *buffer, uint8 drive, const uint64 &sector, uint16 sectorCount, bool silent)
{
return ReadWriteSectors (true, buffer, drive, sector, sectorCount, silent);
}
-BiosResult GetDriveGeometry (byte drive, DriveGeometry &geometry, bool silent)
+BiosResult GetDriveGeometry (uint8 drive, DriveGeometry &geometry, bool silent)
{
CheckStack();
- byte maxCylinderLow, maxHead, maxSector;
+ uint8 maxCylinderLow, maxHead, maxSector;
BiosResult result;
__asm
{
@@ -329,9 +329,9 @@ void ChsToLba (const DriveGeometry &geometry, const ChsAddress &chs, uint64 &lba
void LbaToChs (const DriveGeometry &geometry, const uint64 &lba, ChsAddress &chs)
{
- chs.Sector = (byte) ((lba.LowPart % geometry.Sectors) + 1);
+ chs.Sector = (uint8) ((lba.LowPart % geometry.Sectors) + 1);
uint32 ch = lba.LowPart / geometry.Sectors;
- chs.Head = (byte) (ch % geometry.Heads);
+ chs.Head = (uint8) (ch % geometry.Heads);
chs.Cylinder = (uint16) (ch / geometry.Heads);
}
@@ -349,7 +349,7 @@ void PartitionEntryMBRToPartition (const PartitionEntryMBR &partEntry, Partition
}
-BiosResult ReadWriteMBR (bool write, byte drive, bool silent)
+BiosResult ReadWriteMBR (bool write, uint8 drive, bool silent)
{
uint64 mbrSector;
mbrSector.HighPart = 0;
@@ -362,7 +362,7 @@ BiosResult ReadWriteMBR (bool write, byte drive, bool silent)
}
-BiosResult GetDrivePartitions (byte drive, Partition *partitionArray, size_t partitionArrayCapacity, size_t &partitionCount, bool activeOnly, Partition *findPartitionFollowingThis, bool silent)
+BiosResult GetDrivePartitions (uint8 drive, Partition *partitionArray, size_t partitionArrayCapacity, size_t &partitionCount, bool activeOnly, Partition *findPartitionFollowingThis, bool silent)
{
Partition *followingPartition;
Partition tmpPartition;
@@ -419,7 +419,7 @@ BiosResult GetDrivePartitions (byte drive, Partition *partitionArray, size_t par
MBR *extMbr = (MBR *) SectorBuffer;
while (partitionArrayPos < partitionArrayCapacity &&
- (result = ReadSectors ((byte *) extMbr, drive, extStartLBA, 1, silent)) == BiosResultSuccess
+ (result = ReadSectors ((uint8 *) extMbr, drive, extStartLBA, 1, silent)) == BiosResultSuccess
&& extMbr->Signature == 0xaa55)
{
if (extMbr->Partitions[0].SectorCountLBA > 0)
@@ -478,7 +478,7 @@ BiosResult GetDrivePartitions (byte drive, Partition *partitionArray, size_t par
}
-bool GetActivePartition (byte drive)
+bool GetActivePartition (uint8 drive)
{
size_t partCount;
diff --git a/src/Boot/Windows/BootDiskIo.h b/src/Boot/Windows/BootDiskIo.h
index 621acd8f..0b92aa29 100644
--- a/src/Boot/Windows/BootDiskIo.h
+++ b/src/Boot/Windows/BootDiskIo.h
@@ -28,17 +28,17 @@ enum
struct PartitionEntryMBR
{
- byte BootIndicator;
+ uint8 BootIndicator;
- byte StartHead;
- byte StartCylSector;
- byte StartCylinder;
+ uint8 StartHead;
+ uint8 StartCylSector;
+ uint8 StartCylinder;
- byte Type;
+ uint8 Type;
- byte EndHead;
- byte EndSector;
- byte EndCylinder;
+ uint8 EndHead;
+ uint8 EndSector;
+ uint8 EndCylinder;
uint32 StartLBA;
uint32 SectorCountLBA;
@@ -46,15 +46,15 @@ struct PartitionEntryMBR
struct MBR
{
- byte Code[446];
+ uint8 Code[446];
PartitionEntryMBR Partitions[4];
uint16 Signature;
};
struct BiosLbaPacket
{
- byte Size;
- byte Reserved;
+ uint8 Size;
+ uint8 Reserved;
uint16 SectorCount;
uint32 Buffer;
uint64 Sector;
@@ -66,27 +66,27 @@ struct BiosLbaPacket
struct ChsAddress
{
uint16 Cylinder;
- byte Head;
- byte Sector;
+ uint8 Head;
+ uint8 Sector;
};
struct Partition
{
- byte Number;
- byte Drive;
+ uint8 Number;
+ uint8 Drive;
bool Active;
uint64 EndSector;
bool Primary;
uint64 SectorCount;
uint64 StartSector;
- byte Type;
+ uint8 Type;
};
struct DriveGeometry
{
uint16 Cylinders;
- byte Heads;
- byte Sectors;
+ uint8 Heads;
+ uint8 Sectors;
};
@@ -99,23 +99,23 @@ void ReleaseSectorBuffer ();
#endif
void ChsToLba (const DriveGeometry &geometry, const ChsAddress &chs, uint64 &lba);
-bool GetActivePartition (byte drive);
-BiosResult GetDriveGeometry (byte drive, DriveGeometry &geometry, bool silent = false);
-BiosResult GetDrivePartitions (byte drive, Partition *partitionArray, size_t partitionArrayCapacity, size_t &partitionCount, bool activeOnly = false, Partition *findPartitionFollowingThis = nullptr, bool silent = false);
-bool IsLbaSupported (byte drive);
+bool GetActivePartition (uint8 drive);
+BiosResult GetDriveGeometry (uint8 drive, DriveGeometry &geometry, bool silent = false);
+BiosResult GetDrivePartitions (uint8 drive, Partition *partitionArray, size_t partitionArrayCapacity, size_t &partitionCount, bool activeOnly = false, Partition *findPartitionFollowingThis = nullptr, bool silent = false);
+bool IsLbaSupported (uint8 drive);
void LbaToChs (const DriveGeometry &geometry, const uint64 &lba, ChsAddress &chs);
void Print (const ChsAddress &chs);
-void PrintDiskError (BiosResult error, bool write, byte drive, const uint64 *sector, const ChsAddress *chs = nullptr);
+void PrintDiskError (BiosResult error, bool write, uint8 drive, const uint64 *sector, const ChsAddress *chs = nullptr);
void PrintSectorCountInMB (const uint64 &sectorCount);
-BiosResult ReadWriteMBR (bool write, byte drive, bool silent = false);
-BiosResult ReadSectors (uint16 bufferSegment, uint16 bufferOffset, byte drive, const uint64 &sector, uint16 sectorCount, bool silent = false);
-BiosResult ReadSectors (byte *buffer, byte drive, const uint64 &sector, uint16 sectorCount, bool silent = false);
-BiosResult ReadSectors (byte *buffer, byte drive, const ChsAddress &chs, byte sectorCount, bool silent = false);
-BiosResult ReadWriteSectors (bool write, uint16 bufferSegment, uint16 bufferOffset, byte drive, const uint64 &sector, uint16 sectorCount, bool silent);
-BiosResult ReadWriteSectors (bool write, byte *buffer, byte drive, const uint64 &sector, uint16 sectorCount, bool silent);
-BiosResult WriteSectors (byte *buffer, byte drive, const uint64 &sector, uint16 sectorCount, bool silent = false);
-BiosResult WriteSectors (byte *buffer, byte drive, const ChsAddress &chs, byte sectorCount, bool silent = false);
-
-extern byte SectorBuffer[TC_LB_SIZE];
+BiosResult ReadWriteMBR (bool write, uint8 drive, bool silent = false);
+BiosResult ReadSectors (uint16 bufferSegment, uint16 bufferOffset, uint8 drive, const uint64 &sector, uint16 sectorCount, bool silent = false);
+BiosResult ReadSectors (uint8 *buffer, uint8 drive, const uint64 &sector, uint16 sectorCount, bool silent = false);
+BiosResult ReadSectors (uint8 *buffer, uint8 drive, const ChsAddress &chs, uint8 sectorCount, bool silent = false);
+BiosResult ReadWriteSectors (bool write, uint16 bufferSegment, uint16 bufferOffset, uint8 drive, const uint64 &sector, uint16 sectorCount, bool silent);
+BiosResult ReadWriteSectors (bool write, uint8 *buffer, uint8 drive, const uint64 &sector, uint16 sectorCount, bool silent);
+BiosResult WriteSectors (uint8 *buffer, uint8 drive, const uint64 &sector, uint16 sectorCount, bool silent = false);
+BiosResult WriteSectors (uint8 *buffer, uint8 drive, const ChsAddress &chs, uint8 sectorCount, bool silent = false);
+
+extern uint8 SectorBuffer[TC_LB_SIZE];
#endif // TC_HEADER_Boot_BootDiskIo
diff --git a/src/Boot/Windows/BootEncryptedIo.cpp b/src/Boot/Windows/BootEncryptedIo.cpp
index 8ca55635..24fbbbd0 100644
--- a/src/Boot/Windows/BootEncryptedIo.cpp
+++ b/src/Boot/Windows/BootEncryptedIo.cpp
@@ -19,7 +19,7 @@
#include "BootEncryptedIo.h"
-BiosResult ReadEncryptedSectors (uint16 destSegment, uint16 destOffset, byte drive, uint64 sector, uint16 sectorCount)
+BiosResult ReadEncryptedSectors (uint16 destSegment, uint16 destOffset, uint8 drive, uint64 sector, uint16 sectorCount)
{
BiosResult result;
bool decrypt = true;
@@ -76,7 +76,7 @@ BiosResult ReadEncryptedSectors (uint16 destSegment, uint16 destOffset, byte dri
}
-BiosResult WriteEncryptedSectors (uint16 sourceSegment, uint16 sourceOffset, byte drive, uint64 sector, uint16 sectorCount)
+BiosResult WriteEncryptedSectors (uint16 sourceSegment, uint16 sourceOffset, uint8 drive, uint64 sector, uint16 sectorCount)
{
BiosResult result = BiosResultSuccess;
AcquireSectorBuffer();
diff --git a/src/Boot/Windows/BootEncryptedIo.h b/src/Boot/Windows/BootEncryptedIo.h
index d1c9e5f3..d2fa6d96 100644
--- a/src/Boot/Windows/BootEncryptedIo.h
+++ b/src/Boot/Windows/BootEncryptedIo.h
@@ -15,8 +15,8 @@
#include "Platform.h"
-BiosResult ReadEncryptedSectors (uint16 destSegment, uint16 destOffset, byte drive, uint64 sector, uint16 sectorCount);
-BiosResult WriteEncryptedSectors (uint16 sourceSegment, uint16 sourceOffset, byte drive, uint64 sector, uint16 sectorCount);
+BiosResult ReadEncryptedSectors (uint16 destSegment, uint16 destOffset, uint8 drive, uint64 sector, uint16 sectorCount);
+BiosResult WriteEncryptedSectors (uint16 sourceSegment, uint16 sourceOffset, uint8 drive, uint64 sector, uint16 sectorCount);
static bool ReadWritePartiallyCoversEncryptedArea (const uint64 &sector, uint16 sectorCount);
#endif // TC_HEADER_Boot_BootEncryptionIo
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)
{
diff --git a/src/Boot/Windows/BootMain.h b/src/Boot/Windows/BootMain.h
index 52d5c8cc..af445024 100644
--- a/src/Boot/Windows/BootMain.h
+++ b/src/Boot/Windows/BootMain.h
@@ -16,16 +16,16 @@
#include "TCdefs.h"
#include "Platform.h"
-static byte AskPassword (Password &password, int& pim);
+static uint8 AskPassword (Password &password, int& pim);
static int AskSelection (const char *options[], size_t optionCount);
static bool AskYesNo (const char *message);
-static byte BootEncryptedDrive ();
+static uint8 BootEncryptedDrive ();
static void BootMenu ();
-static void ExecuteBootSector (byte drive, byte *sectorBuffer);
+static void ExecuteBootSector (uint8 drive, uint8 *sectorBuffer);
static void InitScreen ();
-static bool IsMenuKey (byte scanCode);
-static bool MountVolume (byte drive, byte &exitKey);
-static bool OpenVolume (byte drive, Password &password, CRYPTO_INFO **cryptoInfo, uint32 *headerSaltCrc32 = nullptr, bool skipNormal = false, bool skipHidden = false);
+static bool IsMenuKey (uint8 scanCode);
+static bool MountVolume (uint8 drive, uint8 &exitKey);
+static bool OpenVolume (uint8 drive, Password &password, CRYPTO_INFO **cryptoInfo, uint32 *headerSaltCrc32 = nullptr, bool skipNormal = false, bool skipHidden = false);
static void PrintMainMenu ();
static void RepairMenu ();
diff --git a/src/Boot/Windows/IntFilter.cpp b/src/Boot/Windows/IntFilter.cpp
index 9e5c8536..36837d58 100644
--- a/src/Boot/Windows/IntFilter.cpp
+++ b/src/Boot/Windows/IntFilter.cpp
@@ -38,7 +38,7 @@ bool Int13Filter ()
static int ReEntryCount = -1;
++ReEntryCount;
- byte function = (byte) (regs.AX >> 8);
+ uint8 function = (uint8) (regs.AX >> 8);
#ifdef TC_TRACE_INT13
DisableScreenOutput();
@@ -63,14 +63,14 @@ bool Int13Filter ()
case 0x2: // Read sectors
case 0x3: // Write sectors
{
- byte drive = (byte) regs.DX;
+ uint8 drive = (uint8) regs.DX;
ChsAddress chs;
chs.Cylinder = ((regs.CX << 2) & 0x300) | (regs.CX >> 8);
chs.Head = regs.DX >> 8;
chs.Sector = regs.CX & 0x3f;
- byte sectorCount = (byte) regs.AX;
+ uint8 sectorCount = (uint8) regs.AX;
#ifdef TC_TRACE_INT13
PrintVal (": Drive", drive - TC_FIRST_BIOS_DRIVE, false);
@@ -125,10 +125,10 @@ bool Int13Filter ()
case 0x42: // Read sectors LBA
case 0x43: // Write sectors LBA
{
- byte drive = (byte) regs.DX;
+ uint8 drive = (uint8) regs.DX;
BiosLbaPacket lba;
- CopyMemory (regs.DS, regs.SI, (byte *) &lba, sizeof (lba));
+ CopyMemory (regs.DS, regs.SI, (uint8 *) &lba, sizeof (lba));
#ifdef TC_TRACE_INT13
PrintVal (": Drive", drive - TC_FIRST_BIOS_DRIVE, false);
@@ -337,7 +337,7 @@ bool Int15Filter ()
}
else
{
- CopyMemory ((byte *) &BiosMemoryMap[IntRegisters.EBX], IntRegisters.ES, IntRegisters.DI, sizeof (BiosMemoryMap[0]));
+ CopyMemory ((uint8 *) &BiosMemoryMap[IntRegisters.EBX], IntRegisters.ES, IntRegisters.DI, sizeof (BiosMemoryMap[0]));
IntRegisters.Flags &= ~TC_X86_CARRY_FLAG;
IntRegisters.EAX = 0x534D4150UL;
@@ -380,7 +380,7 @@ bool Int15Filter ()
#ifdef TC_TRACE_INT15
BiosMemoryMapEntry entry;
- CopyMemory (IntRegisters.ES, IntRegisters.DI, (byte *) &entry, sizeof (entry));
+ CopyMemory (IntRegisters.ES, IntRegisters.DI, (uint8 *) &entry, sizeof (entry));
PrintHex (entry.Type); PrintChar (' ');
PrintHex (entry.BaseAddress); PrintChar (' ');
PrintHex (entry.Length); PrintChar (' ');
diff --git a/src/Boot/Windows/Platform.cpp b/src/Boot/Windows/Platform.cpp
index 046fa4a4..3b94d22c 100644
--- a/src/Boot/Windows/Platform.cpp
+++ b/src/Boot/Windows/Platform.cpp
@@ -84,7 +84,7 @@ uint64 operator>> (const uint64 &a, int shiftCount)
{
r.LowPart >>= 1;
- if ((byte) r.HighPart & 1)
+ if ((uint8) r.HighPart & 1)
r.LowPart |= 0x80000000UL;
r.HighPart >>= 1;