[PATCH] to add reg_multi_sz support to win32reg
Brian Kacos
bdkacos@REDACTED
Fri Aug 4 01:05:26 CEST 2006
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. :) 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().
-------------- next part --------------
A non-text attachment was scrubbed...
Name: win32reg.erl.patch
Type: application/octet-stream
Size: 4573 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20060803/d49f2169/attachment.obj>
More information about the erlang-patches
mailing list