BBS: Inland Empire Archive Date: 03-15-92 (16:54) Number: 140 From: TOM HAMMOND Refer#: NONE To: ALL Recvd: NO Subj: GW-BAS to QB 2 of 2 Conf: (2) Quik_Bas
Part 2, continued from part 1 (wow, what a concept!) I did not conceive of this patch, but it does seem to work quite well. >> NOTE: These pages detail how to use DEBUG to PATCH a copy of IBM (or GW) BASICA.EXE or BASIC.COM to permit that program to remove PROTection from a BASIC program when it is LOADed. A patched version of BASIC is created. Unprotecting BASICA (or GW Basic) files is a fairly simple task, if you have the right tools and know what to look for. The following sequence is the procedure for creating a copy of BASICA, version 2.0, that will NOT test the protect flag when you ask for a LIST, LLIST, SAVE, etc. This procedure is possible as the BasicA LOAD or implied (command line) program load both convert the program to BasicA's normal tokenized internal format and just relies on an internal flag to disallow those commands. This patch changes that flag test to always return "allowed". In the following we patch the main version of BASICA (in this version, three programs make up the BASIC set, they are named BASIC.COM, BASICA.COM and BASICA.EXE. The first two are just loaders for the latter, which we'll patch). Note, finally, that the search pattern I used is for the OR AL,AL JMP +2 POPF RET and JMP opcodes, which makes the search version independent (where the exact addresses may vary). The comments following the "*" character have been added as an explanation. A> copy basica.exe b.xxx * Make an editable copy to patch 1 File(s) copied * (DEBUG won't edit .EXE files). A> DEBUG b.xxx * Invoke DEBUG b.XXX -s cs:0 ffff 0a c0 75 02 9d c3 e9 * Search for the test, NO addresses. 786B:A557 * DEBUG only found the right address. -u cs:a554 * Now, UNASSEMBLE 3 bytes BEFORE that. 786B:A554 A00C06 MOV AL,[060C] 786B:A557 0AC0 OR AL,AL 786B:A559 7502 JNZ A55D 786B:A55B 9D POPF 786B:A55C C3 RET 786B:A55D E95068 JMP 0DB0 786B:A560 807C2800 CMP Byte Ptr [SI+28],00 786B:A564 7403 JZ A569 * NOTE in the above that the * address of the first * instruction may vary slightly * with the BASICA version. -a cs:a554 * ASSEMBLE the following patch: 786B:A554 mov al,0 * Put a zero into AL, 786B:A556 nop * NOP for the correct code length. 786B:A557 * RETURN only to stop ASSEMBLE. -u cs:a554 * UNASSEMBLE the code to check it. 786B:A554 B000 MOV AL,00 786B:A556 90 NOP 786B:A557 0AC0 OR AL,AL 786B:A559 7502 JNZ A55D 786B:A55B 9D POPF 786B:A55C C3 RET 786B:A55D E95068 JMP 0DB0 786B:A560 807C2800 CMP Byte Ptr [SI+28],00 -w * Looks good, WRITE it to disk, Writing FF90 bytes * this may vary slightly on * yours, -q * and QUIT the DEBUG. A> Ren b.xxx b-unprot.exe * REName the file to use it. That does it. You now have a program named B-UnProt that will allow you to LOAD a protected file and then LIST, SAVE, edit, etc, it to your heart's content. --- WM v2.00/91-0231 * Origin: The Modem Zone BBS (314) 893-5106 (1:289/2)
Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET