How to make a partition on a RAW USB flash disk by programming?

Briefly, here are the steps:1. Use CreateFile to open PhysicalDriveX, that is the USB Flash disk2. IOCTL_DISK_GET_DRIVE_GEOMETRY_EX to get the physical disk’s geometry ( we need some information in it to fill partition data)3. IOCTL_DISK_CREATE_DISK to creates an empty partition.4. IOCTL_DISK_SET_DRIVE_LAYOUT_EX to repartition a disk as specified.Note: use IOCTL_DISK_UPDATE_PROPERTIES to synchronize system view after IOCTL_DISK_CREATE_DISK…


How to make a partition on a RAW USB flash disk by programming?

Briefly, here are the steps:1. Use CreateFile to open PhysicalDriveX, that is the USB Flash disk2. IOCTL_DISK_GET_DRIVE_GEOMETRY_EX to get the physical disk’s geometry ( we need some information in it to fill partition data)3. IOCTL_DISK_CREATE_DISK to creates an empty partition.4. IOCTL_DISK_SET_DRIVE_LAYOUT_EX to repartition a disk as specified.Note: use IOCTL_DISK_UPDATE_PROPERTIES to synchronize system view after IOCTL_DISK_CREATE_DISK…