VERSION 5.00
Begin VB.Form Form31 
   Caption         =   " Seeking SINGLIX FS1 Partition"
   ClientHeight    =   1680
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   3525
   Icon            =   "fs1seek.frx":0000
   LinkTopic       =   "Form31"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1680
   ScaleWidth      =   3525
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Command1 
      Caption         =   "Seek"
      Height          =   375
      Left            =   1800
      TabIndex        =   2
      Top             =   960
      Width           =   1455
   End
   Begin VB.CommandButton Command2 
      Caption         =   "Cancel"
      Height          =   375
      Left            =   240
      TabIndex        =   1
      Top             =   960
      Width           =   1335
   End
   Begin VB.ComboBox Combo1 
      Height          =   315
      Left            =   1560
      TabIndex        =   0
      Text            =   "PhysicalDrive0"
      Top             =   240
      Width           =   1695
   End
   Begin VB.Label Label1 
      Caption         =   "Physical  Drive :"
      Height          =   255
      Left            =   240
      TabIndex        =   3
      Top             =   285
      Width           =   1215
   End
End
Attribute VB_Name = "Form31"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim PT(63) As Byte
Dim DriveName As String

Private Sub Combo1_Change()
Combo1.ListIndex = C1LI
End Sub

Private Sub Combo1_Click()
C1LI = Combo1.ListIndex
End Sub

Private Sub Combo1_LostFocus()
DriveName = Combo1.Text
End Sub

Private Sub Command1_Click()
On Error GoTo ErrMsg
Dim SinglixDetected As Boolean
Dim X As Integer
Dim Y As Integer
Dim T As Integer
Dim Z As Long
Dim SystemId(3) As Byte
Dim S1 As Double
Dim S2 As Long
Dim S3 As Long
Dim BeginningSector As Double
Me.Caption = " Reading Master Boot Sector"
Z = DirectReadDriveNT(DriveName, 0, 0, abResult(), 512)
If Z > 0 Then
   For X = 0 To 63
       PT(X) = abResult(446 + X)
   Next X
   SystemId(0) = PT(4)
   SystemId(1) = PT(20)
   SystemId(2) = PT(36)
   SystemId(3) = PT(52)
   For Y = 0 To 3
       If SystemId(Y) = &HA1 Then
          S1 = CDbl(PT(11 + (Y * 16)))
          S1 = S1 * 16777216
          S2 = CLng(PT(10 + (Y * 16)))
          S2 = S2 * 65536
          S3 = CLng(PT(9 + (Y * 16)))
          S3 = S3 * 256
          BeginningSector = S1 + S2 + S3 + PT(8 + (Y * 16))
          MsgBox (DriveName + " sector " + CStr(BeginningSector) + " is Singlix FS1 Boot Sector..." + Chr$(13) + Chr$(10) + Chr$(13) + Chr$(10) + "Use 'Physical Disk Read' menu/command for reading the Singlix FS1 boot sector..."), 0, " SINGLIX FS1 PARTITION (A1h) FOUND !"
          SinglixDetected = True
          Exit For
       End If
   Next Y
Else
IHV:
   MsgBox ("Invalid handle value !" + Chr$(13) + Chr$(10) + "(Disk not ready or read error.)"), 48, " Physical Disk " + Right(DriveName, 1) + " Read Error !"
   GoTo Cikis
End If
If SinglixDetected = False Then
   MsgBox ("Singlix FS1 partition (A1h) could not be detected on the drive " + DriveName + " ..."), 0, " SINGLIX FS1 PARTITION (A1h) NOT FOUND !"
End If
Cikis:
Unload Me
Exit Sub
ErrMsg:
Beep
MsgBox ("Drive could not read!..." + Chr$(13) + Chr$(13) + "Error Number: " + Str$(Err)), 48, "! ERROR !"
C1LI = 0
Resume Cikis
End Sub

Private Sub Command2_Click()
Rem C1LI = 0
Unload Me
End Sub

Private Sub Form_Load()
Rem 4-11-2008
Combo1.AddItem "PhysicalDrive0"
Combo1.AddItem "PhysicalDrive1"
Combo1.AddItem "PhysicalDrive2"
Combo1.AddItem "PhysicalDrive3"
Rem 16-11-2008
Combo1.ListIndex = C1LI
DriveName = "PhysicalDrive0"
End Sub

Private Sub Form_Unload(Cancel As Integer)
Combo1.ListIndex = 0
End Sub
