This version fixes a detection error when working with activated Windows Vista User Account Control (UAC). Somehow this prevents a correct detection of the physical USB device size (IOCTL_DISK_GET_LENGTH_INFO fails with an access error). Because the physical device size is only for information purpose, I decided to ignore the access error and continue the detection process. All transfer functions work with activated UAC.
Archive for April, 2008
The new version is not such a big change. It just adds a Rescan button, which does a rescan for connected USB devices, in case of the application didn’t get the automatic notification. This is helpful for card readers, because switching the cards within a plugged in device doesn’t lead to a “device changed” notification. I’m still not sure how Windows itself handles this, but eventually I have to do it by some kind of polling in my application DLL, which checks each device periodically for changes.
Unfortunately my attempts to access partitions, that are not recognized by Windows, went not very well. FSCTL_ALLOW_EXTENDED_DASD_IO was not the solution of my problems, so I tried to switch to the NtReadFile/NtWriteFile functions from the Windows WDK (former DDK), but I could get the WDK implemented in my VS 2008. When I compile, using headers from the WDK, I get macro redefinition errors between the ntdef.h from the Windows WDK and the winnt.h from the Windows SDK. The former combination of VS 2005 and Windows DDK worked for some reason, so I’m currently trying to get the WDK working, although I read about the WDK not to be intended to compile with the VS IDE.
Also the book about USB mass storage, that I bought last week, was deliverd last Saturday. For now I only took a short peek at the content, but it may be possible to get direct access to an USB device using IOCTL_SCSI_PASS_THROUGH. With this, some major changes will come ahead, because then I have to divide between volume based and device based access. This would definitely call for a 1.30 version number.
The new version fixes some more interface issues. The size check when restoring an image has been changed to be based on the partition size. Former versions checked the physical device size, which was not compatible with multiple partitions on a USB device. All other operations (progress bar, etc.) have been changed to use either volume or partition size, since all operations currently are volume based.
As a result of some new functions used, version 1.24 is not compatible with Windows 2000 anymore. Supported Windows versions are XP, Vista, Server 2003 and Server 2008. Eventually I will try some workarounds, that could make the next version compatible with Windows 2000 again.
Because of limitations in Windows it is currently not possible to access more than one partition on a removable USB device, limiting USB Image Tool to the first partition found. Partitions unknown to Windows, such as ext2, ext3, and so on, are still problematic to read and write, mostly resulting i/o errors. I’m trying to fix this using FSCTL_ALLOW_EXTENDED_DASD_IO to gain direct access to partitions unknown to windows.
I also played around with the Linux fdisk tool to create and examine some multiple partition situations, like an Ubuntu Live on a USB stick with a FAT16 and an ext2 partition (pointed out in a comment regarding version 1.20) as well as two FAT16 partitions on a Sony 128MB memory card plugged in via a card reader, but the current volume based program structure makes it difficult to access volumes, that aren’t detected and reported by Windows volume management functions. Perhaps I can use some partition based functions to get the necessary information. This needs more investigation.
Additionally I did some research on gaining direct access to the USB stick itself, regardless its volume structure. This would allow USB Image Tool to read and write images of complete USB sticks with multiple partitions on it. I found some information on www.lvr.com, so I ordered the book on USB Mass Storage to get some detailed information. Luckily the current USD – EUR exchange rate makes it not very expensive in Germany. The book has some information on using SCSI commands to access an USB device, so perhaps I can use this to read and write data directly, since I’m currently able to open a handle to the USB device, but not to get valid data from it.
USB Image Tool uses XZip compression routines to read and write compressed images. Since version 1.20 of USB Image Tool there have been some bugfixes made to XZip, so I implemented the newest version (XZip 1.3) instead of the old XZip 1.1 source code. Also two small user interface flaws have been fixed.