mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 11:08:02 -06:00
Windows: Remove unused method ReadEfiConfig
This commit is contained in:
@@ -400,34 +400,6 @@ DWORD BaseCom::GetEfiBootDeviceNumber (BSTR* pSdn)
|
|||||||
return ERROR_SUCCESS;
|
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)
|
DWORD BaseCom::WriteEfiBootSectorUserConfig (DWORD userConfig, BSTR customUserMessage, int pim, int hashAlg)
|
||||||
{
|
{
|
||||||
if (!customUserMessage)
|
if (!customUserMessage)
|
||||||
|
|||||||
@@ -116,7 +116,6 @@ public:
|
|||||||
static DWORD BackupEfiSystemLoader ();
|
static DWORD BackupEfiSystemLoader ();
|
||||||
static DWORD RestoreEfiSystemLoader ();
|
static DWORD RestoreEfiSystemLoader ();
|
||||||
static DWORD GetEfiBootDeviceNumber (BSTR* pSdn);
|
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);
|
static DWORD WriteEfiBootSectorUserConfig (DWORD userConfig, BSTR customUserMessage, int pim, int hashAlg);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
static void WriteEfiBootSectorUserConfig (byte userConfig, const string &customUserMessage, int pim, int hashAlg)
|
||||||
{
|
{
|
||||||
Elevate();
|
Elevate();
|
||||||
@@ -492,7 +469,6 @@ namespace VeraCrypt
|
|||||||
static void BackupEfiSystemLoader () { throw ParameterIncorrect (SRC_POS); }
|
static void BackupEfiSystemLoader () { throw ParameterIncorrect (SRC_POS); }
|
||||||
static void RestoreEfiSystemLoader () { throw ParameterIncorrect (SRC_POS); }
|
static void RestoreEfiSystemLoader () { throw ParameterIncorrect (SRC_POS); }
|
||||||
static void GetEfiBootDeviceNumber (PSTORAGE_DEVICE_NUMBER pSdn) { 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); }
|
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
|
// return false when the user cancel an elevation request
|
||||||
bool BootEncryption::ReadBootSectorConfig (byte *config, size_t bufLength, byte *userConfig, string *customUserMessage, uint16 *bootLoaderVersion)
|
bool BootEncryption::ReadBootSectorConfig (byte *config, size_t bufLength, byte *userConfig, string *customUserMessage, uint16 *bootLoaderVersion)
|
||||||
{
|
{
|
||||||
@@ -1569,7 +1518,7 @@ namespace VeraCrypt
|
|||||||
if (config)
|
if (config)
|
||||||
memset (config, 0, bufLength);
|
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)
|
if (userConfig || customUserMessage || bootLoaderVersion)
|
||||||
{
|
{
|
||||||
std::string confContent = ReadESPFile (L"\\EFI\\VeraCrypt\\DcsProp", true);
|
std::string confContent = ReadESPFile (L"\\EFI\\VeraCrypt\\DcsProp", true);
|
||||||
|
|||||||
@@ -276,7 +276,6 @@ namespace VeraCrypt
|
|||||||
void ProbeRealSystemDriveSize ();
|
void ProbeRealSystemDriveSize ();
|
||||||
bool ReadBootSectorConfig (byte *config, size_t bufLength, byte *userConfig = nullptr, string *customUserMessage = nullptr, uint16 *bootLoaderVersion = nullptr);
|
bool ReadBootSectorConfig (byte *config, size_t bufLength, byte *userConfig = nullptr, string *customUserMessage = nullptr, uint16 *bootLoaderVersion = nullptr);
|
||||||
uint32 ReadDriverConfigurationFlags ();
|
uint32 ReadDriverConfigurationFlags ();
|
||||||
void ReadEfiConfig (const wchar_t* filename, byte* confContent, DWORD maxSize, DWORD* pcbRead);
|
|
||||||
void RegisterBootDriver (bool hiddenSystem);
|
void RegisterBootDriver (bool hiddenSystem);
|
||||||
void RegisterFilterDriver (bool registerDriver, FilterType filterType);
|
void RegisterFilterDriver (bool registerDriver, FilterType filterType);
|
||||||
void RegisterSystemFavoritesService (BOOL registerService);
|
void RegisterSystemFavoritesService (BOOL registerService);
|
||||||
|
|||||||
@@ -167,11 +167,6 @@ public:
|
|||||||
return BaseCom::GetEfiBootDeviceNumber (pSdn);
|
return BaseCom::GetEfiBootDeviceNumber (pSdn);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual DWORD STDMETHODCALLTYPE ReadEfiConfig (BSTR filename, BSTR* pContent, DWORD *pcbRead)
|
|
||||||
{
|
|
||||||
return BaseCom::ReadEfiConfig (filename, pContent, pcbRead);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual DWORD STDMETHODCALLTYPE WriteEfiBootSectorUserConfig (DWORD userConfig, BSTR customUserMessage, int pim, int hashAlg)
|
virtual DWORD STDMETHODCALLTYPE WriteEfiBootSectorUserConfig (DWORD userConfig, BSTR customUserMessage, int pim, int hashAlg)
|
||||||
{
|
{
|
||||||
return BaseCom::WriteEfiBootSectorUserConfig (userConfig, customUserMessage,pim, hashAlg);
|
return BaseCom::WriteEfiBootSectorUserConfig (userConfig, customUserMessage,pim, hashAlg);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import "..\Common\Password.h";
|
|||||||
[
|
[
|
||||||
uuid(56327DDA-F1A7-4e13-B128-520D129BDEF6),
|
uuid(56327DDA-F1A7-4e13-B128-520D129BDEF6),
|
||||||
helpstring("VeraCrypt Format UAC Support Library"),
|
helpstring("VeraCrypt Format UAC Support Library"),
|
||||||
version(2.6) // Update ComSetup.cpp when changing version number
|
version(2.7) // Update ComSetup.cpp when changing version number
|
||||||
]
|
]
|
||||||
library TrueCryptFormatCom
|
library TrueCryptFormatCom
|
||||||
{
|
{
|
||||||
@@ -46,7 +46,6 @@ library TrueCryptFormatCom
|
|||||||
DWORD BackupEfiSystemLoader ();
|
DWORD BackupEfiSystemLoader ();
|
||||||
DWORD RestoreEfiSystemLoader ();
|
DWORD RestoreEfiSystemLoader ();
|
||||||
DWORD GetEfiBootDeviceNumber (BSTR* pSdn);
|
DWORD GetEfiBootDeviceNumber (BSTR* pSdn);
|
||||||
DWORD ReadEfiConfig (BSTR filename, BSTR* pContent, DWORD *pcbRead);
|
|
||||||
DWORD WriteEfiBootSectorUserConfig (DWORD userConfig, BSTR customUserMessage, int pim, int hashAlg);
|
DWORD WriteEfiBootSectorUserConfig (DWORD userConfig, BSTR customUserMessage, int pim, int hashAlg);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -188,11 +188,6 @@ public:
|
|||||||
return BaseCom::GetEfiBootDeviceNumber (pSdn);
|
return BaseCom::GetEfiBootDeviceNumber (pSdn);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual DWORD STDMETHODCALLTYPE ReadEfiConfig (BSTR filename, BSTR* pContent, DWORD *pcbRead)
|
|
||||||
{
|
|
||||||
return BaseCom::ReadEfiConfig (filename, pContent, pcbRead);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual DWORD STDMETHODCALLTYPE WriteEfiBootSectorUserConfig (DWORD userConfig, BSTR customUserMessage, int pim, int hashAlg)
|
virtual DWORD STDMETHODCALLTYPE WriteEfiBootSectorUserConfig (DWORD userConfig, BSTR customUserMessage, int pim, int hashAlg)
|
||||||
{
|
{
|
||||||
return BaseCom::WriteEfiBootSectorUserConfig (userConfig, customUserMessage,pim, hashAlg);
|
return BaseCom::WriteEfiBootSectorUserConfig (userConfig, customUserMessage,pim, hashAlg);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import "..\Common\Password.h";
|
|||||||
[
|
[
|
||||||
uuid(9ACF6176-5FC4-4690-A025-B3306A50EB6A),
|
uuid(9ACF6176-5FC4-4690-A025-B3306A50EB6A),
|
||||||
helpstring("VeraCrypt Main UAC Support Library"),
|
helpstring("VeraCrypt Main UAC Support Library"),
|
||||||
version(2.8) // Update ComSetup.cpp when changing version number
|
version(2.9) // Update ComSetup.cpp when changing version number
|
||||||
]
|
]
|
||||||
library TrueCryptMainCom
|
library TrueCryptMainCom
|
||||||
{
|
{
|
||||||
@@ -50,7 +50,6 @@ library TrueCryptMainCom
|
|||||||
DWORD BackupEfiSystemLoader ();
|
DWORD BackupEfiSystemLoader ();
|
||||||
DWORD RestoreEfiSystemLoader ();
|
DWORD RestoreEfiSystemLoader ();
|
||||||
DWORD GetEfiBootDeviceNumber (BSTR* pSdn);
|
DWORD GetEfiBootDeviceNumber (BSTR* pSdn);
|
||||||
DWORD ReadEfiConfig (BSTR filename, BSTR* pContent, DWORD *pcbRead);
|
|
||||||
DWORD WriteEfiBootSectorUserConfig (DWORD userConfig, BSTR customUserMessage, int pim, int hashAlg);
|
DWORD WriteEfiBootSectorUserConfig (DWORD userConfig, BSTR customUserMessage, int pim, int hashAlg);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -11,10 +11,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define TC_MAIN_COM_VERSION_MAJOR 2
|
#define TC_MAIN_COM_VERSION_MAJOR 2
|
||||||
#define TC_MAIN_COM_VERSION_MINOR 8
|
#define TC_MAIN_COM_VERSION_MINOR 9
|
||||||
|
|
||||||
#define TC_FORMAT_COM_VERSION_MAJOR 2
|
#define TC_FORMAT_COM_VERSION_MAJOR 2
|
||||||
#define TC_FORMAT_COM_VERSION_MINOR 6
|
#define TC_FORMAT_COM_VERSION_MINOR 7
|
||||||
|
|
||||||
#include <atlbase.h>
|
#include <atlbase.h>
|
||||||
#include <comdef.h>
|
#include <comdef.h>
|
||||||
@@ -39,12 +39,10 @@ extern "C" BOOL RegisterComServers (wchar_t *modulePath)
|
|||||||
UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR, 0, SYS_WIN32);
|
UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR, 0, SYS_WIN32);
|
||||||
UnRegisterTypeLib (LIBID_TrueCryptFormatCom, TC_FORMAT_COM_VERSION_MAJOR, TC_FORMAT_COM_VERSION_MINOR, 0, SYS_WIN32);
|
UnRegisterTypeLib (LIBID_TrueCryptFormatCom, TC_FORMAT_COM_VERSION_MAJOR, TC_FORMAT_COM_VERSION_MINOR, 0, SYS_WIN32);
|
||||||
// unregister older versions that may still exist
|
// unregister older versions that may still exist
|
||||||
UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-4, 0, SYS_WIN32);
|
for (WORD i = 5; i >= 1; i--)
|
||||||
UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-3, 0, SYS_WIN32);
|
UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-i, 0, SYS_WIN32);
|
||||||
UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-2, 0, SYS_WIN32);
|
for (WORD i = 3; i >= 1; i--)
|
||||||
UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-1, 0, SYS_WIN32);
|
UnRegisterTypeLib (LIBID_TrueCryptFormatCom, TC_FORMAT_COM_VERSION_MAJOR, TC_FORMAT_COM_VERSION_MINOR-i, 0, SYS_WIN32);
|
||||||
UnRegisterTypeLib (LIBID_TrueCryptFormatCom, TC_FORMAT_COM_VERSION_MAJOR, TC_FORMAT_COM_VERSION_MINOR-2, 0, SYS_WIN32);
|
|
||||||
UnRegisterTypeLib (LIBID_TrueCryptFormatCom, TC_FORMAT_COM_VERSION_MAJOR, TC_FORMAT_COM_VERSION_MINOR-1, 0, SYS_WIN32);
|
|
||||||
|
|
||||||
wchar_t setupModule[MAX_PATH];
|
wchar_t setupModule[MAX_PATH];
|
||||||
GetModuleFileNameW (NULL, setupModule, sizeof (setupModule) / sizeof (setupModule[0]));
|
GetModuleFileNameW (NULL, setupModule, sizeof (setupModule) / sizeof (setupModule[0]));
|
||||||
@@ -80,13 +78,10 @@ extern "C" BOOL UnregisterComServers (wchar_t *modulePath)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// unregister older versions that may still exist
|
// unregister older versions that may still exist
|
||||||
UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-4, 0, SYS_WIN32);
|
for (WORD i = 5; i >= 1; i--)
|
||||||
UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-3, 0, SYS_WIN32);
|
UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-i, 0, SYS_WIN32);
|
||||||
UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-3, 0, SYS_WIN32);
|
for (WORD i = 3; i >= 1; i--)
|
||||||
UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-2, 0, SYS_WIN32);
|
UnRegisterTypeLib (LIBID_TrueCryptFormatCom, TC_FORMAT_COM_VERSION_MAJOR, TC_FORMAT_COM_VERSION_MINOR-i, 0, SYS_WIN32);
|
||||||
UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-1, 0, SYS_WIN32);
|
|
||||||
UnRegisterTypeLib (LIBID_TrueCryptFormatCom, TC_FORMAT_COM_VERSION_MAJOR, TC_FORMAT_COM_VERSION_MINOR-2, 0, SYS_WIN32);
|
|
||||||
UnRegisterTypeLib (LIBID_TrueCryptFormatCom, TC_FORMAT_COM_VERSION_MAJOR, TC_FORMAT_COM_VERSION_MINOR-1, 0, SYS_WIN32);
|
|
||||||
|
|
||||||
wchar_t module[1024];
|
wchar_t module[1024];
|
||||||
CRegObject ro;
|
CRegObject ro;
|
||||||
|
|||||||
Reference in New Issue
Block a user