Discussion:
How to "Reset" an USB stick after it has been low-level changed ?
(too old to reply)
R.Wieser
2021-03-19 08:25:58 UTC
Permalink
Hello all,

I just read the "testing USB-ZIP images" post, and would like to ask a
question that has some relation to it.

Some time ago on Win XP I wrote some code to make an USB stick bootable
(either as FDD or HDD), which worked (using the DeviceIOControl function and
stuff like IOCTL_DISK_CREATE_DISK).

The idea was that I could (re)create USB sticks to look like any old OS
(from DOS upto W98).

The thing is I always needed to eject the stick and re-inserted it before
being able to place files onto it (starting with MSDOS.SYS and the like), as
I've never found how to tell the OS to re-initialize what it knew about the
stick ...

tl;dr:
Does anyone perhaps know how programmatically to tell the OS to
re-initialize an USB stick (so it becomes aware of newly created, removed or
resized volumes etc.) ?

Regards,
Rudy Wieser
Kerr-Mudd,John
2021-03-24 14:02:58 UTC
Permalink
On Fri, 19 Mar 2021 08:25:58 GMT, "R.Wieser" <***@not.available>
wrote:

[]
Post by R.Wieser
Does anyone perhaps know how programmatically to tell the OS to
re-initialize an USB stick (so it becomes aware of newly created,
removed or resized volumes etc.) ?
For Windows (cmdline) there's
RemoveDrive
Homepage: http://www.uwe-sieber.de/drivetools_e.html
he also has a restart

Another option:
C++ code source for USB device ejecting can be had from
http://www.withopf.com/tools/deveject/

but I don't think there's restart code in there.
--
Bah, and indeed, Humbug.
R.Wieser
2021-03-24 16:47:33 UTC
Permalink
John,
Post by Kerr-Mudd,John
For Windows (cmdline) there's
RemoveDrive
Homepage: http://www.uwe-sieber.de/drivetools_e.html
he also has a restart
C++ code source for USB device ejecting can be had from
http://www.withopf.com/tools/deveject/
Thanks. I've downloaded the C++ code and will take a peek to see how they
are dooing it.
Post by Kerr-Mudd,John
but I don't think there's restart code in there.
Maybe I've not used the right term for it.. How else can I partition a
drive (USB or not), format it and use it directly afterwards without needing
to restart the OS ? As some point the OS needs to be made ware of the
changes ...

Regards,
Rudy Wieser
Kerr-Mudd,John
2021-03-26 12:33:26 UTC
Permalink
Post by R.Wieser
John,
Post by Kerr-Mudd,John
For Windows (cmdline) there's
RemoveDrive
Homepage: http://www.uwe-sieber.de/drivetools_e.html
he also has a restart
C++ code source for USB device ejecting can be had from
http://www.withopf.com/tools/deveject/
Thanks. I've downloaded the C++ code and will take a peek to see how
they are dooing it.
Post by Kerr-Mudd,John
but I don't think there's restart code in there.
Maybe I've not used the right term for it.. How else can I partition
a drive (USB or not), format it and use it directly afterwards without
needing to restart the OS ? As some point the OS needs to be made
ware of the changes ...
Regards,
Rudy Wieser
Sorry I don't know.
I recall DOS's Fdisk required a reboot; I don't know about modern OS's
(especially EUFI).

I recall that usb device driver installs required a manual "unplug &
replug" in 2004.
--
Bah, and indeed, Humbug.
Loading...