OcBootManagementLib: Fix IsFolder detection for split nodes
@@ -312,9 +312,11 @@ InternalSetBootEntryFlags (
&& (DevicePathSubType (DevicePathWalker) == MEDIA_FILEPATH_DP)) {
FilePath = (FILEPATH_DEVICE_PATH *)DevicePathWalker;
Len = OcFileDevicePathNameLen (FilePath);
- if ((Len > 0) && (FilePath->PathName[Len - 1] == L'\\')) {
- BootEntry->IsFolder = TRUE;
- }
+ if (Len > 0) {
+ //
+ // Only the trailer of the last (non-empty) FilePath node matters.
+ //
+ BootEntry->IsFolder = (FilePath->PathName[Len - 1] == L'\\');
if (!BootEntry->IsRecovery) {
Result = OcOverflowSubUN (
@@ -336,6 +338,7 @@ InternalSetBootEntryFlags (
}
}
}
+ }
} else {
BootEntry->IsFolder = FALSE;
}
