mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 11:08:02 -06:00
Windows: add more checks to correctly identify Microsoft original bootloader.
This commit is contained in:
@@ -3204,8 +3204,18 @@ namespace VeraCrypt
|
|||||||
// check that it is not bootmgfw.efi
|
// check that it is not bootmgfw.efi
|
||||||
if (0 != _wcsicmp (loaderPath.c_str(), L"\\EFI\\Microsoft\\Boot\\bootmgfw.efi"))
|
if (0 != _wcsicmp (loaderPath.c_str(), L"\\EFI\\Microsoft\\Boot\\bootmgfw.efi"))
|
||||||
{
|
{
|
||||||
bFound = true;
|
// look for bootmgfw.efi identifiant string
|
||||||
EfiBootInst.RenameFile(loaderPath.c_str(), L"\\EFI\\Microsoft\\Boot\\bootmgfw_ms.vc", TRUE);
|
EfiBootInst.GetFileSize(loaderPath.c_str(), loaderSize);
|
||||||
|
std::vector<byte> bootLoaderBuf ((size_t) loaderSize);
|
||||||
|
|
||||||
|
EfiBootInst.ReadFile(loaderPath.c_str(), &bootLoaderBuf[0], (DWORD) loaderSize);
|
||||||
|
|
||||||
|
// look for bootmgfw.efi identifiant string
|
||||||
|
if (BufferHasPattern (bootLoaderBuf.data (), (size_t) loaderSize, g_szMsBootString, strlen (g_szMsBootString)))
|
||||||
|
{
|
||||||
|
bFound = true;
|
||||||
|
EfiBootInst.RenameFile(loaderPath.c_str(), L"\\EFI\\Microsoft\\Boot\\bootmgfw_ms.vc", TRUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4307,7 +4317,18 @@ namespace VeraCrypt
|
|||||||
&& (0 != _wcsicmp (loaderPath.c_str(), L"\\EFI\\Microsoft\\Boot\\bootmgfw.efi"))
|
&& (0 != _wcsicmp (loaderPath.c_str(), L"\\EFI\\Microsoft\\Boot\\bootmgfw.efi"))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EfiBootInst.RenameFile(loaderPath.c_str(), L"\\EFI\\Microsoft\\Boot\\bootmgfw.efi", TRUE);
|
const char* g_szMsBootString = "bootmgfw.pdb";
|
||||||
|
unsigned __int64 loaderSize = 0;
|
||||||
|
EfiBootInst.GetFileSize(loaderPath.c_str(), loaderSize);
|
||||||
|
std::vector<byte> bootLoaderBuf ((size_t) loaderSize);
|
||||||
|
|
||||||
|
EfiBootInst.ReadFile(loaderPath.c_str(), &bootLoaderBuf[0], (DWORD) loaderSize);
|
||||||
|
|
||||||
|
// look for bootmgfw.efi identifiant string
|
||||||
|
if (BufferHasPattern (bootLoaderBuf.data (), (size_t) loaderSize, g_szMsBootString, strlen (g_szMsBootString)))
|
||||||
|
{
|
||||||
|
EfiBootInst.RenameFile(loaderPath.c_str(), L"\\EFI\\Microsoft\\Boot\\bootmgfw.efi", TRUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user