VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common
diff options
context:
space:
mode:
authorkavsrf <kavsrf@gmail.com>2017-02-08 21:28:02 (GMT)
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2017-06-05 15:45:45 (GMT)
commit46cd09ef50bb63fa2b30b9c4f9fd284e130a46d4 (patch)
tree152e3767b8ae81a2dd6dc7e5e81e1411e02ce7e3 /src/Common
parenta075d45a99d31340c0de57262cd18eb717c3722a (diff)
downloadVeraCrypt-46cd09ef50bb63fa2b30b9c4f9fd284e130a46d4.zip
VeraCrypt-46cd09ef50bb63fa2b30b9c4f9fd284e130a46d4.tar.gz
PlatformInfo read. (via ReadEfiConfig)
It is displayed in System settings
Diffstat (limited to 'src/Common')
-rw-r--r--src/Common/BaseCom.cpp4
-rw-r--r--src/Common/BaseCom.h2
-rw-r--r--src/Common/BootEncryption.cpp18
-rw-r--r--src/Common/BootEncryption.h2
4 files changed, 13 insertions, 13 deletions
diff --git a/src/Common/BaseCom.cpp b/src/Common/BaseCom.cpp
index 26e2650..a73e472 100644
--- a/src/Common/BaseCom.cpp
+++ b/src/Common/BaseCom.cpp
@@ -400,7 +400,7 @@ DWORD BaseCom::GetEfiBootDeviceNumber (BSTR* pSdn)
return ERROR_SUCCESS;
}
-DWORD BaseCom::ReadEfiConfig (BSTR* pContent, DWORD *pcbRead)
+DWORD BaseCom::ReadEfiConfig (BSTR filename, BSTR* pContent, DWORD *pcbRead)
{
if (!pContent || !(*pContent))
return ERROR_INVALID_PARAMETER;
@@ -409,7 +409,7 @@ DWORD BaseCom::ReadEfiConfig (BSTR* pContent, DWORD *pcbRead)
{
DWORD maxSize = ((DWORD *) ((BYTE *) *pContent))[-1];
BootEncryption bootEnc (NULL);
- bootEnc.ReadEfiConfig ((byte*) *pContent, maxSize, pcbRead);
+ bootEnc.ReadEfiConfig (filename, (byte*) *pContent, maxSize, pcbRead);
}
catch (SystemException &)
{
diff --git a/src/Common/BaseCom.h b/src/Common/BaseCom.h
index b103ad5..1ec9012 100644
--- a/src/Common/BaseCom.h
+++ b/src/Common/BaseCom.h
@@ -116,7 +116,7 @@ public:
static DWORD BackupEfiSystemLoader ();
static DWORD RestoreEfiSystemLoader ();
static DWORD GetEfiBootDeviceNumber (BSTR* pSdn);
- static DWORD ReadEfiConfig (BSTR* pContent, DWORD *pcbRead);
+ 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 45ba53d..6dc2c97 100644
--- a/src/Common/BootEncryption.cpp
+++ b/src/Common/BootEncryption.cpp
@@ -372,7 +372,7 @@ namespace VeraCrypt
}
}
- static void ReadEfiConfig (byte* confContent, DWORD maxSize, DWORD* pcbRead)
+ static void ReadEfiConfig (const wchar_t *filename, byte* confContent, DWORD maxSize, DWORD* pcbRead)
{
Elevate();
@@ -382,8 +382,8 @@ namespace VeraCrypt
SetLastError (ERROR_INVALID_PARAMETER);
throw SystemException(SRC_POS);
}
-
- DWORD result = ElevatedComInstance->ReadEfiConfig (&outputBstr, pcbRead);
+ BSTR bstrfn = W2BSTR(filename);
+ DWORD result = ElevatedComInstance->ReadEfiConfig (bstrfn, &outputBstr, pcbRead);
if (confContent)
memcpy (confContent, *(void **) &outputBstr, maxSize);
@@ -492,7 +492,7 @@ 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 (byte* confContent, DWORD maxSize, DWORD* pcbRead) { 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,14 +1530,14 @@ namespace VeraCrypt
}
}
- void BootEncryption::ReadEfiConfig (byte* confContent, DWORD maxSize, DWORD* pcbRead)
+ void BootEncryption::ReadEfiConfig (const wchar_t* fileName, byte* confContent, DWORD maxSize, DWORD* pcbRead)
{
if (!pcbRead)
throw ParameterIncorrect (SRC_POS);
if (!IsAdmin() && IsUacSupported())
{
- Elevator::ReadEfiConfig (confContent, maxSize, pcbRead);
+ Elevator::ReadEfiConfig (fileName, confContent, maxSize, pcbRead);
}
else
{
@@ -1546,14 +1546,14 @@ namespace VeraCrypt
finally_do ({ EfiBootInst.DismountBootPartition(); });
EfiBootInst.MountBootPartition(0);
- EfiBootInst.GetFileSize(L"\\EFI\\VeraCrypt\\DcsProp", ui64Size);
+ EfiBootInst.GetFileSize(fileName, ui64Size);
*pcbRead = (DWORD) ui64Size;
if (*pcbRead > maxSize)
throw ParameterIncorrect (SRC_POS);
- EfiBootInst.ReadFile (L"\\EFI\\VeraCrypt\\DcsProp", confContent, *pcbRead);
+ EfiBootInst.ReadFile (fileName, confContent, *pcbRead);
}
}
@@ -1575,7 +1575,7 @@ namespace VeraCrypt
// call ReadEfiConfig only when needed since it requires elevation
if (userConfig || customUserMessage || bootLoaderVersion)
{
- ReadEfiConfig (confContent, sizeof (confContent) - 1, &dwSize);
+ ReadEfiConfig (L"\\EFI\\VeraCrypt\\DcsProp", confContent, sizeof (confContent) - 1, &dwSize);
confContent[dwSize] = 0;
diff --git a/src/Common/BootEncryption.h b/src/Common/BootEncryption.h
index 4071a7f..c63aa80 100644
--- a/src/Common/BootEncryption.h
+++ b/src/Common/BootEncryption.h
@@ -270,7 +270,7 @@ namespace VeraCrypt
void ProbeRealSystemDriveSize ();
bool ReadBootSectorConfig (byte *config, size_t bufLength, byte *userConfig = nullptr, string *customUserMessage = nullptr, uint16 *bootLoaderVersion = nullptr);
uint32 ReadDriverConfigurationFlags ();
- void ReadEfiConfig (byte* confContent, DWORD maxSize, DWORD* pcbRead);
+ 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);