[SCM] Samba Shared Repository - branch v3-2-test updated -
release-3-2-0pre2-733-ga8cedfe
Michael Adam
obnox at samba.org
Wed Apr 9 23:18:55 GMT 2008
The branch, v3-2-test has been updated
via a8cedfef27a0400c6aa05ddb5e51308ce0b789bd (commit)
from bf46f614c497110dcc3fc79f610fcc7a8784dbb2 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test
- Log -----------------------------------------------------------------
commit a8cedfef27a0400c6aa05ddb5e51308ce0b789bd
Author: Michael Adam <obnox at samba.org>
Date: Tue Apr 8 17:44:40 2008 +0200
registry: add support for REG_MULTI_SZ to registry_push_value().
This enables us to fetch multi_sz values from registry...
Michael
-----------------------------------------------------------------------
Summary of changes:
source/lib/util_reg_api.c | 56 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 56 insertions(+), 0 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/lib/util_reg_api.c b/source/lib/util_reg_api.c
index fccc38e..60031d9 100644
--- a/source/lib/util_reg_api.c
+++ b/source/lib/util_reg_api.c
@@ -152,6 +152,62 @@ WERROR registry_push_value(TALLOC_CTX *mem_ctx,
}
break;
}
+ case REG_MULTI_SZ: {
+ uint32_t count;
+ size_t len = 0;
+ char **strings;
+ size_t *string_lengths;
+ uint32_t ofs;
+ TALLOC_CTX *tmp_ctx = talloc_stackframe();
+
+ strings = TALLOC_ARRAY(tmp_ctx, char *,
+ value->v.multi_sz.num_strings);
+ if (strings == NULL) {
+ return WERR_NOMEM;
+ }
+
+ string_lengths = TALLOC_ARRAY(tmp_ctx, size_t,
+ value->v.multi_sz.num_strings);
+ if (string_lengths == NULL) {
+ TALLOC_FREE(tmp_ctx);
+ return WERR_NOMEM;
+ }
+
+ /* convert the single strings */
+ for (count = 0; count < value->v.multi_sz.num_strings; count++)
+ {
+ string_lengths[count] = convert_string_talloc(
+ strings, CH_UNIX, CH_UTF16LE,
+ value->v.multi_sz.strings[count],
+ strlen(value->v.multi_sz.strings[count])+1,
+ (void *)&strings[count], false);
+ if (string_lengths[count] == (size_t)-1) {
+ TALLOC_FREE(tmp_ctx);
+ return WERR_NOMEM;
+ }
+ len += string_lengths[count];
+ }
+
+ /* now concatenate all into the data blob */
+ presult->data = TALLOC_ARRAY(mem_ctx, uint8_t, len);
+ if (presult->data == NULL) {
+ TALLOC_FREE(tmp_ctx);
+ return WERR_NOMEM;
+ }
+ for (count = 0, ofs = 0;
+ count < value->v.multi_sz.num_strings;
+ count++)
+ {
+ memcpy(presult->data + ofs, strings[count],
+ string_lengths[count]);
+ ofs += string_lengths[count];
+ }
+ presult->length = len;
+
+ TALLOC_FREE(tmp_ctx);
+
+ break;
+ }
case REG_BINARY:
*presult = data_blob_talloc(mem_ctx,
value->v.binary.data,
--
Samba Shared Repository
More information about the samba-cvs
mailing list