# Hide or unhide the E2B partition from Windows and linux (assumes E2B on hd0,0 or hd0,1) - user must enter the password 'fred' to unhide the E2B partition
# Tip: compress this file using LZMA_Encode to make it difficult to read by a user and/or use --md5 encoding for the password or use %pwd% instead of fred
# Before running Windows-based ISOs, you should UnHide the E2B drive if the ISO is on the E2B partition.

# The grub4dos hide and unhide commands just changes the partition type in the MBR partition table - e.g. from 07 to 17.
# True_hide/true_unhide makes partitions inaccessible to Windows and linux but not grub4dos
# parttype will return the partition type number, so the menu entry will only be displayed if required
# we don't want to make the type F extended partition table entry hidden or else all logical partitions will be hidden.
# redirect the call to nul if you don't want to see any diagnostic text - e.g. call /%grub%/true_hide.g4b (hd0,1) > nul

iftitle [parttype (hd0,0) &; set /A p=%@retval% &; if not %p%==0x0F && calc %p%&0x10^0x10 && if exist (hd0,0)/_ISO/e2b/grub/E2B_GRUB.txt] Hide E2B partition\n Hide 1st partition from Linux and Windows
set p=
call /%grub%/true_hide.g4b (hd0,0) > nul
# Reload menu
configfile (md)0xa000+0x50 || configfile /menu.lst

iftitle [parttype (hd0,0) &; set /A p=%@retval% &; if not %p%==0x0F && calc %p%&0x10 && if exist (hd0,0)/_ISO/e2b/grub/E2B_GRUB.txt] Unhide E2B partition\n Unhide 1st partition from Linux and Windows
set p=
password fred || configfile (md)0xa000+0x50 || configfile /menu.lst
call /%grub%/true_unhide.g4b (hd0,0) > nul
# Reload menu
configfile (md)0xa000+0x50 || configfile /menu.lst

iftitle [parttype (hd0,1) &; set /A p=%@retval% &; if not %p%==0x0F && calc %p%&0x10^0x10 && if exist (hd0,1)/_ISO/e2b/grub/E2B_GRUB.txt] Hide E2B partition\n Hide 2nd partition from Linux and Windows
set p=
call /%grub%/true_hide.g4b (hd0,1) > nul
# Reload menu
configfile (md)0xa000+0x50 || configfile /menu.lst

iftitle [parttype (hd0,1) &; set /A p=%@retval% &; if not %p%==0x0F && calc %p%&0x10 && if exist (hd0,1)/_ISO/e2b/grub/E2B_GRUB.txt] Unhide E2B partition\n Unhide 2nd partition from Linux and Windows
set p=
password fred || configfile (md)0xa000+0x50 || configfile /menu.lst
call /%grub%/true_unhide.g4b (hd0,1) > nul
# Reload menu
configfile (md)0xa000+0x50 || configfile /menu.lst

# this menu entry is never seen but it clears the p variable to keep things tidy!
iftitle [set p= && if 1=2] clear p
boot

