Jump to content











DavidB's Content

There have been 611 items by DavidB (Search limited from 01-April 14)



Sort by                Order  

#191847 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 03 April 2015 - 09:35 AM in Grub4dos

And a notice: 5 years ago I was diagnosed with Parkinson disease.
The medication helped me to continue my work here. But, lately, even this is not enough.
This is half of the reason a few months ago I tried to disable my account here.

My (real) name is not DavidB and I'm not from Norway. It's just a random name/country I picked up so I can made an account, like I have on many other forums.
Why I (usually) hide my real name/nationality:
1. I don't trust the internet.
2. My country (Romania) is not so well "seen" by other countries (unfairly).

Now I will log out and never come back.
I have to do it so I can have some peace in my last few years.

Good bye, everybody. And thank you.
Hope to see you all in the other life.

Cosmin




#191845 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 03 April 2015 - 08:24 AM in Grub4dos

Attached File  grubinst Windows binaries.7z   82.25KB   2352 downloads

 

Attached File  Grubinst Linux binaries.7z   1.04MB   667 downloads

 

Attached File  grubinst_gui languages.7z   2.24KB   769 downloads

 

Attached File  grubinst sources.7z   228.44KB   683 downloads

 

Changed a bit the way the chosen filesystem is passed to grubinst. For example, if you choose "MBR" instead of "AutoDetect" and select a partition instead of "Whole disk (MBR)", the command line switch specifying the filesystem type won't be "--file-system-type=MBR" but "--file-system-type=partition's_filesystem".
Also, in the Linux version, a rare interface bug was solved.




#191839 Virtual Machine USB Boot

Posted by DavidB on 02 April 2015 - 06:08 PM in Boot from USB / Boot anywhere

Don't know, but they were pretty "mad" about that on their forum...




#191837 Virtual Machine USB Boot

Posted by DavidB on 02 April 2015 - 06:00 PM in Boot from USB / Boot anywhere

Ok :)

 

Only one problem: the makers of VB are not too happy about VB been used for USB boot...  :rolleyes:

So you should try to report without mentioning VMUB and/or USB boot - if you want the problem fixed fast...




#191835 Virtual Machine USB Boot

Posted by DavidB on 02 April 2015 - 05:41 PM in Boot from USB / Boot anywhere

Yup, that's the "trigger".

Looks like the vmdk+SATA implementation in VirtualBox is not 100% bug free...




#191828 Virtual Machine USB Boot

Posted by DavidB on 02 April 2015 - 01:15 PM in Boot from USB / Boot anywhere

I am using 4.3.26 r98988

 

Me too.

Clipboard02.png

 

 

P.S. The partitions on the USB disks do not go right to the end, there is some 'unused' space at the end of the disk.

Not sure if this matters...

 

The 2 and 9 GB disks have the same issue.

The real disk was partitioned 'till the end.

 

 

Here is the 2 GB VHD: Attached File  Test 2 GB vhd.7z   278.7KB   642 downloads
Don't use it directly in VB; install a vhd mounting tool like WinVHD, mount the vhd on the real computer and then use it in VMUB just like a real disk.
Let's see if you get a different result...




#191824 Virtual Machine USB Boot

Posted by DavidB on 02 April 2015 - 12:37 PM in Boot from USB / Boot anywhere

So I don't see any problems...

Or should I test in a different way?

 

Which version of VirtualBox are you using?




#191823 Virtual Machine USB Boot

Posted by DavidB on 02 April 2015 - 12:19 PM in Boot from USB / Boot anywhere

On my computer I use both real and virtual disks (vhds, mounted with vhdmount.exe from Microsoft Virtual Server) to test grubinst.
I created 2 virtual disks (2 and 9 GB), partitioned them NTFS and filled the last sector with 30's:

2 GB virtual.png

9 GB virtual.png

I then used a real disk. The last sector had some data so I didn't have to fill it:

 

real USB disk.png

I got the same results in QEMU.




#191793 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 01 April 2015 - 01:03 PM in Grub4dos

I haven't created a github project yet.

You can use this sources:

 

Attached File  grubinst Windows latest sources.7z   168.09KB   500 downloads




#191776 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 01 April 2015 - 04:43 AM in Grub4dos

I tested in Windows 8.1, no problems with grubinst_gui.

 

I checked and, for Regional Options >> Standard and formats >> English (United Kingdom), grubinst_gui.eng is indeed automatically loaded.

Most likely its version is different from grubinst_gui.exe's version.

 

The latest versions: Attached File  grubinst_gui exe and lngs.7z   67.57KB   608 downloads

 

Anyway I added grubinst_gui.eng only for testing, because obviously is not needed (the interface is already in english).

 

Also I have modified grubinst.exe to display the state of the removable bit when "verbose" and "--rmb-status=auto" are used.

 

Attached File  grubinst.7z   47.4KB   510 downloads

 

In the current implementation, you can get the undefined/unknown state by simply not using the"--rmb-status=" switch.

 




#191771 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 31 March 2015 - 08:25 PM in Grub4dos

Doesn't the code load grldr?

Can't it patch the memory location after loading it?

 

In normal programming is easy to do this but not in assembler in a boot record.

Also you have to be careful to not brake the other functions + to still fit into 8/9 KB.

For this an asm expert is needed. I'm not :(




#191767 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 31 March 2015 - 07:46 PM in Grub4dos

2. That's not suppose to be there. Do you have the latest version of the GUI and the language files?
Is it always displayed? Is the only choice? If you move "grubinst_gui.eng" in another folder and restart the GUI, is it still displayed?

 

Clipboard02.png

3. For a while I will develop them as separate versions. But if the RMB version will be liked more then I'll switch to it.

5. That's a little weird, the user knows half, he doesn't investigate so he would know all but instead sets to undefined/unknown.
Even so, the on/off manual switches should be enough for most of these rare situations.
In a VM where the disk is always "fixed", they could set "off".

Yes, 0.4.6a has a silent patch, but there is no link between the silent boot switch from MBR and the patch from grldr. In other words, grldr doesn't know how to check the silent boot option from the MBR code byte.




#191763 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 31 March 2015 - 07:03 PM in Grub4dos

1. Ok, I'll try to implement.
2. If the GUI doesn't find the latest 0.4.5c/0.4.6a MBR/PBR versions, it calls them "obsolete".
But, if you're sure you have the latest version, please send me that MBR/PBR so I can check.
3. I don't know, the idea was to modify grubinst in such way so you could compile a RMB version. I will release the official version without the RMB (//#define STORE_RMB_STATUS 1); you will uncomment it (#define STORE_RMB_STATUS 1) and recompile the sources in Mingw (as you described in tutorial).
This way you and the RMPrepUSB/Easy2Boot users will be happy for using that version in RMPrepUSB and Make_E2B script but also Chenall and Yaya will be happy too for keeping the code byte entries free in the official version.
Btw, I removed the "silent boot" code byte entry for some time too. Without the Chenall/Yaya support was useless anyway...
I just kept the usual option.
4. See 3.
5. Why would they wanna hide it?




#191757 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 31 March 2015 - 06:20 PM in Grub4dos

Just in Windows for now.




#191752 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 31 March 2015 - 04:47 PM in Grub4dos

 

Thanks for that.

It would be better if you could just auto-detect whether the drive is Removable or not in grubinst (or GUI?) and update the bit accordingly.

 

 

Have you checked "grubinst --help" to see the latest switch I added? :D




#191749 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 31 March 2015 - 01:14 PM in Grub4dos

Steve, I have been thinking at your idea to store the removable bit status (on/off) in the Grub4Dos MBR/PBR.
Chenall and Yaya have said nothing when you asked them. So it seems they're not so happy about it.
But I found a way for you to make a custom grubinst.exe by just commenting/uncommenting a line of code in grubinst.c:

Not implemented:

#ifdef WIN32
//#define STORE_RMB_STATUS 1
#endif


Implemented:

#ifdef WIN32
#define STORE_RMB_STATUS 1
#endif

The rest of the code checks for this STORE_RMB_STATUS (defined or not).

For now I implemented in the "code byte" of the Grub4Dos MBR. But if we find a good location in PBR, I can implement for this too.

 

Attached File  grubinst exe.7z   47.33KB   566 downloads

 

Attached File  grubinst.c.7z   11.86KB   447 downloads

Here is a Grub4Dos script showing how you can check the value from the "code byte":
 

!BAT

