VERSION 5.00
Begin VB.Form Form2 
   Caption         =   " FS Hard Disk Drive"
   ClientHeight    =   1590
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   3285
   Icon            =   "frmHardDiskDrive.frx":0000
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1590
   ScaleWidth      =   3285
   StartUpPosition =   1  'CenterOwner
   Begin VB.OptionButton Option2 
      Caption         =   "hd1"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   162
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   1920
      TabIndex        =   2
      Top             =   240
      Width           =   1095
   End
   Begin VB.OptionButton Option1 
      Caption         =   "hd0"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   162
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   240
      TabIndex        =   1
      Top             =   240
      Value           =   -1  'True
      Width           =   1095
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Open"
      Height          =   375
      Left            =   1920
      TabIndex        =   0
      Top             =   960
      Width           =   1095
   End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim PT(63) As Byte

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
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
          PartitionStartSector = S1 + S2 + S3 + PT(8 + (Y * 16))
          MsgBox (DriveName + " sector " + CStr(PartitionStartSector) + " is Singlix FS1 Boot Sector..."), 0, " SINGLIX FS1 PARTITION (A1h) FOUND !"
          SinglixDetected = True
          Exit For
       End If
   Next Y
Else
IHV:
   GoTo Cikis1
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 !"
   GoTo Cikis2
Else
   If Form1.ReadSector(DriveName, 0, 1, BS()) <> 0 Then
      GoTo Cikis1
   End If
   Form1.Show
   Unload Me
End If
Exit Sub
Cikis1:
MsgBox ("Drive not ready or read error !"), 48, " Physical Disk " + Right(DriveName, 1) + " Read Error !"
Cikis2:
End
Exit Sub
ErrMsg:
Beep
MsgBox ("Drive not ready or read error!..." + Chr$(13) + Chr$(13) + "Error Number: " + Str$(Err)), 48, "! ERROR !"
Resume Cikis2
End Sub

Private Sub Form_Load()
DriveName = "PhysicalDrive0"
End Sub

Private Sub Option1_Click()
DriveName = "PhysicalDrive0"
End Sub

Private Sub Option2_Click()
DriveName = "PhysicalDrive1"
End Sub
