VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common
diff options
context:
space:
mode:
Diffstat (limited to 'src/Common')
-rw-r--r--src/Common/BootEncryption.cpp12
-rw-r--r--src/Common/Cmdline.c2
-rw-r--r--src/Common/Dlgcode.c71
-rw-r--r--src/Common/Dlgcode.h8
-rw-r--r--src/Common/Language.c6
-rw-r--r--src/Common/Registry.c4
-rw-r--r--src/Common/SecurityToken.cpp6
-rw-r--r--src/Common/Tcdefs.h2
8 files changed, 56 insertions, 55 deletions
diff --git a/src/Common/BootEncryption.cpp b/src/Common/BootEncryption.cpp
index ae57dc37..3678bc71 100644
--- a/src/Common/BootEncryption.cpp
+++ b/src/Common/BootEncryption.cpp
@@ -1721,7 +1721,7 @@ namespace VeraCrypt
size_t verifiedSectorCount = (TC_CD_BOOTSECTOR_OFFSET + TC_ORIG_BOOT_LOADER_BACKUP_SECTOR_OFFSET + TC_BOOT_LOADER_AREA_SIZE) / 2048;
Buffer buffer ((verifiedSectorCount + 1) * 2048);
- DWORD bytesRead = driveDevice.Read (buffer.Ptr(), buffer.Size());
+ DWORD bytesRead = driveDevice.Read (buffer.Ptr(), (DWORD) buffer.Size());
if (bytesRead != buffer.Size())
continue;
@@ -1898,7 +1898,7 @@ namespace VeraCrypt
size_t strSize = filter.size() + 1;
byte regKeyBuf[65536];
- DWORD size = sizeof (regKeyBuf) - strSize;
+ DWORD size = (DWORD) (sizeof (regKeyBuf) - strSize);
// SetupInstallFromInfSection() does not support prepending of values so we have to modify the registry directly
StringCbCopyA ((char *) regKeyBuf, sizeof(regKeyBuf), filter.c_str());
@@ -1906,7 +1906,7 @@ namespace VeraCrypt
if (RegQueryValueEx (regKey, filterReg.c_str(), NULL, NULL, regKeyBuf + strSize, &size) != ERROR_SUCCESS)
size = 1;
- SetLastError (RegSetValueEx (regKey, filterReg.c_str(), 0, REG_MULTI_SZ, regKeyBuf, strSize + size));
+ SetLastError (RegSetValueEx (regKey, filterReg.c_str(), 0, REG_MULTI_SZ, regKeyBuf, (DWORD) strSize + size));
throw_sys_if (GetLastError() != ERROR_SUCCESS);
}
else
@@ -1921,7 +1921,7 @@ namespace VeraCrypt
"[veracrypt_reg]\r\n"
"HKR,,\"" + filterReg + "\",0x0001" + string (registerFilter ? "0008" : "8002") + ",\"" + filter + "\"\r\n";
- infFile.Write ((byte *) infTxt.c_str(), infTxt.size());
+ infFile.Write ((byte *) infTxt.c_str(), (DWORD) infTxt.size());
infFile.Close();
HINF hInf = SetupOpenInfFile (infFileName.c_str(), NULL, INF_STYLE_OLDNT | INF_STYLE_WIN4, NULL);
@@ -2464,7 +2464,7 @@ namespace VeraCrypt
try
{
device.SeekAt (config.DrivePartition.Info.PartitionLength.QuadPart - geometry.BytesPerSector);
- device.Read (sector.Ptr(), sector.Size());
+ device.Read (sector.Ptr(), (DWORD) sector.Size());
}
catch (SystemException &e)
{
@@ -2515,7 +2515,7 @@ namespace VeraCrypt
StringCbCopyA (pagingFiles, sizeof(pagingFiles), "X:\\pagefile.sys 0 0");
pagingFiles[0] = GetWindowsDirectory()[0];
- throw_sys_if (!WriteLocalMachineRegistryMultiString ("System\\CurrentControlSet\\Control\\Session Manager\\Memory Management", "PagingFiles", pagingFiles, strlen (pagingFiles) + 2));
+ throw_sys_if (!WriteLocalMachineRegistryMultiString ("System\\CurrentControlSet\\Control\\Session Manager\\Memory Management", "PagingFiles", pagingFiles, (DWORD) strlen (pagingFiles) + 2));
}
void BootEncryption::WriteLocalMachineRegistryDwordValue (char *keyPath, char *valueName, DWORD value)
diff --git a/src/Common/Cmdline.c b/src/Common/Cmdline.c
index f15b8d27..c1fde79a 100644
--- a/src/Common/Cmdline.c
+++ b/src/Common/Cmdline.c
@@ -107,7 +107,7 @@ int Win32CommandLine (char *lpszCommandLine, char ***lpszArgs)
if (argLen > 0)
{
- int len = WideCharToMultiByte (CP_ACP, 0, arguments[i + 1], -1, arg, argLen + 1, NULL, NULL);
+ int len = WideCharToMultiByte (CP_ACP, 0, arguments[i + 1], -1, arg, (int) argLen + 1, NULL, NULL);
if (len == 0)
{
handleWin32Error (NULL);
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index 0c5395c9..a6700e29 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -316,12 +316,12 @@ void cleanup ()
void LowerCaseCopy (char *lpszDest, const char *lpszSource)
{
- int i = strlen (lpszSource);
+ size_t i = strlen (lpszSource) + 1;
- lpszDest[i] = 0;
- while (--i >= 0)
+ lpszDest[i - 1] = 0;
+ while (--i > 0)
{
- lpszDest[i] = (char) tolower (lpszSource[i]);
+ lpszDest[i - 1] = (char) tolower (lpszSource[i - 1]);
}
}
@@ -330,14 +330,15 @@ void UpperCaseCopy (char *lpszDest, size_t cbDest, const char *lpszSource)
{
if (lpszDest && cbDest)
{
- int i = strlen (lpszSource);
- if (i >= (int) cbDest)
+ size_t i = strlen (lpszSource);
+ if (i >= cbDest)
i = cbDest - 1;
lpszDest[i] = 0;
- while (--i >= 0)
+ i++;
+ while (--i > 0)
{
- lpszDest[i] = (char) toupper (lpszSource[i]);
+ lpszDest[i - 1] = (char) toupper (lpszSource[i - 1]);
}
}
}
@@ -511,7 +512,7 @@ void *err_malloc (size_t size)
char *err_strdup (char *lpszText)
{
- int j = (strlen (lpszText) + 1) * sizeof (char);
+ size_t j = (strlen (lpszText) + 1) * sizeof (char);
char *z = (char *) err_malloc (j);
memmove (z, lpszText, j);
return z;
@@ -667,7 +668,7 @@ int GetTextGfxWidth (HWND hwndDlgItem, const wchar_t *text, HFONT hFont)
SelectObject(hdc, (HGDIOBJ) hFont);
- GetTextExtentPoint32W (hdc, text, wcslen (text), &sizes);
+ GetTextExtentPoint32W (hdc, text, (int) wcslen (text), &sizes);
GetTextMetrics(hdc, &textMetrics); // Necessary for non-TrueType raster fonts (tmOverhang)
@@ -684,7 +685,7 @@ int GetTextGfxHeight (HWND hwndDlgItem, const wchar_t *text, HFONT hFont)
SelectObject(hdc, (HGDIOBJ) hFont);
- GetTextExtentPoint32W (hdc, text, wcslen (text), &sizes);
+ GetTextExtentPoint32W (hdc, text, (int) wcslen (text), &sizes);
ReleaseDC (hwndDlgItem, hdc);
@@ -708,7 +709,7 @@ std::string FitPathInGfxWidth (HWND hwnd, HFONT hFont, LONG width, const std::st
char pathBuf[TC_MAX_PATH];
strcpy_s (pathBuf, sizeof (pathBuf), path.c_str());
- if (DrawText (hdc, pathBuf, path.size(), &rect, DT_CALCRECT | DT_MODIFYSTRING | DT_PATH_ELLIPSIS | DT_SINGLELINE) != 0)
+ if (DrawText (hdc, pathBuf, (int) path.size(), &rect, DT_CALCRECT | DT_MODIFYSTRING | DT_PATH_ELLIPSIS | DT_SINGLELINE) != 0)
newPath = pathBuf;
ReleaseDC (hwnd, hdc);
@@ -1146,7 +1147,7 @@ void ToSBCS (LPWSTR lpszText, size_t cbSize)
{
if (lpszText)
{
- int j = wcslen (lpszText);
+ int j = (int) wcslen (lpszText);
if (j == 0)
{
*((char *) lpszText) = 0;
@@ -1641,7 +1642,7 @@ SelectAlgo (HWND hComboBox, int *algo_id)
/* Something went wrong ; couldn't find the requested algo id so we drop
back to a default */
- *algo_id = SendMessage (hComboBox, CB_GETITEMDATA, 0, 0);
+ *algo_id = (int) SendMessage (hComboBox, CB_GETITEMDATA, 0, 0);
SendMessage (hComboBox, CB_SETCURSEL, 0, 0);
@@ -2828,12 +2829,12 @@ int IsNonSysPartitionOnSysDrive (const char *path)
strncpy (tmpPath, path, sizeof (tmpPath) - 1);
- pos = (int) FindString (tmpPath, "Partition", strlen (tmpPath), strlen ("Partition"), 0);
+ pos = (int) FindString (tmpPath, "Partition", (int) strlen (tmpPath), (int) strlen ("Partition"), 0);
if (pos < 0)
return -1;
- pos += strlen ("Partition");
+ pos += (int) strlen ("Partition");
if (pos + 1 > sizeof (tmpPath) - 1)
return -1;
@@ -2912,7 +2913,7 @@ wstring GetDecoyOsInstructionsString (void)
}
-BOOL TextInfoDialogBox (int nID)
+INT_PTR TextInfoDialogBox (int nID)
{
return DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_TEXT_INFO_DIALOG_BOX_DLG), MainDlg, (DLGPROC) TextInfoDialogBoxDlgProc, (LPARAM) nID);
}
@@ -3970,7 +3971,7 @@ BOOL SelectMultipleFilesNext (char *lpszFileName, size_t cbFileName)
StringCbCatA (lpszFileName, cbFileName,SelectMultipleFilesPath + SelectMultipleFilesOffset);
- SelectMultipleFilesOffset += strlen (SelectMultipleFilesPath + SelectMultipleFilesOffset) + 1;
+ SelectMultipleFilesOffset += (int) strlen (SelectMultipleFilesPath + SelectMultipleFilesOffset) + 1;
if (SelectMultipleFilesPath[SelectMultipleFilesOffset] == 0)
SelectMultipleFilesOffset = 0;
@@ -4950,7 +4951,7 @@ BOOL CALLBACK BenchmarkDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
nIndex = SendMessage (hCboxSortMethod, CB_GETCURSEL, 0, 0);
if (nIndex != benchmarkSortMethod)
{
- benchmarkSortMethod = nIndex;
+ benchmarkSortMethod = (int) nIndex;
DisplayBenchmarkResults (hwndDlg);
}
return 1;
@@ -4958,7 +4959,7 @@ BOOL CALLBACK BenchmarkDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
case IDC_PERFORM_BENCHMARK:
nIndex = SendMessage (hCboxBufferSize, CB_GETCURSEL, 0, 0);
- benchmarkBufferSize = SendMessage (hCboxBufferSize, CB_GETITEMDATA, nIndex, 0);
+ benchmarkBufferSize = (int) SendMessage (hCboxBufferSize, CB_GETITEMDATA, nIndex, 0);
BenchmarkThreadParam threadParam;
threadParam.hBenchDlg = hwndDlg;
@@ -5841,7 +5842,7 @@ ResetCipherTest(HWND hwndDlg, int idTestCipher)
SendMessage (GetDlgItem(hwndDlg, IDC_KEY_SIZE), CB_RESETCONTENT, 0,0);
SendMessage (GetDlgItem(hwndDlg, IDC_TEST_BLOCK_NUMBER), CB_RESETCONTENT, 0,0);
- ndx = SendMessage (GetDlgItem(hwndDlg, IDC_PLAINTEXT_SIZE), CB_ADDSTRING, 0,(LPARAM) "64");
+ ndx = (int) SendMessage (GetDlgItem(hwndDlg, IDC_PLAINTEXT_SIZE), CB_ADDSTRING, 0,(LPARAM) "64");
SendMessage(GetDlgItem(hwndDlg, IDC_PLAINTEXT_SIZE), CB_SETITEMDATA, ndx,(LPARAM) 8);
SendMessage(GetDlgItem(hwndDlg, IDC_PLAINTEXT_SIZE), CB_SETCURSEL, ndx,0);
@@ -5851,7 +5852,7 @@ ResetCipherTest(HWND hwndDlg, int idTestCipher)
StringCbPrintfA (tmpStr, sizeof(tmpStr), "%d", ndx);
- ndx = SendMessage (GetDlgItem(hwndDlg, IDC_TEST_BLOCK_NUMBER), CB_ADDSTRING, 0,(LPARAM) tmpStr);
+ 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);
}
@@ -5865,12 +5866,12 @@ ResetCipherTest(HWND hwndDlg, int idTestCipher)
if (idTestCipher == AES || idTestCipher == SERPENT || idTestCipher == TWOFISH)
{
- ndx = SendMessage (GetDlgItem(hwndDlg, IDC_KEY_SIZE), CB_ADDSTRING, 0,(LPARAM) "256");
+ ndx = (int) SendMessage (GetDlgItem(hwndDlg, IDC_KEY_SIZE), CB_ADDSTRING, 0,(LPARAM) "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 = SendMessage (GetDlgItem(hwndDlg, IDC_PLAINTEXT_SIZE), CB_ADDSTRING, 0,(LPARAM) "128");
+ ndx = (int) SendMessage (GetDlgItem(hwndDlg, IDC_PLAINTEXT_SIZE), CB_ADDSTRING, 0,(LPARAM) "128");
SendMessage(GetDlgItem(hwndDlg, IDC_PLAINTEXT_SIZE), CB_SETITEMDATA, ndx,(LPARAM) 16);
SendMessage(GetDlgItem(hwndDlg, IDC_PLAINTEXT_SIZE), CB_SETCURSEL, ndx,0);
@@ -5960,7 +5961,7 @@ BOOL CALLBACK MultiChoiceDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA
} while (nStr < MAX_MULTI_CHOICES+1);
// Length of main message in characters (not bytes)
- nMainTextLenInChars = wcslen ((const wchar_t *) (bResolve ? GetString(*(pStrOrig+1)) : *(pwStrOrig+1)));
+ nMainTextLenInChars = (int) wcslen ((const wchar_t *) (bResolve ? GetString(*(pStrOrig+1)) : *(pwStrOrig+1)));
if (nMainTextLenInChars > 200
&& nMainTextLenInChars / nLongestButtonCaptionCharLen >= 10)
@@ -6000,7 +6001,7 @@ BOOL CALLBACK MultiChoiceDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA
offset = FindString ((char *) (bResolve ? GetString(*(pStrOrig+1)) : *(pwStrOrig+1)),
(char *) L"\n",
nMainTextLenInChars * 2,
- wcslen (L"\n") * 2,
+ (int) wcslen (L"\n") * 2,
offset + 1);
newLineSeqCount++;
@@ -7300,7 +7301,7 @@ HANDLE DismountDrive (char *devName, char *devicePath)
// 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, size_t strLen, int64 startOffset)
+int64 FindString (const char *buf, const char *str, int64 bufLen, int64 strLen, int64 startOffset)
{
if (buf == NULL
|| str == NULL
@@ -7544,7 +7545,7 @@ BOOL TCFlushFile (FILE *f)
// 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, char *title, int textByteLen)
+BOOL PrintHardCopyTextUTF16 (wchar_t *text, char *title, size_t textByteLen)
{
char cl [MAX_PATH*3] = {"/p \""};
char path [MAX_PATH * 2] = { 0 };
@@ -7575,7 +7576,7 @@ BOOL PrintHardCopyTextUTF16 (wchar_t *text, char *title, int textByteLen)
}
// Write the actual text
- if (!SaveBufferToFile ((char *) text, path, textByteLen, TRUE))
+ if (!SaveBufferToFile ((char *) text, path, (DWORD) textByteLen, TRUE))
{
remove (path);
return FALSE;
@@ -7965,7 +7966,7 @@ int GetDriverRefCount ()
// processed by mputLong(). The result is stored in *result. Returns TRUE if successful (otherwise FALSE).
BOOL LoadInt32 (char *filePath, unsigned __int32 *result, __int64 fileOffset)
{
- size_t bufSize = sizeof(__int32);
+ DWORD bufSize = sizeof(__int32);
unsigned char *buffer = (unsigned char *) malloc (bufSize);
unsigned char *bufferPtr = buffer;
HANDLE src = NULL;
@@ -8009,7 +8010,7 @@ fsif_end:
// processed by mputWord(). The result is stored in *result. Returns TRUE if successful (otherwise FALSE).
BOOL LoadInt16 (char *filePath, int *result, __int64 fileOffset)
{
- size_t bufSize = sizeof(__int16);
+ DWORD bufSize = sizeof(__int16);
unsigned char *buffer = (unsigned char *) malloc (bufSize);
unsigned char *bufferPtr = buffer;
HANDLE src = NULL;
@@ -8085,7 +8086,7 @@ char *LoadFile (const char *fileName, DWORD *size)
// Returns NULL if there's any error.
-char *LoadFileBlock (char *fileName, __int64 fileOffset, size_t count)
+char *LoadFileBlock (char *fileName, __int64 fileOffset, DWORD count)
{
char *buf;
DWORD bytesRead = 0;
@@ -8511,7 +8512,7 @@ int AskMultiChoice (void *strings[], BOOL bBold, HWND hwnd)
params.strings = &strings[0];
params.bold = bBold;
- return DialogBoxParamW (hInst,
+ return (int) DialogBoxParamW (hInst,
MAKEINTRESOURCEW (IDD_MULTI_CHOICE_DLG), hwnd,
(DLGPROC) MultiChoiceDialogProc, (LPARAM) &params);
}
@@ -9765,7 +9766,7 @@ static BOOL CALLBACK NewSecurityTokenKeyfileDlgProc (HWND hwndDlg, UINT msg, WPA
return 1;
}
- newParams->SlotId = ComboBox_GetItemData (GetDlgItem (hwndDlg, IDC_SELECTED_TOKEN), selectedToken);
+ 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)
@@ -10028,7 +10029,7 @@ BOOL CALLBACK SecurityTokenKeyfileDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam
finally_do_arg (vector <byte> *, &keyfileData, { burn (&finally_arg->front(), finally_arg->size()); });
- if (!SaveBufferToFile ((char *) &keyfileData.front(), keyfilePath, keyfileData.size(), FALSE))
+ if (!SaveBufferToFile ((char *) &keyfileData.front(), keyfilePath, (DWORD) keyfileData.size(), FALSE))
throw SystemException ();
}
diff --git a/src/Common/Dlgcode.h b/src/Common/Dlgcode.h
index 115a3b85..e45a9b87 100644
--- a/src/Common/Dlgcode.h
+++ b/src/Common/Dlgcode.h
@@ -302,7 +302,7 @@ int GetAvailableRemovables ( HWND hComboBox , char *lpszRootPath );
int IsSystemDevicePath (const char *path, HWND hwndDlg, BOOL bReliableRequired);
int IsNonSysPartitionOnSysDrive (const char *path);
BOOL CALLBACK RawDevicesDlgProc ( HWND hwndDlg , UINT msg , WPARAM wParam , LPARAM lParam );
-BOOL TextInfoDialogBox (int nID);
+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);
@@ -346,13 +346,13 @@ int FileSystemAppearsEmpty (const char *devicePath);
__int64 GetStatsFreeSpaceOnPartition (const char *devicePath, float *percent, __int64 *occupiedBytes, BOOL silent);
__int64 GetDeviceSize (const char *devicePath);
HANDLE DismountDrive (char *devName, char *devicePath);
-int64 FindString (const char *buf, const char *str, int64 bufLen, size_t strLen, int64 startOffset);
+int64 FindString (const char *buf, const char *str, int64 bufLen, int64 strLen, int64 startOffset);
BOOL FileExists (const char *filePathPtr);
__int64 FindStringInFile (const char *filePath, const char *str, int strLen);
BOOL TCCopyFile (char *sourceFileName, char *destinationFile);
BOOL SaveBufferToFile (const char *inputBuffer, const char *destinationFile, DWORD inputLength, BOOL bAppend);
BOOL TCFlushFile (FILE *f);
-BOOL PrintHardCopyTextUTF16 (wchar_t *text, char *title, int byteLen);
+BOOL PrintHardCopyTextUTF16 (wchar_t *text, char *title, size_t byteLen);
void GetSpeedString (unsigned __int64 speed, wchar_t *str, size_t cbStr);
BOOL IsNonInstallMode ();
BOOL DriverUnload ();
@@ -374,7 +374,7 @@ __int64 GetFileSize64 (const char *path);
BOOL LoadInt16 (char *filePath, int *result, __int64 fileOffset);
BOOL LoadInt32 (char *filePath, unsigned __int32 *result, __int64 fileOffset);
char *LoadFile (const char *fileName, DWORD *size);
-char *LoadFileBlock (char *fileName, __int64 fileOffset, size_t count);
+char *LoadFileBlock (char *fileName, __int64 fileOffset, DWORD count);
char *GetModPath (char *path, int maxSize);
char *GetConfigPath (char *fileName);
char *GetProgramConfigPath (char *fileName);
diff --git a/src/Common/Language.c b/src/Common/Language.c
index 7853d18c..e9d3a573 100644
--- a/src/Common/Language.c
+++ b/src/Common/Language.c
@@ -362,7 +362,7 @@ BOOL CALLBACK LanguageDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
if (len != 0 && len != ERROR_NO_UNICODE_TRANSLATION
&& (!defaultLangFound || wcscmp (wattr, L"English") != 0))
{
- int i = SendDlgItemMessageW (hwndDlg, IDC_LANGLIST, LB_ADDSTRING, 0, (LPARAM)wattr);
+ int i = (int) SendDlgItemMessageW (hwndDlg, IDC_LANGLIST, LB_ADDSTRING, 0, (LPARAM)wattr);
if (i >= 0)
{
int id;
@@ -441,11 +441,11 @@ BOOL CALLBACK LanguageDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
if (lw == IDOK || hw == LBN_DBLCLK)
{
- int i = SendDlgItemMessage (hwndDlg, IDC_LANGLIST, LB_GETCURSEL, 0, 0);
+ int i = (int) SendDlgItemMessage (hwndDlg, IDC_LANGLIST, LB_GETCURSEL, 0, 0);
if (i >= 0)
{
- int id = SendDlgItemMessage (hwndDlg, IDC_LANGLIST, LB_GETITEMDATA, i, 0);
+ int id = (int) SendDlgItemMessage (hwndDlg, IDC_LANGLIST, LB_GETITEMDATA, i, 0);
if (id != LB_ERR)
{
diff --git a/src/Common/Registry.c b/src/Common/Registry.c
index 07ca6b10..a3fadd32 100644
--- a/src/Common/Registry.c
+++ b/src/Common/Registry.c
@@ -232,7 +232,7 @@ BOOL WriteLocalMachineRegistryString (char *subKey, char *name, char *str, BOOL
return FALSE;
}
- if ((status = RegSetValueEx (hkey, name, 0, expandable ? REG_EXPAND_SZ : REG_SZ, (BYTE *) str, strlen (str) + 1)) != ERROR_SUCCESS)
+ if ((status = RegSetValueEx (hkey, name, 0, expandable ? REG_EXPAND_SZ : REG_SZ, (BYTE *) str, (DWORD) strlen (str) + 1)) != ERROR_SUCCESS)
{
RegCloseKey (hkey);
SetLastError (status);
@@ -252,7 +252,7 @@ void WriteRegistryString (char *subKey, char *name, char *str)
0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hkey, &disp) != ERROR_SUCCESS)
return;
- RegSetValueEx (hkey, name, 0, REG_SZ, (BYTE *) str, strlen (str) + 1);
+ RegSetValueEx (hkey, name, 0, REG_SZ, (BYTE *) str, (DWORD) strlen (str) + 1);
RegCloseKey (hkey);
}
diff --git a/src/Common/SecurityToken.cpp b/src/Common/SecurityToken.cpp
index 1bbad78e..bbcefe30 100644
--- a/src/Common/SecurityToken.cpp
+++ b/src/Common/SecurityToken.cpp
@@ -132,8 +132,8 @@ namespace VeraCrypt
{ CKA_CLASS, &dataClass, sizeof (dataClass) },
{ CKA_TOKEN, &trueVal, sizeof (trueVal) },
{ CKA_PRIVATE, &trueVal, sizeof (trueVal) },
- { CKA_LABEL, (CK_UTF8CHAR *) name.c_str(), name.size() },
- { CKA_VALUE, &keyfileData.front(), keyfileData.size() }
+ { CKA_LABEL, (CK_UTF8CHAR *) name.c_str(), (CK_ULONG) name.size() },
+ { CKA_VALUE, &keyfileData.front(), (CK_ULONG) keyfileData.size() }
};
CK_OBJECT_HANDLE keyfileHandle;
@@ -420,7 +420,7 @@ namespace VeraCrypt
else if (Sessions[slotId].UserLoggedIn)
return;
- CK_RV status = Pkcs11Functions->C_Login (Sessions[slotId].Handle, CKU_USER, (CK_CHAR_PTR) pin.c_str(), pin.size());
+ CK_RV status = Pkcs11Functions->C_Login (Sessions[slotId].Handle, CKU_USER, (CK_CHAR_PTR) pin.c_str(), (CK_ULONG) pin.size());
if (status != CKR_OK)
throw Pkcs11Exception (status);
diff --git a/src/Common/Tcdefs.h b/src/Common/Tcdefs.h
index f7693954..f115f837 100644
--- a/src/Common/Tcdefs.h
+++ b/src/Common/Tcdefs.h
@@ -220,7 +220,7 @@ typedef int BOOL;
#endif
#ifdef _WIN32
-#define burn(mem,size) do { volatile char *burnm = (volatile char *)(mem); int burnc = size; RtlSecureZeroMemory (mem, size); while (burnc--) *burnm++ = 0; } while (0)
+#define burn(mem,size) do { volatile char *burnm = (volatile char *)(mem); size_t burnc = size; RtlSecureZeroMemory (mem, size); while (burnc--) *burnm++ = 0; } while (0)
#else
#define burn(mem,size) do { volatile char *burnm = (volatile char *)(mem); int burnc = size; while (burnc--) *burnm++ = 0; } while (0)
#endif