Commit graph

49 commits

Author SHA1 Message Date
Vivyy
60a6a57510
EfiDSEFix: FindCiOptions: match arbitrary r32 immediates (#156) 2026-06-17 01:48:43 +02:00
Matthijs Lavrijsen
04fb763465
EfiDSEFix: fix failure to find g_CiOptions with KB5083631
Additionally, print a more helpful error message when FindCiOptions fails.

Fixes #151
2026-05-11 18:36:18 +02:00
Matthijs Lavrijsen
c047987382
Update VS project files to VS2026 2026-04-02 07:56:28 +02:00
Matthijs Lavrijsen
5bfa808faa
Fix build with current EDK2 master
Re-add the missing headers for EFI_LEGACY_BIOS_PROTOCOL and gEfiLegacyBiosGuid which were removed from OvmfPkg in 9d4becddba.

Neither OVMF nor EfiGuard actually *needs* the CSM for anything, but being able to check for the presence of the legacy BIOS protocol is still important in order to determine if we are actually booting a legacy BIOS boot option. This allows us to then inform the user that what they are doing is not suppported and most likely a mistake.

Fixes #119
2025-01-17 04:46:34 +01:00
Matthijs Lavrijsen
b55a50a414
Fix build with current EDK2 master
Override the unwanted /GS flag addition (MSVC) and -fno-stack-protector removal (GCC) introduced in f53f029122

Additionally remove some other (less harmful but still unwanted) build flags that have been made the default in MSVC in the .vcxproj/.props files as well.

Fixes #134
2025-01-17 04:46:34 +01:00
Matthijs Lavrijsen
f3cf9d1c6b
Misc. minor warning fixes 2025-01-17 04:46:34 +01:00
Matthijs Lavrijsen
b8d787c347
Loader: do not pass load options to auto-generated boot entries 2024-01-21 07:27:42 +01:00
Matthijs Lavrijsen
620defa398
Use case-insensitive string comparison when checking file names 2024-01-21 07:25:48 +01:00
Matthijs Lavrijsen
a1c33c4ae6
Loader: close root volume handle in LocateFile() 2024-01-21 06:07:36 +01:00
Matthijs Lavrijsen
f04570f799
EfiDSEFix: do not request UAC elevation in manifest
This works around a Windows Shell issue when launching console applications that require admin elevation (this includes EfiDSEFix) from an unelevated command prompt while having UAC enabled.

Fixes #75
2023-10-14 22:02:46 +02:00
Matthijs Lavrijsen
6774173bfc
Always use CopyWpMem in SetVariable hook 2023-10-14 22:02:45 +02:00
Matthijs Lavrijsen
529537f027
Loader: make driver configuration a runtime option
The interactive driver configuration now requires the HOME key to be pressed when the loader is started. If it is not pressed, the default configuration will be used as before.
The CONFIGURE_DRIVER compile time define is no longer useful due to this change and has been removed.
2023-10-12 12:15:45 +02:00
Matthijs Lavrijsen
d9eafb77f8
Use EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL if available 2023-10-12 09:01:55 +02:00
Matthijs Lavrijsen
1eeb31ac49
Loader: report POST codes when booting 2023-10-12 03:10:56 +02:00
Matthijs Lavrijsen
bb77cca1a7
Loader: continue booting if the driver is already loaded 2023-09-25 21:17:57 +02:00
Matthijs Lavrijsen
41b17319e8
EfiDSEFix: acquire SE_DEBUG_PRIVILEGE when finding kernel addresses
Fixes #97
2023-07-31 03:54:46 +02:00
Matthijs Lavrijsen
2233c19374
EfiDSEFix: print help text on invalid usage 2023-05-31 18:19:16 +02:00
Matthijs Lavrijsen
e588a7d948
Loader: check entry descriptions to determine whether they are Windows 2023-03-26 19:10:14 +02:00
Matthijs Lavrijsen
9c35789cf8
Loader: remove BdsLibConnectAllDriversToAllControllers
EfiBootManagerConnectAll provides this functionality now.
2023-03-26 18:04:41 +02:00
Matthijs Lavrijsen
3e9c9868b0
Loader: minor SetHighestAvailableMode improvements
- Add primitive aspect ratio weighting when determining which text mode is best
- Move all uses of gST->ConOut to SetHighestAvailableTextMode and exit early if it is NULL
2023-03-26 18:04:00 +02:00
Matthijs Lavrijsen
83bb58f2f4
Loader: handle EFI_SECURITY_VIOLATION from LoadImage
This behaviour matches that of edk2's UefiBootManagerLib since edk2 commit f7fdd620e8
2023-03-26 16:36:44 +02:00
Matthijs Lavrijsen
513c08bc00
EfiDSEFix -c: error message wording
Reference: #60
2023-03-17 00:10:54 +01:00
Matthijs Lavrijsen
2f4a666beb
EfiGuardDxe: disable VBS for the current boot
This prevents a bugcheck on Windows 10 and later when VBS is enabled, which was made the default setting in Windows 11.
Additionally, EfiDSEFix will not proceed if it detects that VBS is still unexpectedly running (meaning either EfiGuardDxe was never loaded, or it failed to disable VBS).

Fixes #59
2023-03-16 18:02:47 +01:00
Matthijs Lavrijsen
741686c176
EfiDSEFix -i: print CI option values and IUM status 2023-03-13 00:15:29 +01:00
Matthijs Lavrijsen
dea33fff9f
Misc. warning fixes 2023-03-13 00:11:08 +01:00
Matthijs Lavrijsen
4ad9836d58
EfiDSEFix: add "-r" command to read the value of g_CiOptions 2023-02-27 11:04:28 +01:00
Matthijs Lavrijsen
ebfe06fe79
Update ntdll.h 2023-02-27 10:38:16 +01:00
Matthijs Lavrijsen
f7f83efed4
Misc. warning fixes 2022-08-17 08:00:41 +02:00
Matthijs Lavrijsen
c29def17dc
Update to VS2022 2022-04-21 21:41:01 +02:00
Matthijs Lavrijsen
d128e2a30b
EfiDSEFix: add /SUBSYSTEM:NATIVE project configuration
Closes #51
2022-04-21 21:03:50 +02:00
Matthijs Lavrijsen
734be74c4d
Update ntdll.h 2022-04-21 20:51:06 +02:00
Matthijs Lavrijsen
1cc497f053
EfiDSEFix: improve g_CiOptions address validation
- Verify expected lengths of instructions
- Verify CipInitialize is in PAGE
- Verify g_CiOptions is in either .data or CiPolicy

Fixes #31 (regression due to KB5003173 fix)
2021-05-25 21:08:07 +02:00
Matthijs Lavrijsen
a36292df1d
EfiDSEFix: fix BSOD on Windows 10 with KB5003173 when using '-d'
EfiDSEFix was not finding the address of CI!g_CiOptions correctly after KB5003173 changed the layout of CI!CiInitialize.

Fixes #28
2021-05-12 12:55:58 +02:00
Matthijs Lavrijsen
5c649201bb
Fix MSVC 2019 and GCC 10 warnings 2021-01-07 16:09:25 +01:00
Mattiwatti
0256353e45
Loader: call BmSetMemoryTypeInformationVariable
Note that BmSetMemoryTypeInformationVariable() is told by the loader that the image being loaded is *not* a boot application, which is a blatant lie. The reason for doing this is to prevent BmSetMemoryTypeInformationVariable() from performing a warm reset of the system due to a change in the memory type info. (Again, and again, and again...)

This is an attempt to fix S4 (hibernate) entry/resume issues; see #12.
2020-05-28 18:53:20 +02:00
Mattiwatti
9947a9fbc2
Loader: support legacy BIOS boot entries in the fallback path
Fixes #9
2020-04-25 06:33:56 +02:00
Mattiwatti
00159446da
Compile as UTF-8 2019-12-04 08:07:26 +01:00
Mattiwatti
e084160727
Disable Spectre mitigation crap 2019-10-07 07:09:16 +02:00
Mattiwatti
22cd8379cd
Update README.md 2019-10-07 06:18:45 +02:00
Mattiwatti
f9270cfb38
Fix potential recursive self-boot by Loader.efi
The EFI variable "BootCurrent" corresponds to XXXX in some variable "BootXXXX", and this value was being used to guard against recursive self-booting. However, EfiBootManagerGetLoadOptions() already returns the options sorted by the contents of the "BootOrder" variable, which means that XXXX does not necessarily correspond to the linear index in a for loop. Instead use BootOptions[Index].OptionNumber to retrieve and compare the original value of XXXX

Fixes #5
2019-07-09 22:02:57 +02:00
Mattiwatti
7702234474
EfiDSEFix: HDE64 fixes
- Make hde64_table const to prevent it from ending up in .data
- #include <intrin.h> because Clang gets confused by __stosb without it
- Fix various warnings
2019-05-30 17:36:00 +02:00
Mattiwatti
9112c308dd
Update ntdll.h 2019-05-30 17:35:05 +02:00
Mattiwatti
6dc5189d11
Minor fixes 2019-05-06 19:15:42 +02:00
Mattiwatti
21828acd65
Update to VS2019 2019-04-08 23:25:10 +02:00
Mattiwatti
d50a2aa739
EfiDSEFix: on Windows >= 8, use a different default g_CiOptions value
Fixes #1
2019-03-30 02:15:36 +01:00
Mattiwatti
f56011ea4d
EfiDSEFix: read input value for '--enable' as hex to match '--disable' 2019-03-30 02:14:23 +01:00
Mattiwatti
0769fea67c
Ensure ntdllp.lib only exports Vista-compatible symbols 2019-03-28 20:30:03 +01:00
Mattiwatti
fafb739ebe
Minor fixes 2019-03-28 20:29:12 +01:00
Mattiwatti
0be8f445b6
Initial commit 2019-03-25 20:56:43 +01:00