Les Cargill
2012-07-17 17:43:21 UTC
I am using the Mingw toolchain. I also reproduced this using Tcl version
8.6. O/S is WinXP or Win7.
So I would like to write a utility to recover a USB stick
that has been formatted to FAT32 which has had sector 0 erased or
all zeros ( erased would be all ones ). IOW, it just happened to
fail when it was removed without being unmounted.
When I use fopen() to open D: as a raw device (path "//./d:") , it fails
because of permissions.
FILE *f=fopen("//./d:","wb");
What's the best way to do what I am trying to do? Are there
raw ioctl() or "give me more privilege" calls I can use to
do this? Are the ioctl() calls similar to Unix?
There is a verison of "dd" for Windows here:
http://www.chrysocome.net/dd
dd does this just fine. IOW, I can overwrite the first sector
using dd, but I'd like to have a single executable do this for
purely arbitrary reasons.
Thanks in advance.
--
Les Cargill
8.6. O/S is WinXP or Win7.
So I would like to write a utility to recover a USB stick
that has been formatted to FAT32 which has had sector 0 erased or
all zeros ( erased would be all ones ). IOW, it just happened to
fail when it was removed without being unmounted.
When I use fopen() to open D: as a raw device (path "//./d:") , it fails
because of permissions.
FILE *f=fopen("//./d:","wb");
What's the best way to do what I am trying to do? Are there
raw ioctl() or "give me more privilege" calls I can use to
do this? Are the ioctl() calls similar to Unix?
There is a verison of "dd" for Windows here:
http://www.chrysocome.net/dd
dd does this just fine. IOW, I can overwrite the first sector
using dd, but I'd like to have a single executable do this for
purely arbitrary reasons.
Thanks in advance.
--
Les Cargill