CMOS Memory Utility v1.2 by Paul Howe, 1994 This program is a read, write, and compare utility for the CMOS memory found in 286 and newer computers. It is designed for use in batch files by utilizing command line parameters as needed. It was created to fill the niche left by all the other CMOS utilities...command line operation. This is especially valuable if the computer operator is a relative newcomer to computing because this utility will automatically insure that the CMOS data is correct. How many people know the CMOS drive type for their hard drive without looking it up? Some computers won't even start if the CMOS info is incorrect...This little program fixes all those problems quietly and automatically. On-line documentation is provided in the .EXE file. In keeping with the intent of batch file operation, return status values are provided for use with the ERRORLEVEL batch file function. The CMOS data is stored as a 66 byte binary file. This file is a true image of the 64 bytes of CMOS data plus two checksum bytes. The checksum bytes are used to validate the stored CMOS data before any restore operations are allowed. This prevents disk or data file corruption from destroying the contents of CMOS memory. The CMOS data is read via CPU ports 70h and 71h which bypasses any CMOS password scheme. This is handy if some unauthorized person has changed the CMOS access password. If you have the image file saved you can easily restore the correct password. This utility does not crack the password encryption used by some BIOS manufacturers. It simply saves the raw image after encryption. -------------------------------------------------------------------------- Usage: CMOS [/r][/w][/c] [filename] /r - This switch reads a CMOS data file previously established using this utility and updates CMOS memory using that data file. /w - This switch writes a CMOS data file using the CMOS data currently in memory. It will cheerfully overwrite an existing file with the same file name so be careful to select unique data file names. /c - This switch will compare the contents of CMOS memory to a data file. The first 16 bytes are not compared as they hold the date and time. If there is a good match the utility will simply return without taking any action. If there is a mismatch the utility will update CMOS memory from the data file and cold start the computer. The restart is necessary for a correct equipment list in memory. [filename] - This is the CMOS data file name. If the data file is not in the same directory as the utility the full path must be specified. For security the PATH stored in the environment space is ignored. Any legal DOS file name is fine. Note: Entering the utility file name by itself will bring up the abbreviated documentation stored in the .EXE file. -------------------------------------------------------------------------- Return Codes: The following return codes are used in this utility. They are useful when performing ERRORLEVEL routines in a batch file. Exit Code Description 0 Normal program termination. 1 File read error or invalid command line argument. 2 File write error. 3 Data file checksum error. Note: A comparison failure using the /c switch will not return a code to the calling batch file. A cold start is performed internally so control is never returned to the batch file. This makes a return code unnecessary. -------------------------------------------------------------------------- Examples: 1. Creating a CMOS data file called CMOS.DAT in a specified location: CMOS /w c:\dos\cmos.dat 2. Creating a CMOS data file called CMOS123.BIN in the current directory: CMOS /w cmos123.bin 3. Restoring CMOS memory from a data file called CMOS.DAT in the current directory: CMOS /r cmos.dat 4. Using the compare switch in a batch file with the CMOS data file called CMOS1.DAT in the F:\PUBLIC subdirectory: : : : cd\pub ndir > out.lst cmos /c f:\public\cmos1.dat if errorlevel 3 goto ... if errorlevel 2 ... : : : -------------------------------------------------------------------------- Final Notes: Remember to update the CMOS data file if the CMOS data is legitimately changed! This is especially true when using the /c switch. The utility will automatically restore CMOS memory to reflect the data file in that case. A public domain license is hereby granted to all to find this program useful.