(view source code of scsi.rex as plain text)
/* SCSI.rex *//* List all SCSI and IDE drives *//* Empty line */Say/* Check command line arguments (none required) */If Arg( 1, "E" ) Then Call Syntax
/* Check OS version */Parse Upper Source os .
If os <> "WIN32" Then Call Syntax "This Rexx script was not written for this Windows version"
/* Initialize W32Funcs */If RxFuncAdd( "w32loadfuncs", "W32Util", "w32loadfuncs" ) Then Do
Call Syntax "Could not load W32Util Rexx extension"
EndElse Do
Call w32loadfuncsEnd/* Read SCSI ports from registry */porthandle = w32RegOpenKey( "HKEY_LOCAL_MACHINE", "HARDWARE\DEVICEMAP\Scsi" )
If w32RegEnumKey( porthandle, , "port." ) Then Call Syntax
Do i = 1 To port.0
Parse Upper Value port.i With test1 test2 port
If test1||" "||test2 = "SCSI PORT" Then Do
Call ScsiPort port.i, i EndElse Do
Call Syntax "Invalid port name: "||port.i
EndEndCall w32RegCloseKey porthandle/* Done */Exit 0
ScsiBus: Procedure
port = Arg(1)
bus = Arg(2)
type = Arg(3)
/* Read target ID from registry */tidhandle = w32RegOpenKey( "HKEY_LOCAL_MACHINE", "HARDWARE\DEVICEMAP\Scsi\"||port||"\"||bus )
If w32RegEnumKey( tidhandle, , "tid." ) = 0 Then Do
Do i = 1 To tid.0
Parse Upper Value tid.i With test1 test2 .
If test1||" "||test2 = "TARGET ID" Then Do
Call ScsiTid port, bus, tid.i, type End End End Call w32RegCloseKey tidhandleReturnScsiLId: procedure
port = Arg(1)
bus = Arg(2)
tid = Arg(3)
lid = Arg(4)
type = Arg(5)
/* Read logical ID from registry */idhandle = w32RegOpenKey( "HKEY_LOCAL_MACHINE", "HARDWARE\DEVICEMAP\Scsi\"||port||"\"||bus||"\"||tid||"\"||lid )
identifier = w32RegQueryValue( idhandle, "Identifier" )
devtype = w32RegQueryValue( idhandle, "Type" )
If devtype = "CdRomPeripheral" Then Do
devicename = w32RegQueryValue( idhandle, "DeviceName" )
EndElse Do
devicename = devtype End Call w32RegCloseKey idhandleid = SubStr( tid, 11 )
Say port||", "||bus||", ID "||id||", "||type||", "||devicename||" = "||identifier
ReturnScsiPort: Procedure
port = Arg(1)
/* Read SCSI bus from registry */bushandle = w32RegOpenKey( "HKEY_LOCAL_MACHINE", "HARDWARE\DEVICEMAP\Scsi\"||port )
bustype = w32RegQueryValue( bushandle, "Driver" )
If Translate( bustype ) = "ATAPI" Then Do
bustype = "IDE"
EndElse Do
bustype = "SCSI"
EndIf w32RegEnumKey( bushandle, , "bus." ) Then Call Syntax
Do i = 1 To bus.0
Call ScsiBus port, bus.i, bustype End Call w32RegCloseKey bushandleReturnScsiTId: procedure
port = Arg(1)
bus = Arg(2)
tid = Arg(3)
type = Arg(4)
/* Read logical ID from registry */lidhandle = w32RegOpenKey( "HKEY_LOCAL_MACHINE", "HARDWARE\DEVICEMAP\Scsi\"||port||"\"||bus||"\"||tid )
If w32RegEnumKey( lidhandle, , "lid." ) = 0 Then Do
Do i = 1 To lid.0
Parse Upper Value lid.i With test1 test2 test3 .
If test1||" "||test2||" "||test3 = "LOGICAL UNIT ID" Then Do
Call ScsiLid port, bus, tid, lid.i, type End End End Call w32RegCloseKey lidhandleReturnSyntax:
Parse Arg errdescr
If errdescr <> "" Then Do
Say errdescr Say EndSay "SCSI.rex, Version 1.00 for Windows 2000"
Say "Enumerate SCSI and IDE drives"
SaySay "Usage: REGINA.EXE SCSI.REX [ /? ]"
SaySay "Written by Rob van der Woude"
Say "http://www.robvanderwoude.com"
Exit 1
Returnpage last modified: 2025-10-11; loaded in 0.0074 seconds