]> code.delx.au - refind/commitdiff
Misc. small cleanups.
authorsrs5694 <srs5694@users.sourceforge.net>
Sat, 21 Apr 2012 04:58:01 +0000 (00:58 -0400)
committersrs5694 <srs5694@users.sourceforge.net>
Sat, 21 Apr 2012 04:58:01 +0000 (00:58 -0400)
docs/refind/drivers.html
docs/refind/todo.html
refind/lib.c
refind/main.c

index 58467041755b1aeddbd20c8eb4b4daa368d6b2e7..8f09ae5b409e6cb40064b1c01391f47cba134046 100644 (file)
@@ -121,7 +121,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 
 <li><b><a href="http://refit.sourceforge.net">rEFIt's ext2fs and ReiserFS drivers</a></b>&mdash;You can gain read-only access to ext2fs, ext3fs, and ReiserFS volumes with these drivers. You can use the binaries in the <tt>refit-bin-0.14/efi/tools/drivers</tt> directory of the binary package directly on a Mac. On a UEFI-based PC, though, you'll need to break the Mac-style "fat" binary into its 32- and 64-bit components. You can use my <a href="http://www.rodsbooks.com/thin/index.html"><tt>thin</tt></a> program for this job.</li>
 
-<li><b><a href="https://sourceforge.net/projects/cloverefiboot/">Clover EFI's ISO-9660, ext2fs, and HFS+ drivers</a></b>&mdash;This project is an offshoot of TianoCore, the main UEFI project. It's primarily a Hackintosh boot loader, but it includes drivers for <a href="http://cloverefiboot.svn.sourceforge.net/viewvc/cloverefiboot/VBoxFsDxe/">ISO-9660, ext2fs, and HFS+;</a> however, building them requires a fair amount of expertise. You can find a compile script for the ISO-9660 driver <a href="https://github.com/the-ridikulus-rat/My_Shell_Scripts/blob/master/tianocore_uefi/iso9660_virtualbox_x86_64_udk_linux_compile.sh">here,</a> and a compiled ISO-9660 binary <a href="dl.dropbox.com/u/9710721/VBoxIso9600.efi">here.</a> I haven't yet tested the compiled binary, much less tried to compile the source code.</li>
+<li><b><a href="https://sourceforge.net/projects/cloverefiboot/">Clover EFI's ISO-9660, ext2fs, and HFS+ drivers</a></b>&mdash;This project is an offshoot of TianoCore, the main UEFI project. It's primarily a Hackintosh boot loader, but it includes drivers for <a href="http://cloverefiboot.svn.sourceforge.net/viewvc/cloverefiboot/VBoxFsDxe/">ISO-9660, ext2fs, and HFS+;</a> however, building them requires a fair amount of expertise. You can find a compile script for the ISO-9660 driver <a href="https://github.com/the-ridikulus-rat/My_Shell_Scripts/blob/master/tianocore_uefi/iso9660_virtualbox_x86_64_udk_linux_compile.sh">here,</a> and a compiled ISO-9660 binary <a href="http://dl.dropbox.com/u/9710721/VBoxIso9600.efi">here.</a> I haven't yet tested the compiled binary, much less tried to compile the source code.</li>
 
 <li><b><a href="http://www.osx86.net/view/2571-clover_v2_r384__efi_bootloader_pkg_+_gpt_efi_tools.html">Clover's EFI Tools package</a></b>&mdash;This osx86.net thread includes links to a package called <tt>EFI_Tools_Clover_v2_r384_EFI_x32_x64_EN.zip</tt>, which holds an OS X application (a directory with a <tt>.app</tt> extension, as seen from other platforms) with a number of drivers in the <tt>Contents/Resources/EFI/drivers64</tt> directory (and an equivalent for 32-bit binaries). Some of these, such as keyboard drivers, are unlikely to be useful unless your system is badly broken as delivered. Three that caught my eye, however, are <tt>VBoxExt2-64.efi</tt>, <tt>NTFS-64.efi</tt>, and <tt>VBoxIso9600-64.efi</tt>.</li>
 
index 4a30c1717e8931176467ccbf2818c27e91c715c4..21e07382239870ad43233785b199e6f998abdb31 100644 (file)
@@ -127,6 +127,10 @@ them on the project's Sourceforge page). For more information on designing theme
 
 <li>Returning from a program (such as an EFI shell or a boot loader that fails) produces an error message about a failure when "(re)opening our installation volume" on some computers. (Among mine, only a 32-bit Mac Mini produces this message.) In some cases, rEFInd then hangs. I don't fully understand its cause or why it doesn't appear on most systems. This needs investigating and fixing.</li>
 
