/* Backup video adapter driver files with DEVCON */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Sample DEVCON output: */ /* */ /* PCI\VEN_10DE&DEV_0110&SUBSYS_40311043&REV_B2\4&252D6E8&0&0008 */ /* Name: NVIDIA GeForce2 MX */ /* Driver installed from c:\winnt\inf\oem29.inf [nv4]. 21 file(s) used by driver: */ /* C:\WINNT\system32\DRIVERS\nv4_mini.sys */ /* C:\WINNT\system32\nvinstnt.dll */ /* C:\WINNT\system32\nvsvc32.exe */ /* C:\WINNT\system32\nvcod.dll */ /* C:\WINNT\system32\nv4_disp.dll */ /* C:\WINNT\system32\nvoglnt.dll */ /* C:\WINNT\system32\nvcpl.dll */ /* C:\WINNT\system32\nvmctray.dll */ /* C:\WINNT\system32\nview.dll */ /* C:\WINNT\system32\nvwddi.dll */ /* C:\WINNT\system32\nvappbar.exe */ /* C:\WINNT\system32\nvwdmcpl.dll */ /* C:\WINNT\system32\nvshell.dll */ /* C:\WINNT\system32\nvtuicpl.cpl */ /* C:\WINNT\system32\nwiz.exe */ /* C:\WINNT\system32\nviewimg.dll */ /* C:\WINNT\system32\keystone.exe */ /* C:\WINNT\system32\nvnt4cpl.dll */ /* C:\WINNT\help\nvcpl.hlp */ /* C:\WINNT\help\nvwcplen.hlp */ /* C:\WINNT\nview\generic.tvp */ /* 1 matching device(s) found. */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ "@ECHO OFF" Trace Off /* Check OS type (should be 32 bits Windows)*/ Parse Upper Source os . If os <> "WIN32" Then Call Syntax /* Check command line arguments */ Parse Arg test If test <> "" Then Call Syntax /* Initialize RexxUtil library */ If RxFuncQuery( "sysloadfuncs" ) <> 0 Then Do initRc = RxFuncAdd( "sysloadfuncs", "RexxUtil", "sysloadfuncs" ) If initRc = 0 Then Do Call sysloadfuncs End Else Do Say Say "Error "||initRc||" while trying to initialize RegUtil (RexxUtil)" Say Say "This script requires Patrick TJ McPhee's RegUtil library," Say "available at http://www.interlog.com/~ptjm/" Say Say "Do yo want to download it now? [y/N]" Say download = Translate( SysGetKey( "NOECHO" ) ) If download = "Y" Then Do Address SYSTEM "http://www.interlog.com/~ptjm/" Say "Install the downloaded library file and try again." End Else Do Say "Download and install the library and try again." End Exit 1 End End /* Check DEVCON's availability */ Address SYSTEM "DEVCON.EXE /? >NUL 2>&1" If rc <> 0 Then Do Say Say "This script requires Microsoft's DEVCON.EXE, available at" Say "http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q311272" Say Say "Do yo want to download it now? [y/N]" Say download = Translate( SysGetKey( "NOECHO" ) ) If download = "Y" Then Do Address SYSTEM "http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q311272" Say "Install the downloaded file and try again." End Else Do Say "Download the tool and try again." End Exit 1 End /* Use DEVCON to retrieve info, and store it in an array */ Address SYSTEM 'DEVCON.EXE DriverFiles =Display 2>NUL | RXQUEUE' empty = 0 Do i = 1 By 1 Until Queued( ) = 0 Parse Pull line.i line.i = Strip( line.i, "B", " " ) If line.i = "" Then Do empty = empty + 1 if empty > 5 Then Leave End line.0 = i End /* Interpret DEVCON's output line by line */ nextLine = "ID" fileCount = 0 driver. = "" driver.0 = 0 j = 0 Do i = 1 By 1 To line.0 Select When Pos( "matching device(s) found.", line.i ) > 0 Then Leave i /* Last line of output */ When nextLine = "ID" Then Do /* First line for driver */ Parse Value line.i With root"\"str1"&"str2"\"str3 If str3 <> "" Then Do j = j + 1 driver.0 = j driver.j.0 = 0 nextLine = "Name" End End When nextLine = "Name" Then Do /* Line with device name */ Parse Value line.i With "Name: "name If name <> "" Then Do name = EscName( name ) driver.j = name k = 0 nextLine = "inf" End End When nextLine = "inf" Then Do /* Line with inf file name */ Parse Value line.i With "Driver installed from "inf" ["key"]. "numFiles" file(s) used by driver:" If numFiles <> "" Then Do k = k + 1 driver.j.k = inf driver.j.0 = k nextLine = "files" End End When nextLine = "files" Then Do /* Actual driver files */ Parse Value line.i With file If file <> "" Then Do k = k + 1 If k = numFiles + 1 Then Do nextLine = "ID" End driver.j.k = file driver.j.0 = k End End Otherwise Nop End End /* Create a target "root" directory */ If SysMkDir( "Video" ) <> 0 Then Do Call SysFileTree "Video", "exist.", "D" If exist.0 <> 1 Then Do Say "Error creating directory Video" Exit 1 End End Do i = 1 By 1 To driver.0 Say "Backing up drivers for display adapter "||driver.i /* Create a subdirectory with the device name */ If SysMkDir( "Video\"||driver.i ) <> 0 Then Do Call SysFileTree "Video\"||driver.i, "exist.", "D" If exist.0 <> 1 Then Do Say "Error creating directory Video\"||driver.i Exit 1 End End Do j = 1 To driver.i.0 driverFile = driver.i.j Do Until driverFile = "" Parse Value driverFile With dummy"\"driverFile End driverFile = dummy copyRc = SysCopyObject( driver.i.j, "Video\"||driver.i||"\"||driverFile ) If copyRc <> 0 Then Do Say "Error "||copyRc||" while copying "||driver.i.j Exit 1 End End End Say "Your display adapter drivers are now stored in the directory Video" /* Done */ Exit 0 EscName: procedure name = Arg( 1 ) name = Translate( name, "", "|" ) name = Translate( name, "", "?" ) name = Translate( name, "", ":" ) name = Translate( name, "", ";" ) name = Translate( name, "", "," ) name = Translate( name, "", "/" ) name = Translate( name, "", "\" ) name = Translate( name, "[", "(" ) name = Translate( name, "]", ")" ) name = Translate( name, "and", "&" ) Return name Syntax: Say Say "BkVidDrv, Version 1.00 for Windows 2000 / XP" Say "Backup driver files for every display adapter installed" Say Say "Usage: BKVIDDRV.REX" Say Say "Note: This script requires Microsoft's DEVCON.EXE, available at" Say " http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q311272" Say " This script also requires Patrick TJ McPhee's RegUtil," Say " available at http://www.interlog.com/~ptjm/" Say " You will be prompted for download if either isn't found." Say Say "Written by Rob van der Woude" Say "http://www.robvanderwoude.com" Exit 1 Return