if ((t <= 0x1f) && ((mask >> (t & ~0x10u)) & 1)) {
/* It's a hideable partition type */
- if (miter->index == iter->index)
+ if (miter->index == iter->index || opt.hide & 4)
t &= (uint8_t)(~0x10u); /* unhide */
else
t |= 0x10u; /* hide */
int ridx;
if (miter->type != typedos) {
- error("Partition entry mangling ('hide[all]', 'mbrchs')\n"
+ error("Partition entry mangling ('[un]hide[all]', 'mbrchs')\n"
"is meaningful only for legacy partition scheme.");
goto bail;
}
- if ((miter->index < 1 || miter->index > 4) && opt.hide == 1)
- error("WARNING: option 'hide' specified with a non-primary partition.\n");
+ if ((miter->index < 1 || miter->index > 4) && opt.hide & 1)
+ error("WARNING: option '[un]hide' specified with a non-primary partition.\n");
if (!(iter = pi_begin(&miter->di, 1))) /* turn on stepall */
goto bail;
- while (!pi_next(&iter) && !werr && (opt.hide == 2 || opt.mbrchs)) {
+ while (!pi_next(&iter) && !werr && (opt.hide & 2 || opt.mbrchs)) {
ridx = iter->rawindex;
dp = (struct disk_dos_part_entry *)iter->record;
if (dp->ostype) {
- if (opt.hide == 2 || (opt.hide == 1 && ridx <= 4)) {
+ if (opt.hide & 2 || (opt.hide & 1 && ridx <= 4)) {
wb |= pem_sethide(miter, iter);
}
if (opt.mbrchs) {
pi_del(&iter);
if (werr)
error("WARNING: failed to write E/MBR for partition\n"
- "mangling options ('hide[all]', 'mbrchs').\n");
+ "mangling options ('[un]hide[all]', 'mbrchs').\n");
return 0;
}
opt.swap = true;
} else if (!strcmp(argv[i], "noswap")) {
opt.swap = false;
- } else if (!strcmp(argv[i], "nohide") ||
- !strcmp(argv[i], "nohideall")) {
+ } else if (!strcmp(argv[i], "nohide")) {
opt.hide = 0;
} else if (!strcmp(argv[i], "hide")) {
- opt.hide = 1;
+ opt.hide = 1; /* 001b */
} else if (!strcmp(argv[i], "hideall")) {
- opt.hide = 2;
+ opt.hide = 2; /* 010b */
+ } else if (!strcmp(argv[i], "unhide")) {
+ opt.hide = 5; /* 101b */
+ } else if (!strcmp(argv[i], "unhideall")) {
+ opt.hide = 6; /* 110b */
} else if (!strcmp(argv[i], "setbpb")) {
opt.setbpb = true;
} else if (!strcmp(argv[i], "nosetbpb")) {
drive we use during chainloading is not fd0 or hd0.
hide[all]
+ unhide[all]
*nohide
In certain situations it's useful to hide partitions - for example to make sure
DOS gets C:. 'hide' will hide hidable primary partitions, except the one we're
booting from. Similary, 'hideall' will hide all hidable partitions, except the
-one we're booting from. Hiding is performed only on the boot drive.
-Writing is only performed, if the values actually got changed.
+one we're booting from. Hiding is performed only on the booting drive. Options
+starting with 'un' will simply unhide every partition (primary ones or all).
+Writing is only performed, if the os type values actually changed.
mbrchs
*nombrchs