VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkavsrf <kavsrf@gmail.com>2017-02-09 00:28:02 +0300
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2017-06-05 17:45:45 +0200
commit46cd09ef50bb63fa2b30b9c4f9fd284e130a46d4 (patch)
tree152e3767b8ae81a2dd6dc7e5e81e1411e02ce7e3 /src
parenta075d45a99d31340c0de57262cd18eb717c3722a (diff)
downloadVeraCrypt-46cd09ef50bb63fa2b30b9c4f9fd284e130a46d4.tar.gz
VeraCrypt-46cd09ef50bb63fa2b30b9c4f9fd284e130a46d4.zip
PlatformInfo read. (via ReadEfiConfig)
It is displayed in System settings
Diffstat (limited to 'src')
-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
-rw-r--r--src/Format/FormatCom.cpp4
-rw-r--r--src/Format/FormatCom.idl2
-rw-r--r--src/Mount/MainCom.cpp4
-rw-r--r--src/Mount/MainCom.idl2
-rw-r--r--src/Mount/Mount.c11
-rw-r--r--src/Mount/Mount.rc9
-rw-r--r--src/Mount/Resource.h4
11 files changed, 38 insertions, 24 deletions
diff --git a/src/Common/BaseCom.cpp b/src/Common/BaseCom.cpp
index 26e2650a..a73e472d 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 b103ad59..1ec9012a 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 45ba53d4..6dc2c979 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 4071a7f5..c63aa80e 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);
diff --git a/src/Format/FormatCom.cpp b/src/Format/FormatCom.cpp
index 2aa5cea9..44d93991 100644
--- a/src/Format/FormatCom.cpp
+++ b/src/Format/FormatCom.cpp
@@ -167,9 +167,9 @@ public:
return BaseCom::GetEfiBootDeviceNumber (pSdn);
}
- virtual DWORD STDMETHODCALLTYPE ReadEfiConfig (BSTR* pContent, DWORD *pcbRead)
+ virtual DWORD STDMETHODCALLTYPE ReadEfiConfig (BSTR filename, BSTR* pContent, DWORD *pcbRead)
{
- return BaseCom::ReadEfiConfig (pContent, pcbRead);
+ return BaseCom::ReadEfiConfig (filename, pContent, pcbRead);
}
virtual DWORD STDMETHODCALLTYPE WriteEfiBootSectorUserConfig (DWORD userConfig, BSTR customUserMessage, int pim, int hashAlg)
diff --git a/src/Format/FormatCom.idl b/src/Format/FormatCom.idl
index 1eb09b43..e682803e 100644
--- a/src/Format/FormatCom.idl
+++ b/src/Format/FormatCom.idl
@@ -46,7 +46,7 @@ library TrueCryptFormatCom
DWORD BackupEfiSystemLoader ();
DWORD RestoreEfiSystemLoader ();
DWORD GetEfiBootDeviceNumber (BSTR* pSdn);
- DWORD ReadEfiConfig (BSTR* pContent, DWORD *pcbRead);
+ DWORD ReadEfiConfig (BSTR filename, BSTR* pContent, DWORD *pcbRead);
DWORD WriteEfiBootSectorUserConfig (DWORD userConfig, BSTR customUserMessage, int pim, int hashAlg);
};
diff --git a/src/Mount/MainCom.cpp b/src/Mount/MainCom.cpp
index 6056697c..13e1e67a 100644
--- a/src/Mount/MainCom.cpp
+++ b/src/Mount/MainCom.cpp
@@ -188,9 +188,9 @@ public:
return BaseCom::GetEfiBootDeviceNumber (pSdn);
}
- virtual DWORD STDMETHODCALLTYPE ReadEfiConfig (BSTR* pContent, DWORD *pcbRead)
+ virtual DWORD STDMETHODCALLTYPE ReadEfiConfig (BSTR filename, BSTR* pContent, DWORD *pcbRead)
{
- return BaseCom::ReadEfiConfig (pContent, pcbRead);
+ return BaseCom::ReadEfiConfig (filename, pContent, pcbRead);
}
virtual DWORD STDMETHODCALLTYPE WriteEfiBootSectorUserConfig (DWORD userConfig, BSTR customUserMessage, int pim, int hashAlg)
diff --git a/src/Mount/MainCom.idl b/src/Mount/MainCom.idl
index 9c3ef372..3b1c62d8 100644
--- a/src/Mount/MainCom.idl
+++ b/src/Mount/MainCom.idl
@@ -50,7 +50,7 @@ library TrueCryptMainCom
DWORD BackupEfiSystemLoader ();
DWORD RestoreEfiSystemLoader ();
DWORD GetEfiBootDeviceNumber (BSTR* pSdn);
- DWORD ReadEfiConfig (BSTR* pContent, DWORD *pcbRead);
+ DWORD ReadEfiConfig (BSTR filename, BSTR* pContent, DWORD *pcbRead);
DWORD WriteEfiBootSectorUserConfig (DWORD userConfig, BSTR customUserMessage, int pim, int hashAlg);
};
diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c
index 50f6e8f0..6c1aeedf 100644
--- a/src/Mount/Mount.c
+++ b/src/Mount/Mount.c
@@ -10916,6 +10916,17 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA
return 1;
}
+ byte platforminfo[10*1024];
+ platforminfo[0] = 0;
+ DWORD cbread;
+ try
+ {
+ BootEncObj->ReadEfiConfig(L"\\EFI\\VeraCrypt\\PlatformInfo", platforminfo, 10*1024 - 1, &cbread);
+ platforminfo[cbread - 1] = 0;
+ }
+ catch (Exception &e) { }
+ SetDlgItemTextA (hwndDlg, IDC_PLATFORMINFO, (char*)platforminfo);
+
try
{
LocalizeDialog (hwndDlg, "IDD_SYSENC_SETTINGS");
diff --git a/src/Mount/Mount.rc b/src/Mount/Mount.rc
index ff2ab845..2b703f07 100644
--- a/src/Mount/Mount.rc
+++ b/src/Mount/Mount.rc
@@ -285,15 +285,15 @@ BEGIN
LTEXT "",IDT_PKCS11_LIB_HELP,16,63,286,65
END
-IDD_EFI_SYSENC_SETTINGS DIALOGEX 0, 0, 370, 139
+IDD_EFI_SYSENC_SETTINGS DIALOGEX 0, 0, 370, 245
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "VeraCrypt - System Encryption Settings"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "&Cache pre-boot authentication password in driver memory (for mounting of non-system volumes)",IDC_BOOT_LOADER_CACHE_PASSWORD,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,79,339,10
- DEFPUSHBUTTON "OK",IDOK,257,115,50,14
- PUSHBUTTON "Cancel",IDCANCEL,313,115,50,14
+ DEFPUSHBUTTON "OK",IDOK,267,225,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,318,225,50,14
GROUPBOX "Boot Loader Screen Options",IDT_BOOT_LOADER_SCREEN_OPTIONS,8,7,355,53
GROUPBOX "Security Options",IDT_SECURITY_OPTIONS,8,64,355,44
CONTROL "Include PIM when caching pre-boot authentication password",IDC_BOOT_LOADER_CACHE_PIM,
@@ -302,6 +302,7 @@ BEGIN
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,20,339,9
CONTROL "Do not request Hash algorithm in the pre-boot authentication screen",IDC_DISABLE_BOOT_LOADER_HASH_PROMPT,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,35,339,9
+ EDITTEXT IDC_PLATFORMINFO,9,111,351,111,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | WS_VSCROLL | WS_HSCROLL
END
IDD_PERFORMANCE_SETTINGS DIALOGEX 0, 0, 370, 248
@@ -483,7 +484,7 @@ BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 363
TOPMARGIN, 7
- BOTTOMMARGIN, 129
+ BOTTOMMARGIN, 235
END
IDD_PERFORMANCE_SETTINGS, DIALOG
diff --git a/src/Mount/Resource.h b/src/Mount/Resource.h
index 0c863386..83e30b2d 100644
--- a/src/Mount/Resource.h
+++ b/src/Mount/Resource.h
@@ -184,6 +184,8 @@
#define IDC_HIDE_WAITING_DIALOG 1161
#define IDC_DISABLE_BOOT_LOADER_HASH_PROMPT 1162
#define IDC_SECURE_DESKTOP_PASSWORD_ENTRY 1163
+#define IDB_PLATFORMINFO 1164
+#define IDC_PLATFORMINFO 1165
#define IDM_HELP 40001
#define IDM_ABOUT 40002
#define IDM_UNMOUNT_VOLUME 40003
@@ -260,7 +262,7 @@
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 120
#define _APS_NEXT_COMMAND_VALUE 40069
-#define _APS_NEXT_CONTROL_VALUE 1164
+#define _APS_NEXT_CONTROL_VALUE 1166
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif