diff options
Diffstat (limited to 'src/ExpandVolume/ExpandVolume.c')
-rw-r--r-- | src/ExpandVolume/ExpandVolume.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/ExpandVolume/ExpandVolume.c b/src/ExpandVolume/ExpandVolume.c index 1d777a11..5b9509be 100644 --- a/src/ExpandVolume/ExpandVolume.c +++ b/src/ExpandVolume/ExpandVolume.c @@ -97,9 +97,9 @@ static int FsctlExtendVolume(char * szVolume, LONGLONG nTotalSectors ); int with Truecrypt error code (ERR_SUCCESS on success) */ -int MountVolTemp (HWND hwndDlg, char *volumePath, int *driveNo, Password *password, int pkcs5) +int MountVolTemp (HWND hwndDlg, char *volumePath, int *driveNo, Password *password, int pkcs5, int pin) { MountOptions mountOptions; ZeroMemory (&mountOptions, sizeof (mountOptions)); @@ -117,9 +117,9 @@ int MountVolTemp (HWND hwndDlg, char *volumePath, int *driveNo, Password *passwo mountOptions.PreserveTimestamp = bPreserveTimestamp; mountOptions.PartitionInInactiveSysEncScope = FALSE; mountOptions.UseBackupHeader = FALSE; - if (MountVolume (hwndDlg, *driveNo, volumePath, password, pkcs5, FALSE, FALSE, TRUE, &mountOptions, FALSE, FALSE) < 1) + if (MountVolume (hwndDlg, *driveNo, volumePath, password, pkcs5, pin, FALSE, FALSE, TRUE, &mountOptions, FALSE, FALSE) < 1) { *driveNo = -3; return ERR_VOL_MOUNT_FAILED; } @@ -384,9 +384,9 @@ uint64 GetVolumeSizeByDataAreaSize (uint64 dataAreaSize, BOOL legacyVolume) return dataAreaSize + reservedSize; } -int ExtendFileSystem (HWND hwndDlg , char *lpszVolume, Password *pVolumePassword, int VolumePkcs5, uint64 newDataAreaSize) +int ExtendFileSystem (HWND hwndDlg , char *lpszVolume, Password *pVolumePassword, int VolumePkcs5, int VolumePin, uint64 newDataAreaSize) { char szVolumeGUID[128]; int driveNo = -1; char rootPath[] = "A:\\"; @@ -398,9 +398,9 @@ int ExtendFileSystem (HWND hwndDlg , char *lpszVolume, Password *pVolumePassword // mount and resize file system DebugAddProgressDlgStatus (hwndDlg, "Mounting volume ...\r\n"); - nStatus=MountVolTemp(hwndDlg, lpszVolume, &driveNo, pVolumePassword, VolumePkcs5); + nStatus=MountVolTemp(hwndDlg, lpszVolume, &driveNo, pVolumePassword, VolumePkcs5, VolumePin); if (nStatus!=ERR_SUCCESS) { driveNo = -1; goto error; @@ -499,9 +499,9 @@ error: Remarks: a lot of code is from TrueCrypt 'Common\Password.c' :: ChangePwd() */ -static int ExpandVolume (HWND hwndDlg, char *lpszVolume, Password *pVolumePassword, int VolumePkcs5, uint64 newHostSize, BOOL initFreeSpace) +static int ExpandVolume (HWND hwndDlg, char *lpszVolume, Password *pVolumePassword, int VolumePkcs5, int VolumePin, uint64 newHostSize, BOOL initFreeSpace) { int nDosLinkCreated = 1, nStatus = ERR_OS_ERROR; char szDiskFile[TC_MAX_PATH], szCFDevice[TC_MAX_PATH]; char szDosDevice[TC_MAX_PATH]; @@ -643,9 +643,9 @@ static int ExpandVolume (HWND hwndDlg, char *lpszVolume, Password *pVolumePasswo } /* Try to decrypt the header */ - nStatus = ReadVolumeHeader (FALSE, buffer, pVolumePassword, VolumePkcs5, FALSE, &cryptoInfo, NULL); + nStatus = ReadVolumeHeader (FALSE, buffer, pVolumePassword, VolumePkcs5, VolumePin, FALSE, &cryptoInfo, NULL); if (nStatus == ERR_CIPHER_INIT_WEAK_KEY) nStatus = 0; // We can ignore this error here if (nStatus != 0) @@ -801,8 +801,9 @@ static int ExpandVolume (HWND hwndDlg, char *lpszVolume, Password *pVolumePasswo cryptoInfo->ea, cryptoInfo->mode, pVolumePassword, cryptoInfo->pkcs5, + VolumePin, (char*)(cryptoInfo->master_keydata), &ci, newDataAreaSize, 0, // hiddenVolumeSize @@ -967,9 +968,9 @@ error: SetLastError (dwError); if (nStatus == ERR_SUCCESS) { - nStatus = ExtendFileSystem (hwndDlg, lpszVolume, pVolumePassword, VolumePkcs5, newDataAreaSize); + nStatus = ExtendFileSystem (hwndDlg, lpszVolume, pVolumePassword, VolumePkcs5, VolumePin, newDataAreaSize); } return nStatus; } @@ -982,9 +983,9 @@ void __cdecl volTransformThreadFunction (void *pExpandDlgParam) EXPAND_VOL_THREAD_PARAMS *pParam=(EXPAND_VOL_THREAD_PARAMS *)pExpandDlgParam; HWND hwndDlg = (HWND) pParam->hwndDlg; nStatus = ExpandVolume (hwndDlg, (char*)pParam->szVolumeName, pParam->pVolumePassword, - pParam->VolumePkcs5, pParam->newSize, pParam->bInitFreeSpace ); + pParam->VolumePkcs5, pParam->VolumePin, pParam->newSize, pParam->bInitFreeSpace ); if (nStatus!=ERR_SUCCESS && nStatus!=ERR_USER_ABORT) handleError (hwndDlg, nStatus); |