VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common
diff options
context:
space:
mode:
Diffstat (limited to 'src/Common')
-rw-r--r--src/Common/BaseCom.cpp28
-rw-r--r--src/Common/BaseCom.h1
-rw-r--r--src/Common/BootEncryption.cpp53
-rw-r--r--src/Common/BootEncryption.h1
4 files changed, 1 insertions, 82 deletions
diff --git a/src/Common/BaseCom.cpp b/src/Common/BaseCom.cpp
index a73e472d..12af98a4 100644
--- a/src/Common/BaseCom.cpp
+++ b/src/Common/BaseCom.cpp
@@ -400,34 +400,6 @@ DWORD BaseCom::GetEfiBootDeviceNumber (BSTR* pSdn)
return ERROR_SUCCESS;
}
-DWORD BaseCom::ReadEfiConfig (BSTR filename, BSTR* pContent, DWORD *pcbRead)
-{
- if (!pContent || !(*pContent))
- return ERROR_INVALID_PARAMETER;
-
- try
- {
- DWORD maxSize = ((DWORD *) ((BYTE *) *pContent))[-1];
- BootEncryption bootEnc (NULL);
- bootEnc.ReadEfiConfig (filename, (byte*) *pContent, maxSize, pcbRead);
- }
- catch (SystemException &)
- {
- return GetLastError();
- }
- catch (Exception &e)
- {
- e.Show (NULL);
- return ERROR_EXCEPTION_IN_SERVICE;
- }
- catch (...)
- {
- return ERROR_EXCEPTION_IN_SERVICE;
- }
-
- return ERROR_SUCCESS;
-}
-
DWORD BaseCom::WriteEfiBootSectorUserConfig (DWORD userConfig, BSTR customUserMessage, int pim, int hashAlg)
{
if (!customUserMessage)
diff --git a/src/Common/BaseCom.h b/src/Common/BaseCom.h
index 1ec9012a..27a46c79 100644
--- a/src/Common/BaseCom.h
+++ b/src/Common/BaseCom.h
@@ -116,7 +116,6 @@ public:
static DWORD BackupEfiSystemLoader ();
static DWORD RestoreEfiSystemLoader ();
static DWORD GetEfiBootDeviceNumber (BSTR* pSdn);
- static DWORD ReadEfiConfig (BSTR filename, BSTR* pContent, DWORD *pcbRead);
static DWORD WriteEfiBootSectorUserConfig (DWORD userConfig, BSTR customUserMessage, int pim, int hashAlg);
};
diff --git a/src/Common/BootEncryption.cpp b/src/Common/BootEncryption.cpp
index b2ab9f2a..60985751 100644
--- a/src/Common/BootEncryption.cpp
+++ b/src/Common/BootEncryption.cpp
@@ -372,29 +372,6 @@ namespace VeraCrypt
}
}
- static void ReadEfiConfig (const wchar_t *filename, byte* confContent, DWORD maxSize, DWORD* pcbRead)
- {
- Elevate();
-
- CComBSTR outputBstr;
- if (confContent && outputBstr.AppendBytes ((const char *) confContent, maxSize) != S_OK)
- {
- SetLastError (ERROR_INVALID_PARAMETER);
- throw SystemException(SRC_POS);
- }
- BSTR bstrfn = W2BSTR(filename);
- DWORD result = ElevatedComInstance->ReadEfiConfig (bstrfn, &outputBstr, pcbRead);
-
- if (confContent)
- memcpy (confContent, *(void **) &outputBstr, maxSize);
-
- if (result != ERROR_SUCCESS)
- {
- SetLastError (result);
- throw SystemException(SRC_POS);
- }
- }
-
static void WriteEfiBootSectorUserConfig (byte userConfig, const string &customUserMessage, int pim, int hashAlg)
{
Elevate();
@@ -492,7 +469,6 @@ namespace VeraCrypt
static void BackupEfiSystemLoader () { throw ParameterIncorrect (SRC_POS); }
static void RestoreEfiSystemLoader () { throw ParameterIncorrect (SRC_POS); }
static void GetEfiBootDeviceNumber (PSTORAGE_DEVICE_NUMBER pSdn) { throw ParameterIncorrect (SRC_POS); }
- static void ReadEfiConfig (const wchar_t *filename, byte* confContent, DWORD maxSize, DWORD* pcbRead) { throw ParameterIncorrect (SRC_POS); }
static void WriteEfiBootSectorUserConfig (byte userConfig, const string &customUserMessage, int pim, int hashAlg) { throw ParameterIncorrect (SRC_POS); }
};
@@ -1530,33 +1506,6 @@ namespace VeraCrypt
}
}
- void BootEncryption::ReadEfiConfig (const wchar_t* fileName, byte* confContent, DWORD maxSize, DWORD* pcbRead)
- {
- if (!pcbRead)
- throw ParameterIncorrect (SRC_POS);
-
- if (!IsAdmin() && IsUacSupported())
- {
- Elevator::ReadEfiConfig (fileName, confContent, maxSize, pcbRead);
- }
- else
- {
- unsigned __int64 ui64Size = 0;
-
- finally_do ({ EfiBootInst.DismountBootPartition(); });
- EfiBootInst.MountBootPartition(0);
-
- EfiBootInst.GetFileSize(fileName, ui64Size);
-
- *pcbRead = (DWORD) ui64Size;
-
- if (*pcbRead > maxSize)
- throw ParameterIncorrect (SRC_POS);
-
- EfiBootInst.ReadFile (fileName, confContent, *pcbRead);
- }
- }
-
// return false when the user cancel an elevation request
bool BootEncryption::ReadBootSectorConfig (byte *config, size_t bufLength, byte *userConfig, string *customUserMessage, uint16 *bootLoaderVersion)
{
@@ -1569,7 +1518,7 @@ namespace VeraCrypt
if (config)
memset (config, 0, bufLength);
- // call ReadEfiConfig only when needed since it requires elevation
+ // call ReadESPFile only when needed since it requires elevation
if (userConfig || customUserMessage || bootLoaderVersion)
{
std::string confContent = ReadESPFile (L"\\EFI\\VeraCrypt\\DcsProp", true);
diff --git a/src/Common/BootEncryption.h b/src/Common/BootEncryption.h
index 0c4094b4..06329717 100644
--- a/src/Common/BootEncryption.h
+++ b/src/Common/BootEncryption.h
@@ -276,7 +276,6 @@ namespace VeraCrypt
void ProbeRealSystemDriveSize ();
bool ReadBootSectorConfig (byte *config, size_t bufLength, byte *userConfig = nullptr, string *customUserMessage = nullptr, uint16 *bootLoaderVersion = nullptr);
uint32 ReadDriverConfigurationFlags ();
- void ReadEfiConfig (const wchar_t* filename, byte* confContent, DWORD maxSize, DWORD* pcbRead);
void RegisterBootDriver (bool hiddenSystem);
void RegisterFilterDriver (bool registerDriver, FilterType filterType);
void RegisterSystemFavoritesService (BOOL registerService);