Erlang Mailing Lists

Author Message

<  Erlang patches mailing list  ~  [PATCH] to add reg_multi_sz support to win32reg

Guest
Posted: Thu Aug 03, 2006 11:20 pm Reply with quote
Guest
I wrote a patch to win32reg.erl (part of stdlib) that adds the ability to
manipulate Windows32 Registry values of types REG_MULTI_SZ, REG_EXPAND_SZ,
and REG_NONE. This is done through three new functions (so as to maintain
backward compatibility). I have defined these functions below in the same
manner as the erlang reference manual (using copy, paste and editing).

Also, this is my first patch (to any project) so go easy on me. Smile I wrote
this because I needed to mess with REG_MULTI_SZ values for a project.
Anywho, I can't beleive how easy it is to understand erlang source. Comments
are almost never required, and things are still understandable. It's
amazing. Anyway, without further ado, the function descriptions:

set_value_typed(RegHandle, Name, Value, Type) -> ReturnValue

Types:

Name = string() | default
Value = string() | integer() | binary()
Type = reg_none | reg_dword | reg_sz |
reg_expand_sz | reg_multi_sz | reg_binary

Sets the named (or default) value to value. Calls the Win32 API function
RegSetValueEx(). Value must be of a type compatible with the Type field,
according to the table below:

reg_none = binary()
reg_dword = integer()
reg_sz = string()
reg_expand_sz = string()
reg_multi_sz = binary()
reg_binary = binary()

The registry must have been opened in write-mode.

value_typed(RegHandle, Name) -> ReturnValue

Types:

Name = string() | default
ReturnValue = {ok, Value, Type}
Value = string() | integer() | binary()
Type = reg_none | reg_dword | reg_sz |
reg_expand_sz | reg_multi_sz | reg_binary

Retrieves the named value (or default) on the current key. Registry values
of type REG_SZ and REG_EXPAND_SZ (as always on the expand, although the
original so otherwise), are returned as strings. Type REG_DWORD values are
returned as integers. All other types are returned as binaries.

values_typed(RegHandle) -> ReturnValue

Types:

ReturnValue = {ok, ValueTriplets}
ValueTriplets = [ValueTriplet]
ValueTriplet = {Name, Value, Type}
Name = string | default
Value = string() | integer() | binary()
Type = reg_none | reg_dword | reg_sz |
reg_expand_sz | reg_multi_sz | reg_binary

Retrieves a list of all values on the current key. The values have types
corresponding to the registry types, see value. Calls the Win32 API
function EnumRegValuesEx().

Post recived from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum