VERSION 5.00
Begin VB.Form Form18 
   Caption         =   " Linux Ext2 (Ext3, Ext4) File System - Directory Entry "
   ClientHeight    =   2610
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6360
   Icon            =   "ext4direntry.frx":0000
   LinkTopic       =   "Form18"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2610
   ScaleWidth      =   6360
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton cmdNext 
      DownPicture     =   "ext4direntry.frx":0442
      Height          =   345
      Left            =   5640
      MaskColor       =   &H00FFFFFF&
      Picture         =   "ext4direntry.frx":057E
      Style           =   1  'Graphical
      TabIndex        =   12
      ToolTipText     =   "Next"
      Top             =   120
      UseMaskColor    =   -1  'True
      Width           =   435
   End
   Begin VB.CommandButton cmdPrev 
      DownPicture     =   "ext4direntry.frx":06BA
      Height          =   345
      Left            =   5040
      MaskColor       =   &H00FFFFFF&
      Picture         =   "ext4direntry.frx":07F6
      Style           =   1  'Graphical
      TabIndex        =   11
      ToolTipText     =   "Previous"
      Top             =   120
      UseMaskColor    =   -1  'True
      Width           =   435
   End
   Begin VB.Label Label7 
      Height          =   375
      Left            =   240
      TabIndex        =   18
      Top             =   2040
      Width           =   6015
   End
   Begin VB.Label Label23 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   162
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   4
      Left            =   1920
      TabIndex        =   17
      Top             =   1560
      Width           =   4365
   End
   Begin VB.Label Label17 
      Caption         =   "0"
      Height          =   255
      Left            =   4800
      TabIndex        =   16
      Top             =   1080
      Width           =   855
   End
   Begin VB.Label Label16 
      Caption         =   "Offset :"
      Height          =   255
      Left            =   4200
      TabIndex        =   15
      Top             =   1080
      Width           =   615
   End
   Begin VB.Label Label15 
      Caption         =   "0"
      Height          =   255
      Left            =   4800
      TabIndex        =   14
      Top             =   720
      Width           =   1455
   End
   Begin VB.Label Label14 
      Caption         =   "Sector:"
      Height          =   255
      Left            =   4200
      TabIndex        =   13
      Top             =   720
      Width           =   615
   End
   Begin VB.Label Label23 
      Caption         =   "0"
      Height          =   255
      Index           =   3
      Left            =   1920
      TabIndex        =   10
      Top             =   1320
      Width           =   1965
   End
   Begin VB.Label Label23 
      Caption         =   "0"
      Height          =   255
      Index           =   2
      Left            =   1920
      TabIndex        =   9
      Top             =   1080
      Width           =   1995
   End
   Begin VB.Label Label23 
      Caption         =   "0"
      Height          =   255
      Index           =   1
      Left            =   1920
      TabIndex        =   8
      Top             =   840
      Width           =   1965
   End
   Begin VB.Label Label23 
      Caption         =   "0"
      Height          =   255
      Index           =   0
      Left            =   1920
      TabIndex        =   7
      Top             =   600
      Width           =   1965
   End
   Begin VB.Label Label22 
      Caption         =   "PhysicalDrive0:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   162
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   1080
      TabIndex        =   1
      Top             =   120
      Width           =   1695
   End
   Begin VB.Label Label6 
      Caption         =   "Name:"
      Height          =   255
      Left            =   240
      TabIndex        =   6
      Top             =   1560
      Width           =   1600
   End
   Begin VB.Label Label5 
      Caption         =   "File Type:"
      Height          =   255
      Left            =   240
      TabIndex        =   5
      Top             =   1320
      Width           =   1600
   End
   Begin VB.Label Label4 
      Caption         =   "Name Length:"
      Height          =   255
      Left            =   240
      TabIndex        =   4
      Top             =   1080
      Width           =   1600
   End
   Begin VB.Label Label3 
      Caption         =   "Entry Length:"
      Height          =   255
      Left            =   240
      TabIndex        =   3
      Top             =   840
      Width           =   1600
   End
   Begin VB.Label Label2 
      Caption         =   "Inode Number:"
      Height          =   255
      Left            =   240
      TabIndex        =   2
      Top             =   600
      Width           =   1600
   End
   Begin VB.Label Label1 
      Caption         =   "Drive"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   162
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   240
      TabIndex        =   0
      Top             =   120
      Width           =   735
   End
