t = "Check this box if you want DRSP to run in batch mode." & NL & NL
t = t & "In batch mode DRSP will not go interactive if any of the parameters are wrong. It will neither ask for comments before writing the results to the log-file." & NL & NL
t = t & "It is highly recommended to choose batch mode in case you are testing multiple drives. (Remember to choose this mode for all the drives that you are going to test!)"
MsgBox t, 64, "Help on ""Batch mode"""
End Sub
Sub Drsp_do_Click ()
Dim i, RetVal
Dim Coml As String
Dim ResPath As String, tmp As String
Static res(-2 To 13) As String
res(-2) = "Can't execute"
res(-1) = "Not available"
res(0) = "Normal exit"
res(1) = "Aborted by user"
res(2) = "Can't write results to the log-file"
res(3) = "Can't open file"
res(4) = "Can't write to file"
res(5) = "Can't close a file"
res(6) = "Can't delete a file"
res(7) = "DOS ver too old"
res(8) = "Out of memory"
res(9) = "Math error - select a larger test-file size"
res(10) = "No such drive or drive not ready"
res(11) = "Test-size too small or too large - too few files on drive in read-only test"
If Drv(i).Enabled Then Drv(i).Value = Drv_all.Value
Next i
End Sub
Sub Drv_Help_Click ()
Dim t As String
t = "Here you select the drives you wish to test" & NL & NL
t = t & "You may select multiple drives from the ones that are available." & NL & NL
t = t & "When you click a check-box, the parameters that you selected for that drive will be loaded. The modified parameters are saved when you select another drive. The currently active drive is marked with red." & NL & NL
t = t & "Right-click the check-boxes to edit a new drive's parameters without changing its on/off status."
MsgBox t, 64, "Help on ""Drives"""
End Sub
Sub Drv_MouseDown (Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
If CurDrv <> -1 Then
Drv(CurDrv).ForeColor = 0
RemChar Size, ",", "."
Params(CurDrv).Size = Val(Size.Text)
Params(CurDrv).Turns = Val(Turns.Text)
Params(CurDrv).Batch = Batch.Value
Params(CurDrv).RO = RO_tgl.Value
If RSW(0).Value Then
Params(CurDrv).Mode = 1
Else
Params(CurDrv).Mode = 2
End If
End If
Drv(Index).ForeColor = &HFF
CurDrv = Index
Size.Text = Trim$(Str$(Params(CurDrv).Size))
Turns.Text = Params(CurDrv).Turns
TScroll.Value = Params(CurDrv).Turns
Batch.Value = Params(CurDrv).Batch
RO_tgl.Value = Params(CurDrv).RO
If Params(CurDrv).Mode = 1 Then
RSW(0).Value = True
Else
RSW(1).Value = True
End If
RO_tgl_Click
End Sub
Sub Form_Load ()
Dim i
If App.PrevInstance Then
MsgBox "Can't run two instances of " & ProgName & " at once!", 48 + 4096, ProgName
End
End If
Left = (Screen.Width - Width) / 2
Top = (Screen.Height - Height) / 2
NL = Chr$(13) & Chr$(10)
AppPath = App.Path
If Right$(AppPath, 1) <> "\" Then AppPath = AppPath & "\"
Form1.Caption = ProgName
Form2.Caption = ProgName & " - Select the log-file"
Form3.Caption = ProgName & " - Log-file viewer"
i = SendMessage(Status.hWnd, EM_SETREADONLY, True, 0)
i = SendMessage(Form3.Viewer.hWnd, EM_SETREADONLY, True, 0)
Open AppPath & SavFile For Random As #1 Len = RecLen
For i = 0 To 25
Get #1, i + 1, Params(i)
Next i
Close #1
On Error GoTo 0
NoFile:
'Select active drive
CurDrv = -1
For i = 0 To 25
If Drv(i).Enabled Then
Drv_MouseDown i, 2, 0, 0, 0
Exit For
End If
Next i
Exit Sub
Trap:
Resume NoFile
End Sub
Sub Form_QueryUnload (Cancel As Integer, UnloadMode As Integer)
If Running Then
MsgBox "You can't quit " & ProgName & " while the tests are running. Press Stop first!", 16, ProgName
Cancel = True
Exit Sub
End If
If MsgBox("Do you really wish to quit " & ProgName & "?", 4 + 32, ProgName) = 7 Then Cancel = True
End Sub
Sub Form_Unload (Cancel As Integer)
Dim i
Unload Form2
'Update drive parameters
Drv_MouseDown CurDrv, 2, 0, 0, 0
'Load saved data
On Error GoTo Trap1
Open AppPath & SavFile For Random As #1 Len = RecLen
For i = 0 To 25
Put #1, i + 1, Params(i)
Next i
Close #1
Trap1:
End
End Sub
Sub Label6_Click ()
Dim t As String
t = ProgName & ", ver. 3.10, GPL Freeware." & NL
t = t & "Copyleft (l) Stanislav Sokolov, May 2000 and onwards." & NL & NL
t = t & "This is a Windows front-end for DriveSpeed 3.10, designed to make testings easier and less scary..."
MsgBox t, , ProgName
End Sub
Sub Log_f_LostFocus ()
RemChar Log_f, " ", ""
Log_f.Text = UCase$(Log_f.Text)
SearchFile
End Sub
Sub Log_Help_Click ()
Dim t As String
t = "Here you can select the log-file that DRSP will append the test results to. If the file does not exist, it will be created." & NL & NL
t = t & "If, for some reason, DRSP fails to write to the file, it will attempt using the default DRSP.LOG, placing it in the same directory as the DRSP.EXE. Leave the field blank to make DRSP use the default filename and location." & NL & NL
t = t & "Please, keep to the 8.3 convention. Note that the log-file is common for all the drives that you test."
MsgBox t, 64, "Help on ""Select log-file"""
End Sub
Sub Log_sel_Click ()
'Brows base directory
Form2.Show 1
If Form2.Ok_btn.Tag <> "" Then Log_f.Text = UCase$(Form2.Ok_btn.Tag)
SearchFile
End Sub
Sub Quit_Click ()
Unload Form1
End Sub
Sub ReadFile (LogFile As String)
Dim Text As String, tmp As String
Dim i, j
Dim start As Long
ReDim s(9) As String, r(9) As String
s(1) = "
": r(1) = "-"
s(2) = "
": r(2) = "|"
s(3) = "
": r(3) = "+"
s(4) = "
": r(4) = "+"
s(5) = "
": r(5) = "+"
s(6) = "
": r(6) = "+"
s(7) = "
": r(7) = "+"
s(8) = "
": r(8) = "+"
s(9) = "
": r(9) = "+"
On Error GoTo View_Trap
Form3.Viewer.Text = ""
Open LogFile For Input As #1: Close #1
Open LogFile For Binary As #1
If LOF(1) > 32600 Then
Form3.Viewer.Text = "Log-file is larger than 32600 bytes!" & NL & "Displaying the last 32600 bytes." & NL & NL & NL
start = LOF(1) - 32599
Text = Space$(32600)
Else
start = 1
Text = Space$(LOF(1))
End If
Get #1, start, Text
Close #1
On Error GoTo 0
'Go through the file and replace DOS pseudo-graphics
For i = 1 To 9
j = InStr(Text, s(i))
While j <> 0
Mid$(Text, j, 1) = r(i)
j = InStr(j + 1, Text, s(i))
Wend
Next i
Form3.Viewer.Text = Form3.Viewer.Text + Text
Form3.Viewer.SelStart = Len(Form3.Viewer.Text)
Form3.LogName.Caption = UCase$(LogFile)
Form3.DoPrint.Enabled = True
Exit Sub
View_Trap:
Form3.Viewer.Text = "Log-file not found or it has not been created yet." & NL & "Errorcode:" & Str$(Err)
Form3.LogName.Caption = ""
Close #1
Exit Sub
End Sub
Sub RemChar (C As Control, in As String, out As String)
Dim i
C.Text = Trim$(C.Text)
i = InStr(C.Text, in)
While i <> 0
C.Text = Left$(C.Text, i - 1) & out & Mid$(C.Text, i + 1)
i = InStr(C.Text, in)
Wend
End Sub
Sub RO_Help_Click ()
Dim t As String
t = "Check the ""Read-only mode"" box if you want to run a read-only test on a spesific drive. Select then one of the two modes of testing. Note that in ""single-pass"" mode the ""Number of turns"" text-box is greyed out." & NL & NL
t = t & """Single-pass mode"" is more accurate. It is performed by finding 17 largest files on the drive and reading them in seqence. Thus, caching does not affect this test." & NL & NL
t = t & """Multi-pass mode"" gives slightly faster results due to caching. It finds the largest file on the drive and reads it ""Number of turns"" times." & NL & NL
t = t & "If you attempt running DRSP on a read-only drive without first selecting a read-only mode, DRSP will automaticly run in the multi-pass mode. This mode is chosen for compatibility reasons."
MsgBox t, 64, "Help on ""Read-only mode"""
End Sub
Sub RO_tgl_Click ()
If RO_tgl.Value = 1 Then
RSW(0).Enabled = True
RSW(1).Enabled = True
RSW_Click (0)
Else
RSW(0).Enabled = False
RSW(1).Enabled = False
RSW_Click (0)
End If
End Sub
Sub RSW_Click (Index As Integer)
If RSW(1).Value And RO_tgl.Value = 1 Then
Turns.Enabled = True
TScroll.Enabled = True
ElseIf RSW(0).Value And RO_tgl.Value = 1 Then
Turns.Enabled = False
TScroll.Enabled = False
Else
Turns.Enabled = True
TScroll.Enabled = True
End If
End Sub
Sub SearchFile ()
Dim LogFile As String, TryPath As String, Path As String
Dim ErrFlag, i, start_t, stop_t
On Error GoTo Try
Form3.DoPrint.Enabled = False
'Try selected file
ErrFlag = False
LogFile = Form1.Log_f.Text
Open LogFile For Input As #1: Close #1
If Not ErrFlag Then
ReadFile LogFile
Exit Sub
End If
'Try current dir
ErrFlag = False
Open ".\DRSP.EXE" For Input As #1: Close #1
If Not ErrFlag Then
ReadFile ".\DRSP.LOG"
Exit Sub
End If
'Try WINDOWS dir
ErrFlag = False
TryPath = Space(80)
i = GetWindowsDirectory(TryPath, 80)
If i > 0 Then
TryPath = Trim$(TryPath)
TryPath = Left$(TryPath, Len(TryPath) - 1)
If Right$(TryPath, 1) <> "\" Then TryPath = TryPath & "\"
Open TryPath & "DRSP.EXE" For Input As #1: Close #1
If Not ErrFlag Then
ReadFile TryPath & "DRSP.LOG"
Exit Sub
End If
End If
'Try SYSTEM dir
ErrFlag = False
TryPath = Space(80)
i = GetSystemDirectory(TryPath, 80)
If i > 0 Then
TryPath = Trim$(TryPath)
TryPath = Left$(TryPath, Len(TryPath) - 1)
If Right$(TryPath, 1) <> "\" Then TryPath = TryPath & "\"
Open TryPath & "DRSP.EXE" For Input As #1: Close #1
If Not ErrFlag Then
ReadFile TryPath & "DRSP.LOG"
Exit Sub
End If
End If
'Try module dir
ErrFlag = False
Open AppPath & "DRSP.EXE" For Input As #1: Close #1
If Not ErrFlag Then
ReadFile AppPath & "DRSP.LOG"
Exit Sub
End If
'Try PATH envir
Path = Environ$("PATH")
start_t = 1
stop_t = InStr(Path, ";")
If stop_t = 0 Then stop_t = Len(Path)
Do
ErrFlag = False
TryPath = Mid$(Path, start_t, stop_t - start_t)
If Right$(TryPath, 1) <> "\" Then TryPath = TryPath & "\"
Open TryPath & "DRSP.EXE" For Input As #1: Close #1
If Not ErrFlag Then
ReadFile TryPath & "DRSP.LOG"
Exit Sub
End If
start_t = stop_t + 1
stop_t = InStr(start_t + 1, Path, ";")
If stop_t = 0 Then stop_t = Len(Path) + 1
Loop While start_t <> Len(Path) + 2
On Error GoTo 0
Form3.Viewer.Text = "Log-file not found or it has not been created yet."
Form3.LogName.Caption = ""
Form3.DoPrint.Enabled = True
Exit Sub
ErrFlag = True
Resume Next
End Sub
Sub Size_Help_Click ()
Dim t As String
t = "Here you specify the size of a test-file or a selection of files." + NL + NL
t = t & "In read-write mode this is the size of the file that DRSP will generate in the root directory of the selected drive. If the size is too big, DRSP will ajust it to fit in." & NL & NL
t = t & "In read-only multi-pass mode DRSP will search for a file that is no larger than the specified size." & NL & NL
t = t & "In read-only sigle-pass mode DRSP will search for 17 largest files so that the total sum of the sizes does not exceed the size specified." & NL & NL
t = t & "The valid range is 0.2MB through 999.99MB."
MsgBox t, 64, "Help on ""Test-file size"""
End Sub
Sub Size_LostFocus ()
RemChar Size, ",", "."
If Val(Size.Text) < .2 Then Size.Text = "0.2"
If Val(Size.Text) > 999.99 Then Size.Text = "999.99"
End Sub
Sub SScroll_Change ()
Static Changing
'Critical region
If Not Changing Then
Changing = True
If SScroll.Value > Val(SScroll.Tag) Then
Size.Text = Val(Size.Text) + .8
If SScroll.Value = 999 Then SScroll.Value = 1
ElseIf SScroll.Value < Val(SScroll.Tag) Then
Size.Text = Val(Size.Text) - .8
If SScroll.Value = 1 Then SScroll.Value = 999
End If
SScroll.Tag = SScroll.Value
Size_LostFocus
Changing = False
End If
End Sub
Sub Stop_t_Click ()
Dim i
Stopped = True
stop_t.Enabled = False
Status.SelText = NL & NL & "Stop requested..." & NL & "Please wait until the current test is complete" & NL & "or press 'Esc' 1-2 times in the DriveSpeed window." & NL
End Sub
Sub TScroll_Change ()
Turns.Text = TScroll.Value
End Sub
Sub Turns_Help_Click ()
Dim t As String
t = "Here you specify the number of times the test-file is read and/or written in read-write and read-only multi-pass modes." & NL & NL
t = t & "If you choose the read-only single-pass mode this option will be unavailable." & NL & NL