Thanks Steve. Your code works like a charm. I have tested it on a primary ntfs partition (hd1,2) and on a logical ntfs partition (hd0,16). Both "true hiding" and "true unhiding" works ok. Also, there are no conflicts with Boot-US bootloader in MBR, so both methods of true hiding can be used depending on circumstances. On the screenshots below the primary ntfs partition /dev/sdb3 is "true hidden" using your code:
http://i.imgur.com/S4ObecS.png
http://i.imgur.com/LTr4RVA.png
At this point I'm focusing only on ntfs partitions because true hiding is only really needed when you have a few instances of Windows OS installed on different partitions. Windows is known to snoop around the hard disk and ignore the standard hidden flag. I assume that for true hiding Windows only the cat line with NTFS from your original code is needed:
title True Hide NTFS (hd1,2) & Boot Windows XP on (hd0,0)
set PTN=(hd1,2)
debug 2
cat --locate=NTFS --replace=ntfs --skip=3 --length=8 %PTN%+1 > nul
# make magic bytes invalid
cat --locate=\x55\xaa --replace=\x15\xaa --skip=510 %PTN%+1 > nul
cat --locate=\x55\xaa --replace=\x15\xaa --skip=510 %PTN%1+1 > nul
# set hidden flag in MBR
hide %PTN%
pause
errorcheck off
chainloader (hd0,0)/ntldr
With debug level set to 2 I didn't get any error messages when true hiding a logical partition. With the primary the errors were as follows. Are they safe to ignore?
Warning: MBR cylinders (60802) is not equal to the BIOS one (1023)
Warning: MBR total sectors (976773120) is greater than the BIOS one (16434495). Some buggy BIOSes could hang when you access sectors exceeding the BIOS limit.
Partition (1,2) successfully set hidden
Edited by Kirkx, 12 January 2015 - 06:58 AM.