clear
dd if=(hd0) of=(md)0x19000+1 > nul
set G4DVER=0.4.5c > nul
cat --hex --number=1 --locate="Missing MBR-help" (md)0x19000+1 | set TXTPOS=
if "%TXTPOS%"=="" && set G4DVER=0.4.6a && cat --hex --number=1 --locate="Missing helper." (md)0x19000+1 | set TXTPOS=
if "%TXTPOS%"=="" goto nogrub
echo Grub4Dos %G4DVER% MBR found
if "%G4DVER%"=="0.4.6a" goto 046a
#0.4.5c
cat --hex --length=5 (md)0x19000+1 | set HDR=
if "%HDR:~10,8%"=="33 C0 EB" goto enhver
#normal version
cat --hex --skip=0x2 --length=1 (md)0x19000+1 | set CTRLB=
set /a CTRLBN=0x%CTRLB:~10,2% > nul
set /a ISON=%CTRLBN% & 16 > nul
if not "%ISON%"=="0" && echo The disk is removable && goto end
set /a ISOFF=%CTRLBN% & 32 > nul
if not "%ISOFF%"=="0" && echo The disk is fixed && goto end
echo Removable bit status not stored in Grub4Dos MBR!
goto end
:enhver
#enhanced version
cat --hex --skip=0x4 --length=1 (md)0x19000+1 | set CTRLB=
set /a CTRLBN=0x%CTRLB:~10,2% > nul
set /a ISON=%CTRLBN% & 16 > nul
if not "%ISON%"=="0" && echo The disk is removable && goto end
set /a ISOFF=%CTRLBN% & 32 > nul
if not "%ISOFF%"=="0" && echo The disk is fixed && goto end
echo Removable bit status not stored in Grub4Dos MBR!
goto end
:046a
cat --hex --skip=0x5A --length=1 (md)0x19000+1 | set CTRLB=
set /a CTRLBN=0x%CTRLB:~10,2% > nul
set /a ISON=%CTRLBN% & 16 > nul
if not "%ISON%"=="0" && echo The disk is removable && goto end
set /a ISOFF=%CTRLBN% & 32 > nul
if not "%ISOFF%"=="0" && echo The disk is fixed && goto end
echo Removable bit status not stored in Grub4Dos MBR!
goto end
:nogrub
echo Grub4Dos MBR not found! && pause --wait=10
:end




#191742 help.. how not to grubinst

Posted by DavidB on 31 March 2015 - 04:51 AM in Boot from USB / Boot anywhere

kind regards to DavidB for your help :clap:

 

 

 .......................... thanks

 

Like I said, you're welcome :)

 

"Giveaway" :lamo:

MiniTool Partition Wizard 9 Professional Edition (100% Discount) Here  ( deal expires 1 day 7hours @ time of this post)

 

Thank you.




#191716 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 30 March 2015 - 01:23 PM in Grub4dos

Yup, it's what I was talking about:

 

Clipboard02.png

 

Clipboard03.png

 

Thank you very much, Steve :)




#191713 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 30 March 2015 - 01:01 PM in Grub4dos

Thanks, Wonko, but, unfortunately, most of what you're saying I already know for years :(

 

The source code would be a little useful, but not as useful as a straightforward explanation of the vhd's format.




#191709 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 30 March 2015 - 12:15 PM in Grub4dos

Thank you for the links.

Unfortunately, the information from them is not helping me much. Because is not showing what I really need so I can access the data stored in the (dynamically allocated) vhd directly without mounting it.
For example is like the difference between http://www.pcguide.c...chSector-c.htmland http://ntfs.com/ntfs...boot-sector.htm
In the first link it's some general info, in the second one is shown how and where the data is stored. This is what I need to implement in code: specific areas at specific positions, each one with its use.

Why do I want to implement it in grubinst?
I don't need it but I thought it would help others.
The Grub4Dos MBR/BS/PBR can be already installed in plain raw (without header) disk image files (since before I started improving grubinst). Just use "File:" instead of "Disk:" in grubinst_gui.
I just wanted to improve it by adding a few other image formats.

But, you're right, an image file with Grub4Dos MBR/BS/PBR installled inside seems not to be that useful (and it's not worth the work).
So, unless someone else says it would be useful for him/her/others, I will not implement other image formats.

Thank you anyway.




#191692 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 30 March 2015 - 05:33 AM in Grub4dos

Does anybody know where I can find info about vhds internal structure? I'm talking about both vhd types: dynamically allocated and fixed size.
I intend to implement it in grubinst.

I searched on Google and on other search engines and/or forums, but no luck.




#191683 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 29 March 2015 - 06:34 PM in Grub4dos

Here's the Linux version with the same changes + some other small improvements:

 

Attached File  grubinst Linux binaries.7z   1.04MB   435 downloads




#191681 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 29 March 2015 - 03:48 PM in Grub4dos

Also implemented the combination of a "Force LBA" with a fake entry:

  bt  h0  s0  c0  fs  h1  s1  c1      base      leng
  80  FE  FF  FF  07  FE  FF  FF       800   1400000
  00  FE  FF  FF  07  FE  FF  FF   1400800    A00000
  00  FE  FF  FF  07  FE  FF  FF   1E00800    9FF7FF
  00  95  DD  FF  00  63  F4  FF   308B927    111C90

I simplified the entire code by moving the code from chk_mbr2 into get_fstype (and deleting chk_mbr2):

int
chk_mbr(unsigned char *buf)
{
  return(probe_mbr((struct master_and_dos_boot_sector *) buf, 0, 1, 0) == 0);
}
#endif

int
get_fstype(unsigned char *buf)
{
  if (chk_mbr(buf))
    return FST_MBR;

  unsigned long pt[4][2];
  int           i, j, nrm_entrs, gpt_entrs, bp, fake_entrs, frlba_entrs, empt_entrs;

  nrm_entrs = gpt_entrs = bp = fake_entrs = frlba_entrs = empt_entrs = 0;
  for (i = 0x1BE; i < 0x1FE; i += 16)
  {
	 //boot flag
    if ((unsigned char) buf[i] == 0x80)
    {
      if (bp)
        break;
      else
        bp = 1;
    }
    else if (buf[i])
      break;

    if (buf[i + 4])  //valid filesystem id
    {
      //force LBA
      if ((buf[i + 1] == buf[i + 5]) && (buf[i + 1] == 0xFE) && (buf[i + 2] == buf[i + 6]) &&
          (buf[i + 2] == 0xFF) && (buf[i + 3] == buf[i + 7]) && (buf[i + 3] == 0xFF))
      {
        frlba_entrs++;
        continue;
      }

      //GPT
      if ((unsigned char) buf[i + 4] == 0xEE)
        if (((unsigned char) buf[i + 1] == 0) && ((unsigned char) buf[i + 2] == 2) && ((unsigned char) buf[i + 3] == 0) && ((unsigned char) buf[i + 5] >= 0xFE) && ((unsigned char) buf[i + 6] == 0xFF) && ((unsigned char) buf[i + 7] == 0xFF) && (valueat(buf[i], 8, unsigned long) == 1) && (valueat(buf[i], 12, unsigned long) == 0xFFFFFFFF))
        {
          gpt_entrs++;
          continue;
        }

      //normal entries
      pt[nrm_entrs][0] = valueat(buf[i], 8, unsigned long);
      pt[nrm_entrs][1] = pt[nrm_entrs][0] + valueat(buf[i], 12, unsigned long);
      if ((pt[nrm_entrs][0] == 0) || (pt[nrm_entrs][0] >= pt[nrm_entrs][1]))
        break;

      for (j = 0; j < nrm_entrs; j++)
        if ((pt[nrm_entrs][0] > pt[j][0]) ? (pt[nrm_entrs][0] < pt[j][1]) : (pt[nrm_entrs][1] > pt[j][0]))
          break;

      nrm_entrs++;
    }
    else
    {
      //fake entries
      for (j = 0; j < 16; j++)
        if (buf[i + j])
          break;
	  //all 0's
      if (j == 16)
	  {
		empt_entrs++;
        continue;
	  }
      if ((nrm_entrs == 0) && (frlba_entrs == 0))
        break;
      if ((valueat(buf[i], 8, unsigned long) <= 0) || (valueat(buf[i], 12, unsigned long) <= 0))
        break;

      fake_entrs++;
    }
  }

  if (i >= 0x1FE)  //normal cycle exit
  {
    if ((gpt_entrs == 1) && (!nrm_entrs) && (!fake_entrs) && (!frlba_entrs))
      return FST_GPT;
    else
    if (frlba_entrs && (!nrm_entrs) && (!gpt_entrs))
      return FST_MBR_FORCE_LBA;
    else
	if (empt_entrs < 4)
      return FST_MBR_BAD;
  }

  // The first sector of EXT2 might not contain the 0xAA55 signature
  if (valueat(buf[1024], 56, unsigned short) == EXT2_SUPER_MAGIC)
  {
    if (valueat(buf[1024], 0xE0, unsigned long) == 0)
      return FST_EXT2;
    else
    {
      unsigned long sfrc;

      sfrc = valueat(buf[1024], 0x64, unsigned long);
      if ((sfrc & 0x8) || (sfrc & 0x40))
        return FST_EXT4;
      else
        return FST_EXT3;
    }
  }
  if (valueat(buf[0], 0x1FE, unsigned short) != 0xAA55)
    return FST_OTHER;
  if (!strncmp((char *) &buf[0x36], "FAT", 3))
    return ((buf[0x26] == 0x28)
            || (buf[0x26] == 0x29)) ? FST_FAT16 : FST_OTHER;
  if (!strncmp((char *) &buf[0x52], "FAT32", 5))
    return ((buf[0x42] == 0x28)
            || (buf[0x42] == 0x29)) ? FST_FAT32 : FST_OTHER;
  if (!strncmp((char *) &buf[0x3], "NTFS", 4))
    return ((buf[0] == 0xEB) && (buf[1] == 0x52)) ? FST_NTFS : FST_OTHER;
  if (!strncmp((char *) &buf[0x3], "EXFAT", 5))
    return ((buf[0] == 0xEB) && (buf[1] == 0x76)) ? FST_EXFAT : FST_OTHER;
  return FST_OTHER;
}

