diff options
Diffstat (limited to 'src/Format/Tcformat.c')
-rw-r--r-- | src/Format/Tcformat.c | 75 |
1 files changed, 39 insertions, 36 deletions
diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c index 658d3797..dd7ff18b 100644 --- a/src/Format/Tcformat.c +++ b/src/Format/Tcformat.c @@ -222,3 +222,3 @@ HBITMAP hbmWizardBitmapRescaled = NULL; -wchar_t OrigKeyboardLayout [8+1] = L"00000409"; +wchar_t OrigKeyboardLayout [KL_NAMELENGTH] = L"00000409"; BOOL bKeyboardLayoutChanged = FALSE; /* TRUE if the keyboard layout was changed to the standard US keyboard layout (from any other layout). */ @@ -403,3 +403,3 @@ static BOOL ElevateWholeWizardProcess (wstring arguments) { - if ((int)ShellExecute (MainDlg, L"runas", modPath, (wstring(L"/q UAC ") + arguments).c_str(), NULL, SW_SHOWNORMAL) > 32) + if ((intptr_t)ShellExecute (MainDlg, L"runas", modPath, (wstring(L"/q UAC ") + arguments).c_str(), NULL, SW_SHOWNORMAL) > 32) { @@ -3189,3 +3189,3 @@ __int64 PrintFreeSpace (HWND hwndTextBox, wchar_t *lpszDrive, PLARGE_INTEGER lDi char *nResourceString; - __int64 nMultiplier; + __int64 nPrintMultiplier; wchar_t szTmp2[256]; @@ -3193,13 +3193,13 @@ __int64 PrintFreeSpace (HWND hwndTextBox, wchar_t *lpszDrive, PLARGE_INTEGER lDi if (lDiskFree->QuadPart < BYTES_PER_KB) - nMultiplier = 1; + nPrintMultiplier = 1; else if (lDiskFree->QuadPart < BYTES_PER_MB) - nMultiplier = BYTES_PER_KB; + nPrintMultiplier = BYTES_PER_KB; else if (lDiskFree->QuadPart < BYTES_PER_GB) - nMultiplier = BYTES_PER_MB; + nPrintMultiplier = BYTES_PER_MB; else if (lDiskFree->QuadPart < BYTES_PER_TB) - nMultiplier = BYTES_PER_GB; + nPrintMultiplier = BYTES_PER_GB; else - nMultiplier = BYTES_PER_TB; + nPrintMultiplier = BYTES_PER_TB; - if (nMultiplier == 1) + if (nPrintMultiplier == 1) { @@ -3212,3 +3212,3 @@ __int64 PrintFreeSpace (HWND hwndTextBox, wchar_t *lpszDrive, PLARGE_INTEGER lDi } - else if (nMultiplier == BYTES_PER_KB) + else if (nPrintMultiplier == BYTES_PER_KB) { @@ -3221,3 +3221,3 @@ __int64 PrintFreeSpace (HWND hwndTextBox, wchar_t *lpszDrive, PLARGE_INTEGER lDi } - else if (nMultiplier == BYTES_PER_MB) + else if (nPrintMultiplier == BYTES_PER_MB) { @@ -3230,3 +3230,3 @@ __int64 PrintFreeSpace (HWND hwndTextBox, wchar_t *lpszDrive, PLARGE_INTEGER lDi } - else if (nMultiplier == BYTES_PER_GB) + else if (nPrintMultiplier == BYTES_PER_GB) { @@ -3251,3 +3251,3 @@ __int64 PrintFreeSpace (HWND hwndTextBox, wchar_t *lpszDrive, PLARGE_INTEGER lDi { - StringCbPrintfW (szTmp2, sizeof szTmp2, GetString (nResourceString), ((double) lDiskFree->QuadPart) / nMultiplier); + StringCbPrintfW (szTmp2, sizeof szTmp2, GetString (nResourceString), ((double) lDiskFree->QuadPart) / nPrintMultiplier); SetWindowTextW (GetDlgItem (hwndTextBox, IDC_SIZEBOX), szTmp2); @@ -3255,3 +3255,3 @@ __int64 PrintFreeSpace (HWND hwndTextBox, wchar_t *lpszDrive, PLARGE_INTEGER lDi else if (lpszDrive) - StringCbPrintfW (szTmp2, sizeof szTmp2, GetString (nResourceString), lpszDrive, ((double) lDiskFree->QuadPart) / nMultiplier); + StringCbPrintfW (szTmp2, sizeof szTmp2, GetString (nResourceString), lpszDrive, ((double) lDiskFree->QuadPart) / nPrintMultiplier); else @@ -3262,5 +3262,5 @@ __int64 PrintFreeSpace (HWND hwndTextBox, wchar_t *lpszDrive, PLARGE_INTEGER lDi if (lDiskFree->QuadPart % (__int64) BYTES_PER_MB != 0) - nMultiplier = BYTES_PER_KB; + nPrintMultiplier = BYTES_PER_KB; - return nMultiplier; + return nPrintMultiplier; } @@ -3664,3 +3664,3 @@ void HandleOldAssignedDriveLetter (void) { - wchar_t rootPath[] = { (wchar_t) driveLetter + L'A', L':', L'\\', 0 }; + wchar_t rootPath[] = { (wchar_t) (driveLetter + L'A'), L':', L'\\', 0 }; wchar_t szTmp[8192]; @@ -4388,7 +4388,10 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa - StringCbPrintfW (OrigKeyboardLayout, sizeof(OrigKeyboardLayout), L"%08X", (DWORD) GetKeyboardLayout (NULL) & 0xFFFF); + if (!GetKeyboardLayoutNameW(OrigKeyboardLayout)) + { + StringCbPrintfW(OrigKeyboardLayout, sizeof(OrigKeyboardLayout), L"%08X", (DWORD)(DWORD_PTR)GetKeyboardLayout(NULL) & 0xFFFF); + } - if ((DWORD) GetKeyboardLayout (NULL) != 0x00000409 && (DWORD) GetKeyboardLayout (NULL) != 0x04090409) + if ((DWORD)(DWORD_PTR)GetKeyboardLayout (NULL) != 0x00000409 && (DWORD)(DWORD_PTR)GetKeyboardLayout (NULL) != 0x04090409) { - DWORD keybLayout = (DWORD) LoadKeyboardLayout (L"00000409", KLF_ACTIVATE); + DWORD keybLayout = (DWORD)(DWORD_PTR)LoadKeyboardLayout (L"00000409", KLF_ACTIVATE); @@ -5321,3 +5324,3 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa // NOTE: per documentation as pointed out by selbie, GetSolidBrush would leak a GDI handle. - return (BOOL)GetSysColorBrush(COLOR_MENU); + return (BOOL) (INT_PTR)GetSysColorBrush(COLOR_MENU); } @@ -6700,3 +6703,3 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa { - DWORD keybLayout = (DWORD) GetKeyboardLayout (NULL); + DWORD keybLayout = (DWORD)(DWORD_PTR) GetKeyboardLayout (NULL); @@ -6713,3 +6716,3 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa - keybLayout = (DWORD) LoadKeyboardLayout (L"00000409", KLF_ACTIVATE); + keybLayout = (DWORD)(DWORD_PTR)LoadKeyboardLayout (L"00000409", KLF_ACTIVATE); @@ -9702,3 +9705,3 @@ int DetermineMaxHiddenVolSize (HWND hwndDlg) // the TrueCrypt volume format version and the type of volume. -int AnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 hiddenVolHostSize, int *realClusterSize, __int64 *pnbrFreeClusters) +int AnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 hiddenVolHostSize, int *pRealClusterSize, __int64 *pnbrFreeClusters) { @@ -9710,4 +9713,4 @@ int AnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 hiddenVolHostSi 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}; + 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]; @@ -9786,3 +9789,3 @@ int AnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 hiddenVolHostSi // Retrieve the cluster size - *realClusterSize = ((int) readBuffer[0xb] + ((int) readBuffer[0xc] << 8)) * (int) readBuffer[0xd]; + *pRealClusterSize = ((int) readBuffer[0xb] + ((int) readBuffer[0xc] << 8)) * (int) readBuffer[0xd]; @@ -9792,3 +9795,3 @@ int AnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 hiddenVolHostSi // The value will then be used to determine the maximum possible size of the hidden volume. - if (*realClusterSize > 0) + if (*pRealClusterSize > 0) { @@ -9796,3 +9799,3 @@ int AnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 hiddenVolHostSi driveNo, - hiddenVolHostSize / *realClusterSize, + hiddenVolHostSize / *pRealClusterSize, pnbrFreeClusters); @@ -9824,3 +9827,3 @@ int AnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 hiddenVolHostSi - *realClusterSize = dwBytesPerSector * dwSectorsPerCluster; + *pRealClusterSize = dwBytesPerSector * dwSectorsPerCluster; @@ -9833,3 +9836,3 @@ int AnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 hiddenVolHostSi driveNo, - hiddenVolHostSize / *realClusterSize, + hiddenVolHostSize / *pRealClusterSize, pnbrFreeClusters); @@ -9889,3 +9892,3 @@ int MountHiddenVolHost (HWND hwndDlg, wchar_t *volumePath, int *driveNo, Passwor of the hidden volume. */ -int ScanVolClusterBitmap (HWND hwndDlg, int *driveNo, __int64 nbrClusters, __int64 *nbrFreeClusters) +int ScanVolClusterBitmap (HWND hwndDlg, int *driveNo, __int64 nbrClusters, __int64 *pnbrFreeClusters) { @@ -9897,3 +9900,3 @@ int ScanVolClusterBitmap (HWND hwndDlg, int *driveNo, __int64 nbrClusters, __int BYTE rmnd; - wchar_t tmpPath[7] = {L'\\',L'\\',L'.',L'\\', (wchar_t) *driveNo + L'A', L':', 0}; + wchar_t tmpPath[7] = {L'\\',L'\\',L'.',L'\\', (wchar_t) (*driveNo + L'A'), L':', 0}; @@ -9943,3 +9946,3 @@ int ScanVolClusterBitmap (HWND hwndDlg, int *driveNo, __int64 nbrClusters, __int { - *nbrFreeClusters = 0; + *pnbrFreeClusters = 0; } @@ -9947,3 +9950,3 @@ int ScanVolClusterBitmap (HWND hwndDlg, int *driveNo, __int64 nbrClusters, __int { - *nbrFreeClusters = lpOutBuffer->BitmapSize.QuadPart; + *pnbrFreeClusters = lpOutBuffer->BitmapSize.QuadPart; bitmapCnt = lpOutBuffer->BitmapSize.QuadPart / 8; @@ -9957,3 +9960,3 @@ int ScanVolClusterBitmap (HWND hwndDlg, int *driveNo, __int64 nbrClusters, __int // These are ignored because there is always a cluster reserve added anyway. - *nbrFreeClusters = lpOutBuffer->BitmapSize.QuadPart - ((bitmapCnt + 1) * 8); + *pnbrFreeClusters = lpOutBuffer->BitmapSize.QuadPart - ((bitmapCnt + 1) * 8); break; |