TOC · Work · Menu · Disk

Device I/O Handler Script

Device I/O Parameters   Device I/O Dialog Box

The script can be used for I/O error logging and for extended processing of errors (include external program calls). The feature is available in the Professional Edition only.

Script can be loaded or modified via Device I/O Parameters (button Script).

The file ondevhsc.txt contains a brief description of available commands and some script examples.

Possible script lines are of the form:
IF CONDITION COMMAND
or
COMMAND
or
:LABEL
where CONDITION is an inequality or equality (!=, >, <, >=, <=, =) of two quantities,
and quantity is either an integer constant (0, 1, ...) or a variable (the list is below) or a simple mathematical expression (operators +, -, *, %, /, without parentheses, ignoring the mathematical order of operators), e.g. %ERROR%=0

Comments are preceded by two minuses (--)

Variables

Zero based
%CONFIRM% =1 if Confirm pressed, =0 if Cancel pressed (confirmation dialog box appears)
%DISKNUM% disk number in RAID array
%TRYNUM% i/o retry number
%LBA% first i/o sector number
%SECNUM% number of i/o sectors
%ERROR% i/o error
%ATASTATUS% ATA Status Register value (defined if BSY bit is cleared, DOS ATA only)
%ATAERROR% ATA Error Register (defined if ERR bit of %ATASTATUS% is set)
%LINE% current line number in script
%SERVICE% i/o service:
0-ATA 1-ATAPI 3-BIOSINT13OLD 4-BIOSINT13
5-DOSINT25 6-DOSINT73 7-DOSASPI 8-DOSMSCDEX 9-DOSFILE
11-WINFILE 12-WINSCSI 13-WIN9XINT13 14-WINATA
20-LINUXFILE 21-LINUXSCSI
%LASTRES% result of the previous command
%LASTERR% error of the previous command

Commands

SHOWDLG - force device i/o dialog box popping up
WAIT - wait for user choice
DELAY N - delay for N msec
EXECCMD CMDLINE - execute external command CMDLINE using Command interpreter
(equals "cmd CMDLINE" in Windows)
EXECCMDQ CMDLINE - execute without creating new console window (quiet)
EXEC "FILENAME" CMDLINE - call external programm FILENAME with parameter CMDLINE
EXECQ "FILENAME" CMDLINE - call without creating new console window (quiet)
MSDOS - call Command processor (OS Windows and DOS)
GOTO LABELNAME - jump to label LABELNAME in script (to the string :LABELNAME)
RETURN - break script execution, handle error according to device I/O params
RETRETRY - break script as Retry button pressed
RETIGNORE - break script as Ignore button pressed
RETABORT - break script as Abort button pressed
ADDLOG "FILENAME" LOGLINE - write LOGLINE to file FILENAME
(string LOGLINE may contain variables)
CANCELIO - Call CancelIO (WinNT+ only)
(available if a device is opened with overlapped option)
OVLRESLT N - Check Overlapped result (N=1: wait; N=0: not wait) (WinNT+ only)
(must be used if a device is opened with overlapped option)
RESETHANDLE - Reopen disk handle
RESETDEVLIST - Update the list of devices, reopen disk handle
ATARESET - ATA Soft Reset (DOS ATA only)
ATARESETDET - ATA Soft Reset followed by ATA Identify (DOS ATA only)

Format specifiers

To format output integer a variable name can be followed by a format specifier after a colon, e.g.
%LBA:8x% -- width: 8, hexadecimal

Sample

IF %ERROR%=0 RETURN -- return if no error on last i/o
IF %ERROR%=128 GOTO LABEL1
IF %ERROR%=5 GOTO LABEL1
RETURN

:LABEL1
IF %CONFIRM%=0 RETRETRY
-- retry if Cancel button is pressed
-- continue script execution if Confirm is pressed
EXECCMD /K ECHO error %ERROR% at LBA: %LBA% (%SECNUM%) try: %TRYNUM%. Type EXIT to return.
IF %TRYNUM%<2 RETRETRY
DELAY 500
ADDLOG "C:\ERRORS.LOG" error %ERROR:x% at LBA: %LBA:10% (%SECNUM%) try: %TRYNUM%
RETIGNORE