+<li>The <a href="http://www.rodsbooks.com/gb-hybrid-efi/">Gigabyte Hybrid EFI</a> has a bug that causes the allegedly case-insensitive <tt>StriCmp()</tt> function to perform a case-sensitive comparison. This causes any number of bugs in file matching. For instance: Changing the case of icon filename extensions (or various other parts of icon filenames) causes icons to be replaced by ugly "generic" ones; rEFInd sometimes appears in its own menu (the firmware sometimes returns an all-caps version of the filename, but other times returns the filename with the correct case, causing a mismatch if the path includes lowercase elements); and boot loaders will not be detected if their filenames use uppercase <tt>.EFI</tt> extensions. Some of these problems can be overcome by converting both strings to be compared to one case before doing the comparison, but others aren't so easy, since I think <tt>StriCmp()</tt> is being called internally to the EFI. In any event, it'd be nice to fix some of these problems. OTOH, this is a workaround for a bug on just one EFI implementation, and a dismal one at that, so I'm inclined to just let it go.</li>
+
+<li>I've received queries about rEFInd's ability to work with Apple's whole-disk encryption scheme that's new with OS X 10.7. Unfortunately, I lack the hardware to test this.</li>
+
 <li>The Page Up and Page Down keys work in a rather strange way&mdash;a result of an admittedly quick fix on my part to a problem with a data structure that makes implementation of scrolling harder than it ought to be.</li>
 
 <li>I'd like to find a way to enable users to enter customizations for boot options and then save them to the <tt>refind.conf</tt> file.</li>
index 81b71ade95d3a0e41a0c754c03065995f8d91085..d19e21e5230e48a995f0d61f53a8888ca9c47040 100644 (file)
@@ -77,28 +77,38 @@ static VOID UninitVolumes(VOID);
 // self recognition stuff
 //
 
-// Converts forward slashes to backslashes and removes duplicate slashes.
+// Converts forward slashes to backslashes, removes duplicate slashes, and
+// removes slashes from both the start and end of the pathname.
 // Necessary because some (buggy?) EFI implementations produce "\/" strings
