mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 02:58:02 -06:00
Windows: Fix warning when building Setup and Portable. No file elevation is used for them.
This commit is contained in:
@@ -773,11 +773,13 @@ namespace VeraCrypt
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
LastError = GetLastError();
|
LastError = GetLastError();
|
||||||
|
#ifndef SETUP
|
||||||
if (LastError == ERROR_ACCESS_DENIED && IsUacSupported())
|
if (LastError == ERROR_ACCESS_DENIED && IsUacSupported())
|
||||||
{
|
{
|
||||||
Elevated = true;
|
Elevated = true;
|
||||||
FileOpen = true;
|
FileOpen = true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
FilePointerPosition = 0;
|
FilePointerPosition = 0;
|
||||||
@@ -806,12 +808,14 @@ namespace VeraCrypt
|
|||||||
throw SystemException (SRC_POS);
|
throw SystemException (SRC_POS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef SETUP
|
||||||
if (Elevated)
|
if (Elevated)
|
||||||
{
|
{
|
||||||
Elevator::ReadWriteFile (false, IsDevice, Path, buffer, FilePointerPosition, size, &bytesRead);
|
Elevator::ReadWriteFile (false, IsDevice, Path, buffer, FilePointerPosition, size, &bytesRead);
|
||||||
FilePointerPosition += bytesRead;
|
FilePointerPosition += bytesRead;
|
||||||
return bytesRead;
|
return bytesRead;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!ReadFile (Handle, buffer, size, &bytesRead, NULL))
|
if (!ReadFile (Handle, buffer, size, &bytesRead, NULL))
|
||||||
{
|
{
|
||||||
@@ -913,6 +917,7 @@ namespace VeraCrypt
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
#ifndef SETUP
|
||||||
if (Elevated)
|
if (Elevated)
|
||||||
{
|
{
|
||||||
Elevator::ReadWriteFile (true, IsDevice, Path, buffer, FilePointerPosition, size, &bytesWritten);
|
Elevator::ReadWriteFile (true, IsDevice, Path, buffer, FilePointerPosition, size, &bytesWritten);
|
||||||
@@ -920,6 +925,7 @@ namespace VeraCrypt
|
|||||||
throw_sys_if (bytesWritten != size);
|
throw_sys_if (bytesWritten != size);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (!WriteFile (Handle, buffer, size, &bytesWritten, NULL))
|
if (!WriteFile (Handle, buffer, size, &bytesWritten, NULL))
|
||||||
{
|
{
|
||||||
@@ -1046,11 +1052,13 @@ namespace VeraCrypt
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
LastError = GetLastError ();
|
LastError = GetLastError ();
|
||||||
|
#ifndef SETUP
|
||||||
if (LastError == ERROR_ACCESS_DENIED && IsUacSupported())
|
if (LastError == ERROR_ACCESS_DENIED && IsUacSupported())
|
||||||
{
|
{
|
||||||
Elevated = true;
|
Elevated = true;
|
||||||
FileOpen = true;
|
FileOpen = true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
FilePointerPosition = 0;
|
FilePointerPosition = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user