Attached File  grubinst Windows binaries.7z   112.64KB   452 downloads
 




#191676 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 29 March 2015 - 01:01 PM in Grub4dos

I didn't see modulo used for < 8 GB but it still makes some checks with the "63" value.

 

Anyway I think I found a way to safely "bypass" the fake entries.

Here is the cycle per partition table entries, the code I used is close to the end

  /* probe the partition table */
  
  Cmax = 0;
  Hmax = 0;
  Smax = 0;
  for (i = 0; i < 4; i++)
    {
      /* the boot indicator must be 0x80 (for bootable) or 0 (for non-bootable) */
      if ((unsigned char) (BS->P[i].boot_indicator << 1))	/* if neither 0x80 nor 0 */
	return 1;
      /* check if the entry is empty, i.e., all the 16 bytes are 0 */
      if (*(long long *) (void *) &(BS->P[i].boot_indicator)
	  || *(long long *) (void *) &(BS->P[i].start_lba))
	{
	  /* valid partitions never start at 0, because this is where the MBR
	   * lives; and more, the number of total sectors should be non-zero.
	   */
	  if (!BS->P[i].start_lba || !BS->P[i].total_sectors)
	    return 2;
	  /* the partitions should not overlap each other */
	  for (j = 0; j < i; j++)
	    {
	      if ((BS->P[j].start_lba <= BS->P[i].start_lba)
		  && (BS->P[j].start_lba + BS->P[j].total_sectors >=
		      BS->P[i].start_lba + BS->P[i].total_sectors))
		continue;
	      if ((BS->P[j].start_lba >= BS->P[i].start_lba)
		  && (BS->P[j].start_lba + BS->P[j].total_sectors <=
		      BS->P[i].start_lba + BS->P[i].total_sectors))
		continue;
	      if ((BS->P[j].start_lba < BS->P[i].start_lba) ?
		  (BS->P[i].start_lba - BS->P[j].start_lba <
		   BS->P[j].total_sectors) : (BS->P[j].start_lba -
					      BS->P[i].start_lba <
					      BS->P[i].total_sectors))
		return 3;
	    }
	  //partition type undefined on a 2..4 entry                   begin new code
	  if ((i > 0) && (BS->P[i].system_indicator == 0))
	  {
	    /* fake entry, zero all the coefficients */
		C[i] = 0;
		H[i] = 0;
		L[i] = 0;
		C[i + 4] = 0;
		H[i + 4] = 0;
		L[i + 4] = 0;		  
	    continue;
	  }		                                                   end new code
	  /* the cylinder number */
	  C[i] =
	    (BS->P[i].
	     start_sector_cylinder >> 8) | ((BS->P[i].
					     start_sector_cylinder & 0xc0) <<
					    2);
	  if (Cmax < C[i])
	    Cmax = C[i];
	  H[i] = BS->P[i].start_head;
	  if (Hmax < H[i])
	    Hmax = H[i];
	  X = BS->P[i].start_sector_cylinder & 0x3f;	/* the sector number */
	  if (Smax < X)
	    Smax = X;
.........................

This way the fake entry helps to identify the data as a MBR partition table as much as it can.

 

For now the code seems to properly function.

 

 




#191671 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 29 March 2015 - 11:19 AM in Grub4dos

If I also deactivate 118, 119 and 120, no error.

 

So it properly function by deactivating 114, 118, 119 and 120 checks. But, the question is: how to know when to check or not to check?

The 0 filesystem id would be enough for this?




#191668 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 29 March 2015 - 10:54 AM in Grub4dos

I don't see it.

But, even if I deactivate it, it returns error code 118.

Attached Files

  • Attached File  utils.7z   5.78KB   397 downloads



#191666 get the disk capacity/size using grub4dos and the bios utility

Posted by DavidB on 29 March 2015 - 10:04 AM in Grub4dos

Maybe that area it's used by some grub4dos/bios code, try with a much higher memory area, like 0x19000 and above.

I use 0x19000 to load all my menu and  batch files in RAM (as a single file) and I've never had problems on dozens of computer configurations.

 

LE: I was talking about the "(md)0x300+1" from the fix...




#191664 get the disk capacity/size using grub4dos and the bios utility

Posted by DavidB on 29 March 2015 - 09:34 AM in Grub4dos

ok, I'll reboot to test.

 

LE: BTW, I added this line at the end "echo HDD size is %END% && pause" and removed the previous exit.

 

LLE: Yes, with your late fix seems to work now. For my 500 GB internal HDD returned 0x3A38602F sectors = 976773167 sectors. Multiplied with 512 B /s = 500107861504 B = 465.76 GB (correct value).

 

Well done, thank you :)




#191662 get the disk capacity/size using grub4dos and the bios utility

Posted by DavidB on 29 March 2015 - 09:30 AM in Grub4dos

It doesn't matter if I try on the real computer

 

Internal HDD 500 GB.jpg

 

USB disk 58.6 GB.jpg

 

Looks like the Bios calls fails...




#191658 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 29 March 2015 - 05:59 AM in Grub4dos

I noticed that the primary test (sub)function (probe_mbr) from the get_fstype function does not fail to detect a proper partition table for all the situations where it has a fake entry (most likely generated by partnew).

For example:

It fails:



  bt  h0  s0  c0  fs  h1  s1  c1      base      leng
  80  01  01  00  07  FE  FF  FF        3F   66B1F30
  00  FE  FF  FF  83  FE  FF  FF   66B2000    E8E000
  00  00  00  00  00  00  00  00         0         0
  00  95  DD  FF  00  63  F4  FF   308B927    111C90

Does not fail:



  bt  h0  s0  c0  fs  h1  s1  c1      base      leng
  80  01  01  00  07  FE  FF  FF        3F   66B1F30
  00  FE  FF  FF  83  FE  FF  FF   66B2000    E8E000
  00  00  00  00  00  00  00  00         0         0
  00  56  C5  51  00  0C  C2  89    D0333F     DA800

Traced the problem to here:

Clipboard02.png

It's returning error code 114. Notice this code is for "large disks" (above 8 GB). Most of you probably know already about the 8 GB Bios limit.

So, if the fake partition is under 8 GB, all is ok. Above, problem.
Have to find a way to modify that code to properly function for > 8 GB too.

Any ideas?




#191653 get the disk capacity/size using grub4dos and the bios utility

Posted by DavidB on 29 March 2015 - 03:02 AM in Grub4dos

That looks interesting.

 

Thank you.

 

 

Late edit: strange, it's returning "Drive too big!" even for a 58.6 GB disk. So, not even near to 1 TB.
It doesn't matter if I try on the real computer or on VirtualBox/Qemu, if I try with Grub4Dos 0.4.5c or 0.4.6a version or if I try with my real USB disk or with a virtual one.

 

USB Boot test.png

 

"END" is is 0xFFF...FFF.

Also the link to grubutils pack is actually to this thread. I had to use my bios utility (3704 B), hope it is the last version...




#191630 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 26 March 2015 - 01:48 PM in Grub4dos

Attached File  grubinst Linux binaries.7z   1.18MB   430 downloads

Changes:
- detection of GPT
- grubinst command line tool shows now in "Image type" the EXT number (2, 3 or 4) instead of just "Ext2/3/4"
- language code implemented. It uses the same content of the current language files, although for some languages the file extension should be a little different to be automatically loaded by the app
- the informations in the disk list and the partition list are now grouped on columns (for easy reading). Also the lists show now the mounted partitions (in the form: [sd + disk letter + blank space + partition(s) number(s)])
- a few bugs solved

 

snapshot1.png snapshot2.png




#191579 Rufus 2.0 has been released

Posted by DavidB on 24 March 2015 - 05:42 AM in USB Drive Format Utilities

Gee, I wondered which of these £%&*( antivirus would produce a false positive this time...

 

Please see here. I'm afraid I have better things to do than confirm yet another friggin' false positive.

The only thing I'll say then is: When it's clear that you can't win the game, the only winning move is not to play.

 

"Guilty until proven innocent" - the way cheap/adware AVs achieve (so-called) better results in detecting viruses :rolleyes:

But lately, even some of the professional AVs began to use this "technique"...

And more and more developers have to pay the "protection fee". Sorry, I meant to say "digital signature" :rolleyes:




#191556 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 22 March 2015 - 05:22 PM in Grub4dos

Attached File  grubinst Windows binaries.7z   82.28KB   438 downloads

Changes:
- detection of GPT
- grubinst command line tool shows now in "Image type" the EXT number (2, 3 or 4) instead of just "Ext2/3/4"

I'm thinking of also implementing the detection of GPT partitions + installing Grub4Dos PBR.
But I'm not sure it's worth the work...

 

Late edit: just a small change - adapted to detect GPT from disks partitioned with Bootice's partition manager as well.




#191532 help.. how not to grubinst

Posted by DavidB on 21 March 2015 - 09:44 AM in Boot from USB / Boot anywhere

You're welcome :)




#191530 help.. how not to grubinst

Posted by DavidB on 21 March 2015 - 08:59 AM in Boot from USB / Boot anywhere

Well, I was able to recover the unaccessible partitions by using MiniTool Partition Wizard Free 9.
In its interface I right clicked on the disk and selected "Partition recovery". I then choosed "Full disk" and then tried with "Quick scan".
You can try with "Full scan" if "Quick scan" doesn't find them.
After that right click on partitions and assign them letters.

If it's unsuccessful you can also try with TestDisk.




#191525 help.. how not to grubinst

Posted by DavidB on 21 March 2015 - 02:33 AM in Boot from USB / Boot anywhere

Looking at the file, seems to be a PBR, not a MBR.
What's weird is that it's got only 1 sector (512/0x200 B) of data. For a long time the Grub4Dos NTFS PBR is 4 sectors long (2048/0x800 B).
What's again weird is it seems to be a "generic" PBR (no info about the partition). So no wonder the OS can't read the data from partition.
Can you show us each step you did in grubinst_gui?

What tool have you used to partition the disk? Was it "disk management" from Windows? If yes, which Windows version? If not, in that tool have you used GPT or MBR?

 

Late edit: 

I was able to get similar results as you by doing this:
I created a 465 GB virtual HDD, mount it, used MiniTool Partition Wizard to create a 455 GB NTFS partition + a 10 GB FAT32 hidden partition; I then "forced" Grub4Dos installer to see it as a NTFS partitioned floppy by using NTFS instead of AutoDetect at FileSystem.
At this point both partitions are unaccessible.




#191517 help.. how not to grubinst

Posted by DavidB on 20 March 2015 - 08:22 PM in Boot from USB / Boot anywhere

Since you know how to use Bootice: open it, select the disk, click on sector edit and then on "backup to file".

Set it like in the screenshot:

 

Clipboard01.png

 

Click on backup. Save a copy of the file in a safe location and also post it here.

 




#191512 help.. how not to grubinst

Posted by DavidB on 20 March 2015 - 07:24 PM in Boot from USB / Boot anywhere

One option will be to try to restore the original MBR, using grubinst_gui.

Just tick on "Restore the previous MBR" and click on Restore button.

 

If it was restored, disconnect and reconnect the disk.




#191508 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 20 March 2015 - 06:50 PM in Grub4dos

Thank you for the advice, Tinybit.

Meantime, alacran sent me the Spanish translation for grubinst_gui. Thank you very much :)

Attached File  grubinst_gui Spanish translation.7z   1.13KB   405 downloads

Also I made some improvements to the language code:
 

Attached File  grubinst Windows binaries.7z   82.78KB   415 downloads

 

One of these days I'll start implementing the language code in the Linux GUI version as well.




#191477 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 19 March 2015 - 05:59 AM in Grub4dos

Well, meantime I found and corrected a few small bugs and made some (also small) improvements.
The tool is now close to "Release Candidate" stage.
I reuploaded in the previous post.


I'm thinking on uploading it to the original site: http://code.google.c....3.zip&can=2&q=
Or, to be more precise, to send it to Bean or Chenall, since they are the only one who can upload it there.
But I don't know if it's worth to do since code.google.com will shutdown soon.

Or I can create a new project at github. But still I think I should ask Bean/Chenall before, since most of the code is theirs.

What do you say, guys?




#191434 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 17 March 2015 - 11:41 AM in Grub4dos

Implemented:

 

Attached File  grubinst Windows binaries.7z   82.59KB   443 downloads

 

Attached File  grubinst Linux binaries.7z   990.59KB   386 downloads

 

Attached File  grubinst Windows and Linux sources.7z   228.42KB   399 downloads




#191423 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 16 March 2015 - 09:44 PM in Grub4dos

This seems to work:

 

utils.c

int
chk_mbr2 (char *buf)
{
  unsigned long pt[4][2];
  int i, pn, bp, pf;

  pn = bp = pf = 0;
  for (i = 0x1BE; i < 0x1FE; i += 16)
    {
      if ((unsigned char) buf[i] == 0x80)
	{
	  if (bp)
	    return 0;
	  else
	    bp = 1;
	}
      else if (buf[i])
	return 0;

      if (buf[i + 4])
	{
	  int j;

	  pt[pn][0] = valueat (buf[i], 8, unsigned long);
	  pt[pn][1] = pt[pn][0] + valueat (buf[i], 12, unsigned long);
	  if ((pt[pn][0] == 0) || (pt[pn][0] >= pt[pn][1]))
	    return 0;

	  for (j = 0; j < pn; j++)
	    if ((pt[pn][0] > pt[j][0]) ? (pt[pn][0] < pt[j][1]) : (pt[pn][1] >
								   pt[j][0]))
	      return 0;

	  pn++;
	}
      else
	{
	  int j;
	  
	  for (j=0;j<16;j++)
		  if (buf[i + j])
			  break;
	  if (j == 16)
		  continue;
      if (pn == 0)
		  return 0;
	  if ((valueat (buf[i], 8, unsigned long) <= 0) || (valueat (buf[i], 12, unsigned long) <= 0))
          return 0;

	  pf++;
	}
    }

  if (pn && (!pf))
    return pn;
  else
	if (pn && pf)
	  return -pf;
    else
	  return pn;
}

int
get_fstype (unsigned char *buf)
{
  if (chk_mbr (buf))
    return FST_MBR;

  int r;
  
  r = chk_mbr2 ((char *)buf);
  if (r > 0)
    {
      int i,j;

      for (i=0x1BE;i<0x1FE;i+=16)
        {
          for (j=0;j<8;j++)
            if (buf[i+j]!=0)
              break;
          if (j==8)
            continue;
          if((buf[i+1]!=buf[i+5]) || (buf[i+1]!=0xFE) || (buf[i+2]!=buf[i+6]) || (buf[i+2]!=0xFF) || (buf[i+3]!=buf[i+7]) || (buf[i+3]!=0xFF))
            return FST_MBR_BAD;
        }
      return FST_MBR_FORCE_LBA;
    }
  else
	if (r < 0)
	  return FST_MBR_FAKE_PART;

  // The first sector of EXT2 might not contain the 0xAA55 signature
  if (valueat (buf[1024], 56, unsigned short) == EXT2_SUPER_MAGIC)
    return FST_EXT2;
  if (valueat (buf[0], 0x1FE, unsigned short) != 0xAA55)
      return FST_OTHER;
  if (!strncmp ((char *)&buf[0x36], "FAT", 3))
    return ((buf[0x26] == 0x28)
	    || (buf[0x26] == 0x29)) ? FST_FAT16 : FST_OTHER;
  if (!strncmp ((char *)&buf[0x52], "FAT32", 5))
    return ((buf[0x42] == 0x28)
	    || (buf[0x42] == 0x29)) ? FST_FAT32 : FST_OTHER;
  if (!strncmp ((char *)&buf[0x3], "NTFS", 4))
    return ((buf[0] == 0xEB) && (buf[1] == 0x52)) ? FST_NTFS : FST_OTHER;
  if (!strncmp ((char *)&buf[0x3], "EXFAT", 5))
    return ((buf[0] == 0xEB) && (buf[1] == 0x76)) ? FST_EXFAT : FST_OTHER;
  return FST_OTHER;
}

grubinst_gui.c >> refresh_part function

...........................
  if (fs == FST_MBR_FORCE_LBA)
  {
    MessageBox(hWnd, LoadText(IDS_FORCE_LBA_MBR), "Warning", MB_OK);
    fs = FST_MBR;
  }
  else
  if (fs == FST_MBR_BAD)
  {
    MessageBox(hWnd, LoadText(IDS_INVALID_MBR), "Warning", MB_OK);
    fs = FST_MBR;
  }
  else
  if (fs == FST_MBR_FAKE_PART)
  {
    MessageBox(hWnd, LoadText(IDS_FAKE_PART_MBR), "Warning", MB_OK);
    fs = FST_MBR;
  }
..................................



#191410 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 16 March 2015 - 04:35 PM in Grub4dos

Ok.
Until I will implement a solution, here is the Linux version updated with the latest modifications from the Windows version:

 

Attached File  Grubinst Linux binaries.7z   989.98KB   422 downloads

It's not that complex as the Windows version, but it's what you can do with Lazarus...




#191407 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 16 March 2015 - 02:13 PM in Grub4dos

Ya, I read it once ages ago.. :D

Thank you, Tinybit.

Here is another idea: modify chk_mbr2 to return the negative number of such "fake" partitions if everything else is ok.
In this situation, get_fstype will return FST_MBR_FAKE_PART.
Grubinst_gui will warn the user and it will advice him to use --skip-mbr; meantime it will use FST_MBR to display the partition list.
In grubinst --skip-mbr will skip this issue too.




#191401 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 16 March 2015 - 12:52 PM in Grub4dos

As you guys might remember, a few months ago when I started to work on Grubinst, I found a situation where the default MBR testing and/or ticking the Skip MBR option didn't help.
The only thing that helped was to set directly "MBR type" for the disk. That's why I implemented the choice for AutoDetect/MBR/NTFS/exFAT/FAT32/FAT16/EXT2/3/4.
Now I found out how to duplicate that problem. It's from using the partnew command to map ISOs.

Here is the partitions table of my USB flash disk before using the partnew command:



bt h0 s0 c0 fs h1 s1 c1 base leng
80 01 01 00 07 FE FF FF 3F 66B1F30
00 FE FF FF 83 FE FF FF 66B2000 E8E000
00 00 00 00 00 00 00 00 0 0
00 00 00 00 00 00 00 00 0 0

The get_fstype function from utils.c returns FST_MBR.

Here is the partitions table of my USB flash disk after using the partnew command:



bt h0 s0 c0 fs h1 s1 c1 base leng
80 01 01 00 07 FE FF FF 3F 66B1F30
00 FE FF FF 83 FE FF FF 66B2000 E8E000
00 00 00 00 00 00 00 00 0 0
00 95 DD FF 00 63 F4 FF 308B927 111C90

The get_fstype function returns FST_OTHER.
As you may have noticed, the 4th entry is generating the problem.
In other tools is not making this kind of problems, so the function should be modified to not show error in such situations but without decreasing its efficiency in other situations.

I noticed the chk_mbr2 function (used by get_fstype) expects all 0's when the filesystem (fs) is 0:
 



      if (buf[i + 4])  //nonzero fs
	{
	  int j;

	  pt[pn][0] = valueat (buf[i], 8, unsigned long);
	  pt[pn][1] = pt[pn][0] + valueat (buf[i], 12, unsigned long);
	  if ((pt[pn][0] == 0) || (pt[pn][0] >= pt[pn][1]))
	    return 0;

	  for (j = 0; j < pn; j++)
	    if ((pt[pn][0] > pt[j][0]) ? (pt[pn][0] < pt[j][1]) : (pt[pn][1] >
								   pt[j][0]))
	      return 0;

	  pn++;
	}
      else  //zero fs
	{
	  int j;

	  for (j = 0; j < 16; j++)
	    if (buf[i + j])
	      return 0;
	}
    }

