how to fix corrupted download files fixing corrupted download files -------------------------------------------------------------------------------large downloads often seem to become corrupted due to one or more of the following reasons: * * * *
bug in the download manager. bad proxy server. bad web server. problems with your own computer.
re-downloading corrupted files, specially those sized over 500 mb are really painful for most of us. and there is no guarantee that the re-downloaded file will be free of corruption as far as you are using the same configuration. in such cases, its best to fix them manually instead of downloading again. the whole process is very simple, but requries enough concentration. once you have mastered it, you will never have to worry about corrupted files. -------------------------------------------------------------------------------tools required: * winhex http://www.winhex.com/winhex.zip * curl http://curl.haxx.se/latest.cgi?curl=win32-nossl-sspi steps required in brief: * make a backup copy of the corrupted file and open it with winhex. * identify corrupted segments. large sequences of zeros are all we have to search for in most cases. * re-download the corrupted segments with curl. * write the retrieved data on appropiate offsets. now, let us look at a step by step example: let us assume that we have a corrupted file named corrupted.rar. we open it winhex, and do the following things: * switch the offset representation from hex to decimal by clicking once on the offset area. ->http://fapomatic.com/show.php?loc=01&f=1offset3nz.gif
* now we search for corrupted segments. most of the time they will be sequences of zeros. as we can see from the first bytes of the opened file, it's a rar file. files we download over the internet are mostly compressed formats. by design, a fresh file should not contain sequences of zeros or other repeating bytes after the header part. so, we scroll a few pages down.
->http://fapomatic.com/show.php?loc=01&f=2afterheader4se.gif
# now we start searching for such sequences with ctrl+alt+f.
->http://fapomatic.com/show.php?loc=01&f=3searchstart6bj.gif # the search takes us to a place where we can see some zeros and repeating bytes. surely this is one of the corrupted segments.
->http://fapomatic.com/show.php?loc=01&f=4suspect8rx.gif so, now we have to download the missing data using curl. it's always a good idea to retrieve the data with some margin. in our case, we get the bytes from 01094304 to 01094512 in order to cover the screenshot size. in real case it should be even higher. so, we start command prompt and issue the command "curl -r 1094304-1094512 http://badserver.com/mygoodfile.rar" target="_blank">http://badserver.com/mygoodfile.rar -o 01094304.bin" to download the mentioned segment of the original file, and save it to a file named 01094304.bin. for details, curl manual can help. after it's done, curl will terminate and we will have our file 01094304.bin right inside curl's folder.]
->http://fapomatic.com/show.php?loc=01&f=5curl2np.gif
# now we open the downloaded segment 01094304.bin with winhex. # copy the whole file with ctrl+a -> ctrl+c.
->http://fapomatic.com/show.php?loc=01&f=6newbin7yd_1.gif # switch back to our corrupted file and go to the starting offset of our retrieved segment. ctrl+g -> 01094304 ->http://fapomatic.com/show.php?loc=01&f=7fixnow9rz.gif now press ctrl+b to write the copied data over this offset. it is very important to determine correct offset. one offset left or right can ruin everything. our retrieved segment starts with 18 1e bd 3d, and the offset we are going to write here also starts with 18 1e bd 3d.
->http://fapomatic.com/show.php?loc=01&f=8fixed9oy.gif * after we are done, we save the file using ctrl+s. for larger files, it is better to switch the edit mode to in-place mode. f6 -> in-place mode. now we can see that the corrupted part has been filled with original data, and it's fixed. in this example we had only of such segment. but in real cases, there might be several segments like this. in that case the whole procedure is to be repeated for each corrupted segment. also note that, the length of zero sequences to find for can be chosen to be smaller or larger than the length used here.