Windows: solve Expander GUI issues caused by latest Unicode modifications.

This commit is contained in:
Mounir IDRASSI 2016-01-18 19:51:46 +01:00
parent 90957cd9d9
commit 8a2d9c4120
4 changed files with 20 additions and 20 deletions

View File

@ -82,7 +82,7 @@ BOOL UpdateProgressBarProc (__int64 byteOffset)
else else
StringCbPrintfW (text, sizeof text, GetString ("PROCESSED_PORTION_X_PERCENT"), perc); StringCbPrintfW (text, sizeof text, GetString ("PROCESSED_PORTION_X_PERCENT"), perc);
StringCbCatW (speed, sizeof(speed), L" "); StringCbCatW (text, sizeof(speed), L" ");
} }
else else
{ {

View File

@ -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; 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; HWND hwndCtrl;
@ -294,13 +294,13 @@ BOOL CALLBACK ExpandVolProgressDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, L
if (nStatus != 0) if (nStatus != 0)
{ {
if ( nStatus != ERR_USER_ABORT ) if ( nStatus != ERR_USER_ABORT )
AddProgressDlgStatus (hwndDlg, "Error: volume expansion failed."); AddProgressDlgStatus (hwndDlg, L"Error: volume expansion failed.");
else else
AddProgressDlgStatus (hwndDlg, "Error: operation aborted by user."); AddProgressDlgStatus (hwndDlg, L"Error: operation aborted by user.");
} }
else else
{ {
AddProgressDlgStatus (hwndDlg, "Finished. Volume successfully expanded."); AddProgressDlgStatus (hwndDlg, L"Finished. Volume successfully expanded.");
} }
SetWindowText (GetDlgItem (hwndDlg, IDOK), L"Exit"); 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); KillTimer (hwndDlg, TIMER_ID_RANDVIEW);
EnableWindow (GetDlgItem (hwndDlg, IDC_DISPLAY_POOL_CONTENTS), FALSE); EnableWindow (GetDlgItem (hwndDlg, IDC_DISPLAY_POOL_CONTENTS), FALSE);
EnableWindow (GetDlgItem (hwndDlg, IDOK), FALSE); EnableWindow (GetDlgItem (hwndDlg, IDOK), FALSE);
SetProgressDlgStatus (hwndDlg, "Starting volume expansion ...\r\n"); SetProgressDlgStatus (hwndDlg, L"Starting volume expansion ...\r\n");
bVolTransformStarted = TRUE; bVolTransformStarted = TRUE;
pProgressDlgParam->hwndDlg = hwndDlg; pProgressDlgParam->hwndDlg = hwndDlg;
if ( _beginthread (volTransformThreadFunction, 0, pProgressDlgParam) == -1L ) if ( _beginthread (volTransformThreadFunction, 0, pProgressDlgParam) == -1L )

View File

@ -383,7 +383,7 @@ int ExtendFileSystem (HWND hwndDlg , wchar_t *lpszVolume, Password *pVolumePassw
// mount and resize file system // 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); nStatus=MountVolTemp(hwndDlg, lpszVolume, &driveNo, pVolumePassword, VolumePkcs5, VolumePim);
if (nStatus!=ERR_SUCCESS) if (nStatus!=ERR_SUCCESS)
@ -435,7 +435,7 @@ int ExtendFileSystem (HWND hwndDlg , wchar_t *lpszVolume, Password *pVolumePassw
goto error; goto error;
} }
DebugAddProgressDlgStatus (hwndDlg, "Extending file system ...\r\n"); DebugAddProgressDlgStatus (hwndDlg, L"Extending file system ...\r\n");
// extend volume // extend volume
nStatus = FsctlExtendVolume(szVolumeGUID, newDataAreaSize/BytesPerSector ); nStatus = FsctlExtendVolume(szVolumeGUID, newDataAreaSize/BytesPerSector );
@ -446,7 +446,7 @@ int ExtendFileSystem (HWND hwndDlg , wchar_t *lpszVolume, Password *pVolumePassw
if (driveNo>=0) if (driveNo>=0)
{ {
DebugAddProgressDlgStatus (hwndDlg, "Unmounting volume ...\r\n"); DebugAddProgressDlgStatus (hwndDlg, L"Unmounting volume ...\r\n");
UnmountVolume (hwndDlg, driveNo, TRUE); UnmountVolume (hwndDlg, driveNo, TRUE);
} }
@ -736,7 +736,7 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas
goto error; 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); SetFormatSectorSize(HostSectorSize);
nStatus = FormatNoFs (hwndDlg, startSector, num_sectors, dev, cryptoInfo, FALSE); 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) if (nStatus != ERR_SUCCESS)
{ {
dwError = GetLastError(); 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 ) { if ( !bDevice ) {
// restore original size of the container file // restore original size of the container file
LARGE_INTEGER liOldSize; LARGE_INTEGER liOldSize;
liOldSize.QuadPart=(LONGLONG)hostSize; liOldSize.QuadPart=(LONGLONG)hostSize;
if (!SetFilePointerEx (dev, liOldSize, NULL, FILE_BEGIN) || !SetEndOfFile (dev)) 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); SetLastError (dwError);
@ -777,9 +777,9 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas
while ( !cryptoInfo->LegacyVolume ) while ( !cryptoInfo->LegacyVolume )
{ {
if (backupHeader) if (backupHeader)
DebugAddProgressDlgStatus(hwndDlg, "Writing re-encrypted backup header ...\r\n"); DebugAddProgressDlgStatus(hwndDlg, L"Writing re-encrypted backup header ...\r\n");
else else
DebugAddProgressDlgStatus(hwndDlg, "Writing re-encrypted primary header ...\r\n"); DebugAddProgressDlgStatus(hwndDlg, L"Writing re-encrypted primary header ...\r\n");
// Prepare new volume header // Prepare new volume header
nStatus = CreateVolumeHeaderInMemory (hwndDlg, FALSE, 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 ) && (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); nStatus = WriteRandomDataToReservedHeaderAreas (hwndDlg, dev, cryptoInfo, newDataAreaSize, !backupHeader, backupHeader);
if (nStatus != ERR_SUCCESS) if (nStatus != ERR_SUCCESS)
goto error; goto error;
@ -870,7 +870,7 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas
goto error; goto error;
} }
DebugAddProgressDlgStatus(hwndDlg, "Wiping old backup header ...\r\n"); DebugAddProgressDlgStatus(hwndDlg, L"Wiping old backup header ...\r\n");
wipeBuffer = (byte *) TCalloc (workChunkSize); wipeBuffer = (byte *) TCalloc (workChunkSize);
if (!wipeBuffer) if (!wipeBuffer)
@ -901,7 +901,7 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas
) )
{ {
// Write error // 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); 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) if (wipePass == 1)
continue; // retry once continue; // retry once

View File

@ -63,8 +63,8 @@ BOOL GetNtfsNumberOfSectors(wchar_t *rootPath, uint64 *pNumberOfSectors, DWORD *
void __cdecl volTransformThreadFunction (void *hwndDlgArg); void __cdecl volTransformThreadFunction (void *hwndDlgArg);
/* defined in DlgExpandVolume.cpp */ /* defined in DlgExpandVolume.cpp */
void AddProgressDlgStatus(HWND hwndDlg, const char* szText); void AddProgressDlgStatus(HWND hwndDlg, const wchar_t* szText);
void SetProgressDlgStatus(HWND hwndDlg, const char* szText); void SetProgressDlgStatus(HWND hwndDlg, const wchar_t* szText);
#ifdef __cplusplus #ifdef __cplusplus
} }