Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _UNICODE 1
- #define UNICODE 1
- #include "crt\string.bi"
- #include "windows.bi"
- '' Author: Ascend4nt
- Function RegistryOpenKey(ByVal hKey As HKEY, ByRef sSubKey As WString, ByVal nAccess As UInteger) As HKEY
- Dim hRet As HKEY
- If (hKey = 0) Then
- Return 0
- End If
- If (ERROR_SUCCESS = RegOpenKeyEx(hKey, sSubKey, 0, nAccess, @hRet) ) Then
- Return hRet
- End If
- Return 0
- End Function
- Function RegistryCloseKey(ByVal hKey As HKEY) As Integer
- If (hKey = 0) Then
- Return FALSE
- End If
- If (RegCloseKey(hKey) <> ERROR_SUCCESS) Then
- Return FALSE
- End If
- Return True
- End Function
- Function RegistryIsKeyEmpty(ByVal hKey As HKEY) As Integer
- Dim dwSubKeys As DWORD
- Dim dwSubValues As DWORD
- If (ERROR_SUCCESS <> RegQueryInfoKey(hKey, 0,0,0, @dwSubKeys, 0,0, @dwSubValues, 0,0,0,0)) Then
- Return FALSE
- End If
- If (dwSubKeys = 0 And dwSubValues <= 1) Then
- Return TRUE
- End If
- Return FALSE
- End Function
- '' === MAIN CODE ===
- Dim myKey As HKEY
- Dim bEmpty As Integer
- bEmpty = FALSE
- ''myKey = RegistryOpenKey(HKEY_CURRENT_USER, "Software\7-Zip\Compression\Options", KEY_QUERY_VALUE)
- myKey = RegistryOpenKey(HKEY_CURRENT_USER, "System\CurrentControlSet\Policies", KEY_QUERY_VALUE)
- If (myKey <> 0) Then
- bEmpty = RegistryIsKeyEmpty(myKey)
- RegistryCloseKey(myKey)
- End If
- Print "Reg Key empty?:";bEmpty
- Sleep
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement