home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.2#0"; "COMCTL32.OCX"
- Begin VB.Form exam3
- Caption = "Registry Explorer"
- ClientHeight = 3930
- ClientLeft = 2010
- ClientTop = 1545
- ClientWidth = 9045
- LinkTopic = "Form1"
- ScaleHeight = 3930
- ScaleWidth = 9045
- Begin VB.ListBox lstValues
- Height = 1620
- Left = 5160
- TabIndex = 3
- Top = 480
- Width = 3915
- End
- Begin ComctlLib.TreeView treReg
- Height = 3735
- Left = 360
- TabIndex = 1
- Top = 0
- Width = 4755
- _ExtentX = 8387
- _ExtentY = 6588
- _Version = 327682
- LineStyle = 1
- Style = 7
- Appearance = 1
- End
- Begin VB.CommandButton cmdExit
- Caption = "E&xit"
- Height = 315
- Left = 8100
- TabIndex = 0
- Top = 3240
- Width = 915
- End
- Begin VB.Label lblValue
- Caption = "Values"
- Height = 315
- Left = 5340
- TabIndex = 2
- Top = 60
- Width = 1995
- End
- Attribute VB_Name = "exam3"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Private Sub Command1_Click()
- End Sub
- Private Sub cmdExit_Click()
- Unload Me
- End Sub
- Private Sub Form_Load()
- Dim ntest As Long
- Dim cname As String
- Dim lname As Long
- Dim x As Integer
- Dim nodX As Node
- Screen.MousePointer = vbHourglass
- cname = Space$(4096)
- lname = 4096
- Set nodX = treReg.Nodes.Add(, , "HKEY_CLASSES_ROOT", "HKEY_CLASSES_ROOT")
- Set nodX = treReg.Nodes.Add(, , "HKEY_CURRENT_USER", "HKEY_CURRENT_USER")
- Set nodX = treReg.Nodes.Add(, , "HKEY_LOCAL_MACHINE", "HKEY_LOCAL_MACHINE")
- Set nodX = treReg.Nodes.Add(, , "HKEY_USERS", "HKEY_USERS")
- Set nodX = treReg.Nodes.Add(, , "HKEY_CURRENT_CONFIG", "HKEY_CURRENT_CONFIG")
- Set nodX = treReg.Nodes.Add(, , "HKEY_DYN_DATA", "HKEY_DYN_DATA")
- x = 0
- Do While ntest = 0
- ' get all of the Sub Keys for HKEY_CLASSES_ROOT
- ntest = RegEnumKey(HKEY_CLASSES_ROOT, x, cname, lname)
- If ntest = 0 Then
-
- Set nodX = treReg.Nodes.Add("HKEY_CLASSES_ROOT", tvwChild, "A" & CStr(x), cname)
- x = x + 1
-
- End If
- x = 0
- ntest = 0
- Do While ntest = 0
- ' get all of the Sub Keys for HKEY_CURRENT_USER
- ntest = RegEnumKey(HKEY_CURRENT_USER, x, cname, lname)
- If ntest = 0 Then
-
- Set nodX = treReg.Nodes.Add("HKEY_CURRENT_USER", tvwChild, "B" & CStr(x), cname)
- x = x + 1
- End If
- x = 0
- ntest = 0
- Do While ntest = 0
- ' get all of the Sub Keys for HKEY_LOCAL_MACHINE
- ntest = RegEnumKey(HKEY_LOCAL_MACHINE, x, cname, lname)
- If ntest = 0 Then
- Set nodX = treReg.Nodes.Add("HKEY_LOCAL_MACHINE", tvwChild, "C" & CStr(x), cname)
- x = x + 1
- End If
- x = 0
- ntest = 0
- Do While ntest = 0
- ' get all of the Sub Keys for HKEY_USERS
- ntest = RegEnumKey(HKEY_USERS, x, cname, lname)
- If ntest = 0 Then
-
- Set nodX = treReg.Nodes.Add("HKEY_USERS", tvwChild, "D" & CStr(x), cname)
- x = x + 1
- End If
- x = 0
- ntest = 0
- Do While ntest = 0
- ' get all of the Sub Keys for HKEY_CURRENT_CONFIG
- ntest = RegEnumKey(HKEY_CURRENT_CONFIG, x, cname, lname)
- If ntest = 0 Then
-
- Set nodX = treReg.Nodes.Add("HKEY_CURRENT_CONFIG", tvwChild, "E" & CStr(x), cname)
- x = x + 1
- End If
- x = 0
- ntest = 0
- Do While ntest = 0
- ' get all of the Sub Keys for HKEY_DYN_DATA
- ntest = RegEnumKey(HKEY_DYN_DATA, x, cname, lname)
- If ntest = 0 Then
-
- Set nodX = treReg.Nodes.Add("HKEY_DYN_DATA", tvwChild, "F" & CStr(x), cname)
- x = x + 1
- End If
- Screen.MousePointer = vbDefault
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- Set exam3 = Nothing
- End Sub
- Private Sub treReg_NodeClick(ByVal Node As ComctlLib.Node)
- Dim nodX As Node
- Dim ntest As Integer
- Dim lret As Long
- Dim hKey As Long
- Dim x As Integer
- Dim cname As String
- Dim cvname As String
- Dim ctype As String
- Dim lpcvalue As Long
- Dim lname As Long
- Dim lhandle As Long
- Dim ntype As Long
- Dim cdata As Byte
- Dim ldata As Long
- cname = Space$(4096)
- cvname = Space$(25)
- lname = 4096
- 'cdata = Space$(4096)
- ldata = Len(cdata)
- If Node.Children > 0 Then
- Exit Sub
- Select Case Mid$(Node.FullPath, 1, InStr(1, Node.FullPath, "\") - 1)
- Case "HKEY_CLASSES_ROOT"
- hKey = HKEY_CLASSES_ROOT
- Case "HKEY_CURRENT_CONFIG"
- hKey = HKEY_CURRENT_CONFIG
- Case "HKEY_CURRENT_USER"
- hKey = HKEY_CURRENT_USER
- Case "HKEY_DYN_DATA"
- hKey = HKEY_DYN_DATA
- Case "HKEY_LOCAL_MACHINE"
- hKey = HKEY_LOCAL_MACHINE
- Case "HKEY_PERFORMANCE_DATA"
- hKey = HKEY_PERFORMANCE_DATA
- Case "HKEY_USERS"
- hKey = HKEY_USERS
- End Select
- lret = RegOpenKeyEx(hKey, Mid$(Node.FullPath, InStr(1, Node.FullPath, "\") + 1, Len(Node.FullPath) - InStr(1, Node.FullPath, "\") + 1), 0, KEY_QUERY_VALUE, lhandle)
- If lret <> 0 Then
- Exit Sub
- End If
- ntest = 0
- x = 0
- Do While ntest <> ERROR_NO_MORE_ITEMS
- ntest = RegEnumKey(lhandle, x, cname, lname)
- If ntest = 0 Then
- Set nodX = treReg.Nodes.Add(Node.Index, tvwChild, "A" & CStr(x) & CStr(Timer), cname)
- x = x + 1
- Else
- ntest = 0
- x = 0
- lstValues.Clear
- Do While ntest <> ERROR_NO_MORE_ITEMS
-
-
- ntest = RegEnumValue(lhandle, x, cvname, Len(cvname), 0, ntype, cdata, ldata)
- If ntest = 0 Then
-
- lstValues.AddItem Trim$(cvname)
- x = x + 1
-
- End If
-
- Loop
- End If
- End If
- lret = RegCloseKey(lhandle)
- If Node.Children <> 0 Then
- Node.Expanded = True
- End If
- End Sub
-