So I have to found a way to make it not "notice" a 0 filesystem type + nonzero parameters but without lowering its efficiency.
And the chk_mbr function should be modified as well.

Any ideas?




#191268 "Cloning" bootable pendrives

Posted by DavidB on 11 March 2015 - 03:21 PM in USB Drive Format Utilities

Content removed 




#191265 "Cloning" bootable pendrives

Posted by DavidB on 11 March 2015 - 12:44 PM in USB Drive Format Utilities

Content removed 




#191261 "Cloning" bootable pendrives

Posted by DavidB on 11 March 2015 - 10:32 AM in USB Drive Format Utilities

Content removed 




#191255 "Cloning" bootable pendrives

Posted by DavidB on 11 March 2015 - 09:41 AM in USB Drive Format Utilities

Content removed  




#191253 "Cloning" bootable pendrives

Posted by DavidB on 11 March 2015 - 08:21 AM in USB Drive Format Utilities

Content removed 




#191250 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 11 March 2015 - 05:46 AM in Grub4dos

Grubinst for Windows is now in Beta test stage.
So, if you notice any problems, just report them here with details to help reproduce them.


Meantime I'm trying to find a way to make a Linux GUI version using C instead of Lazarus.
Any ideas are welcome.




#191242 Virtual Machine USB Boot

