Skip to content

Commit bc7dc49

Browse files
Truecrypt FoundationFreeApophis
Truecrypt Foundation
authored andcommitted
TrueCrypt Source Version 6.0a
1 parent 62a1e6d commit bc7dc49

21 files changed

+292
-187
lines changed

Common/DLGCODE.C

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6070,10 +6070,9 @@ BOOL IsNonInstallMode ()
60706070
char path[MAX_PATH * 2] = { 0 };
60716071

60726072
// We can't use GetConfigPath() here because it would call us back (indirect recursion)
6073-
if (SUCCEEDED(SHGetFolderPath (NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, path)))
6073+
if (SUCCEEDED(SHGetFolderPath (NULL, CSIDL_APPDATA, NULL, 0, path)))
60746074
{
60756075
strcat (path, "\\TrueCrypt\\");
6076-
CreateDirectory (path, NULL);
60776076
strcat (path, FILE_SYSTEM_ENCRYPTION_CFG);
60786077

60796078
if (FileExists (path))
@@ -7442,15 +7441,35 @@ BOOL IsPagingFileActive ()
74427441
DWORD size = sizeof (data);
74437442

74447443
if (ReadLocalMachineRegistryMultiString ("System\\CurrentControlSet\\Control\\Session Manager\\Memory Management", "PagingFiles", data, &size)
7445-
&& size > 6)
7444+
&& size > 12)
74467445
return TRUE;
74477446

74487447
for (char drive = 'C'; drive <= 'Z'; ++drive)
74497448
{
7449+
// Query geometry of the drive first to prevent "no medium" pop-ups
7450+
string drivePath = "\\\\.\\X:";
7451+
drivePath[4] = drive;
7452+
HANDLE handle = CreateFile (drivePath.c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
7453+
7454+
if (handle == INVALID_HANDLE_VALUE)
7455+
continue;
7456+
7457+
DISK_GEOMETRY driveInfo;
7458+
DWORD dwResult;
7459+
7460+
if (!DeviceIoControl (handle, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, &driveInfo, sizeof (driveInfo), &dwResult, NULL))
7461+
{
7462+
CloseHandle (handle);
7463+
continue;
7464+
}
7465+
7466+
CloseHandle (handle);
7467+
7468+
// Test if a paging file exists and is locked by another process
74507469
string path = "X:\\pagefile.sys";
74517470
path[0] = drive;
74527471

7453-
HANDLE handle = CreateFile (path.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
7472+
handle = CreateFile (path.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
74547473

74557474
if (handle != INVALID_HANDLE_VALUE)
74567475
CloseHandle (handle);

0 commit comments

Comments
 (0)