Overview
simple_registry provides safe, SCOOP-compatible access to the Windows Registry from Eiffel applications. It wraps the Win32 Registry API functions through a clean C interface, enabling registry operations without threading complications.
The library supports reading and writing string, integer, and binary values across all major registry hives (HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE, etc.), with proper error handling and resource cleanup.
Part of the simple_* ecosystem of focused, single-purpose Eiffel libraries.
Quick Start
Installation
<library name="simple_registry" location="$SIMPLE_EIFFEL/simple_registry/simple_registry.ecf"/>
Read a String Value
local
reg: SIMPLE_REGISTRY
value: detachable STRING_8
do
create reg.make
-- Read from HKEY_CURRENT_USER
value := reg.read_string (reg.HKCU, "Software\MyApp", "Username")
if attached value as v then
print ("Username: " + v)
end
reg.close
end
Write Values
local
reg: SIMPLE_REGISTRY
do
create reg.make
-- Write a string value
reg.write_string (reg.HKCU, "Software\MyApp", "Username", "JohnDoe")
-- Write an integer value
reg.write_integer (reg.HKCU, "Software\MyApp", "LaunchCount", 42)
if reg.last_write_succeeded then
print ("Values written successfully")
end
reg.close
end
Features
Read Values
Query string, integer (DWORD), and binary registry values
Write Values
Create or update string and integer values
Delete Values
Remove specific values from registry keys
Key Management
Open, create, and delete registry keys
Registry Hives
| Constant | Hive |
|---|---|
HKCU | HKEY_CURRENT_USER |
HKLM | HKEY_LOCAL_MACHINE |
HKCR | HKEY_CLASSES_ROOT |
HKU | HKEY_USERS |
HKCC | HKEY_CURRENT_CONFIG |
API Reference
read_string (a_hive, a_subkey, a_value_name): detachable STRING_8
Read REG_SZ value from registry. Returns Void if not found.
read_integer (a_hive, a_subkey, a_value_name): INTEGER
Read REG_DWORD value from registry.
write_string (a_hive, a_subkey, a_value_name, a_value)
Write REG_SZ value to registry.
write_integer (a_hive, a_subkey, a_value_name, a_value)
Write REG_DWORD value to registry.
Status Queries
| Feature | Description |
|---|---|
last_read_succeeded | Did the last read operation succeed? |
last_write_succeeded | Did the last write operation succeed? |
last_error_code | Windows error code from last failed operation |