Posted by DavidB on 10 March 2015 - 04:55 PM in Boot from USB / Boot anywhere

New version: 1.51 final

All changes:

1. The scan for (USB) disks is faster.
2. In the Add/Edit window the information about found disks and CDROM drives is shown on columns (name/size/volume letter(s)).
3. A few bugs solved.
4. Some small improvements to the language code.
5. Added german translation (lng file) sent by Blackcrack.

 

Download from here




#191228 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 10 March 2015 - 04:24 AM in Grub4dos

Attached File  grubinst Windows binaries.7z   81.32KB   454 downloads

 

Attached File  grubinst Windows sources.7z   142.38KB   385 downloads

 

 

Changes:

1. Some bugs fixed.
2. Once again the scan for (USB) disks is now a little faster.
3. The window flickering was reduced.
4. "Floppy image" option replaced with "Copy bpb of the 1st partition".




#191205 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 09 March 2015 - 03:16 AM in Grub4dos

I understand.

Thank you for the informations :)




#191203 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 09 March 2015 - 02:39 AM in Grub4dos

Hmm, maybe that was the problem, testing with ext4...

 

Another thing:

 

A question: how to get the "bytes per sector" value for a disk?
Most disks now have 512 B/s but I want to make grubinst able to adapt to any disk (for example with 4096).
There are Windows and Linux functions but they require a mounted volume. I was thinking about a way to access the disk directly and get it.

 

LE: I know you can get it from some PBR's for example but I'm looking for a function that would work even on an empty disk.




#191201 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 09 March 2015 - 02:26 AM in Grub4dos

Is in fact "partition manager view style" for the partition list but I couldn't write such a long description in that place (I would have to make the other controls with the same width and it would of looked ugly).

But I'm open to suggestions...

 

In the last days I have made some modifications, I'm working on code right now...




#191199 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 09 March 2015 - 01:24 AM in Grub4dos

Yes, it was only the PBR with the problem, the MBR was ok.

 

Well, to be 100% sure, I tested again.

Good news, it seems that using the PBR generated by the 0.4.5c bootlace.com you can boot after all :)

And, after making some small adjustments in grubinst, now you can boot also with the PBR generated by grubinst.

I don't know what was different in the first tests but I will try to find out.

 

Just a curiosity: it seems that most of these parameteres are not needed to be able to boot with Ext2 0.4.6a PBR. At least I was able to boot with  only "--floppy=num_part"...




#191197 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 08 March 2015 - 03:27 PM in Grub4dos

 

 

You may look into the bootlace code. You know, bootlace can install grub4dos partition boot sector code for the ext2 partitions. So bootlace will fill in those fields (mentioned above) according to data in the super block.

 

I already knew that, but thank you for the idea.

 

Anyway, I already figure it out what I should use:



		  memcpy(grub_mbr,&grub_mbr[0x800],slen);
		  if(afg & AFG_IS_FLOPPY)
		    grub_mbr[0x25]=0xFF;
		  else
		    grub_mbr[0x25]=part_num;
		  if (afg & AFG_LBA_MODE)
		    grub_mbr[2]=0x42;
		  else if (afg & AFG_CHS_MODE)
		    grub_mbr[2]=0x2;
		  else
		    grub_mbr[2]=0x0;

		  if (def_spt!=-1)
		    valueat(grub_mbr,0x18,unsigned short)=def_spt;
		  else
		    valueat(grub_mbr,0x18,unsigned short)=0x0;
		  if (def_hds!=-1)
		    valueat(grub_mbr,0x1A,unsigned short)=def_hds;
		  else
		    valueat(grub_mbr,0x1A,unsigned short)=0x0;
		  if (def_tsc!=-1)
		    valueat(grub_mbr,0x20,unsigned long)=def_tsc;
		  else
		    valueat(grub_mbr,0x20,unsigned long)=0x0;
		  // bytes per block
		  unsigned long bpb;

		  bpb=1024 << valueat(prev_mbr[1024],0x18,unsigned long);
		  valueat(grub_mbr,0xE,unsigned int)=bpb;
		  //sectors per block
		  valueat(grub_mbr,0xD,unsigned short)=(unsigned short)(bpb/512);
		  //number of blocks covered by a indirect block
		  valueat(grub_mbr,0x14,unsigned long)=(unsigned long)bpb/4;
		  //number of blocks covered by a double-indirect block
		  valueat(grub_mbr,0x10,unsigned long)=(unsigned long)(bpb/4)*(bpb/4);
		  //inode size in bytes
		  valueat(grub_mbr,0x26,unsigned int)=valueat(prev_mbr[1024],0x58,unsigned int);
		  // s_inodes_per_group
		  valueat(grub_mbr,0x28,unsigned long)=valueat(prev_mbr[1024],0x28,unsigned long);
		  // s_first_data_block+1
		  valueat(grub_mbr,0x2C,unsigned long)=valueat(prev_mbr[1024],0x14,unsigned long)+1;

