I am modifying the partition table of an Usb Device for encryption purposes.
The code works fine but i need to unplug and plug the usb device to see changes how can i do this programmatically ?
I know is possible because some other apps do it.Currently i use DeviceIoCtrl to remove the usb device and tell the user to do the operation manually but it's not professional.
I tried to use IOCTL_INTERNAL_USB_CYCLE_PORT but that is not supported i guess it can be called only from kernel mode.
The Remarks for IOCTL_DISK_UPDATE_PROPERTIES suggest it's the correct IOCTL to use when you have directly modified the partition table and wish to reload it.
This operation is used in synchronizing the system view of the specified disk device when the partition table of the disk is directly modified. Be sure to perform this operation when you update the usable space for a disk so that the system will update its partition table.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With