List Word Macros LWM version 1.20 Minimal Documentation 31 December 1997 Legal ~~~~~ Program and documentation are Copyright 1997 by Mike Janda, Madison, WI USA. All rights reserved. Distribution and use of this program are free. No fee may be charged for the use and/or distribution of the program. Do not modify the program and redistribute it. Do not distribute the program in archives containing computer viruses, source code or virus listings. As usual, there is no warranty or guarantee that this program will function correctly. Use it at your own risk. Also, it is a good idea to scan the program for viruses and trojans BEFORE using it. Introduction ~~~~~~~~~~~~ LWM will allow you to safely examine the macros present in Word version 6 and 7 templates without the need to load the file into Word and possibly activate a virus or trojan that could delete files, format the drive or install a virus on your system. Since LWM does not use Word (or Windows!) to read the file, there is no chance that any malicious macros can do anything to your system. Just run LWM with the name of the Word template and it will write out a new file with the extension 'mac' containing all the macros listed much like they would be listed in Word (see program notes below for some exceptions). System Requirements ~~~~~~~~~~~~~~~~~~~ A PC (8088 CPU or above) running MS/PC/DR-DOS 2.0 or above. If you're running Windows or OS/2, run it in a DOS window. Memory requirements are variable. The program will require at least 128K of conventional memory to start and will use up to the 640K DOS limit, depending on the size and complexity of the file being examined. The program does not use any XMS or EMS memory, even if it is available. Usage ~~~~~ Enter on the command line: LWM filename.ext where 'filename.ext' is the name of a Word template file. Drive and path names are allowed. Wildcards (* and ?) are not allowed. The Word file will not be modified, but it is always a good idea to work with a backup file. The output file will have the same filename and the extension 'mac' (e.g., 'filename.mac') in the same directory as the input file. If the output file already exists, it will be overwritten. If the file being examined ends with a 'mac' extension, it will be overwritten. The program offers no warning when it does this, so consider yourself warned here. If the Word file is protected by a password, the program will prompt for the password. Type in the correct password and press Enter. Just pressing Enter will cause the program to terminate, as will an incorrect password. Program Notes ~~~~~~~~~~~~~ LWM is able to read and correctly process most Word 6.x and 7.x files. The output listing is quite close to what Word produces with a few exceptions. Windows uses the ANSI character set, while DOS uses the ASCII character set with the IBM extensions. ANSI and ASCII are basically the same for the lower characters (0-127), but differ substantially for the higher characters (128-255). LWM uses the ASCII (with IBM extensions) character set. Most symbols and non-English language characters will not be correctly displayed. No attempt is made to translate the ASCII characters to ANSI. Several versions of Word offer Unicode support which has the ability to handle 65,536 different characters (useful for Asian languages). DOS doesn't handle Unicode very well, so LWM displays Unicode as a series of hexadecimal digits separated by hyphens (e.g., A6DB-B0CA-B0F5-A6E6-A143). If there are ANSI text characters (0-255) imbedded in the Unicode text string, they will be displayed as ASCII (see above paragraph for limitations). Word offers a line break (Shift-Enter) which can be used in comments. Line breaks are marked with a " " so they can be easily seen (if you can't see it, change viewers). The reason for this is that when examining certain macros, what looks like macro code is really part of the comment above it. So, when a line ends with a , the next line is a continuation of the line above it. If LWM encounters an unknown macro function, it will display "UNK-" followed by the hexadecimal code for the function (e.g., UNK-81C3 means LWM didn't know the function's name). If you see many UNK-xx in a row, it means LWM got lost while reading the macro (fairly rare) or the macro is corrupted (which happens quite often with macro viruses). Here are the program termination return codes (useful in batch files) and some error messages the program displays: Return Code Meaning ----------- ------- 0 Success 1 No Filename Specified on Command Line 2 Input File Not Found 3 File is Not a Word 6/7 Template 4 Incorrect Password Provided 5 No Macros Found in File 6 Error Creating Output File 7 Error Reading File 8 Error Writing File 9 Not Enough Memory to Process the File 10 Error Processing the File 11 Unknown Error <-- hopefully you'll never see this one Limitations ~~~~~~~~~~~ LWM can only read Word 6.x and 7.x files and occasionally other files that have Word 6.x/7.x macros imbedded in them. It does not read Word 2.x, 5.x and 8.x (Office 97) files, Excel files, or other types of files. If the Word file is open and in use by another program (e.g. Word), LWM won't be able to read it. Acknowledgements ~~~~~~~~~~~~~~~~ Thanks to Randall Hyde for the public domain floating point routines used to display the double-precision floating point numbers. Thanks to Microsoft for the complex Word file format that took more time to decipher than this program took to write. No thanks to the plethora of macro virus writers that inspired the development of this program. Contact ~~~~~~~ Send bug reports, comments and accolades to mike.janda@mpcug.com Send summonses, complaints and flames to dev/nul (that's ">NUL" for PC users)