3

I am trying to create a bootable partition in Windows. I need to be able to do this from Windows XP through Windows 7. Ideally I would be able to do it both for FAT32 and NTFS depending on if the device is smaller than 32 GB (FAT32) or larger (NTFS).

On Vista and 7 I have a script that can do this using diskpart.exe, but this does not work on Windows XP because creating a partition is not exposed in diskpart.exe. The other problem with Windows XP diskpart is that usb thumb drives are not usually listed as drives (presumably because they're 'removable').

So my main need is, can I use DeviceIoControl or some other API to create a bootable partition, and have this method work from Windows XP to Windows 7? If I absolutely have to have different solutions for Pre-Vista and Vista+ that is ok.

Thank you.

Ben

Chris Gerken
  • 16,221
  • 6
  • 44
  • 59
Ben
  • 127
  • 11

1 Answers1

1

You should be able to do this using IOCTL_DISK_CREATE_DISK with the CREATE_DISK parameters set to indicate MBR.

Steve Townsend
  • 53,498
  • 9
  • 91
  • 140
  • I've done this before without much luck...the individual partitions have to be set to certain values too right? Like http://msdn.microsoft.com/en-us/library/aa365189(VS.85).aspx has to be used too...I'll give it a shot, thanks. – Ben Nov 19 '10 at 21:03
  • @Ben - the only thing I can say for sure is that you ought to be able to do this, or third-party partition managers would not work, which would raise antitrust issues. – Steve Townsend Nov 19 '10 at 21:05