But, no matter if I use bootlace.com or grubinst, the EXT2 0.4.5.c PBR will not boot anyway.

The issue is  the same as here:https://github.com/c...b4dos/issues/37




#191195 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 08 March 2015 - 02:40 PM in Grub4dos

I'm thinking of making the "Floppy image" option internal. It will be ticked/unticked only by the filesystem detection code.
Reasons:
1. I haven't actually met ANY situation in which I would have to set it manually.
2. In its place I can implement another useful option, like "--copy-bpb". Or another, you can suggest one, if you think that "--copy-bpb" will not be so used...

What do you say...?




#191174 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 06 March 2015 - 02:28 PM in Grub4dos

Attached File  grubinst Windows binaries.7z   81.11KB   458 downloads

All changes:

1. Small adjustments to the PBRs.
2. Now it shows an (A) or (B) in the partition list near the partition type when it's active/bootable. (A) in partition manager view mode, (B) in Grub4Dos view mode.
2. In Windows versions >= Vista, the "Lock volume" checkbox is automatically ticked on exFAT too.
3. The language code was updated for the 1.3 >> 1.4 version changes. Also, an *.eng template file was created (for translators).
Unfortunately, since I don't know chinese language, I couldn't update the grubinst_gui.chs file too.
4. Now it can detect a few more Grub4Dos PBR versions.
5. In the partition list it can now differentiate EXT2, EXT3 and EXT4.




#191139 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 05 March 2015 - 01:18 PM in Grub4dos

Hi, guys.

I made some changes:

1. Small adjustments to the PBRs.
2. Now it shows an (A) or ( B) in the partition list near the partition type when it's active/bootable. (A) in partition manager view mode, ( B) in Grub4Dos view mode.
2. In Windows versions >= Vista, the "Lock volume" checkbox is automatically ticked on exFAT too.
3. The language code was updated for the 1.3 >> 1.4 version changes. Also, a *.eng template file was created (for translators).
Unfortunately, since I don't know chinese language, I couldn't update the grubinst_gui.chs file too.
4. Now it can detect a few more Grub4Dos PBR versions.

Also I tested the GUI in Windows XP PE, 7 PE and 8.1 PE. There were no problems.



But, before releasing the new binaries, I need to verify something: in the README_GRUB4DOS.txt file from Grub4dos 0.4.5c binaries there is a description of the Ext2 Boot Sector/Boot Record Layout. Some of the values here I found them in the Ext2 Superblock http://www.nongnu.or...2-doc/ext2.html(3.1 chapter).
But some of them couldn't find/calculate (yet):
 

Offset	Length	Description
======	======	============================================================== 

0Dh	1	Sectors per block. Valid values are 2, 4, 8, 16 and 32.

10h	4	Pointers in pointers-per-block blocks, that is, number of
		blocks covered by a double-indirect block.

		Valid values are 0x10000, 0x40000, 0x100000, 0x400000 and
		0x1000000.

14h	4	Pointers per block, that is, number of blocks covered by an
		indirect block.

		Valid values are 0x100, 0x200, 0x400, 0x800, 0x1000.

Does anybody have an idea how can I get these values using the data from the Ext2 Superblock?




#191087 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 02 March 2015 - 06:46 PM in Grub4dos

I used a checkbox for switching between modes. It's a little bit better :)
 

Grubinst WIN.png

 

Attached File  grubinst_gui Windows binary.7z   64.32KB   475 downloads




#191081 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 02 March 2015 - 01:33 PM in Grub4dos

Attached File  grubinst_gui Windows binary.7z   64.48KB   482 downloads

 

Made an improvement: the combobox that lists the partitions works now in 2 modes:
1. The default. It lists partitions just like Grub4Dos does:
 

QEMU Grub4Dos.png

Grubinst G4D.png

2. It lists partitions just like a partition manager does:

DiskMan.png

Grubinst WIN.png

 

In this case, Grubinst_gui will "know" which number should use to call grubinst.

You can switch between modes using the next combobox with G4D/WIN values.
Yes, I know, it needs better names/component. Maybe someone has a better idea...




#191049 Virtual Machine USB Boot

Posted by DavidB on 01 March 2015 - 01:48 PM in Boot from USB / Boot anywhere

Found the problem.
Looks like I was too "intoxicated" with C  :rolleyes: 
In C the format string functions accept %c for character and %s for string. In Delphi it's %s for both.

Now it's fixed:

Thank you for reporting  :)

LE: download links removed, you can find a better version in the next posts.




#191038 Virtual Machine USB Boot

Posted by DavidB on 01 March 2015 - 01:00 PM in Boot from USB / Boot anywhere

If I understand correctly, the only problem here is the message "Internal error"?




#191028 Virtual Machine USB Boot

Posted by DavidB on 01 March 2015 - 10:51 AM in Boot from USB / Boot anywhere

New version: 1.51 Beta 2

 

Changes:

1. A few adjustments to the latest modifications;
2. Some bugs solved.

The scan for (USB) disks is now as fast as possible. But, if you have many disks connected and you notice a long delay in their scan, could be from the security solution. For example I noticed that Comodo Internet Security delays every access to each removable disk with a few hundred ms. It may not seem much, but when you have a few disks connected and VMUB accesses each of them 2..3 times (to get all their data), it will become noticeable (but not very annoying). I advise you to notify the security solution support so they can fix the problem.
Just so you know:
1. For most of the security solutions, deactivating it from its icon in tray won't help. For Comodo I had to uninstall it to get rid of the delay.
2. When the delay from the security solution is gone, VMUB accesses each disk in a matter of ms.

 

LE: download links removed, you can find a better version in the next posts.




#191027 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 01 March 2015 - 10:14 AM in Grub4dos

Here is the Linux version of grubinst.exe (with the latest modifications):
 

Attached File  grubinst command line binary.7z   26.5KB   435 downloads




#190982 Virtual Machine USB Boot

Posted by DavidB on 26 February 2015 - 08:09 AM in Boot from USB / Boot anywhere

New version: 1.51 Beta 1

Changes:

1. The scan for (USB) disks is faster.
2. In the Add/Edit window the information about found disks is shown on columns (name/size/volume letter(s)).
3. Some small improvements to the language code.
4. Added german translation (lng file) sent by Blackcrack. For now is in the Languages folder near the exe (portable) file but in the final version all the lng files will be added in the exe file resources.
 

LE: download links removed, you can find a better version in the next posts.




#190950 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 24 February 2015 - 06:38 PM in Grub4dos

To install the Grub4Dos MBR/PBR there is no need to download Grub4Dos binaries or anything else. It's standalone.

 

But the MBR/PBR needs the grldr and the menu.lst files.

 

 

I tested this tool on my computer and I had no problems but I advice you to be careful. Backup the old MBR/PBR before installing the Grub4Dos one. Don't use it on your OS disk/volume.




#190943 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 24 February 2015 - 09:20 AM in Grub4dos

Ok, thank you.

Implemented, seems to boot ok:

 

Attached File  grubinst Windows binaries.7z   79.89KB   432 downloads

 

Attached File  grubinst Windows sources.7z   121.11KB   401 downloads




#190941 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 24 February 2015 - 08:52 AM in Grub4dos

Attached File  grubinst Windows binaries.7z   79.84KB   427 downloads

Changes:
1. Solved the flickering by not using resizing anymore + using that method for the rest of the changes.
2. Solved a Silent Boot problem with the latest Grldr.mbr.
3. Now it detects Windows version >= 6 (Vista or above) and automatically ticks the "Lock volume" option for NTFS file system.
4. A few other minor adjustments/tweaks.

Steve, the 0.4.6a grldr.mbr seems stable and bug free now so we can try to apply that "+2" patch, if you think it can be applied:
 

Attached File  grldr46anp mbr.7z   5.76KB   362 downloads

Attached File  grldrstart46anp.7z   44.02KB   405 downloads




#190932 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 23 February 2015 - 05:09 PM in Grub4dos

I'm trying to reduce the window "flickering" when I do many changes to the controls from the window.
A good method is to deactivate the redraw, make all the changes, reactivate the redraw and repaint the hole window in one step:

