From a7cbb60ebfa3089922138f083b9828205838f157 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Tue, 7 May 2024 19:26:03 +0200 Subject: [PATCH] [SETUPLIB] Don't flag freeldr.ini as read-only during installation. CORE-19575 For the time being, don't add read-only attribute for ease of testing and modifying files, but it won't always stay this way. For example, Windows sets its boot.ini (as well as NTLDR, NTDETECT.COM etc.) as read-only (+ hidden and system) during its 1st-stage setup. 2nd-stage setup makes some adjustments in boot.ini but doesn't restore its read-only attribute. Windows tools that can modify boot.ini (i.e. msconfig.exe, bootcfg.exe, and sysdm.cpl) **ALL** know how to remove the read-only attribute for modifying boot.ini, before restoring it if needed. --- base/setup/lib/utils/bldrsup.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/base/setup/lib/utils/bldrsup.c b/base/setup/lib/utils/bldrsup.c index af3acfd042c..ad13cbe51df 100644 --- a/base/setup/lib/utils/bldrsup.c +++ b/base/setup/lib/utils/bldrsup.c @@ -860,7 +860,13 @@ CloseIniBootLoaderStore( /* Re-protect the INI file */ FileAttribs = ProtectAttribs; - /*Status =*/ ProtectFile(BootStore->FileHandle, ProtectAttribs, &FileAttribs); + if (BootStore->Header.Type == FreeLdr) + { + // NOTE: CORE-19575: For the time being, don't add READONLY for ease + // of testing and modifying files, but it won't always stay this way. + FileAttribs &= ~FILE_ATTRIBUTE_READONLY; + } + /*Status =*/ ProtectFile(BootStore->FileHandle, FileAttribs, &FileAttribs); Status = STATUS_SUCCESS; // Ignore the status and just succeed. Quit: