532,535c532,551 < if (hidden) < PC_SLICE_TYPE (mbr, entry) |= PC_SLICE_TYPE_HIDDEN_FLAG; < else < PC_SLICE_TYPE (mbr, entry) &= ~PC_SLICE_TYPE_HIDDEN_FLAG; --- > unsigned char slice_type = PC_SLICE_TYPE (mbr, entry); > if (hidden) { > // There doesn't appear to be a better way to do this, so > // making an exception for types of 7 and 0. > // Make sure NTFS is hidden and ignored by Windows: > if (slice_type == 7) > PC_SLICE_TYPE (mbr, entry) = 0; > // A type of 0 is already hidden, so don't try to hide it: > else if (slice_type != 0) > PC_SLICE_TYPE (mbr, entry) |= PC_SLICE_TYPE_HIDDEN_FLAG; > } > else { > // Make sure NTFS hidden as above is unhidden and recognized > // by Windows (alas, this also changes Empty partitions, but > // should not be a problem, cause they shouldn't get mounted anyway): > if (slice_type == 0) > PC_SLICE_TYPE (mbr, entry) = 7; > else > PC_SLICE_TYPE (mbr, entry) &= ~PC_SLICE_TYPE_HIDDEN_FLAG; > }