SetWindowRedraw(hWnd,FALSE);
...
do changes
...
SetWindowRedraw(hWnd,TRUE);
InvalidateRect(hWnd,NULL,FALSE);

It's working well, with one exception: when is resizing the window to a smaller size.

 

Clipboard02.png

As you can see, it's not erasing the area where it was previously.
In VMUB (Delphi) solved the same problem with this:

SendMessage(Handle, WM_SETREDRAW, WPARAM(False), 0);
...
do changes
...
SendMessage(Handle, WM_SETREDRAW, WPARAM(True), 0);
RedrawWindow(Handle, nil, 0, RDW_ERASE or RDW_FRAME or
RDW_INVALIDATE or RDW_ALLCHILDREN or RDW_UPDATENOW);

Tried them in C, no change.

Any ideas?




#190926 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 23 February 2015 - 08:49 AM in Grub4dos

Attached File  grubinst Windows binaries.7z   79.61KB   434 downloads

Changes:
1. Implemented the last grldr.mbr and grldr.pbr with ext2 fixed.
2. Implemented unmount/remount.
3. The interface is now changed at runtime when the user chooses a floppy image or a partition.




#190916 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 22 February 2015 - 03:48 PM in Grub4dos

Using the old original grubinst.exe I had to use LockDismount.exe under Win 8.1 from an Admin .cmd file on my system (I think there was problems with NTFS PBR??)..

This takes a drive number as a parameter, so I assume it works on the whole drive.

 

If you succeeded, I think that NTFS volume wasn't on the OS disk, because LockDismount cannot lock/dismount the OS volume from that disk.

 

I'm thinking of implementing the unmount/remount too, but not enabled by default. Because it will be slow + the problem rarely appears + it will not help in all situations.

Grubinst could suggest using it after it fails to write (just like it mentions the "Skip MBR test" option)...




#190913 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 22 February 2015 - 02:07 PM in Grub4dos

I just tested in Windows 7 x64, the only problem is with the OS volume. But it's not a good idea to unmount/remount the OS volume while that OS is loaded .
With any other NTFS partitions, mounted or not, I had no problems writing PBR. Tried with UAC on or off, same results.

Steve, can you give me more details about the problem you had in Windows 8.1?

I'm not surprised to heat that about Vista, Wonko. It's the Windows I like less of all...
Yes, temporarily zeroing 55AA or the partition table to make Windows "think" it's nothing there to access could be a solution but it's not without risks...




#190911 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 22 February 2015 - 12:48 PM in Grub4dos

Thank you Wonko.

 

I already know about locking/unlocking unmounting/remounting volumes using DeviceIo+FSCTL_LOCK_VOLUME+FSCTL_DISMOUNT_VOLUME, since I used them in VMUB and in grubinst. I was just curious if someone knows a way to lock/unlock/unmount/remount an entire drive, not just the volumes on it.

A way with partial results is to use CreateFile for the entire drive but with no FILE_SHARE_WRITE/FILE_SHARE_READ/FILE_SHARE_DELETE flags.

 

Something else: Yaya just released a new Grub4Dos 0.4.6a version with all the EXT2 problems solved. Looks like the Grub4Dos MBR/PBR wasn't compatible with the EXT2 from MiniTool Partition Wizard (I used it for tests).




#190907 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 22 February 2015 - 09:11 AM in Grub4dos

Attached File  grubinst Windows binaries.7z   78.76KB   420 downloads

 

Changes:
1. The scan for (USB) drives and their characteristics is now faster, which also means the app starts faster.
2. When it writes the PBR in a partition it locks now only the associated volume instead of locking all volumes on that drive.
3. The partition list is now showing the data on "columns" to be easier to read it. Also it's displaying the associated volume for each partition.
4. The last Grldr.mbr 0.4.6a version was integrated. Thanks to Yaya for fixing some problems.
5. Minor problems fixed on EXT2/3/4 0.4.6a PBR.

Steve, some time ago you said you had to lock the drive/volumes so you can do changes with grubinst.exe in Windows 8.1.
Was the drive or the volumes you locked? Which tool have you used?




#190892 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 21 February 2015 - 01:50 AM in Grub4dos

Well, I tested cfadisk in my XP x86.

Now the Kingston 64 GB USB drive is seen as fixed:

 

Clipboard02.png




#190884 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 20 February 2015 - 03:41 PM in Grub4dos

Sorry to hear this.

Looks like this driver is made for older versions of Windows...




#190875 Giveaway of the Day - MiniTool Partition Wizard Pro 9.0 2-19-2015

Posted by DavidB on 19 February 2015 - 11:15 PM in Community forum

Good tool.

The only problem: exFAT not implemented.




#190853 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 19 February 2015 - 12:20 AM in Grub4dos

Ok.

Thank you alacran for testing.




#190821 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 18 February 2015 - 02:11 PM in Grub4dos

Forgot to say: in Grub4Dos 0.4.6a the GFG_* settings are stored in 0x5A byte.

The last byte could work, need testing.

 

Searching for a way to detect removable/fixed in C...

 

 

Late edit: 

Found a way to detect removable/fixed.
For now I implemented to show [R] or [F] near the drive name.

Seems to work:

Clipboard02.png

Clipboard03.png

Can you test with that cfadisk-type driver + a removable drive, to see what is showing (F/R)?

 

Attached File  grubinst Windows binaries.7z   77.48KB   418 downloads




#190817 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 18 February 2015 - 11:49 AM in Grub4dos

I think BIOSes just don't  care about or even look at the RMB bit. Some may look for a MBR to decide what type it is, some just assume a flash drive is a floppy/zip type, some look at the capacity/size of the device and decide from that if it is a HDD, Floppy or ZIP.

 

 

Yes, I noticed that too.

 

 

But this is not quite the same thing as the RMB bit. The BIOS is just trying to decide whether to treat the device as a HDD/FDD or SuperFloppy(ZIP) device for booting purposes (and mapping to Int 13h as a FDD (0x0) or HDD (0x80)) - it's not the same thing as the RMB bit.

Bottom line is that you can't depend on a BIOS to indicate the RMB status of a device (I don't think any BIOS can detect the RMB bit through normal 'BIOS code' means).

 

Yes, I knew that.

I was trying to say that for me, as a user, the information about removable/fixed (stored in MBR/PBR) doesn't help (me). But I admitted it could be useful for other users. So I will support it.

But we have to solve those 2 problems first...




#190815 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 18 February 2015 - 10:52 AM in Grub4dos

I changed it to "Although I have (USB) drives seen as removable in Windows but been able to boot from them as fixed HDD" 2 min after I posted.

In the BIOS of my mainboard (and others too) these removable USB drives are seen as normal fixed HDDs. So all I have to do to boot from them is to change the order (the one I want to boot at the top of the list).




#190812 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 18 February 2015 - 10:32 AM in Grub4dos

Yes.
I'm not sure the Windows API functions will see it as removable; and accessing the hardware directly is not a good idea (even when the app is started as an admin).
Another way is to detect the use of the cfadisk-type driver, but that's not easy too.




#190809 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 18 February 2015 - 09:56 AM in Grub4dos

It's an interesting idea: to know, when you boot in a Grub4Dos simple menu or in E2B, that the drive is fixed or removable in Windows.
Although I have (USB) drives seen as removable in Windows but been able to boot from them as fixed HDD, this info will not help me much. But for other users it may be helpful.

So I will support it.

2 problems:

1. What about when a specific Windows is "convinced" (by "software" means) the drive is fixed (but being removable in hardware)? The Removable Media Bit tag won't help much, because on other Windows the drive will be seen as removable.
2. It's not a problem implementing this on my own in MBR/PBR/grubinst/grubinst_gui (just like I implemented "Silent boot").
For example I can use the 3rd/5th byte where these settings are stored:

#define GFG_DISABLE_FLOPPY 1
#define GFG_DISABLE_OSBR 2
#define GFG_DUCE 4
#define CFG_CHS_NO_TUNE 8
#define GFG_SILENT_BOOT 16
#define GFG_PREVMBR_LAST 128

Will add these:

#define GFG_IS_REMOVABLE 32
#define GFG_IS_FIXED 64

Usualy one is enough, but this time 2 are required (to achieve those 3 conditions).

But Chenall/Yaya may need these last 2 "slots" for some future switches/options. I'm not even sure they will accept GFG_SILENT_BOOT...
And to find/designate another byte for this is not that easy.
So I advise you to open an issue at Grub4Dos github to talk with Chenall/Yaya first. Like I said, I will support you.




#190804 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 18 February 2015 - 08:37 AM in Grub4dos

YaYa said:

 

"--preferred-drive=" 与"--preferred-partition=" , 0.4.6a 不再支持。

grldr.mbr 可以搜索各磁盘、各分区的 grldr,这是它的优点。而设置 "--preferred-drive=" 与"--preferred-partition=" 并不是通用的,是个别行为,也没有做到快速搜索。

 

