enum_key in the hizzle

git-svn-id: file:///home/svn/incoming/trunk@2360 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Matt Miller 2005-04-10 22:51:16 +00:00
parent d2545df96f
commit 3091e27cd2
2 changed files with 45 additions and 14 deletions

View File

@ -18,6 +18,7 @@ TLV_TYPE_HKEY = TLV_META_TYPE_UINT | 1000
TLV_TYPE_ROOT_KEY = TLV_TYPE_HKEY
TLV_TYPE_BASE_KEY = TLV_META_TYPE_STRING | 1001
TLV_TYPE_PERMISSION = TLV_META_TYPE_UINT | 1002
TLV_TYPE_KEY_NAME = TLV_META_TYPE_STRING | 1003
TLV_TYPE_VALUE_NAME = TLV_META_TYPE_STRING | 1010
TLV_TYPE_VALUE_TYPE = TLV_META_TYPE_UINT | 1011
@ -79,6 +80,27 @@ class Registry
return true
end
=begin
enum_key(hkey)
Enumerates the supplied registry key returning an array of key names
=end
def Registry.enum_key(hkey)
keys = []
request = Packet.create_request('stdapi_registry_enum_key')
request.add_tlv(TLV_TYPE_HKEY, hkey)
response = self.client.send_request(request)
# Enumerate through all of the registry keys
response.each(TLV_TYPE_KEY_NAME) { |key_name|
keys << key_name.value
}
return keys
end
##
#
# Registry value interaction

View File

@ -38,7 +38,7 @@ class RegistryKey
Enumerates all of the child keys within this registry key.
=end
def each_key(&block)
return get_keys.each(&block)
return enum_key.each(&block)
end
=begin
@ -47,9 +47,30 @@ class RegistryKey
Enumerates all of the child values within this registry key.
=end
def each_value(&block)
return get_values.each(&block)
return enum_value.each(&block)
end
=begin
enum_key()
Retrieves all of the registry keys that are direct descendents of
the class' registry key.
=end
def enum_key()
return self.client.registry.enum_key(self.hkey)
end
=begin
enum_value
Retrieves all of the registry values that exist within the opened
registry key.
=end
def enum_value()
return self.client.registry.enum_value(self.hkey)
end
##
#
# Registry key interaction
@ -127,18 +148,6 @@ class RegistryKey
protected
=begin
get_keys()
Retrieves all of the registry keys that are direct descendents of
the class' registry key.
=end
def get_keys()
end
def get_values()
end
attr_accessor :client
attr_writer :hkey, :root_key, :base_key, :perm
end