Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically Create Bootable NTFS/FAT Partition Windows XP to Windows 7 [closed]

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

like image 223
Ben Avatar asked Dec 10 '25 08:12

Ben


1 Answers

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

like image 191
Steve Townsend Avatar answered Dec 11 '25 21:12

Steve Townsend