]> code.delx.au - refind/commitdiff
Added "windows_recovery" option to "showtools" token and
authorsrs5694 <srs5694@users.sourceforge.net>
Wed, 1 Jan 2014 00:45:24 +0000 (19:45 -0500)
committersrs5694 <srs5694@users.sourceforge.net>
Wed, 1 Jan 2014 00:45:24 +0000 (19:45 -0500)
"windows_recovery_files" option.

docs/refind/configfile.html
refind.conf-sample
refind/config.c
refind/config.h
refind/global.h
refind/icns.c
refind/icns.h
refind/main.c

index d2ec210ec4f72db40c82b6fa7501551bf4408f38..94a5b70278782f8c4418fbfc47b0b4d2e01cad61 100644 (file)
@@ -246,7 +246,7 @@ timeout 20
 <tr>
    <td><tt>showtools</tt></td>
    <td><tt>shell</tt>, <tt>memtest</tt>, <tt>gptsync</tt>, <tt>apple_recovery</tt>, <tt>mok_tool</tt>, <tt>about</tt>, <tt>exit</tt>, <tt>shutdown</tt>, <tt>reboot</tt>, and <tt>firmware</tt></td>
-   <td>Specifies which tool tags to display on the second row. <tt>shell</tt> launches an EFI shell, <tt>memtest</tt> (or <tt>memtest86</tt> launches the <a href="http://www.memtest86.com/download.htm">Memtest86</a> program, <tt>gptsync</tt> launches a tool that creates a hybrid MBR, <tt>apple_recovery</tt> boots the OS X Recovery HD, <tt>mok_tool</tt> launches a tool to manage Machine Owner Keys (MOKs) on systems with Secure Boot active, <tt>about</tt> displays information about the program, <tt>exit</tt> terminates rEFInd, <tt>shutdown</tt> shuts down the computer (or reboots it, on some UEFI PCs), <tt>reboot</tt> reboots the computer, and <tt>firmware</tt> reboots the computer into the computer's own setup utility. The tags appear in the order in which you specify them. The default is <tt>shell, memtest, apple_recovery, mok_tool, about, shutdown, reboot, firmware</tt>. Note that the <tt>shell</tt>, <tt>memtest</tt>, <tt>apple_recovery</tt>, and <tt>mok_tool</tt> options all require the presence of programs not included with rEFInd. The <tt>gptsync</tt> option requires use of a like-named program which, although it ships with rEFInd 0.6.9 and later, is not installed by default except under OS X. See the <a href="installing.html#addons">"Installing Additional Components"</a> section of the <a href="installing.html">Installing rEFInd</a> page for pointers to the shell, Memtest86, and <tt>gptsync</tt> programs. The <tt>apple_recovery</tt> option will appear only if you've got an Apple Recovery HD partition (which has a boot loader called <tt>com.apple.recovery.boot/boot.efi</tt>). The <tt>firmware</tt> option works only on computers that support this option; on other computers, the option is quietly ignored. See the <a href="secureboot.html">Secure Boot</a> page for information on Secure Boot and MOK management.</td>
+   <td>Specifies which tool tags to display on the second row. <tt>shell</tt> launches an EFI shell, <tt>memtest</tt> (or <tt>memtest86</tt> launches the <a href="http://www.memtest86.com/download.htm">Memtest86</a> program, <tt>gptsync</tt> launches a tool that creates a hybrid MBR, <tt>apple_recovery</tt> boots the OS X Recovery HD, <tt>windows_recovery</tt> boots a Windows recovery tool, <tt>mok_tool</tt> launches a tool to manage Machine Owner Keys (MOKs) on systems with Secure Boot active, <tt>about</tt> displays information about the program, <tt>exit</tt> terminates rEFInd, <tt>shutdown</tt> shuts down the computer (or reboots it, on some UEFI PCs), <tt>reboot</tt> reboots the computer, and <tt>firmware</tt> reboots the computer into the computer's own setup utility. The tags appear in the order in which you specify them. The default is <tt>shell, memtest, apple_recovery, mok_tool, about, shutdown, reboot, firmware</tt>. Note that the <tt>shell</tt>, <tt>memtest</tt>, <tt>apple_recovery</tt>, and <tt>mok_tool</tt> options all require the presence of programs not included with rEFInd. The <tt>gptsync</tt> option requires use of a like-named program which, although it ships with rEFInd 0.6.9 and later, is not installed by default except under OS X. See the <a href="installing.html#addons">"Installing Additional Components"</a> section of the <a href="installing.html">Installing rEFInd</a> page for pointers to the shell, Memtest86, and <tt>gptsync</tt> programs. The <tt>apple_recovery</tt> option will appear only if you've got an Apple Recovery HD partition (which has a boot loader called <tt>com.apple.recovery.boot/boot.efi</tt>). The <tt>firmware</tt> option works only on computers that support this option; on other computers, the option is quietly ignored. See the <a href="secureboot.html">Secure Boot</a> page for information on Secure Boot and MOK management.</td>
 </tr>
 <tr>
    <td><tt>font</tt></td>
@@ -308,6 +308,11 @@ timeout 20
    <td>filename(s)</td>
    <td>Adds the specified filename or filenames to a filename "blacklist"&mdash;these files are <i>not</i> included as boot loader options even if they're found on the disk. This is useful to exclude support programs (such as <tt>shim.efi</tt> and <tt>MokManager.efi</tt>) and drivers from your OS list. The default value is <tt>shim.efi, shim-fedora.efi, PreLoader.efi, TextMode.efi, ebounce.efi, GraphicsConsole.efi, MokManager.efi, HashTool.efi, HashTool-signed.efi</tt>. To add files to the default list rather than replace the list, specify <tt>+</tt> as the first option, as in <tt>dont_scan_files + badloader.efi</tt>.</td>
 </tr>
+<tr>
+   <td><tt>windows_recovery_files</tt></td>
+   <td>filename(s)</td>
+   <td>Adds the specified filename or filenames to list that will be recognized as Windows recovery tools and presented as such on the second row, if <tt>windows_recovery</tt> is among the options to <tt>showtools</tt>. The filename must include a complete path and may optionally include a filesystem label, as in <tt>LRS_EFI:\EFI\Microsoft\Boot\LrsBootmgr.efi</tt>.</td>
+</tr>
 <tr>
    <td><tt>scan_all_linux_kernels</tt></td>
    <td>none or <tt>0</tt></td>
index c8f2a5db331e8c909bb14cfbe4fce10ad7087380..15beb1fb4907e2e5f1b6a679ef882fe299b5a41d 100644 (file)
@@ -132,26 +132,33 @@ timeout 20
 
 # Which non-bootloader tools to show on the tools line, and in what
 # order to display them:
-#  shell           - the EFI shell (requires external program; see rEFInd
-#                    documentation for details)
-#  memtest         - the memtest86 program, in EFI/tools, EFI/memtest86,
-#                    EFI/memtest, EFI/tools/memtest86, or EFI/tools/memtest
-#  gptsync         - the (dangerous) gptsync.efi utility (requires external
-#                    program; see rEFInd documentation for details)
-#  apple_recovery  - boots the Apple Recovery HD partition, if present
-#  mok_tool        - makes available the Machine Owner Key (MOK) maintenance
-#                    tool, MokManager.efi, used on Secure Boot systems
-#  about           - an "about this program" option
-#  exit            - a tag to exit from rEFInd
-#  shutdown        - shuts down the computer (a bug causes this to reboot
-#                    many UEFI systems)
-#  reboot          - a tag to reboot the computer
-#  firmware        - a tag to reboot the computer into the firmware's
-#                    user interface (ignored on older computers)
+#  shell            - the EFI shell (requires external program; see rEFInd
+#                     documentation for details)
+#  memtest          - the memtest86 program, in EFI/tools, EFI/memtest86,
+#                     EFI/memtest, EFI/tools/memtest86, or EFI/tools/memtest
+#  gptsync          - the (dangerous) gptsync.efi utility (requires external
+#                     program; see rEFInd documentation for details)
+#  apple_recovery   - boots the Apple Recovery HD partition, if present
+#  windows_recovery - boots an OEM Windows recovery tool, if present
+#                     (see also the windows_recovery_files option)
+#  mok_tool         - makes available the Machine Owner Key (MOK) maintenance
+#                     tool, MokManager.efi, used on Secure Boot systems
+#  about            - an "about this program" option
+#  exit             - a tag to exit from rEFInd
+#  shutdown         - shuts down the computer (a bug causes this to reboot
+#                     many UEFI systems)
+#  reboot           - a tag to reboot the computer
+#  firmware         - a tag to reboot the computer into the firmware's
+#                     user interface (ignored on older computers)
 # Default is shell,memtest,apple_recovery,mok_tool,about,shutdown,reboot,firmware
 #
 #showtools shell, memtest, mok_tool, about, reboot, exit, firmware
 
+# Boot loaders that can launch a Windows restore or emergency system.
+# These tend to be OEM-specific.
+#
+#windows_recovery_files LRS_ESP:/EFI/Microsoft/Boot/LrsBootmgr.efi
+
 # Directories in which to search for EFI drivers. These drivers can
 # provide filesystem support, give access to hard disks on plug-in
 # controllers, etc. In most cases none are needed, but if you add
@@ -206,7 +213,7 @@ timeout 20
 # label, which you can obtain in an EFI shell by typing "vol", from
 # Linux by typing "blkid /dev/{devicename}", or by examining the
 # disk's label in various OSes' file browsers.
-# The default is "Recovery HD".
+# The default is "Recovery HD,LRS_ESP".
 #
 #dont_scan_volumes "Recovery HD"
 
@@ -238,7 +245,9 @@ timeout 20
 # set of tools. Most notably, MokManager.efi is in this blacklist,
 # but will show up as a tool if present in certain directories. You
 # can control the tools row with the showtools token.
-# The default is shim.efi,PreLoader.efi,TextMode.efi,ebounce.efi,GraphicsConsole.efi,MokManager.efi,HashTool.efi,HashTool-signed.efi
+# The default is shim.efi,PreLoader.efi,TextMode.efi,ebounce.efi,
+# GraphicsConsole.efi,MokManager.efi,HashTool.efi,HashTool-signed.efi,
+# bootmgr.efi
 #
 #dont_scan_files shim.efi,MokManager.efi
 
index 3d8f970c6a96be057f887cf9e2c1610e67353e19..cfd3f787203a136a35e3ca4c31d54cd8038399a8 100644 (file)
@@ -441,6 +441,7 @@ VOID ReadConfig(CHAR16 *FileName)
        MergeStrings(&(GlobalConfig.DontScanFiles), MOK_NAMES, L',');
        MyFreePool(GlobalConfig.DontScanVolumes);
        GlobalConfig.DontScanVolumes = StrDuplicate(DONT_SCAN_VOLUMES);
+       GlobalConfig.WindowsRecoveryFiles = StrDuplicate(WINDOWS_RECOVERY_FILES);
     } // if
 
     if (!FileExists(SelfDir, FileName)) {
@@ -517,6 +518,9 @@ VOID ReadConfig(CHAR16 *FileName)
         } else if ((StriCmp(TokenList[0], L"don't_scan_files") == 0) || (StriCmp(TokenList[0], L"dont_scan_files") == 0)) {
            HandleStrings(TokenList, TokenCount, &(GlobalConfig.DontScanFiles));
 
+        } else if (StriCmp(TokenList[0], L"windows_recovery_files") == 0) {
+           HandleStrings(TokenList, TokenCount, &(GlobalConfig.WindowsRecoveryFiles));
+
         } else if (StriCmp(TokenList[0], L"scan_driver_dirs") == 0) {
             HandleStrings(TokenList, TokenCount, &(GlobalConfig.DriverDirs));
 
@@ -538,6 +542,8 @@ VOID ReadConfig(CHAR16 *FileName)
                    GlobalConfig.ShowTools[i - 1] = TAG_SHUTDOWN;
                 } else if (StriCmp(FlagName, L"apple_recovery") == 0) {
                    GlobalConfig.ShowTools[i - 1] = TAG_APPLE_RECOVERY;
+                } else if (StriCmp(FlagName, L"windows_recovery") == 0) {
+                   GlobalConfig.ShowTools[i - 1] = TAG_WINDOWS_RECOVERY;
                 } else if (StriCmp(FlagName, L"mok_tool") == 0) {
                    GlobalConfig.ShowTools[i - 1] = TAG_MOK_TOOL;
                 } else if (StriCmp(FlagName, L"firmware") == 0) {
index 3c92fdb4c36bcc08e84318e8e1125909e73ade7a..45d1924e4a21bccc31f2c71193d59a058dea7f9a 100644 (file)
@@ -81,8 +81,8 @@ typedef struct {
 
 #define CONFIG_FILE_NAME         L"refind.conf"
 // Note: Below is combined with MOK_NAMES to make default
-#define DONT_SCAN_FILES L"shim.efi,shim-fedora.efi,PreLoader.efi,TextMode.efi,ebounce.efi,GraphicsConsole.efi"
-#define DONT_SCAN_VOLUMES L"Recovery HD"
+#define DONT_SCAN_FILES L"shim.efi,shim-fedora.efi,PreLoader.efi,TextMode.efi,ebounce.efi,GraphicsConsole.efi,bootmgr.efi"
+#define DONT_SCAN_VOLUMES L"Recovery HD,LRS_ESP"
 #define ALSO_SCAN_DIRS L"boot"
 
 EFI_STATUS ReadFile(IN EFI_FILE_HANDLE BaseDir, CHAR16 *FileName, REFIT_FILE *File, UINTN *size);
index 8dc6d594ac8300167604aa7311d5ab40471ce6d6..ee4876438a0d1ea566c3c062251f1981e3979100 100644 (file)
 #define REFIT_DEBUG (0)
 
 // Tag classifications; used in various ways.
-#define TAG_ABOUT          (1)
-#define TAG_REBOOT         (2)
-#define TAG_SHUTDOWN       (3)
-#define TAG_TOOL           (4)
-#define TAG_LOADER         (5)
-#define TAG_LEGACY         (6)
-#define TAG_EXIT           (7)
-#define TAG_SHELL          (8)
-#define TAG_GPTSYNC        (9)
-#define TAG_LEGACY_UEFI    (10)
-#define TAG_APPLE_RECOVERY (11)
-#define TAG_MOK_TOOL       (12)
-#define TAG_FIRMWARE       (13)
-#define TAG_MEMTEST        (14)
-#define NUM_TOOLS          (14)
+#define TAG_ABOUT            (1)
+#define TAG_REBOOT           (2)
+#define TAG_SHUTDOWN         (3)
+#define TAG_TOOL             (4)
+#define TAG_LOADER           (5)
+#define TAG_LEGACY           (6)
+#define TAG_EXIT             (7)
+#define TAG_SHELL            (8)
+#define TAG_GPTSYNC          (9)
+#define TAG_LEGACY_UEFI      (10)
+#define TAG_APPLE_RECOVERY   (11)
+#define TAG_WINDOWS_RECOVERY (12)
+#define TAG_MOK_TOOL         (13)
+#define TAG_FIRMWARE         (14)
+#define TAG_MEMTEST          (15)
+#define NUM_TOOLS            (16)
 
 #define NUM_SCAN_OPTIONS 10
 
 #define MOK_LOCATIONS           L"\\,EFI\\tools,EFI\\fedora,EFI\\redhat,EFI\\ubuntu,EFI\\suse,EFI\\opensuse,EFI\\altlinux"
 // Directories to search for memtest86....
 #define MEMTEST_LOCATIONS       L"EFI\\tools,EFI\\tools\\memtest86,EFI\\tools\\memtest,EFI\\memtest86,EFI\\memtest"
+// Files that may be Windows recovery files
+#define WINDOWS_RECOVERY_FILES  L"EFI\\Microsoft\\Boot\\LrsBootmgr.efi"
 
 //
 // global definitions
@@ -246,6 +249,7 @@ typedef struct {
    CHAR16      *DontScanVolumes;
    CHAR16      *DontScanDirs;
    CHAR16      *DontScanFiles;
+   CHAR16      *WindowsRecoveryFiles;
    CHAR16      *DriverDirs;
    CHAR16      *IconsDir;
    UINTN       ShowTools[NUM_TOOLS];
index a61bca365f70f6783da53165c63dbb5949f96ae0..45c50490cc9b625cb2f720efcbadcc8c19982196 100644 (file)
@@ -60,6 +60,7 @@ BUILTIN_ICON BuiltinIconTable[BUILTIN_ICON_COUNT] = {
    { NULL, L"tool_part", 48 },
    { NULL, L"tool_rescue", 48 },
    { NULL, L"tool_apple_rescue", 48 },
+   { NULL, L"tool_windows_rescue", 48 },
    { NULL, L"tool_mok_tool", 48 },
    { NULL, L"tool_memtest", 48 },
    { NULL, L"vol_internal", 32 },
index 507f365b7f021d391d18b15633e28a658711d4b2..229594f97a7fd384083f579a6de13b27c9d48c88 100644 (file)
@@ -55,21 +55,22 @@ EG_IMAGE * DummyImage(IN UINTN PixelSize);
 
 EG_IMAGE * BuiltinIcon(IN UINTN Id);
 
-#define BUILTIN_ICON_FUNC_ABOUT        (0)
-#define BUILTIN_ICON_FUNC_RESET        (1)
-#define BUILTIN_ICON_FUNC_SHUTDOWN     (2)
-#define BUILTIN_ICON_FUNC_EXIT         (3)
-#define BUILTIN_ICON_FUNC_FIRMWARE     (4)
-#define BUILTIN_ICON_TOOL_SHELL        (5)
-#define BUILTIN_ICON_TOOL_PART         (6)
-#define BUILTIN_ICON_TOOL_RESCUE       (7)
-#define BUILTIN_ICON_TOOL_APPLE_RESCUE (8)
-#define BUILTIN_ICON_TOOL_MOK_TOOL     (9)
-#define BUILTIN_ICON_TOOL_MEMTEST      (10)
-#define BUILTIN_ICON_VOL_INTERNAL      (11)
-#define BUILTIN_ICON_VOL_EXTERNAL      (12)
-#define BUILTIN_ICON_VOL_OPTICAL       (13)
-#define BUILTIN_ICON_COUNT             (14)
+#define BUILTIN_ICON_FUNC_ABOUT            (0)
+#define BUILTIN_ICON_FUNC_RESET            (1)
+#define BUILTIN_ICON_FUNC_SHUTDOWN         (2)
+#define BUILTIN_ICON_FUNC_EXIT             (3)
+#define BUILTIN_ICON_FUNC_FIRMWARE         (4)
+#define BUILTIN_ICON_TOOL_SHELL            (5)
+#define BUILTIN_ICON_TOOL_PART             (6)
+#define BUILTIN_ICON_TOOL_RESCUE           (7)
+#define BUILTIN_ICON_TOOL_APPLE_RESCUE     (8)
+#define BUILTIN_ICON_TOOL_WINDOWS_RESCUE   (9)
+#define BUILTIN_ICON_TOOL_MOK_TOOL         (10)
+#define BUILTIN_ICON_TOOL_MEMTEST          (11)
+#define BUILTIN_ICON_VOL_INTERNAL          (12)
+#define BUILTIN_ICON_VOL_EXTERNAL          (13)
+#define BUILTIN_ICON_VOL_OPTICAL           (14)
+#define BUILTIN_ICON_COUNT                 (15)
 
 #endif
 
index 31fd8863d75cd74bb67779e1d401c410a7595086..30895bb6d8280b6697b0d456231bde2cce3c26fe 100644 (file)
@@ -132,9 +132,9 @@ static REFIT_MENU_SCREEN MainMenu       = { L"Main Menu", NULL, 0, NULL, 0, NULL
 static REFIT_MENU_SCREEN AboutMenu      = { L"About", NULL, 0, NULL, 0, NULL, 0, NULL, L"Press Enter to return to main menu", L"" };
 
 REFIT_CONFIG GlobalConfig = { FALSE, FALSE, 0, 0, 0, DONT_CHANGE_TEXT_MODE, 20, 0, 0, GRAPHICS_FOR_OSX, LEGACY_TYPE_MAC, 0, 0,
-                              NULL, NULL, CONFIG_FILE_NAME, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                              { TAG_SHELL, TAG_MEMTEST, TAG_APPLE_RECOVERY, TAG_MOK_TOOL, TAG_ABOUT, TAG_SHUTDOWN,
-                                TAG_REBOOT, TAG_FIRMWARE, 0, 0, 0, 0, 0, 0 }
+                              NULL, NULL, CONFIG_FILE_NAME, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+                              { TAG_SHELL, TAG_MEMTEST, TAG_APPLE_RECOVERY, TAG_WINDOWS_RECOVERY, TAG_MOK_TOOL, TAG_ABOUT,
+                                TAG_SHUTDOWN, TAG_REBOOT, TAG_FIRMWARE, 0, 0, 0, 0, 0, 0 }
                             };
 
 EFI_GUID GlobalGuid = EFI_GLOBAL_VARIABLE;
@@ -2235,7 +2235,7 @@ static VOID FindTool(CHAR16 *Locations, CHAR16 *Names, CHAR16 *Description, UINT
 // Add the second-row tags containing built-in and external tools (EFI shell,
 // reboot, etc.)
 static VOID ScanForTools(VOID) {
-   CHAR16 *FileName = NULL, *MokLocations, Description[256];
+   CHAR16 *FileName = NULL, *VolName = NULL, *MokLocations, Description[256];
    REFIT_MENU_ENTRY *TempMenuEntry;
    UINTN i, j, VolumeIndex;
    UINT64 osind;
@@ -2313,12 +2313,31 @@ static VOID ScanForTools(VOID) {
                   SPrint(Description, 255, L"Apple Recovery on %s", Volumes[VolumeIndex]->VolName);
                   AddToolEntry(Volumes[VolumeIndex]->DeviceHandle, FileName, Description,
                                BuiltinIcon(BUILTIN_ICON_TOOL_APPLE_RESCUE), 'R', TRUE);
-               }
+               } // if
             } // for
             MyFreePool(FileName);
             FileName = NULL;
             break;
 
+         case TAG_WINDOWS_RECOVERY:
+            j = 0;
+            while ((FileName = FindCommaDelimited(GlobalConfig.WindowsRecoveryFiles, j++)) != NULL) {
+               SplitVolumeAndFilename(&FileName, &VolName);
+               for (VolumeIndex = 0; VolumeIndex < VolumesCount; VolumeIndex++) {
+                  if ((Volumes[VolumeIndex]->RootDir != NULL) && (FileExists(Volumes[VolumeIndex]->RootDir, FileName)) &&
+                      ((VolName == NULL) || (StriCmp(VolName, Volumes[VolumeIndex]->VolName) == 0))) {
+                     SPrint(Description, 255, L"Microsoft Recovery on %s", Volumes[VolumeIndex]->VolName);
+                     AddToolEntry(Volumes[VolumeIndex]->DeviceHandle, FileName, Description,
+                                  BuiltinIcon(BUILTIN_ICON_TOOL_WINDOWS_RESCUE), 'R', TRUE);
+                  } // if
+               } // for
+            } // while
+            MyFreePool(FileName);
+            FileName = NULL;
+            MyFreePool(VolName);
+            VolName = NULL;
+            break;
+
          case TAG_MOK_TOOL:
             FindTool(MokLocations, MOK_NAMES, L"MOK utility utility", BUILTIN_ICON_TOOL_MOK_TOOL);
             break;