End
Attribute VB_Name = "Form18"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Const EXT3_FT_UNKNOWN = 0
Const EXT3_FT_REG_FILE = 1
Const EXT3_FT_DIR = 2
Const EXT3_FT_CHRDEV = 3
Const EXT3_FT_BLKDEV = 4
Const EXT3_FT_FIFO = 5
Const EXT3_FT_SOCK = 6
Const EXT3_FT_SYMLINK = 7

Dim O As Integer
Dim S As Long
Rem  /* Inode number */ (_le32)
Dim inode As Long
Rem /* Directory entry length */ (_le16)
Dim rec_len As Long
Rem /* Name length */ (_u8)
Dim name_len As Byte
Rem (_u8)
Dim file_type As Byte
Rem /* File name */ (char, max. 255 byte)
Dim f_name As String
Rem
Dim POS(64) As Integer

Dim S1 As Long
Dim S2 As Long
Dim S3 As Long
Dim S4 As Long

Private Sub cmdNext_Click()
If O < POS(0) Then
   O = O + 1
   Call Dir_Entry_Show(POS(O))
End If
End Sub

Private Sub cmdPrev_Click()
If O > 1 Then
   O = O - 1
   Call Dir_Entry_Show(POS(O))
End If
End Sub

Private Sub Form_Load()
Label22.Caption = DRV
POS(0) = 1
POS(1) = 0
O = 1
Call GetDirEntries
Call Dir_Entry_Show(0)
Label15.Caption = CStr(Sector + CInt((FP - 1) / 512))
Label17.Caption = 0
End Sub

Private Sub Dir_Entry_Show(C As Integer)
On Error GoTo Hata
Label15.Caption = CStr(Sector + CInt((FP - 1) / 512))
Label17.Caption = CStr(C)
S1 = CLng(BSBuffer(C + 0))
S2 = CLng(BSBuffer(C + 1))
S3 = CLng(BSBuffer(C + 2))
S4 = CLng(BSBuffer(C + 3))
inode = CLng((S4 * 16777216) + (S3 * 65536) + (S2 * 256) + S1)
Label23(0).Caption = CStr(inode)
rec_len = CInt(BSBuffer(C + 5) * 256)
rec_len = rec_len + BSBuffer(C + 4)
Label23(1).Caption = CStr(rec_len)
name_len = CInt(BSBuffer(C + 6))
Label23(2).Caption = CStr(name_len)
file_type = BSBuffer(C + 7)
Label23(3).Caption = CStr(file_type)
f_name = ""
S = C + 7
If name_len > 0 And name_len <= 255 Then
   If S + name_len <= 512 Then
      For S = S + 1 To S + name_len
          f_name = f_name + Chr$(BSBuffer(S))
      Next S
   End If
End If
Label23(4).Caption = f_name
Select Case file_type
       Case EXT3_FT_UNKNOWN
       Label7.Caption = "Entry is a EXT3_FT_UNKNOWN"
       Case EXT3_FT_REG_FILE
       Label7.Caption = "Entry is a EXT3_FT_REG_FILE"
       Case EXT3_FT_DIR
       Label7.Caption = "Entry is a EXT3_FT_DIR"
       Case EXT3_FT_CHRDEV
       Label7.Caption = "Entry is a EXT3_FT_CHRDEV"
       Case EXT3_FT_BLKDEV
       Label7.Caption = "Entry is a EXT3_FT_BLKDEV"
       Case EXT3_FT_FIFO
       Label7.Caption = "Entry is a EXT3_FT_FIFO"
       Case EXT3_FT_SOCK
       Label7.Caption = "Entry is a EXT3_FT_SOCK"
       Case EXT3_FT_SOCK
       Label7.Caption = "Entry is a EXT3_FT_SOCK"
       Case Else
       Label7.Caption = "Entry is a EXT3_FT_UNKNOWN"
End Select
Cikis:
Exit Sub
Hata:
MsgBox ("Directory Entry is Invalid (wrong block) or there is an overflow (very big number) problem..."), 48, "Directory Entry ! ERROR !"
Resume Cikis
End Sub

Private Sub GetDirEntries()
S = 0
Tekrar1:
rec_len = CInt(BSBuffer(S + 5))
rec_len = rec_len * 256
rec_len = rec_len + BSBuffer(S + 4)
If rec_len > 0 Then
   S = S + rec_len
   If S < 500 Then
      POS(0) = POS(0) + 1
      POS(POS(0)) = S
      GoTo Tekrar1
   End If
End If
End Sub
