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(struct net_context *c, int argc,
234 struct registry_key *hivekey = NULL;
235 TALLOC_CTX *ctx = talloc_stackframe();
238 if (argc != 1 || c->display_usage) {
239 d_printf("Usage: net registry deletekey <path>\n");
240 d_printf("Example: net registry deletekey "
241 "'HKLM\\Software\\Samba\\smbconf.127.0.0.1'\n");
244 if (strlen(argv[0]) == 0) {
245 d_fprintf(stderr, "error: zero length key name given\n");
249 werr = open_hive(ctx, argv[0], REG_KEY_WRITE, &hivekey, &subkeyname);
250 if (!W_ERROR_IS_OK(werr)) {
251 d_fprintf(stderr, "open_hive failed: %s\n", win_errstr(werr));
255 werr = reg_deletekey(hivekey, subkeyname);
256 if (!W_ERROR_IS_OK(werr)) {
257 d_fprintf(stderr, "reg_deletekey failed: %s\n",
269 static int net_registry_getvalue_internal(struct net_context *c, int argc,
270 const char **argv, bool raw)
274 struct registry_key *key = NULL;
275 struct registry_value *value = NULL;
276 TALLOC_CTX *ctx = talloc_stackframe();
278 if (argc != 2 || c->display_usage) {
279 d_fprintf(stderr, "usage: net rpc registry getvalue <key> "
284 werr = open_key(ctx, argv[0], REG_KEY_READ, &key);
285 if (!W_ERROR_IS_OK(werr)) {
286 d_fprintf(stderr, "open_key failed: %s\n", win_errstr(werr));
290 werr = reg_queryvalue(ctx, key, argv[1], &value);
291 if (!W_ERROR_IS_OK(werr)) {
292 d_fprintf(stderr, "reg_queryvalue failed: %s\n",
297 print_registry_value(value, raw);
306 static int net_registry_getvalue(struct net_context *c, int argc,
309 return net_registry_getvalue_internal(c, argc, argv, false);
312 static int net_registry_getvalueraw(struct net_context *c, int argc,
315 return net_registry_getvalue_internal(c, argc, argv, true);
318 static int net_registry_getvaluesraw(struct net_context *c, int argc,
323 struct registry_key *key = NULL;
324 TALLOC_CTX *ctx = talloc_stackframe();
327 if (argc != 1 || c->display_usage) {
328 d_fprintf(stderr, "usage: net rpc registry getvaluesraw "
333 werr = open_key(ctx, argv[0], REG_KEY_READ, &key);
334 if (!W_ERROR_IS_OK(werr)) {
335 d_fprintf(stderr, "open_key failed: %s\n", win_errstr(werr));
341 struct registry_value *val;
343 werr = reg_enumvalue(talloc_tos(), key, idx, NULL, &val);
345 if (W_ERROR_EQUAL(werr, WERR_NO_MORE_ITEMS)) {
349 if (!W_ERROR_IS_OK(werr)) {
352 print_registry_value(val, true);
361 static int net_registry_setvalue(struct net_context *c, int argc,
365 struct registry_value value;
366 struct registry_key *key = NULL;
368 TALLOC_CTX *ctx = talloc_stackframe();
370 if (argc < 4 || c->display_usage) {
371 d_fprintf(stderr, "usage: net rpc registry setvalue <key> "
372 "<valuename> <type> [<val>]+\n");
376 if (!strequal(argv[2], "multi_sz") && (argc != 4)) {
377 d_fprintf(stderr, "Too many args for type %s\n", argv[2]);
381 if (strequal(argv[2], "dword")) {
382 value.type = REG_DWORD;
383 value.v.dword = strtoul(argv[3], NULL, 10);
384 } else if (strequal(argv[2], "sz")) {
386 value.v.sz.len = strlen(argv[3])+1;
387 value.v.sz.str = CONST_DISCARD(char *, argv[3]);
388 } else if (strequal(argv[2], "multi_sz")) {
389 value.type = REG_MULTI_SZ;
390 value.v.multi_sz.num_strings = argc - 3;
391 value.v.multi_sz.strings = (char **)(argv + 3);
393 d_fprintf(stderr, "type \"%s\" not implemented\n", argv[2]);
397 werr = open_key(ctx, argv[0], REG_KEY_WRITE, &key);
398 if (!W_ERROR_IS_OK(werr)) {
399 d_fprintf(stderr, "open_key failed: %s\n", win_errstr(werr));
403 werr = reg_setvalue(key, argv[1], &value);
404 if (!W_ERROR_IS_OK(werr)) {
405 d_fprintf(stderr, "reg_setvalue failed: %s\n",
417 struct net_registry_increment_state {
419 const char *valuename;
425 static void net_registry_increment_fn(void *private_data)
427 struct net_registry_increment_state *state =
428 (struct net_registry_increment_state *)private_data;
429 struct registry_value *value;
430 struct registry_key *key = NULL;
432 state->werr = open_key(talloc_tos(), state->keyname,
433 REG_KEY_READ|REG_KEY_WRITE, &key);
434 if (!W_ERROR_IS_OK(state->werr)) {
435 d_fprintf(stderr, "open_key failed: %s\n",
436 win_errstr(state->werr));
440 state->werr = reg_queryvalue(key, key, state->valuename, &value);
441 if (!W_ERROR_IS_OK(state->werr)) {
442 d_fprintf(stderr, "reg_queryvalue failed: %s\n",
443 win_errstr(state->werr));
447 if (value->type != REG_DWORD) {
448 d_fprintf(stderr, "value not a DWORD: %s\n",
449 reg_type_lookup(value->type));
453 value->v.dword += state->increment;
454 state->newvalue = value->v.dword;
456 state->werr = reg_setvalue(key, state->valuename, value);
457 if (!W_ERROR_IS_OK(state->werr)) {
458 d_fprintf(stderr, "reg_setvalue failed: %s\n",
459 win_errstr(state->werr));
468 static int net_registry_increment(struct net_context *c, int argc,
471 struct net_registry_increment_state state;
475 if (argc < 2 || c->display_usage) {
476 d_fprintf(stderr, "%s\n%s",
478 "net registry increment <key> <valuename> "
483 state.keyname = argv[0];
484 state.valuename = argv[1];
488 state.increment = strtoul(argv[2], NULL, 10);
491 status = g_lock_do("registry_increment_lock", G_LOCK_WRITE,
493 net_registry_increment_fn, &state);
494 if (!NT_STATUS_IS_OK(status)) {
495 d_fprintf(stderr, "g_lock_do failed: %s\n",
499 if (!W_ERROR_IS_OK(state.werr)) {
500 d_fprintf(stderr, "increment failed: %s\n",
501 win_errstr(state.werr));
505 d_printf("new value: %u\n", (unsigned)state.newvalue);
513 static int net_registry_deletevalue(struct net_context *c, int argc,
517 struct registry_key *key = NULL;
518 TALLOC_CTX *ctx = talloc_stackframe();
521 if (argc != 2 || c->display_usage) {
522 d_fprintf(stderr, "usage: net rpc registry deletevalue <key> "
527 werr = open_key(ctx, argv[0], REG_KEY_WRITE, &key);
528 if (!W_ERROR_IS_OK(werr)) {
529 d_fprintf(stderr, "open_key failed: %s\n", win_errstr(werr));
533 werr = reg_deletevalue(key, argv[1]);
534 if (!W_ERROR_IS_OK(werr)) {
535 d_fprintf(stderr, "reg_deletekey failed: %s\n",
547 static WERROR net_registry_getsd_internal(struct net_context *c,
550 struct security_descriptor **sd)
553 struct registry_key *key = NULL;
554 TALLOC_CTX *ctx = talloc_stackframe();
555 uint32_t access_mask = REG_KEY_READ |
556 SEC_FLAG_MAXIMUM_ALLOWED |
557 SEC_FLAG_SYSTEM_SECURITY;
560 * net_rpc_regsitry uses SEC_FLAG_SYSTEM_SECURITY, but access
561 * is denied with these perms right now...
563 access_mask = REG_KEY_READ;
566 d_fprintf(stderr, "internal error: invalid argument\n");
567 werr = WERR_INVALID_PARAM;
571 if (strlen(keyname) == 0) {
572 d_fprintf(stderr, "error: zero length key name given\n");
573 werr = WERR_INVALID_PARAM;
577 werr = open_key(ctx, keyname, access_mask, &key);
578 if (!W_ERROR_IS_OK(werr)) {
579 d_fprintf(stderr, "open_key failed: %s\n", win_errstr(werr));
583 werr = reg_getkeysecurity(mem_ctx, key, sd);
584 if (!W_ERROR_IS_OK(werr)) {
585 d_fprintf(stderr, "reg_getkeysecurity failed: %s\n",
597 static int net_registry_getsd(struct net_context *c, int argc,
602 struct security_descriptor *secdesc = NULL;
603 TALLOC_CTX *ctx = talloc_stackframe();
605 if (argc != 1 || c->display_usage) {
606 d_printf("Usage: net registry getsd <path>\n");
607 d_printf("Example: net registry getsd "
608 "'HKLM\\Software\\Samba'\n");
612 werr = net_registry_getsd_internal(c, ctx, argv[0], &secdesc);
613 if (!W_ERROR_IS_OK(werr)) {
617 display_sec_desc(secdesc);
626 static int net_registry_getsd_sddl(struct net_context *c,
627 int argc, const char **argv)
631 struct security_descriptor *secdesc = NULL;
632 TALLOC_CTX *ctx = talloc_stackframe();
634 if (argc != 1 || c->display_usage) {
635 d_printf("Usage: net registry getsd_sddl <path>\n");
636 d_printf("Example: net registry getsd_sddl 'HKLM\\Software\\Samba'\n");
640 werr = net_registry_getsd_internal(c, ctx, argv[0], &secdesc);
641 if (!W_ERROR_IS_OK(werr)) {
645 d_printf("%s\n", sddl_encode(ctx, secdesc, get_global_sam_sid()));
654 static WERROR net_registry_setsd_internal(struct net_context *c,
657 struct security_descriptor *sd)
660 struct registry_key *key = NULL;
661 TALLOC_CTX *ctx = talloc_stackframe();
662 uint32_t access_mask = REG_KEY_WRITE |
663 SEC_FLAG_MAXIMUM_ALLOWED |
664 SEC_FLAG_SYSTEM_SECURITY;
667 * net_rpc_regsitry uses SEC_FLAG_SYSTEM_SECURITY, but access
668 * is denied with these perms right now...
670 access_mask = REG_KEY_WRITE;
672 if (strlen(keyname) == 0) {
673 d_fprintf(stderr, "error: zero length key name given\n");
674 werr = WERR_INVALID_PARAM;
678 werr = open_key(ctx, keyname, access_mask, &key);
679 if (!W_ERROR_IS_OK(werr)) {
680 d_fprintf(stderr, "open_key failed: %s\n", win_errstr(werr));
684 werr = reg_setkeysecurity(key, sd);
685 if (!W_ERROR_IS_OK(werr)) {
686 d_fprintf(stderr, "reg_setkeysecurity failed: %s\n",
698 static int net_registry_setsd_sddl(struct net_context *c,
699 int argc, const char **argv)
703 struct security_descriptor *secdesc = NULL;
704 TALLOC_CTX *ctx = talloc_stackframe();
706 if (argc != 2 || c->display_usage) {
707 d_printf("Usage: net registry setsd_sddl <path> <security_descriptor>\n");
708 d_printf("Example:\n"
709 "net registry setsd_sddl 'HKLM\\Software\\Samba'\n");
713 secdesc = sddl_decode(ctx, argv[1], get_global_sam_sid());
714 if (secdesc == NULL) {
718 werr = net_registry_setsd_internal(c, ctx, argv[0], secdesc);
719 if (!W_ERROR_IS_OK(werr)) {
730 /******************************************************************************/
732 * @defgroup net_registry net registry
736 * @defgroup net_registry_import Import
737 * @ingroup net_registry
746 static WERROR import_create_key(struct import_ctx* ctx,
747 struct registry_key* parent,
748 const char* name, void** pkey, bool* existing)
751 void* mem_ctx = talloc_new(ctx->mem_ctx);
753 struct registry_key* key = NULL;
754 enum winreg_CreateAction action;
756 if (parent == NULL) {
757 char* subkeyname = NULL;
758 werr = open_hive(mem_ctx, name, REG_KEY_WRITE,
759 &parent, &subkeyname);
760 if (!W_ERROR_IS_OK(werr)) {
761 d_fprintf(stderr, "open_hive failed: %s\n",
768 action = REG_ACTION_NONE;
769 werr = reg_createkey(mem_ctx, parent, name, REG_KEY_WRITE,
771 if (!W_ERROR_IS_OK(werr)) {
772 d_fprintf(stderr, "reg_createkey failed: %s\n",
777 if (action == REG_ACTION_NONE) {
778 d_fprintf(stderr, "createkey did nothing -- huh?\n");
783 if (existing != NULL) {
784 *existing = (action == REG_OPENED_EXISTING_KEY);
788 *pkey = talloc_steal(ctx->mem_ctx, key);
792 talloc_free(mem_ctx);
796 static WERROR import_close_key(struct import_ctx* ctx,
797 struct registry_key* key)
802 static WERROR import_delete_key(struct import_ctx* ctx,
803 struct registry_key* parent, const char* name)
806 void* mem_ctx = talloc_new(talloc_tos());
808 if (parent == NULL) {
809 char* subkeyname = NULL;
810 werr = open_hive(mem_ctx, name, REG_KEY_WRITE,
811 &parent, &subkeyname);
812 if (!W_ERROR_IS_OK(werr)) {
813 d_fprintf(stderr, "open_hive failed: %s\n",
820 werr = reg_deletekey_recursive(mem_ctx, parent, name);
821 if (!W_ERROR_IS_OK(werr)) {
822 d_fprintf(stderr, "reg_deletekey_recursive %s: %s\n", "failed",
828 talloc_free(mem_ctx);
832 static WERROR import_create_val (struct import_ctx* ctx,
833 struct registry_key* parent, const char* name,
834 const struct registry_value* value)
838 if (parent == NULL) {
839 return WERR_INVALID_PARAM;
842 werr = reg_setvalue(parent, name, value);
843 if (!W_ERROR_IS_OK(werr)) {
844 d_fprintf(stderr, "reg_setvalue failed: %s\n",
850 static WERROR import_delete_val (struct import_ctx* ctx, struct registry_key* parent, const char* name) {
853 if (parent == NULL) {
854 return WERR_INVALID_PARAM;
857 werr = reg_deletevalue(parent, name);
858 if (!W_ERROR_IS_OK(werr)) {
859 d_fprintf(stderr, "reg_deletekey failed: %s\n",
867 static int net_registry_import(struct net_context *c, int argc,
870 struct import_ctx import_ctx;
871 struct reg_import_callback import_callback = {
873 .closekey = (reg_import_callback_closekey_t)&import_close_key,
874 .createkey = (reg_import_callback_createkey_t)&import_create_key,
875 .deletekey = (reg_import_callback_deletekey_t)&import_delete_key,
876 .deleteval = (reg_import_callback_deleteval_t)&import_delete_val,
877 .setval.registry_value = (reg_import_callback_setval_registry_value_t)
879 .setval_type = REGISTRY_VALUE,
885 if (argc < 1 || argc > 2 || c->display_usage) {
888 "net registry import <reg> [options]\n");
891 "net registry import file.reg enc=CP1252\n");
895 ZERO_STRUCT(import_ctx);
896 import_ctx.mem_ctx = talloc_stackframe();
899 regdb_transaction_start();
901 ret = reg_parse_file(argv[0],
902 reg_import_adapter(import_ctx.mem_ctx,
904 (argc > 1) ? argv[1] : NULL
907 d_printf("reg_parse_file failed: transaction canceled\n");
908 regdb_transaction_cancel();
910 regdb_transaction_commit();
914 talloc_free(import_ctx.mem_ctx);
920 /******************************************************************************/
923 * @defgroup net_registry_export Export
924 * @ingroup net_registry
928 static int registry_export(TALLOC_CTX *ctx, /*const*/ struct registry_key* key,
929 struct reg_format* f)
935 struct registry_value *valvalue = NULL;
936 char *valname = NULL;
938 struct registry_key* subkey = NULL;
939 char *subkey_name = NULL;
942 reg_format_registry_key(f, key, false);
946 werr = reg_enumvalue(ctx, key, count, &valname, &valvalue),
950 reg_format_registry_value(f, valname, valvalue);
952 if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) {
953 d_fprintf(stderr, "reg_enumvalue failed: %s\n",
958 /* recurse on subkeys */
960 werr = reg_enumkey(ctx, key, count, &subkey_name, &modtime),
964 werr = reg_openkey(ctx, key, subkey_name, REG_KEY_READ,
966 if (!W_ERROR_IS_OK(werr)) {
967 d_fprintf(stderr, "reg_openkey failed: %s\n",
972 registry_export(ctx, subkey, f);
974 if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) {
975 d_fprintf(stderr, "reg_enumkey failed: %s\n",
984 static int net_registry_export(struct net_context *c, int argc,
989 struct registry_key *key = NULL;
990 TALLOC_CTX *ctx = talloc_stackframe();
991 struct reg_format* f=NULL;
993 if (argc < 2 || argc > 3 || c->display_usage) {
996 "net registry export <path> <file> [opt]\n");
999 "net registry export 'HKLM\\Software\\Samba' "
1000 "samba.reg regedit5\n");
1004 werr = open_key(ctx, argv[0], REG_KEY_READ, &key);
1005 if (!W_ERROR_IS_OK(werr)) {
1006 d_fprintf(stderr, "open_key failed: %s\n", win_errstr(werr));
1010 f = reg_format_file(ctx, argv[1], (argc > 2) ? argv[2] : NULL);
1012 d_fprintf(stderr, "open file failed: %s\n", strerror(errno));
1016 ret = registry_export(ctx, key, f);
1024 /******************************************************************************/
1026 * @defgroup net_registry_convert Convert
1027 * @ingroup net_registry
1031 static int net_registry_convert(struct net_context *c, int argc,
1036 const char* in_opt = NULL;
1037 const char* out_opt = NULL;
1039 if (argc < 2 || argc > 4|| c->display_usage) {
1042 "net registry convert <in> <out> [in_opt] [out_opt]\n"
1043 "net registry convert <in> <out> [out_opt]\n");
1046 "net registry convert in.reg out.reg regedit4,enc=CP1252\n");
1050 mem_ctx = talloc_stackframe();
1067 ret = reg_parse_file(argv[0], (struct reg_parse_callback*)
1068 reg_format_file(mem_ctx, argv[1], out_opt),
1071 talloc_free(mem_ctx);
1077 /******************************************************************************/
1079 int net_registry(struct net_context *c, int argc, const char **argv)
1083 struct functable func[] = {
1086 net_registry_enumerate,
1087 NET_TRANSPORT_LOCAL,
1088 "Enumerate registry keys and values",
1089 "net registry enumerate\n"
1090 " Enumerate registry keys and values"
1094 net_registry_createkey,
1095 NET_TRANSPORT_LOCAL,
1096 "Create a new registry key",
1097 "net registry createkey\n"
1098 " Create a new registry key"
1102 net_registry_deletekey,
1103 NET_TRANSPORT_LOCAL,
1104 "Delete a registry key",
1105 "net registry deletekey\n"
1106 " Delete a registry key"
1110 net_registry_getvalue,
1111 NET_TRANSPORT_LOCAL,
1112 "Print a registry value",
1113 "net registry getvalue\n"
1114 " Print a registry value"
1118 net_registry_getvalueraw,
1119 NET_TRANSPORT_LOCAL,
1120 "Print a registry value (raw format)",
1121 "net registry getvalueraw\n"
1122 " Print a registry value (raw format)"
1126 net_registry_getvaluesraw,
1127 NET_TRANSPORT_LOCAL,
1128 "Print all values of a key in raw format",
1129 "net registry getvaluesraw <key>\n"
1130 " Print a registry value (raw format)"
1134 net_registry_setvalue,
1135 NET_TRANSPORT_LOCAL,
1136 "Set a new registry value",
1137 "net registry setvalue\n"
1138 " Set a new registry value"
1142 net_registry_increment,
1143 NET_TRANSPORT_LOCAL,
1144 "Increment a DWORD registry value under a lock",
1145 "net registry increment\n"
1146 " Increment a DWORD registry value under a lock"
1150 net_registry_deletevalue,
1151 NET_TRANSPORT_LOCAL,
1152 "Delete a registry value",
1153 "net registry deletevalue\n"
1154 " Delete a registry value"
1159 NET_TRANSPORT_LOCAL,
1160 "Get security descriptor",
1161 "net registry getsd\n"
1162 " Get security descriptor"
1166 net_registry_getsd_sddl,
1167 NET_TRANSPORT_LOCAL,
1168 "Get security descriptor in sddl format",
1169 "net registry getsd_sddl\n"
1170 " Get security descriptor in sddl format"
1174 net_registry_setsd_sddl,
1175 NET_TRANSPORT_LOCAL,
1176 "Set security descriptor from sddl format string",
1177 "net registry setsd_sddl\n"
1178 " Set security descriptor from sddl format string"
1182 net_registry_import,
1183 NET_TRANSPORT_LOCAL,
1185 "net registry import\n"
1190 net_registry_export,
1191 NET_TRANSPORT_LOCAL,
1193 "net registry export\n"
1198 net_registry_convert,
1199 NET_TRANSPORT_LOCAL,
1200 "Convert .reg file",
1201 "net registry convert\n"
1202 " Convert .reg file"
1204 { NULL, NULL, 0, NULL, NULL }
1207 if (!W_ERROR_IS_OK(registry_init_basic())) {
1211 ret = net_run_function(c, argc, argv, "net registry", func);