Penulis Topik: [shared]-Membuat Scan Registry Yang Cepat Dan Akurat  (Dibaca 1781 kali)

Offline Spensav Antivirus

  • Pro10
  • ***
  • Tulisan: 56
  • Reputation: +107/-0
    • Lihat Profil
    • SPENSAV Antivirus
[shared]-Membuat Scan Registry Yang Cepat Dan Akurat
« pada: Mei 18, 2012, 03:03:03 PM »
[shared]
Scan Registry Dengan Mengecek Value Yang Berbeda...

Example :
Lokasi : HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced
Name : HideFileExt
Value Asli : 0

Jika Valuenya Berbeda Kita Masukkan ke Listview....

Seperti Contoh :

    If GetKeyValue(HKEY_CURRENT_USER, "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideFileExt", Value) Then
        If Value = "0" Then
        Else
            Set G = ListView9.ListItems.Add(, , "HideFileExt")
            G.SubItems(1) = "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
            G.SubItems(2) = "Seharusnya Nilai 0"
        End If
    End If


Jadi, Funsi "GetkeyValue" Kita Berikan Source Code Gini :

Public Function GetKeyValue(KeyRoot As Long, KeyName As String, SubKeyRef As String, ByRef KeyVal As String) As Boolean
    Dim i As Long                                           ' Loop Counter
    Dim rc As Long                                          ' Return Code
    Dim hKey As Long                                        ' Handle To An Open Registry Key
    Dim hDepth As Long                                      '
    Dim KeyValType As Long                                  'Data Tipe Reg.
    Dim tmpVal As String                                    ' Tempory Reg.
    Dim KeyValSize As Long                                  ' Ukuran Key
    '------------------------------------------------------------
    ' Open RegKey Under KeyRoot {HKEY_LOCAL_MACHINE...}
    '------------------------------------------------------------
    rc = RegOpenKeyEx(KeyRoot, KeyName, 0, KEY_ALL_ACCESS, hKey) 'Buka Key Reg.
   
    If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError
   
    tmpVal = String$(1024, 0)
    KeyValSize = 1024
   
    '------------------------------------------------------------
    ' Retrieve Registry Key Value...
    '------------------------------------------------------------
    rc = RegQueryValueEx(hKey, SubKeyRef, 0, _
                         KeyValType, tmpVal, KeyValSize)
                       
    If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError
   
    If (Asc(Mid(tmpVal, KeyValSize, 1)) = 0) Then
        tmpVal = Left(tmpVal, KeyValSize - 1)
    Else
        tmpVal = Left(tmpVal, KeyValSize)
    End If
    '------------------------------------------------------------
    ' Determine Key Value Type For Conversion...
    '------------------------------------------------------------
    Select Case KeyValType
    Case REG_SZ
        KeyVal = tmpVal
    Case REG_DWORD
        For i = Len(tmpVal) To 1 Step -1
            KeyVal = KeyVal + Hex(Asc(Mid(tmpVal, i, 1)))
        Next
        KeyVal = Format$("&h" + KeyVal)
    End Select
   
    GetKeyValue = True                                      ' Berhasil
    rc = RegCloseKey(hKey)                                  ' Keluar Registry Key
    Exit Function                                           ' Keluar
   
GetKeyError:      ' Cleanup After An Error Has Occured...
    KeyVal = ""                                             ' String Kosong
    GetKeyValue = False                                     'Belum Berhasil
    rc = RegCloseKey(hKey)                                  ' Keluar Registry Key
End Function



Dengan Meng Declarasikan Gini : ....
Const READ_CONTROL = &H20000
Const KEY_QUERY_VALUE = &H1
Const KEY_SET_VALUE = &H2
Const KEY_CREATE_SUB_KEY = &H4
Const KEY_ENUMERATE_SUB_KEYS = &H8
Const KEY_NOTIFY = &H10
Const KEY_CREATE_LINK = &H20
Const KEY_ALL_ACCESS = KEY_QUERY_VALUE + KEY_SET_VALUE + _
                       KEY_CREATE_SUB_KEY + KEY_ENUMERATE_SUB_KEYS + _
                       KEY_NOTIFY + KEY_CREATE_LINK + READ_CONTROL
                     
' Reg Key ROOT Types...
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_CLASSES_ROOT = &H80000000
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_USERS = &H80000003
Const HKEY_CURRENT_CONFIG = &H80000005
Const HKEY_PERFORMANCE_DATA = &H80000004
Const HKEY_DYN_DATA = &H80000006

Const ERROR_SUCCESS = 0
Const REG_SZ = 1
Const REG_DWORD = 4

Private Declare Function RegOpenKeyEx Lib "advapi32" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, ByRef phkResult As Long) As Long
Private Declare Function RegQueryValueEx Lib "advapi32" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, ByRef lpType As Long, ByVal lpData As String, ByRef lpcbData As Long) As Long
Private Declare Function RegCloseKey Lib "advapi32" (ByVal hKey As Long) As Long


SELESAI....
Jika Kamu Kurang Paham dengan Source Code DI Atas....Silahkan Download Source Codenya DI SIni....
http://www.mediafire.com/?6s9e1vh0aqbb0dq


By.Spensav Antivirus
Thanks To :
- Allah SWT
- Nabi Muhammad SAW
- Robbyn
- SPENSAV Antivirus ( TEAM )
- Team Smadaver
- Kelas IX F
- SMPN 1 Sungguminasa


Offline Spensav Antivirus

  • Pro10
  • ***
  • Tulisan: 56
  • Reputation: +107/-0
    • Lihat Profil
    • SPENSAV Antivirus
Re: [shared]-Membuat Scan Registry Yang Cepat Dan Akurat
« Jawab #2 pada: Juni 05, 2012, 05:59:56 PM »
:-bd http://dewa-sumberilmu.blogspot.com/2012/05/source-code-scanning-value-reistry-vb6.html


Cantumka Nama Saya Sob....ntu SC saya yang Buat... -_-, Maen Copas aja....Kentara Sob, Kmu Postinng Baru beberapa hari