1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-11 11:08:02 -06:00

Windows: compatibility with multi-OS boot configuration by only setting VeraCrypt as first bootloader of the system if the current first bootloader is Windows one.

This commit is contained in:
Mounir IDRASSI
2019-11-27 00:13:25 +01:00
parent 79eea6e5b1
commit 14a477026d
3 changed files with 38 additions and 9 deletions

View File

@@ -12685,19 +12685,16 @@ void CheckFilesystem (HWND hwndDlg, int driveNo, BOOL fixErrors)
ShellExecuteW (NULL, (!IsAdmin() && IsUacSupported()) ? L"runas" : L"open", cmdPath, param, NULL, SW_SHOW);
}
BOOL BufferContainsString (const byte *buffer, size_t bufferSize, const char *str)
BOOL BufferContainsPattern (const byte *buffer, size_t bufferSize, const byte *pattern, size_t patternSize)
{
size_t strLen = strlen (str);
if (bufferSize < strLen)
if (bufferSize < patternSize)
return FALSE;
bufferSize -= strLen;
bufferSize -= patternSize;
for (size_t i = 0; i < bufferSize; ++i)
{
if (memcmp (buffer + i, str, strLen) == 0)
if (memcmp (buffer + i, pattern, patternSize) == 0)
return TRUE;
}
@@ -12705,6 +12702,17 @@ BOOL BufferContainsString (const byte *buffer, size_t bufferSize, const char *st
}
BOOL BufferContainsString (const byte *buffer, size_t bufferSize, const char *str)
{
return BufferContainsPattern (buffer, bufferSize, (const byte*) str, strlen (str));
}
BOOL BufferContainsWideString (const byte *buffer, size_t bufferSize, const wchar_t *str)
{
return BufferContainsPattern (buffer, bufferSize, (const byte*) str, 2 * wcslen (str));
}
#ifndef SETUP
int AskNonSysInPlaceEncryptionResume (HWND hwndDlg, BOOL *pbDecrypt)