    indexing
    	description: "Registry manager"
    	legal: "See notice at end of class."
    	status: "See notice at end of class."
    	date: "$Date: 2006-04-17 11:38:39 -0700 (Mon, 17 Apr 2006) $"
    	revision: "$Revision: 58231 $"

    class interface
    	WEL_REGISTRY

    create
    	default_create
    			-- Process instances of classes with no creation clause.
    			-- (Default: do nothing.)
    			-- (from ANY)

    feature -- Access

    	enumerate_key (key: POINTER; index: INTEGER_32): WEL_REGISTRY_KEY
    			-- `index'th subkey of `key',
    			-- Void if `key' has less than `index' subkeys.
    		require
    			key_possible: valid_value_for_hkey (key)
    			index_possible: index <= number_of_subkeys (key)

    	generating_type: STRING_8
    			-- Name of current object's generating type
    			-- (type of which it is a direct instance)
    			-- (from ANY)

    	generator: STRING_8
    			-- Name of current object's generating class
    			-- (base class of the type of which it is a direct instance)
    			-- (from ANY)

    	frozen hkey_classes_root: POINTER
    			-- (from WEL_HKEY)

    	frozen hkey_current_config: POINTER
    			-- (from WEL_HKEY)

    	frozen hkey_current_user: POINTER
    			-- (from WEL_HKEY)

    	frozen hkey_dyn_data: POINTER
    			-- (from WEL_HKEY)

    	frozen hkey_local_machine: POINTER
    			-- (from WEL_HKEY)

    	frozen hkey_performance_data: POINTER
    			-- (from WEL_HKEY)

    	frozen hkey_users: POINTER
    			-- (from WEL_HKEY)

    	frozen key_all_access: INTEGER_32
    			-- Combines the KEY_QUERY_VALUE, KEY_ENUMERATE_SUB_KEYS,
    			-- KEY_NOTIFY, KEY_CREATE_SUB_KEY, KEY_CREATE_LINK, and
    			-- KEY_SET_VALUE access rights, plus all the standard
    			-- access rights except SYNCHRONIZE.
    			-- (from WEL_REGISTRY_ACCESS_MODE)

    	frozen key_create_link: INTEGER_32
    			-- Permission to create a symbolic link.
    			-- (from WEL_REGISTRY_ACCESS_MODE)

    	frozen key_create_sub_key: INTEGER_32
    			-- Permission to create subkeys.
    			-- (from WEL_REGISTRY_ACCESS_MODE)

    	frozen key_enumerate_sub_keys: INTEGER_32
    			-- Permission to enumerate subkeys.
    			-- (from WEL_REGISTRY_ACCESS_MODE)

    	frozen key_execute: INTEGER_32
    			-- Permission for read access.
    			-- (from WEL_REGISTRY_ACCESS_MODE)

    	key_from_remote_host (host_name: STRING_GENERAL; root_key: POINTER): POINTER
    			-- Connect the computer designed by its name 'host_name'.
    			-- 'Host_name' should be under the format: \\computer_name
    			-- 'root_key' is the key from where we want to start the
    			-- investigations on the remote machine.
    			-- If 'Host_name' is empty, then the local computer is used by default.
    		require
    			root_key_possible: root_key = hkey_local_machine or root_key = hkey_users or root_key = hkey_performance_data
    			host_name_possible: host_name /= Void

    	frozen key_notify: INTEGER_32
    			-- Permission for change notification.
    			-- (from WEL_REGISTRY_ACCESS_MODE)

    	frozen key_query_value: INTEGER_32
    			-- Permission to query subkey data.
    			-- (from WEL_REGISTRY_ACCESS_MODE)

    	frozen key_read: INTEGER_32
    			-- Combines the STANDARD_RIGHTS_READ, KEY_QUERY_VALUE,
    			-- KEY_ENUMERATE_SUB_KEYS, and KEY_NOTIFY access rights.
    			-- (from WEL_REGISTRY_ACCESS_MODE)

    	frozen key_set_value: INTEGER_32
    			-- Permission to set subkey data.
    			-- (from WEL_REGISTRY_ACCESS_MODE)

    	key_value (key: POINTER; value_name: STRING_GENERAL): WEL_REGISTRY_KEY_VALUE
    			-- Retrieve value of `value_name' associated with open
    			-- `key'.
    			-- The identifier 'key' relative to the parent key must
    			-- have been opened with the KEY_QUERY_VALUE access.
    		require
    			value_name_possible: value_name /= Void
    			key_valid: valid_value_for_hkey (key)

    	frozen key_write: INTEGER_32
    			-- Combines the STANDARD_RIGHTS_WRITE, KEY_SET_VALUE,
    			-- and KEY_CREATE_SUB_KEY access rights.
    			-- (from WEL_REGISTRY_ACCESS_MODE)

    feature -- Comparison

    	frozen deep_equal (some: ANY; other: like arg #1): BOOLEAN
    			-- Are `some' and `other' either both void
    			-- or attached to isomorphic object structures?
    			-- (from ANY)
    		ensure -- from ANY
    			shallow_implies_deep: standard_equal (some, other) implies Result
    			both_or_none_void: (some = Void) implies (Result = (other = Void))
    			same_type: (Result and (some /= Void)) implies some.same_type (other)
    			symmetric: Result implies deep_equal (other, some)

    	frozen equal (some: ANY; other: like arg #1): BOOLEAN
    			-- Are `some' and `other' either both void or attached
    			-- to objects considered equal?
    			-- (from ANY)
    		ensure -- from ANY
    			definition: Result = (some = Void and other = Void) or else ((some /= Void and other /= Void) and then some.is_equal (other))

    	is_equal (other: like Current): BOOLEAN
    			-- Is `other' attached to an object considered
    			-- equal to current object?
    			-- (from ANY)
    		require -- from ANY
    			other_not_void: other /= Void
    		ensure -- from ANY
    			symmetric: Result implies other.is_equal (Current)
    			consistent: standard_is_equal (other) implies Result

    	frozen standard_equal (some: ANY; other: like arg #1): BOOLEAN
    			-- Are `some' and `other' either both void or attached to
    			-- field-by-field identical objects of the same type?
    			-- Always uses default object comparison criterion.
    			-- (from ANY)
    		ensure -- from ANY
    			definition: Result = (some = Void and other = Void) or else ((some /= Void and other /= Void) and then some.standard_is_equal (other))

    	frozen standard_is_equal (other: like Current): BOOLEAN
    			-- Is `other' attached to an object of the same type
    			-- as current object, and field-by-field identical to it?
    			-- (from ANY)
    		require -- from ANY
    			other_not_void: other /= Void
    		ensure -- from ANY
    			same_type: Result implies same_type (other)
    			symmetric: Result implies other.standard_is_equal (Current)

    feature -- Status report

    	conforms_to (other: ANY): BOOLEAN
    			-- Does type of current object conform to type
    			-- of `other' (as per Eiffel: The Language, chapter 13)?
    			-- (from ANY)
    		require -- from ANY
    			other_not_void: other /= Void

    	same_type (other: ANY): BOOLEAN
    			-- Is type of current object identical to type of `other'?
    			-- (from ANY)
    		require -- from ANY
    			other_not_void: other /= Void
    		ensure -- from ANY
    			definition: Result = (conforms_to (other) and other.conforms_to (Current))

    feature -- Duplication

    	copy (other: like Current)
    			-- Update current object using fields of object attached
    			-- to `other', so as to yield equal objects.
    			-- (from ANY)
    		require -- from ANY
    			other_not_void: other /= Void
    			type_identity: same_type (other)
    		ensure -- from ANY
    			is_equal: is_equal (other)

    	frozen deep_copy (other: like Current)
    			-- Effect equivalent to that of:
    			--		copy (`other' . deep_twin)
    			-- (from ANY)
    		require -- from ANY
    			other_not_void: other /= Void
    		ensure -- from ANY
    			deep_equal: deep_equal (Current, other)

    	frozen deep_twin: like Current
    			-- New object structure recursively duplicated from Current.
    			-- (from ANY)
    		ensure -- from ANY
    			deep_equal: deep_equal (Current, Result)

    	frozen standard_copy (other: like Current)
    			-- Copy every field of `other' onto corresponding field
    			-- of current object.
    			-- (from ANY)
    		require -- from ANY
    			other_not_void: other /= Void
    			type_identity: same_type (other)
    		ensure -- from ANY
    			is_standard_equal: standard_is_equal (other)

    	frozen standard_twin: like Current
    			-- New object field-by-field identical to `other'.
    			-- Always uses default copying semantics.
    			-- (from ANY)
    		ensure -- from ANY
    			standard_twin_not_void: Result /= Void
    			equal: standard_equal (Result, Current)

    	frozen twin: like Current
    			-- New object equal to `Current'
    			-- twin calls copy; to change copying/twining semantics, redefine copy.
    			-- (from ANY)
    		ensure -- from ANY
    			twin_not_void: Result /= Void
    			is_equal: Result.is_equal (Current)

    feature -- Basic operations

    	frozen default: like Current
    			-- Default value of object's type
    			-- (from ANY)

    	frozen default_pointer: POINTER
    			-- Default value of type `POINTER'
    			-- (Avoid the need to write `p'.default for
    			-- some `p' of type `POINTER'.)
    			-- (from ANY)

    	default_rescue
    			-- Process exception for routines with no Rescue clause.
    			-- (Default: do nothing.)
    			-- (from ANY)

    	frozen do_nothing
    			-- Execute a null action.
    			-- (from ANY)

    feature -- Actions

    	create_new_key (key_path: STRING_GENERAL)
    			-- Create a new key, with as path 'path'
    			-- The path should be like "a\b\c"
    			-- Please refer to WEL_HKEY for possible value for a.
    		require
    			at_least_one_back_slash: key_path /= Void and then key_path.has_code (('\').natural_32_code)

    	delete_key_value (key_path, value_name: STRING_GENERAL)
    			-- Delete `key_path' key value `value_name'.
    			-- The path should be like "a\b\c"
    			-- Please refer to WEL_HKEY for possible value for a.
    		require
    			at_least_one_back_slash: key_path /= Void and then key_path.has_code (('\').natural_32_code)
    			key_name_possible: value_name /= Void

    	open_key_value (key_path: STRING_GENERAL; value_name: STRING_GENERAL): WEL_REGISTRY_KEY_VALUE
    			-- Open a key, with as path 'path' and
    			-- name 'key_name'.
    			-- The path should be like "a\b\c"
    			-- Please refer to WEL_HKEY for possible value for a.
    			-- Return Void if the operation did not correctly terminate.
    		require
    			key_name_possible: value_name /= Void
    			at_least_one_back_slash: key_path /= Void and then key_path.has_code (('\').natural_32_code)

    	open_key_with_access (key_path: STRING_GENERAL; acc: INTEGER_32): POINTER
    			-- Open the key relative to the path 'key_path', with
    			-- the access 'acc'.
    			-- Return the key reference (default_pointer if the operation failed).
    		require
    			at_least_one_back_slash: key_path /= Void and then key_path.has_code (('\').natural_32_code)

    	save_key_value (key_path, value_name: STRING_GENERAL; value: WEL_REGISTRY_KEY_VALUE)
    			-- Set value of key in `key_path' with name `value_name' to `value'.
    			-- Create key if needed.
    			-- The path should be like "a\b\c"
    			-- Please refer to WEL_HKEY for possible value for a.
    		require
    			at_least_one_back_slash: key_path /= Void and then key_path.has_code (('\').natural_32_code)
    			key_name_possible: value_name /= Void
    			valid_value: value /= Void

    feature -- Basic Actions

    	close_key (key: POINTER)
    			-- Close `key'.
    			-- Return True if succeeded, False otherwise.
    		require
    			key_possible: valid_value_for_hkey (key)

    	create_key (parent_key: POINTER; key_name: STRING_GENERAL; sam: INTEGER_32): POINTER
    			-- Create `key_name' under `parent_key' according to `sam'.
    			-- Return handle to created key or default_pointer on failure.
    		require
    			key_name_possible: key_name /= Void and then not key_name.is_empty
    			parent_key_possible: valid_value_for_hkey (parent_key)

    	delete_key (parent_key: POINTER; key_name: STRING_GENERAL)
    			-- Delete subkey `key_name' of `parent_key'.
    			-- Return True if succeeded, False otherwise.
    			-- Under Windows 95, all subkeys are deleted.
    			-- Under Windows NT, only specified key is deleted
    			-- it should not have subkeys.
    		require
    			key_name_possible: key_name /= Void and then not key_name.is_empty
    			parent_key_possible: valid_value_for_hkey (parent_key)

    	enumerate_values (key: POINTER): LINKED_LIST [STRING_32]
    			-- Find the names of the key values within the
    			-- key referenced by 'key'.

    	enumerate_values_as_string_8 (key: POINTER): LINKED_LIST [STRING_8]
    			-- Find the names of the key values within the
    			-- key referenced by 'key'.

    	open_key (parent_key: POINTER; key_name: STRING_GENERAL; access_mode: INTEGER_32): POINTER
    			-- Open subkey `key_name' of `parent_key' according to `access_mode'.
    			-- Return handle to created key or default_pointer on failure.
    		require
    			key_name_possible: key_name /= Void and then not key_name.is_empty
    			parent_key_possible: valid_value_for_hkey (parent_key)

    feature -- New actions

    	delete_value (parent_key: POINTER; name: STRING_GENERAL)
    		require
    			key_possible: valid_value_for_hkey (parent_key)
    			name_possible: name /= Void

    	enumerate_value (key: POINTER; index: INTEGER_32): STRING_GENERAL
    			-- Find the name of the key_value corresponding
    			-- to the key 'key and the index 'index'.

    	number_of_subkeys (key: POINTER): INTEGER_32

    	number_of_values (key: POINTER): INTEGER_32

    	valid_value_for_hkey (key: POINTER): BOOLEAN
    			-- Does key pointed by 'key' exists

    feature -- Output

    	io: STD_FILES
    			-- Handle to standard file setup
    			-- (from ANY)

    	out: STRING_8
    			-- New string containing terse printable representation
    			-- of current object
    			-- Was declared in ANY as synonym of tagged_out.
    			-- (from ANY)

    	print (some: ANY)
    			-- Write terse external representation of `some'
    			-- on standard output.
    			-- (from ANY)

    	frozen tagged_out: STRING_8
    			-- New string containing terse printable representation
    			-- of current object
    			-- Was declared in ANY as synonym of out.
    			-- (from ANY)

    feature -- Platform

    	operating_environment: OPERATING_ENVIRONMENT
    			-- Objects available from the operating system
    			-- (from ANY)

    feature -- Settings

    	set_key_value (key: POINTER; value_name: STRING_GENERAL; value: WEL_REGISTRY_KEY_VALUE)
    			-- Change value defined by `key' and `value_name' to `value'.
    			-- The key identified by the hKey parameter must have been
    			-- opened with KEY_SET_VALUE access
    		require
    			valid_value: value /= Void
    			valid_value_name: value_name /= Void
    			key_possible: valid_value_for_hkey (key)

    feature -- Status

    	basic_valid_name_for_hkey (name: STRING_GENERAL): BOOLEAN
    			-- Return True if 'name' correspond to one of the
    			-- value names below.
    			-- (from WEL_HKEY)
    		require -- from WEL_HKEY
    			name_possible: name /= Void
    			name_valid: name.is_valid_as_string_8

    	basic_valid_value_for_hkey (value: POINTER): BOOLEAN
    			-- Return True if 'value' is one of the basic following values.
    			-- (from WEL_HKEY)

    	index_value_for_root_keys (name: STRING_GENERAL): POINTER
    			-- Return the index corresponding to a root key.
    			-- (from WEL_HKEY)
    		require -- from WEL_HKEY
    			name_not_void: name /= Void
    			name_valid: name.is_valid_as_string_8
    			valid_key: basic_valid_name_for_hkey (name)

    	last_call_successful: BOOLEAN
    			-- Did last call succeed?

    invariant
    		-- from ANY
    	reflexive_equality: standard_is_equal (Current)
    	reflexive_conformance: conforms_to (Current)

    indexing
    	copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
    	license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
    	source: "[
    		Eiffel Software
    		356 Storke Road, Goleta, CA 93117 USA
    		Telephone 805-685-1006, Fax 805-685-6869
    		Website http://www.eiffel.com
    		Customer support http://support.eiffel.com
    	]"

    end -- class WEL_REGISTRY