Google translate:

 

 

"--preferred-drive =" and "--preferred-partition =", 0.4.6a is no longer supported.  grldr.mbr can search for each disk, each partition grldr, which is its advantage. The set "--preferred-drive =" and "--preferred-partition =" is not universal, individual behavior, nor do the quick search.




#190789 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 17 February 2015 - 02:20 PM in Grub4dos

Yes, that's what I meant by "editable combobox", you can manually edit or choose one of the predefined names.




#190787 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 17 February 2015 - 02:13 PM in Grub4dos

Since I am in the "change GUI" mode :), how about getting read of the Grub2 checkbox but transforming the Boot file editbox into an editable combobox where the loader name will be displayed all the time + you can choose between a few predefined loader names:
 

Clipboard02.png




#190783 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 17 February 2015 - 12:06 PM in Grub4dos

I haven't used "Load seg" and I don't think I'll ever use it.
But I haven't remove it for the eventuality may be of use for someone.
If you say it's not that much used then I will.

Anyway I will still need those MBR/PBR addresses for grubinst.exe...




#190780 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 17 February 2015 - 08:11 AM in Grub4dos

I showed that link to Yaya and in a few hours he fixed grldr.mbr and bootlace.com. Now all exFAT PBR boot/access problems are gone.
I also fixed the exFAT PBR in grubinst and grubinst_gui by adding the checksum function from the link.
In addition, I implemented the detection of Grub4Dos MBRs/PBRs installed by Bootice.

 

Attached File  grubinst Windows binaries.7z   77.75KB   386 downloads

 

Attached File  grubinst Windows sources.7z   118.66KB   356 downloads

Problems to be solved:
1. The Grub4Dos MBR doesn't continue to search grldr after it searches grldr on a EXT2/3/4 partition. Reported to Yaya twice, waiting for a fix.
2. With a normal MBR + a Grub4Dos EXT2/3/4 PBR you can't boot. Reported to Yaya twice, waiting for a fix.
3. The "--preferred-drive=" and the "--preferred-partition=" switches seem to not have any effect. Reported to Yaya, waiting for a fix.
4. The "Load seg" feature is currently not implemented in grubinst and grubinst_gui for Grub4Dos 0.4.6a version, because the Grub4Dos 0.4.6a MBR/PBRs have different locations to store/read the values. I couldn't find them in the documentation + bootlace.com and Bootice do not seem to use this feature. Also I asked Yaya about them, he didn't seem to understand what it's about. Maybe it was my bad english to blame, who knows...




#190773 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 16 February 2015 - 05:14 PM in Grub4dos

I already did compare them (and reported to Yaya):

 

attachicon.gifbootlace PBR before and after booting 1.png

 

attachicon.gifbootlace PBR before and after booting 2.png

 

This areas can't be copied from the original PBR, they have to be custom created for the new PBR.

 

 

I think I found the cause and a possible solution:

 

http://ntfs.com/exfa...rs-checksum.htm




#190770 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 16 February 2015 - 01:56 PM in Grub4dos

Yes, binary patterns could have more potential than string patterns.

But the problem is I can't be sure such a binary pattern doesn' t exist also in nonGrub4Dos MBR's/PBR's. I would have to scan all of them to be sure. I can even make a small code to find binary patterns (as long as possible) in Grub4Dos MBRs/PBRs but checking in nonGrub4Dos MBrs/PBRs.

The problem is: how/where can I get all the nonGrub4Dos MBRs/PBRs? Are the ones for Windows/Linux enough or should I  have to check other OS's too?

 

On the other hand, I'm almost 100% sure I haven't seen the "\r\nMissing [MBR-]helper." in any other. Yes, not 100%, but still higher than the percent for binary pattern.

Also, I can't be so sure the binary pattern won't be changed in a future version. Again, the percent for "\r\nMissing [MBR-]helper." is higher. Mostly because Chenall/Yaya know that a simpler version of this function is already used for years in Grubinst.

The binary pattern is in fact (assembler) code/data and it is permanently improved so the chance to be changed in the future is higher than changing that string.




#190750 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 15 February 2015 - 03:40 PM in Grub4dos

Until Yaya will fix the rest of the problems, let's talk about something else: making a faster and more precise Grub4Dos MBR/PBR detection (when is already installed).

For detecting Grub4Dos MBR:

int is_grldr_mbr(char* buf)
{
  int i;

  for(i=0x170;i<0x1F0;i++)
    if(!memcmp(&buf[i],"\r\nMissing ",10))
      {
        if (!memcmp(&buf[i+10],"helper.",7))
          return 2;
        if (!memcmp(&buf[i+10],"MBR-helper.",11))
          return 1;
      }
  return 0;
}

where "buf" is a 8000/9000 bytes data block read from sector 0. 0x170 to 0x1F0 is the "area" where the string can be found.

Returns 0 for not found, 1 for 0.4.5c and 2 for 0.4.6a.

For Grub4Dos PBR haven't found a way yet.

Any ideas?




#190747 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 15 February 2015 - 12:23 PM in Grub4dos

I already did compare them (and reported to Yaya):

 

bootlace PBR before and after booting 1.png

 

bootlace PBR before and after booting 2.png

 

This areas can't be copied from the original PBR, they have to be custom created for the new PBR.




#190745 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 15 February 2015 - 12:15 PM in Grub4dos

Yaya released a new version for the Grub4Dos MBR.
Some problems were solved, but not all.
The MBR is now able to search grldr on the next partitions after searching on an exFAT partition.
And the exFAT PBR is booting now. But the exFAT partition is still inaccessible in Windows after installing the PBR and becomes accessible only after trying to boot once from it (!).

I implemented these changes + the latest changes on get_fstype function in grubinst and grubinst_gui:
 

Attached File  grubinst Windows binaries.7z   77.25KB   392 downloads

 

Attached File  grubinst Windows sources.7z   134.13KB   337 downloads




#190721 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 14 February 2015 - 05:43 PM in Grub4dos

You're taking about the values from base and length?

I think it might :dubbio:

If you want I can add a check for these too...

 

 

Late edit: no, the code from chk_mbr2 function exclude these errors, so it will not install on these (well, it will install with --skip-mbr-test)




#190719 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 14 February 2015 - 05:09 PM in Grub4dos

(Already) Changed the code a bit:

int
get_fstype (unsigned char *buf)
{
  if (chk_mbr (buf))
    return FST_MBR;

  if (chk_mbr2 ((char *)buf))
    {
      int i,j;

      for (i=0x1BE;i<0x1FE;i+=16)
        {
          for (j=0;j<8;j++)
            if (buf[i+j]!=0)
              break;
          if (j==8)
            continue;
          if((buf[i+1]!=buf[i+5]) || (buf[i+1]!=0xFE) || (buf[i+2]!=buf[i+6]) || (buf[i+2]!=0xFF) || (buf[i+3]!=buf[i+7]) || (buf[i+3]!=0xFF))
            return FST_MBR_BAD;
        }
      return FST_MBR_FORCE_LBA;
    }
.........
}

Works like this:

 

if (chk_mbr (buf))
return FST_MBR; >> it's a healthy MBR, goes out

 

 //it's not MBR or it's a MBR with ALL problems (including force LBA)

 

if (chk_mbr2 ((char *)buf))

 

//it's a MBR with ALL problems (including force LBA)

 

for (i=0x1BE;i<0x1FE;i+=16)
{
for (j=0;j<8;j++)
if (buf[i+j]!=0)
break;
if (j==8)
continue;
if((buf[i+1]!=buf[i+5]) || (buf[i+1]!=0xFE) || (buf[i+2]!=buf[i+6]) || (buf[i+2]!=0xFF) || (buf[i+3]!=buf[i+7]) || (buf[i+3]!=0xFF))
return FST_MBR_BAD; //it's a MBR with a problem (any except force LBA), goes out
}

 

return FST_MBR_FORCE_LBA; //it's a MBR with force LBA, goes out

 

//it's a floppy, checks for every file system (NTFS, FAT ....)




#190716 improving grubinst and grubinst_gui in Windows and Linux

Posted by DavidB on 14 February 2015 - 04:50 PM in Grub4dos

      int i,j;

      for (i=0x1BE;i<0x1FE;i+=16)
        {
          for (j=0;j<8;j++)
            if (buf[i+j]!=0)
              break;
          if (j==8)
            continue;
          if((buf[i+1]!=buf[i+5]) || (buf[i+1]!=0xFE) || (buf[i+2]!=buf[i+6]) || (buf[i+2]!=0xFF) || (buf[i+3]!=buf[i+7]) || (buf[i+3]!=0xFF))
            return FST_MBR2;
        }
      return FST_MBR;

This code is used ONLY if chk_mbr(buf) fails (return false) and if chk_mbr2 (buf) does not fail (return true).

In your case chk_mbr(buf) returns true and never reaches that code...