Re All:
Judging only from the content of this post, it really is quite original. Because many people know it can be used this way, but don't think of using it this way. It's just that the OP's last paragraph really lacked consideration, so it was only natural to provoke public anger.
As for the OP's final question, I think brother "Ultimate Warrior"'s line of thought is correct, it's just that the implementation method wasn't well considered. For editing exe files or other binary files, you absolutely must not use text editors like edit, and must use a dedicated hex editor instead.
And following the OP's line of thought, it seems this problem also needs to use commands that come with DOS, so that leaves only debug. Below is my solution. For the sake of simplicity, some detailed issues are omitted.
Note:
All numbers appearing below are hexadecimal, and calculations should also use that basis;
The contents in square brackets should be hexadecimal values; here they are named according to what they represent, and in actual operation they need to be replaced with the corresponding values according to context;
The contents in parentheses are comments and should not be entered during actual operation;
Judging only from the content of this post, it really is quite original. Because many people know it can be used this way, but don't think of using it this way. It's just that the OP's last paragraph really lacked consideration, so it was only natural to provoke public anger.
As for the OP's final question, I think brother "Ultimate Warrior"'s line of thought is correct, it's just that the implementation method wasn't well considered. For editing exe files or other binary files, you absolutely must not use text editors like edit, and must use a dedicated hex editor instead.
And following the OP's line of thought, it seems this problem also needs to use commands that come with DOS, so that leaves only debug. Below is my solution. For the sake of simplicity, some detailed issues are omitted.
Note:
All numbers appearing below are hexadecimal, and calculations should also use that basis;
The contents in square brackets should be hexadecimal values; here they are named according to what they represent, and in actual operation they need to be replaced with the corresponding values according to context;
The contents in parentheses are comments and should not be entered during actual operation;
c:\windows>ren 3.exe 3.eee (change the program's extension to avoid debug's special handling of executable programs)
c:\windows>debug 3.eee
-s 100 ffff "MZ" (search for the MZ signature word in the range 100 to ffff)
: (shows matching address)
:
.... (there may be some more)
-d (display each address in turn, determine the start address of the second program from the displayed contents)
-d (assume the start of the second file Begin2 is found at xxxx1)
-n 1.eee (create file 1.eee)
-r cx (edit file length)
CX (shows the length of the original file 3.eee)
: (enter Begin2 minus 100 here, that is, the length of file 1.eee)
-w (write file 1.eee)
Writing bytes (shows number of bytes written)
-m ffff 100 (move the contents of the second file to the start at 100)
-h (use the difference to calculate the length of the second file)
(the former is the sum, the latter is the difference; the difference is the length of the third file minus the first file)
-n 2.eee (create file 2.eee)
-r cx (edit the length of file 2.eee)
CX (shows the length of the original file 1.eee)
: (enter the length of file 2.eee here)
-w (write file 2.eee)
Writing bytes (shows number of bytes written)
-q (quit DEBUG)
c:\windows>ren 1.eee 1.exe (change the program extension back)
c:\windows>ren 2.eee 2.exe
Recent Ratings for This Post
( 3 in total)
Click for details
| Rater | Score | Time |
|---|---|---|
| ngd | +1 | 2008-01-12 13:53 |
| regvip2008 | +2 | 2008-04-26 09:57 |
| sl543001 | +8 | 2010-08-15 23:31 |
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!


