VERSION 5.00 Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.1#0"; "COMCTL32.OCX" Begin VB.Form FrmMain BorderStyle = 4 'Fixed ToolWindow Caption = "Boot Manager" ClientHeight = 3015 ClientLeft = 45 ClientTop = 285 ClientWidth = 5790 ControlBox = 0 'False DrawMode = 7 'Invert FontTransparent = 0 'False LinkTopic = "FrmMain" MaxButton = 0 'False MinButton = 0 'False NegotiateMenus = 0 'False ScaleHeight = 3015 ScaleWidth = 5790 ShowInTaskbar = 0 'False StartUpPosition = 2 'CenterScreen Begin VB.Frame Frame2 Caption = "Controls" Height = 2775 Left = 4460 TabIndex = 9 Top = 120 Width = 1215 Begin VB.CommandButton cmdExit Caption = "E&xit" Height = 360 Index = 5 Left = 120 Style = 1 'Graphical TabIndex = 4 Top = 1800 UseMaskColor = -1 'True Width = 975 End Begin VB.CommandButton cmdHelp Caption = "&Help" Height = 360 Index = 4 Left = 120 Style = 1 'Graphical TabIndex = 3 Top = 1320 UseMaskColor = -1 'True Width = 975 End Begin VB.CommandButton cmdAbout Caption = "&About" Height = 360 Index = 3 Left = 120 Style = 1 'Graphical TabIndex = 5 Top = 2280 UseMaskColor = -1 'True Width = 975 End Begin VB.CommandButton cmdConfigure Caption = "C&onfigure" Enabled = 0 'False Height = 360 Index = 2 Left = 120 Style = 1 'Graphical TabIndex = 2 Top = 840 UseMaskColor = -1 'True Width = 975 End Begin VB.CommandButton cmdInstall Caption = "&Install" Height = 360 Index = 0 Left = 120 Style = 1 'Graphical TabIndex = 1 Top = 360 UseMaskColor = -1 'True Width = 975 End End Begin VB.Frame Frame1 Caption = "Disk Drive Information" Height = 2775 Left = 120 TabIndex = 6 Top = 120 Width = 4260 Begin ComctlLib.TreeView DiskTree Height = 1935 Left = 120 TabIndex = 0 Top = 720 Width = 4000 _ExtentX = 7064 _ExtentY = 3413 _Version = 327680 LabelEdit = 1 Style = 7 ImageList = "ImageList1" Appearance = 1 End Begin VB.Label lblDrives Alignment = 2 'Center BackColor = &H00FFFFFF& BorderStyle = 1 'Fixed Single Caption = "0" Height = 250 Left = 240 TabIndex = 8 Top = 360 Width = 375 End Begin VB.Label Label1 Caption = "Physiscal disks attached to the system" Height = 200 Left = 720 TabIndex = 7 Top = 390 Width = 2895 End End Begin ComctlLib.ImageList ImageList1 Left = 6960 Top = 360 _ExtentX = 1005 _ExtentY = 1005 BackColor = -2147483643 ImageWidth = 16 ImageHeight = 16 MaskColor = 12632256 _Version = 327680 BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7} NumListImages = 4 BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7} Picture = "FrmMain.frx":0000 Key = "" EndProperty BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7} Picture = "FrmMain.frx":031A Key = "" EndProperty BeginProperty ListImage3 {0713E8C3-850A-101B-AFC0-4210102A8DA7} Picture = "FrmMain.frx":0634 Key = "" EndProperty BeginProperty ListImage4 {0713E8C3-850A-101B-AFC0-4210102A8DA7} Picture = "FrmMain.frx":094E Key = "" EndProperty EndProperty End End Attribute VB_Name = "FrmMain" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Private Sub cmdAbout_Click(Index As Integer) frmAbout.Show vbModal End Sub Private Sub cmdExit_Click(Index As Integer) Unload FrmMain End Sub Private Sub cmdInstall_Click(Index As Integer) 'Shitty safe arrays... Dim PartData(4 * 11) As Byte Dim Drive As Byte Dim Partition As Byte Dim Offset As Integer Dim count As Integer 'Save the updated boot information For Drive = 0 To glbDrives - 1 'Clear the array... For count = 0 To (4 * 11) PartData(count) = 32 Next count For Partition = 0 To 3 'Move to the next save position... Offset = Partition * 11 'Save the active status... PartData(Offset) = PartitionList(Drive, Partition).Active For count = 1 To Len(PartitionList(Drive, Partition).BootID) Offset = Offset + 1 PartData(Offset) = CByte(Asc(Mid(PartitionList(Drive, Partition).BootID, count, 1))) Next count Next Partition If WriteBootInfo(PartData(0), Drive) = False Then End If Next Drive End Sub Private Sub DiskTree_DblClick() If (glbMouseButton <> 1) Then Exit Sub End If 'If this is not a root item, and this partition can be made bootable then let it be... If (DiskTree.SelectedItem.Image > PINVALID) Then 'Check the current partition's status If DiskTree.SelectedItem.Image = PINACTIVE Then 'The partition is not currently configured - so configure it. 'Get the previous default name for this partition glbtmpString = GetPartitionName(DiskTree.SelectedItem.Key) 'Get the user to name this partition for the Boot Loader FrmAddPartition.Show vbModal 'If tmpString = NULL then they cancelled the operation If glbtmpString <> "" Then 'Set the default name for this partition SetPartition DiskTree.SelectedItem, glbtmpString, PACTIVE End If Else 'We do not want this partition visible from the Boot Loader SetPartition DiskTree.SelectedItem, glbtmpString, PINACTIVE End If End If End Sub Private Sub DiskTree_KeyPress(KeyAscii As Integer) If (KeyAscii = 13) Then DiskTree_DblClick End If End Sub Private Sub DiskTree_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single) glbMouseButton = Button End Sub Private Sub Form_Load() Dim BootSector(511) As Byte Dim NodX As Node Dim Data As PartInfo Dim RetVal As Integer Dim count As Integer 'Set as clean system glbNotUpdated = False 'First get the count of physical disks attached to the system glbDrives = 0 Do While (ReadBootSector(BootSector(0), glbDrives) = 1) 'object.Add(relative, relationship, key, text, image, selectedimage) 'Update the TreeView to display the physical disks and partitions Set NodX = DiskTree.Nodes.Add(, , "D" & Trim(Str(glbDrives)), "Physical Disk" & Str(glbDrives), 1, 1) 'Show the partition information for this disk For count = 0 To 3 GetPartitionInfo BootSector(0), Data, count Set NodX = DiskTree.Nodes.Add("D" & Trim(Str(glbDrives)), tvwChild, "D" & Trim(Str(glbDrives)) & Trim(Str(count)), "", PINVALID, PINVALID) 'The active byte also sets the default color for the string in the boot loader If (Data.CanBoot = 0) Then SetPartition NodX, Data.BootID, PINVALID, Data.Name ElseIf (Data.Active <> 0) Then SetPartition NodX, Data.BootID, PACTIVE, Data.Name Else SetPartition NodX, Data.BootID, PINACTIVE, Data.Name End If Next count 'Increment to the next drive glbDrives = glbDrives + 1 Loop 'Display how many physical disks were found lblDrives.Caption = glbDrives End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) If glbNotUpdated = True Then End If End Sub