-// in pathnames and because some user inputs can produce duplicate directory
-// separators
+// in pathnames, because some user inputs can produce duplicate directory
+// separators, and because we want consistent start and end slashes for
+// directory comparisons. A special case: If the PathName refers to root,
+// return "/", since some firmware implementations flake out if this
+// isn't present.
 VOID CleanUpPathNameSlashes(IN OUT CHAR16 *PathName) {
    CHAR16   *NewName;
-   UINTN    i, j = 0;
+   UINTN    i, FinalChar = 0;
    BOOLEAN  LastWasSlash = FALSE;
 
-   NewName = AllocateZeroPool(sizeof(CHAR16) * (StrLen(PathName) + 1));
+   NewName = AllocateZeroPool(sizeof(CHAR16) * (StrLen(PathName) + 2));
    if (NewName != NULL) {
       for (i = 0; i < StrLen(PathName); i++) {
          if ((PathName[i] == L'/') || (PathName[i] == L'\\')) {
-            if (!LastWasSlash)
-               NewName[j++] = L'\\';
+            if ((!LastWasSlash) && (FinalChar != 0))
+               NewName[FinalChar++] = L'\\';
             LastWasSlash = TRUE;
          } else {
-            NewName[j++] = PathName[i];
+            NewName[FinalChar++] = PathName[i];
             LastWasSlash = FALSE;
          } // if/else
       } // for
-      NewName[j] = 0;
+      NewName[FinalChar] = 0;
+      if ((FinalChar > 0) && (NewName[FinalChar - 1] == L'\\'))
+         NewName[--FinalChar] = 0;
+      if (FinalChar == 0) {
+         NewName[0] = L'\\';
+         NewName[1] = 0;
+      }
       // Copy the transformed name back....
       StrCpy(PathName, NewName);
       FreePool(NewName);
@@ -109,7 +119,6 @@ EFI_STATUS InitRefitLib(IN EFI_HANDLE ImageHandle)
 {
     EFI_STATUS  Status;
     CHAR16      *DevicePathAsString;
-    UINTN       i;
 
     SelfImageHandle = ImageHandle;
     Status = refit_call3_wrapper(BS->HandleProtocol, SelfImageHandle, &LoadedImageProtocol, (VOID **) &SelfLoadedImage);
@@ -119,12 +128,9 @@ EFI_STATUS InitRefitLib(IN EFI_HANDLE ImageHandle)
     // find the current directory
     DevicePathAsString = DevicePathToStr(SelfLoadedImage->FilePath);
     CleanUpPathNameSlashes(DevicePathAsString);
-    if (DevicePathAsString != NULL) {
-        for (i = StrLen(DevicePathAsString); (i > 0) && (DevicePathAsString[i] != '\\'); i--) ;
-        DevicePathAsString[i] = 0;
-    } else
-        DevicePathAsString[0] = 0;
-    SelfDirPath = StrDuplicate(DevicePathAsString);
+    if (SelfDirPath != NULL)
+       FreePool(SelfDirPath);
+    SelfDirPath = FindPath(DevicePathAsString);
     FreePool(DevicePathAsString);
 
     return FinishInitRefitLib();
index 0196aabb8813dcf9983f10c1482611dce977c850..12d2b8f654a0039c9b572230916e812859120397 100644 (file)
@@ -55,7 +55,7 @@
 // 
 // variables
 
-#define MACOSX_LOADER_PATH      L"\\System\\Library\\CoreServices\\boot.efi"
+#define MACOSX_LOADER_PATH      L"System\\Library\\CoreServices\\boot.efi"
 #if defined (EFIX64)
 #define SHELL_NAMES             L"\\EFI\\tools\\shell.efi,\\shellx64.efi"
 #elif defined (EFI32)
@@ -615,7 +615,7 @@ LOADER_ENTRY * AddLoaderEntry(IN CHAR16 *LoaderPath, IN CHAR16 *LoaderTitle, IN
    Entry = InitializeLoaderEntry(NULL);
    if (Entry != NULL) {
       Entry->Title = StrDuplicate(LoaderTitle);
-      Entry->me.Title = PoolPrint(L"Boot %s from %s", (LoaderTitle != NULL) ? LoaderTitle : LoaderPath + 1, Volume->VolName);
+      Entry->me.Title = PoolPrint(L"Boot %s from %s", (LoaderTitle != NULL) ? LoaderTitle : LoaderPath, Volume->VolName);
       Entry->me.Row = 0;
       Entry->me.BadgeImage = Volume->VolBadgeImage;
       Entry->LoaderPath = StrDuplicate(LoaderPath);
@@ -636,18 +636,11 @@ static VOID ScanLoaderDir(IN REFIT_VOLUME *Volume, IN CHAR16 *Path)
     EFI_STATUS              Status;
     REFIT_DIR_ITER          DirIter;
     EFI_FILE_INFO           *DirEntry;
-    CHAR16                  FileName[256], *SelfPath;
-    UINTN                   i = 0;
+    CHAR16                  *FileName;
 
-    // Skip past leading slashes, which are sometimes (but not always) included
-    // in SelfDirPath, to get a path that's known to never include this feature.
-    while ((SelfDirPath != NULL) && (SelfDirPath[i] == L'\\')) {
-       i++;
-    }
-    SelfPath = &SelfDirPath[i]; // NOTE: *DO NOT* call FreePool() on SelfPath!!!
-
-    if (!SelfPath || !Path || ((StriCmp(Path, SelfPath) == 0) && Volume != SelfVolume) ||
-        (StriCmp(Path, SelfPath) != 0)) {
+    FileName = AllocateZeroPool(256 * sizeof(CHAR16));
+    if ((!SelfDirPath || !Path || ((StriCmp(Path, SelfDirPath) == 0) && Volume != SelfVolume) ||
+        (StriCmp(Path, SelfDirPath) != 0)) && FileName) {
        // look through contents of the directory
        DirIterOpen(Volume->RootDir, Path, &DirIter);
        while (DirIterNext(&DirIter, 2, L"*.efi", &DirEntry)) {
@@ -690,13 +683,13 @@ static VOID ScanEfiFiles(REFIT_VOLUME *Volume) {
       }
 
       // check for XOM
-      StrCpy(FileName, L"\\System\\Library\\CoreServices\\xom.efi");
+      StrCpy(FileName, L"System\\Library\\CoreServices\\xom.efi");
       if (FileExists(Volume->RootDir, FileName)) {
          AddLoaderEntry(FileName, L"Windows XP (XoM)", Volume);
       }
 
       // check for Microsoft boot loader/menu
-      StrCpy(FileName, L"\\EFI\\Microsoft\\Boot\\Bootmgfw.efi");
+      StrCpy(FileName, L"EFI\\Microsoft\\Boot\\Bootmgfw.efi");
       if (FileExists(Volume->RootDir, FileName)) {
          AddLoaderEntry(FileName, L"Microsoft EFI boot", Volume);
       }
@@ -1224,7 +1217,6 @@ static VOID LoadDrivers(VOID)
     // load drivers from the "drivers" subdirectory of rEFInd's home directory
     Directory = StrDuplicate(SelfDirPath);
     MergeStrings(&Directory, L"drivers", L'\\');
-//    SPrint(DirName, 255, L"%s\\drivers", SelfDirPath);
     NumFound += ScanDriverDir(Directory);
 
     // Scan additional user-specified driver directories....