{ With this dll it is possible to listen to ASPI commands sent to winaspi.dll. ASPI is from Adaptec (http://www.adaptec.com). Move your winaspi.dll to winaspio.dll (or whatever you have specified in reallibname) and then copy this winaspi.dll to windows\system\. All ASPI commands and there buffers will be copied to the textfile logname. This was written with Borland Delphi 1. It is a quick hack so there will be bugs. 2000-06-18 by Henning Meier-Geinitz Licence: GPL (only this file, for the ASPI system ask Adaptec) } library Winaspi; uses WinCRT, WinTypes, WinProcs, SysUtils; const logname = 'c:\temp\aspi.txt'; reallibname = 'winaspio'; var SaveExit: Pointer; type trb = array [0..255] of byte; trbp = ^trb; { ASPI definition from Adaptec ASPI SDK } type srb = record SRB_Cmd: byte; { 00/000 ASPI command code = SC_EXEC_SCSI_CMD} SRB_Status: byte; { 01/001 ASPI command status byte } SRB_HaId: byte; { 02/002 ASPI host adapter number } SRB_Flags: byte; { 03/003 ASPI request flags } SRB_Hdr_Rsvd: longint; { 04/004 Reserved, MUST = 0 } SRB_Target: byte; { 08/008 Target's SCSI ID } SRB_Lun: byte; { 09/009 Target's LUN number} SRB_BufLen: longint; { 0A/010 Data Allocation Length } SRB_SenseLen: byte; { 0E/014 Sense Allocation Length } SRB_BufPointer: ^byte; { 0F/015 Data Buffer Pointer } SRB_Rsvd1: longint; { 13/019 Reserved, MUST = 0 } SRB_CDBLen: byte; { 17/023 CDB Length = 6 } SRB_HaStat: byte; { 18/024 Host Adapter Status } SRB_TargStat: byte; { 19/025 Target Status } SRB_PostProc: ^byte; { 1A/026 Post routine } SRB_Rsvd2: string[33]; { 1E/030 Reserved, MUST = 0 } CDBByte: string[20]; { 40/064 SCSI CDB } end; type srbp = ^srb; procedure dbg (txt: string); var f: textfile; begin assignfile(f, logname); append(f); writeln (f, DateTimeToStr(Now), ': ', txt); closefile (f); end; function oSendASPICommand(inhalt:srbp):Integer;far; external reallibname name 'SendASPICommand'; function oGetASPISupportInfo:Integer;far; external reallibname name 'GetASPISupportInfo'; procedure LibExit; far; begin if ExitCode = wep_System_Exit then begin dbg ('**** winaspi.dll wird verlassen - shutdown ************'); end else begin dbg ('**** winaspi.dll wird verlassen - unload **************'); end; ExitProc := SaveExit; end; function SendASPICommand(inhalt:srbp):Integer;export; var erg: integer; outtxt: string[255]; i: longint; p: pointer; bp: trbp; bufferlen: longint; begin if (inhalt^.SRB_Cmd = 2) then begin {SCSI command} outtxt := 'Command: '; for i := 0 to inhalt^.SRB_CDBLen - 1 do begin outtxt:=outtxt + IntToHex (Ord(inhalt^.CDBByte[i]), 2) + '; '; end; outtxt := outtxt + 'SCSI-ID ' + IntToStr (inhalt^.SRB_Target) + '; '; outtxt := outtxt + 'Cmd length = ' + IntToStr (inhalt^.SRB_CDBLen) + '; '; outtxt := outtxt + 'BufLen = ' + IntToStr (inhalt^.SRB_BufLen) + '; '; if (inhalt^.SRB_Flags and $18) = $18 then begin outtxt := outtxt + 'no data; '; end else if (inhalt^.SRB_Flags and $18) = $08 then begin outtxt := outtxt + 'S->H; '; end else if (inhalt^.SRB_Flags and $18) = $10 then begin outtxt := outtxt + 'H->S; '; end else begin outtxt := outtxt + '?; '; end; if Ord(inhalt^.CDBByte[0]) <> 3 then dbg (outtxt); { Ignore Request Sense } end; erg := oSendASPICommand(inhalt); { now waiting until ready } while (inhalt^.SRB_status = 0) do begin end; if (inhalt^.SRB_Cmd = 2) then begin {SCSI command} bufferlen := inhalt^.SRB_BufLen; p := inhalt^.SRB_BufPointer; bp := p; if bufferlen >= 70 then bufferlen := 70; outtxt := 'Buffer (' + IntToStr (bufferlen) + '/' + IntToStr (inhalt^.SRB_BufLen) + '): '; for i := 0 to bufferlen - 1 do begin outtxt:=outtxt + IntToHex (bp^[i], 2) + ' '; end; if Ord(inhalt^.CDBByte[0]) <> 3 then dbg (outtxt); { Ignore Request Sense } end; SendASPICommand := erg; end; function GetASPISupportInfo:Integer;export; var info: integer; outstr: string; begin info := oGetASPISupportInfo; {outstr := 'GetASPISupportInfo = ' + IntToStr (info) + '.'; dbg (outstr);} GetASPISupportInfo := info; end; exports SendASPICommand, GetASPISupportInfo; {$R *.RES} var f: textfile; begin SaveExit := ExitProc; ExitProc := @LibExit; if (not (fileexists (logname))) then begin assignfile(f, logname); rewrite (f); closefile (f); dbg('new file'); end; dbg('**** winaspi.dll gestartet ********************************'); end.