Identifying a corrupt exe
-
Hello My code copies an exe onto a USB flash drive using normal File copy functions, however it is quite possible that the USB flash drive might get disconnected during file copy and may not be copied properly (hence gets corrupted) So, when the user plugs in the USB flash drive next time he / she wont be able to use it. Is it possible programatically to identify a corrupted exe once the exe has been copied onto the USB flash drive ? Thanx
-
Hello My code copies an exe onto a USB flash drive using normal File copy functions, however it is quite possible that the USB flash drive might get disconnected during file copy and may not be copied properly (hence gets corrupted) So, when the user plugs in the USB flash drive next time he / she wont be able to use it. Is it possible programatically to identify a corrupted exe once the exe has been copied onto the USB flash drive ? Thanx
Checksumming (e.g. MD5). Tools like MD5sum are readyly available in the internet. But the corrupted exe will very properly not start, so it can't check itself.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal.
George Orwell, "Keep the Aspidistra Flying", Opening words -
Hello My code copies an exe onto a USB flash drive using normal File copy functions, however it is quite possible that the USB flash drive might get disconnected during file copy and may not be copied properly (hence gets corrupted) So, when the user plugs in the USB flash drive next time he / she wont be able to use it. Is it possible programatically to identify a corrupted exe once the exe has been copied onto the USB flash drive ? Thanx
Although there is no Direct way to do this, letme specify some alternatives. 1. calculate the Check sum of the File before you save and validate it after your file copy operation is complete. (Less Error prone but effective) 2.Verify the Size of the file copied. haribabu