mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 02:58:02 -06:00
Windows: implement wait dialog for the backup/restore header operations.
This commit is contained in:
@@ -1494,6 +1494,42 @@ void CALLBACK ChangePwdWaitThreadProc(void* pArg, HWND hwndDlg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// implementation for support of backup header operation in wait dialog mechanism
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
BOOL bRequireConfirmation;
|
||||||
|
char *lpszVolume;
|
||||||
|
int* iResult;
|
||||||
|
} BackupHeaderThreadParam;
|
||||||
|
|
||||||
|
void CALLBACK BackupHeaderWaitThreadProc(void* pArg, HWND hwndDlg)
|
||||||
|
{
|
||||||
|
BackupHeaderThreadParam* pThreadParam = (BackupHeaderThreadParam*) pArg;
|
||||||
|
|
||||||
|
if (!IsAdmin () && IsUacSupported () && IsVolumeDeviceHosted (pThreadParam->lpszVolume))
|
||||||
|
*(pThreadParam->iResult) = UacBackupVolumeHeader (hwndDlg, pThreadParam->bRequireConfirmation, pThreadParam->lpszVolume);
|
||||||
|
else
|
||||||
|
*(pThreadParam->iResult) = BackupVolumeHeader (hwndDlg, pThreadParam->bRequireConfirmation, pThreadParam->lpszVolume);
|
||||||
|
}
|
||||||
|
|
||||||
|
// implementation for support of restoring header operation in wait dialog mechanism
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
char *lpszVolume;
|
||||||
|
int* iResult;
|
||||||
|
} RestoreHeaderThreadParam;
|
||||||
|
|
||||||
|
void CALLBACK RestoreHeaderWaitThreadProc(void* pArg, HWND hwndDlg)
|
||||||
|
{
|
||||||
|
RestoreHeaderThreadParam* pThreadParam = (RestoreHeaderThreadParam*) pArg;
|
||||||
|
|
||||||
|
if (!IsAdmin () && IsUacSupported () && IsVolumeDeviceHosted (pThreadParam->lpszVolume))
|
||||||
|
*(pThreadParam->iResult) = UacRestoreVolumeHeader (hwndDlg, pThreadParam->lpszVolume);
|
||||||
|
else
|
||||||
|
*(pThreadParam->iResult) = RestoreVolumeHeader (hwndDlg, pThreadParam->lpszVolume);
|
||||||
|
}
|
||||||
|
|
||||||
/* Except in response to the WM_INITDIALOG message, the dialog box procedure
|
/* Except in response to the WM_INITDIALOG message, the dialog box procedure
|
||||||
should return nonzero if it processes the message, and zero if it does
|
should return nonzero if it processes the message, and zero if it does
|
||||||
@@ -6157,10 +6193,13 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
WaitCursor ();
|
WaitCursor ();
|
||||||
|
|
||||||
if (!IsAdmin () && IsUacSupported () && IsVolumeDeviceHosted (volPath))
|
int iStatus = 0;
|
||||||
UacBackupVolumeHeader (hwndDlg, TRUE, volPath);
|
BackupHeaderThreadParam threadParam;
|
||||||
else
|
threadParam.bRequireConfirmation = TRUE;
|
||||||
BackupVolumeHeader (hwndDlg, TRUE, volPath);
|
threadParam.lpszVolume = volPath;
|
||||||
|
threadParam.iResult = &iStatus;
|
||||||
|
|
||||||
|
ShowWaitDialog (hwndDlg, TRUE, BackupHeaderWaitThreadProc, &threadParam);
|
||||||
|
|
||||||
NormalCursor ();
|
NormalCursor ();
|
||||||
}
|
}
|
||||||
@@ -6177,10 +6216,12 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
WaitCursor ();
|
WaitCursor ();
|
||||||
|
|
||||||
if (!IsAdmin () && IsUacSupported () && IsVolumeDeviceHosted (volPath))
|
int iStatus = 0;
|
||||||
UacRestoreVolumeHeader (hwndDlg, volPath);
|
RestoreHeaderThreadParam threadParam;
|
||||||
else
|
threadParam.lpszVolume = volPath;
|
||||||
RestoreVolumeHeader (hwndDlg, volPath);
|
threadParam.iResult = &iStatus;
|
||||||
|
|
||||||
|
ShowWaitDialog(hwndDlg, TRUE, RestoreHeaderWaitThreadProc, &threadParam);
|
||||||
|
|
||||||
NormalCursor ();
|
NormalCursor ();
|
||||||
}
|
}
|
||||||
@@ -6578,10 +6619,13 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
WaitCursor ();
|
WaitCursor ();
|
||||||
|
|
||||||
if (!IsAdmin () && IsUacSupported () && IsVolumeDeviceHosted (volPath))
|
int iStatus = 0;
|
||||||
UacBackupVolumeHeader (hwndDlg, TRUE, volPath);
|
BackupHeaderThreadParam threadParam;
|
||||||
else
|
threadParam.bRequireConfirmation = TRUE;
|
||||||
BackupVolumeHeader (hwndDlg, TRUE, volPath);
|
threadParam.lpszVolume = volPath;
|
||||||
|
threadParam.iResult = &iStatus;
|
||||||
|
|
||||||
|
ShowWaitDialog (hwndDlg, TRUE, BackupHeaderWaitThreadProc, &threadParam);
|
||||||
|
|
||||||
NormalCursor ();
|
NormalCursor ();
|
||||||
}
|
}
|
||||||
@@ -6602,10 +6646,12 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
WaitCursor ();
|
WaitCursor ();
|
||||||
|
|
||||||
if (!IsAdmin () && IsUacSupported () && IsVolumeDeviceHosted (volPath))
|
int iStatus = 0;
|
||||||
UacRestoreVolumeHeader (hwndDlg, volPath);
|
RestoreHeaderThreadParam threadParam;
|
||||||
else
|
threadParam.lpszVolume = volPath;
|
||||||
RestoreVolumeHeader (hwndDlg, volPath);
|
threadParam.iResult = &iStatus;
|
||||||
|
|
||||||
|
ShowWaitDialog(hwndDlg, TRUE, RestoreHeaderWaitThreadProc, &threadParam);
|
||||||
|
|
||||||
NormalCursor ();
|
NormalCursor ();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user