Parasyte
April 16th, 2005, 05:10
Hello!
I recently used OllyDump 2.21b to unpack a program, and noticed the Import Rebuild feature contains a bug: When OllyDump calculates the new file size, it will not add the size of the import ordinals in the IID. In some cases (such as mine) the bug will cause the dumped executable to report errors such as "Cannot find <strange filename>.dll" That's because the IID is cut short! I guess the bug is rare enough that it was just never caught during development.
To fix the bug, insert the following into line 1261 of RebuildImport.c:
dwNewSectSize += sizeof(WORD);
Here's what the patched code should look like:
if(strlen(pApi->ApiName) != 0) {
dwNewSectSize += sizeof(WORD);
dwNewSectSize += (strlen(pApi->ApiName) + 1);
}
If you want to quickly patch OllyDump.dll without recompiling the source, you can make a few changes in a hex editor. Go to address 0x00005034, and REPLACE the data with the following:
90 90 90 90 90 90 05 03 00 00 00
Don't forget to backup your copy of OllyDump.dll before trying this.
There it is! Sorry if this has been mentioned before. But I figured I would point it out, in any case.
I recently used OllyDump 2.21b to unpack a program, and noticed the Import Rebuild feature contains a bug: When OllyDump calculates the new file size, it will not add the size of the import ordinals in the IID. In some cases (such as mine) the bug will cause the dumped executable to report errors such as "Cannot find <strange filename>.dll" That's because the IID is cut short! I guess the bug is rare enough that it was just never caught during development.
To fix the bug, insert the following into line 1261 of RebuildImport.c:
dwNewSectSize += sizeof(WORD);
Here's what the patched code should look like:
if(strlen(pApi->ApiName) != 0) {
dwNewSectSize += sizeof(WORD);
dwNewSectSize += (strlen(pApi->ApiName) + 1);
}
If you want to quickly patch OllyDump.dll without recompiling the source, you can make a few changes in a hex editor. Go to address 0x00005034, and REPLACE the data with the following:
90 90 90 90 90 90 05 03 00 00 00
Don't forget to backup your copy of OllyDump.dll before trying this.
There it is! Sorry if this has been mentioned before. But I figured I would point it out, in any case.