|
1
2
|
from Registry import Registry
|
|
3
|
def queryValue(hive,key,valueName):
|
|
4
|
reg = Registry.Registry(hive)
|
|
5
|
key = reg.open(key)
|
|
6
7
|
try:
value = str(key.value(valueName).value)
|
|
8
|
except Registry.RegistryParse.RegistryStructureDoesNotExist:
|
|
9
10
11
12
13
14
|
value = None
return value
def getValues(hive,key):
valueList = []
reg = Registry.Registry(hive)
|
|
15
16
17
|
key = reg.open(key)
for value in key.values():
valueList.append(value.value)
|
|
18
19
20
21
22
|
return valueList
def getSubkeys(hive,key):
subkeyList = []
reg = Registry.Registry(hive)
|
|
23
|
key = reg.open(key)
|
|
24
25
26
27
28
29
30
31
32
33
34
|
for subkey in key.subkeys():
subkeyList.append(subkey.name)
return subkeyList
def keyExists(hive,key):
reg = Registry.Registry(hive)
try:
key = reg.open(key)
return True
except Registry.RegistryKeyNotFoundException:
return False
|