2 * Samba Unix/Linux SMB client library
3 * Distributed SMB/CIFS Server Management Utility
4 * Local registry interface
6 * Copyright (C) Michael Adam 2008
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #include "utils/net.h"
24 #include "utils/net_registry_util.h"
25 #include "include/g_lock.h"
26 #include "registry/reg_import.h"
27 #include "registry/reg_format.h"
37 * split given path into hive and remaining path and open the hive key
39 static WERROR open_hive(TALLOC_CTX *ctx, const char *path,
40 uint32 desired_access,
41 struct registry_key **hive,
45 NT_USER_TOKEN *token = NULL;
46 char *hivename = NULL;
47 char *tmp_subkeyname = NULL;
48 TALLOC_CTX *tmp_ctx = talloc_stackframe();
50 if ((hive == NULL) || (subkeyname == NULL)) {
51 werr = WERR_INVALID_PARAM;
55 werr = split_hive_key(tmp_ctx, path, &hivename, &tmp_subkeyname);
56 if (!W_ERROR_IS_OK(werr)) {
59 *subkeyname = talloc_strdup(ctx, tmp_subkeyname);
60 if (*subkeyname == NULL) {
65 werr = ntstatus_to_werror(registry_create_admin_token(tmp_ctx, &token));
66 if (!W_ERROR_IS_OK(werr)) {
70 werr = reg_openhive(ctx, hivename, desired_access, token, hive);
71 if (!W_ERROR_IS_OK(werr)) {
82 static WERROR open_key(TALLOC_CTX *ctx, const char *path,
83 uint32 desired_access,
84 struct registry_key **key)
87 char *subkey_name = NULL;
88 struct registry_key *hive = NULL;
89 TALLOC_CTX *tmp_ctx = talloc_stackframe();
91 if ((path == NULL) || (key == NULL)) {
92 return WERR_INVALID_PARAM;
95 werr = open_hive(tmp_ctx, path, desired_access, &hive, &subkey_name);
96 if (!W_ERROR_IS_OK(werr)) {
97 d_fprintf(stderr, "open_hive failed: %s\n", win_errstr(werr));
101 werr = reg_openkey(ctx, hive, subkey_name, desired_access, key);
102 if (!W_ERROR_IS_OK(werr)) {
103 d_fprintf(stderr, "reg_openkey failed: %s\n",
111 TALLOC_FREE(tmp_ctx);
117 * the main "net registry" function implementations
121 static int net_registry_enumerate(struct net_context *c, int argc,
125 struct registry_key *key = NULL;
126 TALLOC_CTX *ctx = talloc_stackframe();
130 char *valname = NULL;
131 struct registry_value *valvalue = NULL;
134 if (argc != 1 || c->display_usage) {
135 d_printf("Usage: net registry enumerate <path>\n");
136 d_printf("Example: net registry enumerate "
137 "'HKLM\\Software\\Samba'\n");
141 werr = open_key(ctx, argv[0], REG_KEY_READ, &key);
142 if (!W_ERROR_IS_OK(werr)) {
143 d_fprintf(stderr, "open_key failed: %s\n", win_errstr(werr));
148 werr = reg_enumkey(ctx, key, count, &subkey_name, &modtime),
152 print_registry_key(subkey_name, &modtime);
154 if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) {
159 werr = reg_enumvalue(ctx, key, count, &valname, &valvalue),
163 print_registry_value_with_name(valname, valvalue);
165 if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) {
175 static int net_registry_createkey(struct net_context *c, int argc,
179 enum winreg_CreateAction action;
181 struct registry_key *hivekey = NULL;
182 struct registry_key *subkey = NULL;
183 TALLOC_CTX *ctx = talloc_stackframe();
186 if (argc != 1 || c->display_usage) {
187 d_printf("Usage: net registry createkey <path>\n");
188 d_printf("Example: net registry createkey "
189 "'HKLM\\Software\\Samba\\smbconf.127.0.0.1'\n");
192 if (strlen(argv[0]) == 0) {
193 d_fprintf(stderr, "error: zero length key name given\n");
197 werr = open_hive(ctx, argv[0], REG_KEY_WRITE, &hivekey, &subkeyname);
198 if (!W_ERROR_IS_OK(werr)) {
199 d_fprintf(stderr, "open_hive failed: %s\n", win_errstr(werr));
203 werr = reg_createkey(ctx, hivekey, subkeyname, REG_KEY_WRITE,
205 if (!W_ERROR_IS_OK(werr)) {
206 d_fprintf(stderr, "reg_createkey failed: %s\n",
211 case REG_ACTION_NONE:
212 d_printf("createkey did nothing -- huh?\n");
214 case REG_CREATED_NEW_KEY:
215 d_printf("createkey created %s\n", argv[0]);
217 case REG_OPENED_EXISTING_KEY:
218 d_printf("createkey opened existing %s\n", argv[0]);
229 static int net_registry_deletekey_internal(struct net_context *c, int argc,
235 struct registry_key *hivekey = NULL;
236 TALLOC_CTX *ctx = talloc_stackframe();
239 if (argc != 1 || c->display_usage) {
240 d_printf("Usage: net registry deletekey <path>\n");
241 d_printf("Example: net registry deletekey "
242 "'HKLM\\Software\\Samba\\smbconf.127.0.0.1'\n");
245 if (strlen(argv[0]) == 0) {
246 d_fprintf(stderr, "error: zero length key name given\n");
250 werr = open_hive(ctx, argv[0], REG_KEY_WRITE, &hivekey, &subkeyname);
251 if (!W_ERROR_IS_OK(werr)) {
252 d_fprintf(stderr, "open_hive failed: %s\n", win_errstr(werr));
257 werr = reg_deletekey_recursive(hivekey, subkeyname);
259 werr = reg_deletekey(hivekey, subkeyname);
261 if (!W_ERROR_IS_OK(werr) &&
262 !(c->opt_force && W_ERROR_EQUAL(werr, WERR_BADFILE)))
264 d_fprintf(stderr, "reg_deletekey failed: %s\n",
276 static int net_registry_deletekey(struct net_context *c, int argc,
279 return net_registry_deletekey_internal(c, argc, argv, false);
282 static int net_registry_deletekey_recursive(struct net_context *c, int argc,
285 return net_registry_deletekey_internal(c, argc, argv, true);
288 static int net_registry_getvalue_internal(struct net_context *c, int argc,
289 const char **argv, bool raw)
293 struct registry_key *key = NULL;
294 struct registry_value *value = NULL;
295 TALLOC_CTX *ctx = talloc_stackframe();
297 if (argc != 2 || c->display_usage) {
298 d_fprintf(stderr, "usage: net rpc registry getvalue <key> "
303 werr = open_key(ctx, argv[0], REG_KEY_READ, &key);
304 if (!W_ERROR_IS_OK(werr)) {
305 d_fprintf(stderr, "open_key failed: %s\n", win_errstr(werr));
309 werr = reg_queryvalue(ctx, key, argv[1], &value);
310 if (!W_ERROR_IS_OK(werr)) {
311 d_fprintf(stderr, "reg_queryvalue failed: %s\n",
316 print_registry_value(value, raw);
325 static int net_registry_getvalue(struct net_context *c, int argc,
328 return net_registry_getvalue_internal(c, argc, argv, false);
331 static int net_registry_getvalueraw(struct net_context *c, int argc,
334 return net_registry_getvalue_internal(c, argc, argv, true);
337 static int net_registry_getvaluesraw(struct net_context *c, int argc,
342 struct registry_key *key = NULL;
343 TALLOC_CTX *ctx = talloc_stackframe();
346 if (argc != 1 || c->display_usage) {
347 d_fprintf(stderr, "usage: net rpc registry getvaluesraw "
352 werr = open_key(ctx, argv[0], REG_KEY_READ, &key);
353 if (!W_ERROR_IS_OK(werr)) {
354 d_fprintf(stderr, "open_key failed: %s\n", win_errstr(werr));
360 struct registry_value *val;
362 werr = reg_enumvalue(talloc_tos(), key, idx, NULL, &val);
364 if (W_ERROR_EQUAL(werr, WERR_NO_MORE_ITEMS)) {
368 if (!W_ERROR_IS_OK(werr)) {
371 print_registry_value(val, true);
380 static int net_registry_setvalue(struct net_context *c, int argc,
384 struct registry_value value;
385 struct registry_key *key = NULL;
387 TALLOC_CTX *ctx = talloc_stackframe();
389 if (argc < 4 || c->display_usage) {
390 d_fprintf(stderr, "usage: net rpc registry setvalue <key> "
391 "<valuename> <type> [<val>]+\n");
395 if (!strequal(argv[2], "multi_sz") && (argc != 4)) {
396 d_fprintf(stderr, "Too many args for type %s\n", argv[2]);
400 if (strequal(argv[2], "dword")) {
401 value.type = REG_DWORD;
402 value.v.dword = strtoul(argv[3], NULL, 10);
403 } else if (strequal(argv[2], "sz")) {
405 value.v.sz.len = strlen(argv[3])+1;
406 value.v.sz.str = CONST_DISCARD(char *, argv[3]);
407 } else if (strequal(argv[2], "multi_sz")) {
408 value.type = REG_MULTI_SZ;
409 value.v.multi_sz.num_strings = argc - 3;
410 value.v.multi_sz.strings = (char **)(argv + 3);
412 d_fprintf(stderr, "type \"%s\" not implemented\n", argv[2]);
416 werr = open_key(ctx, argv[0], REG_KEY_WRITE, &key);
417 if (!W_ERROR_IS_OK(werr)) {
418 d_fprintf(stderr, "open_key failed: %s\n", win_errstr(werr));
422 werr = reg_setvalue(key, argv[1], &value);
423 if (!W_ERROR_IS_OK(werr)) {
424 d_fprintf(stderr, "reg_setvalue failed: %s\n",
436 struct net_registry_increment_state {
438 const char *valuename;
444 static void net_registry_increment_fn(void *private_data)
446 struct net_registry_increment_state *state =
447 (struct net_registry_increment_state *)private_data;
448 struct registry_value *value;
449 struct registry_key *key = NULL;
451 state->werr = open_key(talloc_tos(), state->keyname,
452 REG_KEY_READ|REG_KEY_WRITE, &key);
453 if (!W_ERROR_IS_OK(state->werr)) {
454 d_fprintf(stderr, "open_key failed: %s\n",
455 win_errstr(state->werr));
459 state->werr = reg_queryvalue(key, key, state->valuename, &value);
460 if (!W_ERROR_IS_OK(state->werr)) {
461 d_fprintf(stderr, "reg_queryvalue failed: %s\n",
462 win_errstr(state->werr));
466 if (value->type != REG_DWORD) {
467 d_fprintf(stderr, "value not a DWORD: %s\n",
468 reg_type_lookup(value->type));
472 value->v.dword += state->increment;
473 state->newvalue = value->v.dword;
475 state->werr = reg_setvalue(key, state->valuename, value);
476 if (!W_ERROR_IS_OK(state->werr)) {
477 d_fprintf(stderr, "reg_setvalue failed: %s\n",
478 win_errstr(state->werr));
487 static int net_registry_increment(struct net_context *c, int argc,
490 struct net_registry_increment_state state;
494 if (argc < 2 || c->display_usage) {
495 d_fprintf(stderr, "%s\n%s",
497 "net registry increment <key> <valuename> "
502 state.keyname = argv[0];
503 state.valuename = argv[1];
507 state.increment = strtoul(argv[2], NULL, 10);
510 status = g_lock_do("registry_increment_lock", G_LOCK_WRITE,
512 net_registry_increment_fn, &state);
513 if (!NT_STATUS_IS_OK(status)) {
514 d_fprintf(stderr, "g_lock_do failed: %s\n",
518 if (!W_ERROR_IS_OK(state.werr)) {
519 d_fprintf(stderr, "increment failed: %s\n",
520 win_errstr(state.werr));
524 d_printf("new value: %u\n", (unsigned)state.newvalue);
532 static int net_registry_deletevalue(struct net_context *c, int argc,
536 struct registry_key *key = NULL;
537 TALLOC_CTX *ctx = talloc_stackframe();
540 if (argc != 2 || c->display_usage) {
541 d_fprintf(stderr, "usage: net rpc registry deletevalue <key> "
546 werr = open_key(ctx, argv[0], REG_KEY_WRITE, &key);
547 if (!W_ERROR_IS_OK(werr)) {
548 d_fprintf(stderr, "open_key failed: %s\n", win_errstr(werr));
552 werr = reg_deletevalue(key, argv[1]);
553 if (!W_ERROR_IS_OK(werr)) {
554 d_fprintf(stderr, "reg_deletekey failed: %s\n",
566 static WERROR net_registry_getsd_internal(struct net_context *c,
569 struct security_descriptor **sd)
572 struct registry_key *key = NULL;
573 TALLOC_CTX *ctx = talloc_stackframe();
574 uint32_t access_mask = REG_KEY_READ |
575 SEC_FLAG_MAXIMUM_ALLOWED |
576 SEC_FLAG_SYSTEM_SECURITY;
579 * net_rpc_regsitry uses SEC_FLAG_SYSTEM_SECURITY, but access
580 * is denied with these perms right now...
582 access_mask = REG_KEY_READ;
585 d_fprintf(stderr, "internal error: invalid argument\n");
586 werr = WERR_INVALID_PARAM;
590 if (strlen(keyname) == 0) {
591 d_fprintf(stderr, "error: zero length key name given\n");
592 werr = WERR_INVALID_PARAM;
596 werr = open_key(ctx, keyname, access_mask, &key);
597 if (!W_ERROR_IS_OK(werr)) {
598 d_fprintf(stderr, "open_key failed: %s\n", win_errstr(werr));
602 werr = reg_getkeysecurity(mem_ctx, key, sd);
603 if (!W_ERROR_IS_OK(werr)) {
604 d_fprintf(stderr, "reg_getkeysecurity failed: %s\n",
616 static int net_registry_getsd(struct net_context *c, int argc,
621 struct security_descriptor *secdesc = NULL;
622 TALLOC_CTX *ctx = talloc_stackframe();
624 if (argc != 1 || c->display_usage) {
625 d_printf("Usage: net registry getsd <path>\n");
626 d_printf("Example: net registry getsd "
627 "'HKLM\\Software\\Samba'\n");
631 werr = net_registry_getsd_internal(c, ctx, argv[0], &secdesc);
632 if (!W_ERROR_IS_OK(werr)) {
636 display_sec_desc(secdesc);
645 static int net_registry_getsd_sddl(struct net_context *c,
646 int argc, const char **argv)
650 struct security_descriptor *secdesc = NULL;
651 TALLOC_CTX *ctx = talloc_stackframe();
653 if (argc != 1 || c->display_usage) {
654 d_printf("Usage: net registry getsd_sddl <path>\n");
655 d_printf("Example: net registry getsd_sddl 'HKLM\\Software\\Samba'\n");
659 werr = net_registry_getsd_internal(c, ctx, argv[0], &secdesc);
660 if (!W_ERROR_IS_OK(werr)) {
664 d_printf("%s\n", sddl_encode(ctx, secdesc, get_global_sam_sid()));
673 static WERROR net_registry_setsd_internal(struct net_context *c,
676 struct security_descriptor *sd)
679 struct registry_key *key = NULL;
680 TALLOC_CTX *ctx = talloc_stackframe();
681 uint32_t access_mask = REG_KEY_WRITE |
682 SEC_FLAG_MAXIMUM_ALLOWED |
683 SEC_FLAG_SYSTEM_SECURITY;
686 * net_rpc_regsitry uses SEC_FLAG_SYSTEM_SECURITY, but access
687 * is denied with these perms right now...
689 access_mask = REG_KEY_WRITE;
691 if (strlen(keyname) == 0) {
692 d_fprintf(stderr, "error: zero length key name given\n");
693 werr = WERR_INVALID_PARAM;
697 werr = open_key(ctx, keyname, access_mask, &key);
698 if (!W_ERROR_IS_OK(werr)) {
699 d_fprintf(stderr, "open_key failed: %s\n", win_errstr(werr));
703 werr = reg_setkeysecurity(key, sd);
704 if (!W_ERROR_IS_OK(werr)) {
705 d_fprintf(stderr, "reg_setkeysecurity failed: %s\n",
717 static int net_registry_setsd_sddl(struct net_context *c,
718 int argc, const char **argv)
722 struct security_descriptor *secdesc = NULL;
723 TALLOC_CTX *ctx = talloc_stackframe();
725 if (argc != 2 || c->display_usage) {
726 d_printf("Usage: net registry setsd_sddl <path> <security_descriptor>\n");
727 d_printf("Example:\n"
728 "net registry setsd_sddl 'HKLM\\Software\\Samba'\n");
732 secdesc = sddl_decode(ctx, argv[1], get_global_sam_sid());
733 if (secdesc == NULL) {
737 werr = net_registry_setsd_internal(c, ctx, argv[0], secdesc);
738 if (!W_ERROR_IS_OK(werr)) {
749 /******************************************************************************/
751 * @defgroup net_registry net registry
755 * @defgroup net_registry_import Import
756 * @ingroup net_registry
765 static WERROR import_create_key(struct import_ctx* ctx,
766 struct registry_key* parent,
767 const char* name, void** pkey, bool* existing)
770 void* mem_ctx = talloc_new(ctx->mem_ctx);
772 struct registry_key* key = NULL;
773 enum winreg_CreateAction action;
775 if (parent == NULL) {
776 char* subkeyname = NULL;
777 werr = open_hive(mem_ctx, name, REG_KEY_WRITE,
778 &parent, &subkeyname);
779 if (!W_ERROR_IS_OK(werr)) {
780 d_fprintf(stderr, "open_hive failed: %s\n",
787 action = REG_ACTION_NONE;
788 werr = reg_createkey(mem_ctx, parent, name, REG_KEY_WRITE,
790 if (!W_ERROR_IS_OK(werr)) {
791 d_fprintf(stderr, "reg_createkey failed: %s\n",
796 if (action == REG_ACTION_NONE) {
797 d_fprintf(stderr, "createkey did nothing -- huh?\n");
802 if (existing != NULL) {
803 *existing = (action == REG_OPENED_EXISTING_KEY);
807 *pkey = talloc_steal(ctx->mem_ctx, key);
811 talloc_free(mem_ctx);
815 static WERROR import_close_key(struct import_ctx* ctx,
816 struct registry_key* key)
821 static WERROR import_delete_key(struct import_ctx* ctx,
822 struct registry_key* parent, const char* name)
825 void* mem_ctx = talloc_new(talloc_tos());
827 if (parent == NULL) {
828 char* subkeyname = NULL;
829 werr = open_hive(mem_ctx, name, REG_KEY_WRITE,
830 &parent, &subkeyname);
831 if (!W_ERROR_IS_OK(werr)) {
832 d_fprintf(stderr, "open_hive failed: %s\n",
839 werr = reg_deletekey_recursive(parent, name);
840 if (!W_ERROR_IS_OK(werr)) {
841 d_fprintf(stderr, "reg_deletekey_recursive %s: %s\n", "failed",
847 talloc_free(mem_ctx);
851 static WERROR import_create_val (struct import_ctx* ctx,
852 struct registry_key* parent, const char* name,
853 const struct registry_value* value)
857 if (parent == NULL) {
858 return WERR_INVALID_PARAM;
861 werr = reg_setvalue(parent, name, value);
862 if (!W_ERROR_IS_OK(werr)) {
863 d_fprintf(stderr, "reg_setvalue failed: %s\n",
869 static WERROR import_delete_val (struct import_ctx* ctx, struct registry_key* parent, const char* name) {
872 if (parent == NULL) {
873 return WERR_INVALID_PARAM;
876 werr = reg_deletevalue(parent, name);
877 if (!W_ERROR_IS_OK(werr)) {
878 d_fprintf(stderr, "reg_deletekey failed: %s\n",
886 static int net_registry_import(struct net_context *c, int argc,
889 struct import_ctx import_ctx;
890 struct reg_import_callback import_callback = {
892 .closekey = (reg_import_callback_closekey_t)&import_close_key,
893 .createkey = (reg_import_callback_createkey_t)&import_create_key,
894 .deletekey = (reg_import_callback_deletekey_t)&import_delete_key,
895 .deleteval = (reg_import_callback_deleteval_t)&import_delete_val,
896 .setval.registry_value = (reg_import_callback_setval_registry_value_t)
898 .setval_type = REGISTRY_VALUE,
904 if (argc < 1 || argc > 2 || c->display_usage) {
907 "net registry import <reg> [options]\n");
910 "net registry import file.reg enc=CP1252\n");
914 ZERO_STRUCT(import_ctx);
915 import_ctx.mem_ctx = talloc_stackframe();
918 regdb_transaction_start();
920 ret = reg_parse_file(argv[0],
921 reg_import_adapter(import_ctx.mem_ctx,
923 (argc > 1) ? argv[1] : NULL
926 d_printf("reg_parse_file failed: transaction canceled\n");
927 regdb_transaction_cancel();
929 regdb_transaction_commit();
933 talloc_free(import_ctx.mem_ctx);
939 /******************************************************************************/
942 * @defgroup net_registry_export Export
943 * @ingroup net_registry
947 static int registry_export(TALLOC_CTX *ctx, /*const*/ struct registry_key* key,
948 struct reg_format* f)
954 struct registry_value *valvalue = NULL;
955 char *valname = NULL;
957 struct registry_key* subkey = NULL;
958 char *subkey_name = NULL;
961 reg_format_registry_key(f, key, false);
965 werr = reg_enumvalue(ctx, key, count, &valname, &valvalue),
969 reg_format_registry_value(f, valname, valvalue);
971 if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) {
972 d_fprintf(stderr, "reg_enumvalue failed: %s\n",
977 /* recurse on subkeys */
979 werr = reg_enumkey(ctx, key, count, &subkey_name, &modtime),
983 werr = reg_openkey(ctx, key, subkey_name, REG_KEY_READ,
985 if (!W_ERROR_IS_OK(werr)) {
986 d_fprintf(stderr, "reg_openkey failed: %s\n",
991 registry_export(ctx, subkey, f);
993 if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) {
994 d_fprintf(stderr, "reg_enumkey failed: %s\n",
1003 static int net_registry_export(struct net_context *c, int argc,
1008 struct registry_key *key = NULL;
1009 TALLOC_CTX *ctx = talloc_stackframe();
1010 struct reg_format* f=NULL;
1012 if (argc < 2 || argc > 3 || c->display_usage) {
1015 "net registry export <path> <file> [opt]\n");
1018 "net registry export 'HKLM\\Software\\Samba' "
1019 "samba.reg regedit5\n");
1023 werr = open_key(ctx, argv[0], REG_KEY_READ, &key);
1024 if (!W_ERROR_IS_OK(werr)) {
1025 d_fprintf(stderr, "open_key failed: %s\n", win_errstr(werr));
1029 f = reg_format_file(ctx, argv[1], (argc > 2) ? argv[2] : NULL);
1031 d_fprintf(stderr, "open file failed: %s\n", strerror(errno));
1035 ret = registry_export(ctx, key, f);
1043 /******************************************************************************/
1045 * @defgroup net_registry_convert Convert
1046 * @ingroup net_registry
1050 static int net_registry_convert(struct net_context *c, int argc,
1055 const char* in_opt = NULL;
1056 const char* out_opt = NULL;
1058 if (argc < 2 || argc > 4|| c->display_usage) {
1061 "net registry convert <in> <out> [in_opt] [out_opt]\n"
1062 "net registry convert <in> <out> [out_opt]\n");
1065 "net registry convert in.reg out.reg regedit4,enc=CP1252\n");
1069 mem_ctx = talloc_stackframe();
1086 ret = reg_parse_file(argv[0], (struct reg_parse_callback*)
1087 reg_format_file(mem_ctx, argv[1], out_opt),
1090 talloc_free(mem_ctx);
1096 /******************************************************************************/
1098 int net_registry(struct net_context *c, int argc, const char **argv)
1102 struct functable func[] = {
1105 net_registry_enumerate,
1106 NET_TRANSPORT_LOCAL,
1107 "Enumerate registry keys and values",
1108 "net registry enumerate\n"
1109 " Enumerate registry keys and values"
1113 net_registry_createkey,
1114 NET_TRANSPORT_LOCAL,
1115 "Create a new registry key",
1116 "net registry createkey\n"
1117 " Create a new registry key"
1121 net_registry_deletekey,
1122 NET_TRANSPORT_LOCAL,
1123 "Delete a registry key",
1124 "net registry deletekey\n"
1125 " Delete a registry key"
1128 "deletekey_recursive",
1129 net_registry_deletekey_recursive,
1130 NET_TRANSPORT_LOCAL,
1131 N_("Delete a registry key with subkeys"),
1132 N_("net registry deletekey_recursive\n"
1133 " Delete a registry key with subkeys")
1137 net_registry_getvalue,
1138 NET_TRANSPORT_LOCAL,
1139 "Print a registry value",
1140 "net registry getvalue\n"
1141 " Print a registry value"
1145 net_registry_getvalueraw,
1146 NET_TRANSPORT_LOCAL,
1147 "Print a registry value (raw format)",
1148 "net registry getvalueraw\n"
1149 " Print a registry value (raw format)"
1153 net_registry_getvaluesraw,
1154 NET_TRANSPORT_LOCAL,
1155 "Print all values of a key in raw format",
1156 "net registry getvaluesraw <key>\n"
1157 " Print a registry value (raw format)"
1161 net_registry_setvalue,
1162 NET_TRANSPORT_LOCAL,
1163 "Set a new registry value",
1164 "net registry setvalue\n"
1165 " Set a new registry value"
1169 net_registry_increment,
1170 NET_TRANSPORT_LOCAL,
1171 "Increment a DWORD registry value under a lock",
1172 "net registry increment\n"
1173 " Increment a DWORD registry value under a lock"
1177 net_registry_deletevalue,
1178 NET_TRANSPORT_LOCAL,
1179 "Delete a registry value",
1180 "net registry deletevalue\n"
1181 " Delete a registry value"
1186 NET_TRANSPORT_LOCAL,
1187 "Get security descriptor",
1188 "net registry getsd\n"
1189 " Get security descriptor"
1193 net_registry_getsd_sddl,
1194 NET_TRANSPORT_LOCAL,
1195 "Get security descriptor in sddl format",
1196 "net registry getsd_sddl\n"
1197 " Get security descriptor in sddl format"
1201 net_registry_setsd_sddl,
1202 NET_TRANSPORT_LOCAL,
1203 "Set security descriptor from sddl format string",
1204 "net registry setsd_sddl\n"
1205 " Set security descriptor from sddl format string"
1209 net_registry_import,
1210 NET_TRANSPORT_LOCAL,
1212 "net registry import\n"
1217 net_registry_export,
1218 NET_TRANSPORT_LOCAL,
1220 "net registry export\n"
1225 net_registry_convert,
1226 NET_TRANSPORT_LOCAL,
1227 "Convert .reg file",
1228 "net registry convert\n"
1229 " Convert .reg file"
1231 { NULL, NULL, 0, NULL, NULL }
1234 if (!W_ERROR_IS_OK(registry_init_basic())) {
1238 ret = net_run_function(c, argc, argv, "net registry", func);