@@ -6070,10 +6070,9 @@ BOOL IsNonInstallMode ()
6070
6070
char path [MAX_PATH * 2 ] = { 0 };
6071
6071
6072
6072
// 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 )))
6074
6074
{
6075
6075
strcat (path , "\\TrueCrypt\\" );
6076
- CreateDirectory (path , NULL );
6077
6076
strcat (path , FILE_SYSTEM_ENCRYPTION_CFG );
6078
6077
6079
6078
if (FileExists (path ))
@@ -7442,15 +7441,35 @@ BOOL IsPagingFileActive ()
7442
7441
DWORD size = sizeof (data );
7443
7442
7444
7443
if (ReadLocalMachineRegistryMultiString ("System\\CurrentControlSet\\Control\\Session Manager\\Memory Management" , "PagingFiles" , data , & size )
7445
- && size > 6 )
7444
+ && size > 12 )
7446
7445
return TRUE;
7447
7446
7448
7447
for (char drive = 'C' ; drive <= 'Z' ; ++ drive )
7449
7448
{
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
7450
7469
string path = "X:\\pagefile.sys" ;
7451
7470
path [0 ] = drive ;
7452
7471
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 );
7454
7473
7455
7474
if (handle != INVALID_HANDLE_VALUE )
7456
7475
CloseHandle (handle );
0 commit comments