(view source code of biosinfo2.rex as plain text)
/* BIOSinfo.rex */
/* This version uses Patrick TJ McPhee's Rexx Regular Expressions */
/* Display empty line */
Say
/* Check command line argument(s) */
Parse Upper Arg dbgarg .
If dbgarg = "" Then Do
debugmode = 0
End
Else Do
If dbgarg = "DEBUG" Then Do
debugmode = 1
End
Else Do
Call Syntax
End
End
/* Hide standard error */
"@ECHO OFF"
Trace Off
/* Initialize libraries */
If RxFuncQuery( "sysloadfuncs" ) Then Do
free_ru = 1
Call RxFuncAdd "sysloadfuncs", "RexxUtil", "sysloadfuncs"
If sysloadfuncs() Then Call Syntax
End
If RxFuncQuery( "ReLoadFuncs" ) Then Do
free_re = 1
Call RxFuncAdd "ReLoadFuncs", "RexxRE", "ReLoadFuncs"
If ReLoadFuncs() Then Call Syntax
End
/* Define temporary file name and location */
Parse Source . . self
fles = Reverse( self )
dbgscr = Reverse( SubStr( fles, Pos( ".", fles ) + 1 ) )||".dbg"
/* Get the manufacturer info from the BIOS */
info = GetInfo( "FF00:0000", "FF00:0080" )
If info = "" Then info = GetInfo( "FFF0:0000", "FFF0:0080" )
info = Strip( info )
/* Display the result */
Say "BIOS manufacturer : "||info
/* Get the BIOS date */
/* Create a new temporary DEBUG script to retrieve the BIOS date */
Call CreateDbg "FFFF:0005 L 8"
/* Run DEBUG script and store output in array */
"DEBUG.EXE < "||dbgscr||" | RXQUEUE"
Do i = 1 By 1 Until Queued( ) = 0
Parse Pull dbgout.i
/* Debugging info */
If debugmode = 1 Then Say dbgout.i
biosstr = biosstr||SubStr( dbgout.i, 62 )
End
dbgout.0 = i
If debugmode = 1 Then Do i = 1 To dbgout.0
Say SubStr( dbgout.i, 62 )
End
/* Cut first 66 characters from each line (effectively skipping */
/* all lines but one) and store the remainders in a variable */
biosdate = ""
Do i = 1 To dbgout.0
biosdate = biosdate||Strip( SubStr( dbgout.i, 66 ) )
End
/* Display the result */
Say "BIOS date : "||biosdate
/* Delete temporary DEBUG script */
Call SysFileDelete dbgscr
/* Unload libraries */
if free_re = 1 Then Call ReDropFuncs
if free_ru = 1 Then Call SysDropFuncs
Exit 0
/* Try to read relevant info from BIOS at specified address */
GetInfo: procedure expose dbgscr debugmode
/* Parse arguments */
adr0 = Arg(1)
adr1 = Arg(2)
/* Create temporary DEBUG script */
Call CreateDbg "FF00:0000", "FF00:0080"
/* Run DEBUG script and store output in array */
"DEBUG.EXE < "||dbgscr||" | RXQUEUE"
Do i = 1 By 1 Until Queued( ) = 0
Parse Pull dbgout.i
/* Debugging info */
If debugmode = 1 Then Say dbgout.i
biosstr = biosstr||SubStr( dbgout.i, 62 )
End
dbgout.0 = i
If debugmode = 1 Then Do i = 1 To dbgout.0
Say SubStr( dbgout.i, 62 )
End
/* Concatenate relevant parts of screen output into one single line */
line = "";
Do i = 1 To dbgout.0
line = line||SubStr( dbgout.i, 62 )
If debugmode = 1 Then Say SubStr( dbgout.i, 62 )
End
/* Debugging info */
If debugmode = 1 Then Say line
/* Use some regular expressions to tidy up the output before display */
/* Modify required minimum length of resulting string if necessary */
minlen = 7
re = "\.([^.!?\*\+]{"||minlen||",})\."
cre = ReComp( re, "x" )
If Left( cre, 1 ) Then Do
errstr = "Error compiling regular expression"
errstr = errstr||rxCrLf||ReError( cre )
Call Syntax errstr
End
If ReExec( cre, line, matches ) Then line = matches.1
/* Clear memory */
Call ReFree cre
/* Debugging info */
If debugmode = 1 Then Do i = 1 To matches.0
Say matches.i
End
/* Return the resulting string */
Return line
/* Create temporary DEBUG script */
CreateDbg: procedure expose dbgscr debugmode
Call SysFileDelete dbgscr
rxCrLf = "0D0A"X
strdbg = "D "||Arg(1)||rxCrLf
If Arg( 2, "E" ) Then strdbg = strdbg||"D "||Arg(2)||rxCrLf
strdbg = strdbg||"Q"||rxCrLf
ret = LineOut( dbgscr, strdbg )
If ret <> 0 Then Call Syntax "Cannot create temporary debug script"
ret = LineOut( dbgscr )
If ret <> 0 Then Call Syntax "Error closing temporary debug script"
Return
Syntax: procedure
Say "BIOSInfo.rex, Version 2.00 for Windows and OS/2"
Say "Display BIOS manufacturer and date"
Say
Say "Usage: BIOSINFO.REX [ DEBUG ]"
Say
Say 'Where: "DEBUG" will display intermediate results for debugging purposes.'
Say
Say "This script uses DEBUG.EXE to read the information from BIOS, and Patrick TJ"
Say "McPhee's Rexx Regular Expressions library (http://www.interlog.com/~ptjm/)."
Say "Tested in Windows 2000 and XP only."
Say
Say "Written by Rob van der Woude"
Say "http://www.robvanderwoude.com"
Say
Say "Original idea BIOS date: ComputerHope http://www.computerhope.com/rdebug.htm"
Exit 1
Return
page last modified: 2024-04-16; loaded in 0.0072 seconds