From 8a2d9c41206c156937f52d07e7a0b89f38444a44 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Mon, 18 Jan 2016 19:51:46 +0100 Subject: Windows: solve Expander GUI issues caused by latest Unicode modifications. --- src/Common/Progress.c | 2 +- src/ExpandVolume/DlgExpandVolume.cpp | 12 ++++++------ src/ExpandVolume/ExpandVolume.c | 22 +++++++++++----------- src/ExpandVolume/ExpandVolume.h | 4 ++-- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/Common/Progress.c b/src/Common/Progress.c index 29b1590b..36d801fc 100644 --- a/src/Common/Progress.c +++ b/src/Common/Progress.c @@ -82,7 +82,7 @@ BOOL UpdateProgressBarProc (__int64 byteOffset) else StringCbPrintfW (text, sizeof text, GetString ("PROCESSED_PORTION_X_PERCENT"), perc); - StringCbCatW (speed, sizeof(speed), L" "); + StringCbCatW (text, sizeof(speed), L" "); } else { diff --git a/src/ExpandVolume/DlgExpandVolume.cpp b/src/ExpandVolume/DlgExpandVolume.cpp index 67c76c61..ed198f09 100644 --- a/src/ExpandVolume/DlgExpandVolume.cpp +++ b/src/ExpandVolume/DlgExpandVolume.cpp @@ -214,7 +214,7 @@ BOOL CALLBACK ExpandVolSizeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA } -extern "C" void AddProgressDlgStatus(HWND hwndDlg, const char* szText) +extern "C" void AddProgressDlgStatus(HWND hwndDlg, const wchar_t* szText) { HWND hwndCtrl; @@ -224,7 +224,7 @@ extern "C" void AddProgressDlgStatus(HWND hwndDlg, const char* szText) } -extern "C" void SetProgressDlgStatus(HWND hwndDlg, const char* szText) +extern "C" void SetProgressDlgStatus(HWND hwndDlg, const wchar_t* szText) { HWND hwndCtrl; @@ -294,13 +294,13 @@ BOOL CALLBACK ExpandVolProgressDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, L if (nStatus != 0) { if ( nStatus != ERR_USER_ABORT ) - AddProgressDlgStatus (hwndDlg, "Error: volume expansion failed."); + AddProgressDlgStatus (hwndDlg, L"Error: volume expansion failed."); else - AddProgressDlgStatus (hwndDlg, "Error: operation aborted by user."); + AddProgressDlgStatus (hwndDlg, L"Error: operation aborted by user."); } else { - AddProgressDlgStatus (hwndDlg, "Finished. Volume successfully expanded."); + AddProgressDlgStatus (hwndDlg, L"Finished. Volume successfully expanded."); } SetWindowText (GetDlgItem (hwndDlg, IDOK), L"Exit"); @@ -368,7 +368,7 @@ BOOL CALLBACK ExpandVolProgressDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, L KillTimer (hwndDlg, TIMER_ID_RANDVIEW); EnableWindow (GetDlgItem (hwndDlg, IDC_DISPLAY_POOL_CONTENTS), FALSE); EnableWindow (GetDlgItem (hwndDlg, IDOK), FALSE); - SetProgressDlgStatus (hwndDlg, "Starting volume expansion ...\r\n"); + SetProgressDlgStatus (hwndDlg, L"Starting volume expansion ...\r\n"); bVolTransformStarted = TRUE; pProgressDlgParam->hwndDlg = hwndDlg; if ( _beginthread (volTransformThreadFunction, 0, pProgressDlgParam) == -1L ) diff --git a/src/ExpandVolume/ExpandVolume.c b/src/ExpandVolume/ExpandVolume.c index 8777c240..9f2c57cc 100644 --- a/src/ExpandVolume/ExpandVolume.c +++ b/src/ExpandVolume/ExpandVolume.c @@ -383,7 +383,7 @@ int ExtendFileSystem (HWND hwndDlg , wchar_t *lpszVolume, Password *pVolumePassw // mount and resize file system - DebugAddProgressDlgStatus (hwndDlg, "Mounting volume ...\r\n"); + DebugAddProgressDlgStatus (hwndDlg, L"Mounting volume ...\r\n"); nStatus=MountVolTemp(hwndDlg, lpszVolume, &driveNo, pVolumePassword, VolumePkcs5, VolumePim); if (nStatus!=ERR_SUCCESS) @@ -435,7 +435,7 @@ int ExtendFileSystem (HWND hwndDlg , wchar_t *lpszVolume, Password *pVolumePassw goto error; } - DebugAddProgressDlgStatus (hwndDlg, "Extending file system ...\r\n"); + DebugAddProgressDlgStatus (hwndDlg, L"Extending file system ...\r\n"); // extend volume nStatus = FsctlExtendVolume(szVolumeGUID, newDataAreaSize/BytesPerSector ); @@ -446,7 +446,7 @@ error: if (driveNo>=0) { - DebugAddProgressDlgStatus (hwndDlg, "Unmounting volume ...\r\n"); + DebugAddProgressDlgStatus (hwndDlg, L"Unmounting volume ...\r\n"); UnmountVolume (hwndDlg, driveNo, TRUE); } @@ -736,7 +736,7 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas goto error; } - DebugAddProgressDlgStatus(hwndDlg, "Writing random data to new space ...\r\n"); + DebugAddProgressDlgStatus(hwndDlg, L"Writing random data to new space ...\r\n"); SetFormatSectorSize(HostSectorSize); nStatus = FormatNoFs (hwndDlg, startSector, num_sectors, dev, cryptoInfo, FALSE); @@ -753,14 +753,14 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas if (nStatus != ERR_SUCCESS) { dwError = GetLastError(); - DebugAddProgressDlgStatus(hwndDlg, "Error: failed to write random data ...\r\n"); + DebugAddProgressDlgStatus(hwndDlg, L"Error: failed to write random data ...\r\n"); if ( !bDevice ) { // restore original size of the container file LARGE_INTEGER liOldSize; liOldSize.QuadPart=(LONGLONG)hostSize; if (!SetFilePointerEx (dev, liOldSize, NULL, FILE_BEGIN) || !SetEndOfFile (dev)) { - DebugAddProgressDlgStatus(hwndDlg, "Warning: failed to restore original size of the container file\r\n"); + DebugAddProgressDlgStatus(hwndDlg, L"Warning: failed to restore original size of the container file\r\n"); } } SetLastError (dwError); @@ -777,9 +777,9 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas while ( !cryptoInfo->LegacyVolume ) { if (backupHeader) - DebugAddProgressDlgStatus(hwndDlg, "Writing re-encrypted backup header ...\r\n"); + DebugAddProgressDlgStatus(hwndDlg, L"Writing re-encrypted backup header ...\r\n"); else - DebugAddProgressDlgStatus(hwndDlg, "Writing re-encrypted primary header ...\r\n"); + DebugAddProgressDlgStatus(hwndDlg, L"Writing re-encrypted primary header ...\r\n"); // Prepare new volume header nStatus = CreateVolumeHeaderInMemory (hwndDlg, FALSE, @@ -828,7 +828,7 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas && (cryptoInfo->HeaderFlags & ~TC_HEADER_FLAG_NONSYS_INPLACE_ENC) == 0 ) ) { - //DebugAddProgressDlgStatus(hwndDlg, "WriteRandomDataToReservedHeaderAreas() ...\r\n"); + //DebugAddProgressDlgStatus(hwndDlg, L"WriteRandomDataToReservedHeaderAreas() ...\r\n"); nStatus = WriteRandomDataToReservedHeaderAreas (hwndDlg, dev, cryptoInfo, newDataAreaSize, !backupHeader, backupHeader); if (nStatus != ERR_SUCCESS) goto error; @@ -870,7 +870,7 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas goto error; } - DebugAddProgressDlgStatus(hwndDlg, "Wiping old backup header ...\r\n"); + DebugAddProgressDlgStatus(hwndDlg, L"Wiping old backup header ...\r\n"); wipeBuffer = (byte *) TCalloc (workChunkSize); if (!wipeBuffer) @@ -901,7 +901,7 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas ) { // Write error - DebugAddProgressDlgStatus(hwndDlg, "Warning: Failed to wipe old backup header\r\n"); + DebugAddProgressDlgStatus(hwndDlg, L"Warning: Failed to wipe old backup header\r\n"); MessageBoxW (hwndDlg, L"WARNING: Failed to wipe old backup header!\n\nIt may be possible to use the current volume password to decrypt the old backup header even after a future password change.\n", lpszTitle, MB_OK | MB_ICONEXCLAMATION); if (wipePass == 1) continue; // retry once diff --git a/src/ExpandVolume/ExpandVolume.h b/src/ExpandVolume/ExpandVolume.h index 6f3e9629..069b59ec 100644 --- a/src/ExpandVolume/ExpandVolume.h +++ b/src/ExpandVolume/ExpandVolume.h @@ -63,8 +63,8 @@ BOOL GetNtfsNumberOfSectors(wchar_t *rootPath, uint64 *pNumberOfSectors, DWORD * void __cdecl volTransformThreadFunction (void *hwndDlgArg); /* defined in DlgExpandVolume.cpp */ -void AddProgressDlgStatus(HWND hwndDlg, const char* szText); -void SetProgressDlgStatus(HWND hwndDlg, const char* szText); +void AddProgressDlgStatus(HWND hwndDlg, const wchar_t* szText); +void SetProgressDlgStatus(HWND hwndDlg, const wchar_t* szText); #ifdef __cplusplus } -- cgit v1.2.3