How to programmatically connect and reconnect a USB device

I am modifying the partition table of a Usb device for encryption.

The code works fine, but I need to disconnect and connect the USB device to see the changes, how can I do this programmatically?

I know that this is possible because some other applications do it. I am currently using DeviceIoCtrl to remove a USB device and tell the user to perform the operation manually, but not a professional.

I tried to use IOCTL_INTERNAL_USB_CYCLE_PORT, but this is not supported. I think it can only be called from kernel mode.

+5
source share
1 answer
+2

All Articles