<h3>Installing rEFInd Manually Using an EFI Shell</h3>
</a>
+<p class="sidebar"><b>Warning:</b> Do not attempt to use the procedure described in this section on a Macintosh. Macs have a strange EFI implementation that does not use the EFI variables that this procedure manipulates. Therefore, chances are this procedure simply won't work. It's conceivable that this procedure will actually cause problems, but I'm not curious enough to try it and risk damaging my Mac!</p>
+
<p>If you can't currently boot any OS (say, because a firmware update has wiped your NVRAM entries), you may find it convenient to install rEFInd using an EFI version 2 shell. Unfortunately, the <tt>bcfg</tt> command described here is not available in the EFI version 1 shell, and the version 2 shell is unusable on many firmware implementations prior to 2.3.1. Thus, this procedure won't work for all systems.</p>
<p>In addition to emergency situations, using <tt>bcfg</tt> can be desirable if <tt>efibootmgr</tt> or other OS-hosted tools don't do the job. This happens under VirtualBox, for instance. An alternative in such cases can be to use <a href="#naming">alternative names for rEFInd.</a></p>
fsw_u32 blockno;
struct fsw_string s;
HFSMasterDirectoryBlock* mdb;
-// UINTN i;
+ fsw_u32 firstLeafNum;
+ fsw_u64 catfOffset;
+ fsw_u8 cbuff[sizeof (BTNodeDescriptor) + sizeof (HFSPlusCatalogKey)];
rv = FSW_UNSUPPORTED;
}
else if (signature == kHFSSigWord) // 'BD'
{
-// HFSMasterDirectoryBlock* mdb = (HFSMasterDirectoryBlock*)buffer;
-//VolumeName = mdb->drVN 28bytes
if (be16_to_cpu(mdb->drEmbedSigWord) == kHFSPlusSigWord)
{
DPRINT("found HFS+ inside HFS, untested\n");
vol->catalog_tree.root_node = be32_to_cpu (tree_header.rootNode);
vol->catalog_tree.node_size = be16_to_cpu (tree_header.nodeSize);
-// /* get volume name */
-// s.type = FSW_STRING_TYPE_ISO88591;
-// s.size = s.len = kHFSMaxVolumeNameChars;
-// s.data = vol->catalog_tree.file->g.name.data;
-// status = fsw_strdup_coerce(&vol->g.label, vol->g.host_string_type, &s);
-// CHECK(status);
+ //nms42
+ /* Take Volume Name before tree_header overwritten */
+ firstLeafNum = be32_to_cpu(tree_header.firstLeafNode);
+ catfOffset = firstLeafNum * vol->catalog_tree.node_size;
+
+ r = fsw_hfs_read_file(vol->catalog_tree.file, catfOffset, sizeof (cbuff), cbuff);
+
+ if (r == sizeof (cbuff))
+ {
+ BTNodeDescriptor* btnd;
+ HFSPlusCatalogKey* ck;
+
+ btnd = (BTNodeDescriptor*) cbuff;
+ ck = (HFSPlusCatalogKey*) (cbuff + sizeof(BTNodeDescriptor));
+ if (btnd->kind == kBTLeafNode && be32_to_cpu (ck->parentID) == kHFSRootParentID)
+ {
+ struct fsw_string vn;
+
+ vn.type = FSW_STRING_TYPE_UTF16_BE;
+ vn.len = be16_to_cpu (ck->nodeName.length);
+ vn.size = vn.len * sizeof (fsw_u16);
+ vn.data = ck->nodeName.unicode;
+ fsw_strfree (&vol->g.label);
+ status = fsw_strdup_coerce(&vol->g.label, vol->g.host_string_type, &vn);
+ CHECK(status);
+ } // if
+ } // if
/* Read extents overflow file */
r = fsw_hfs_read_file(vol->extents_tree.file,
// check for Microsoft boot loader/menu
if (ShouldScan(Volume, L"EFI\\Microsoft\\Boot")) {
StrCpy(FileName, L"EFI\\Microsoft\\Boot\\bkpbootmgfw.efi");
- if (FileExists(Volume->RootDir, FileName) && !FilenameIn(Volume, Directory, L"bkpbootmgfw.efi", GlobalConfig.DontScanFiles)) {
+ if (FileExists(Volume->RootDir, FileName) && !FilenameIn(Volume, Directory, L"bkpbootmgfw.efi",
+ GlobalConfig.DontScanFiles)) {
AddLoaderEntry(FileName, L"Microsoft EFI boot (Boot Repair backup)", Volume);
FoundBRBackup = TRUE;
if (DuplicatesFallback(Volume, FileName))