2 Samba Unix/Linux SMB client library
3 Distributed SMB/CIFS Server Management Utility
5 Copyright (C) Gerald (Jerry) Carter 2005-2006
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
22 #include "utils/net.h"
24 #include "reg_objects.h"
26 static BOOL reg_hive_key(const char *fullname, uint32 *reg_type,
27 const char **key_name)
32 sep = strchr_m(fullname, '\\');
39 len = strlen(fullname);
43 if (strnequal(fullname, "HKLM", len) ||
44 strnequal(fullname, "HKEY_LOCAL_MACHINE", len))
45 (*reg_type) = HKEY_LOCAL_MACHINE;
46 else if (strnequal(fullname, "HKCR", len) ||
47 strnequal(fullname, "HKEY_CLASSES_ROOT", len))
48 (*reg_type) = HKEY_CLASSES_ROOT;
49 else if (strnequal(fullname, "HKU", len) ||
50 strnequal(fullname, "HKEY_USERS", len))
51 (*reg_type) = HKEY_USERS;
52 else if (strnequal(fullname, "HKPD", len) ||
53 strnequal(fullname, "HKEY_PERFORMANCE_DATA", len))
54 (*reg_type) = HKEY_PERFORMANCE_DATA;
56 DEBUG(10,("reg_hive_key: unrecognised hive key %s\n",
64 static NTSTATUS registry_openkey(TALLOC_CTX *mem_ctx,
65 struct rpc_pipe_client *pipe_hnd,
66 const char *name, uint32 access_mask,
67 struct policy_handle *hive_hnd,
68 struct policy_handle *key_hnd)
72 struct winreg_String key;
74 if (!reg_hive_key(name, &hive, &key.name)) {
75 return NT_STATUS_INVALID_PARAMETER;
78 status = rpccli_winreg_Connect(pipe_hnd, mem_ctx, hive, access_mask,
80 if (!(NT_STATUS_IS_OK(status))) {
84 status = rpccli_winreg_OpenKey(pipe_hnd, mem_ctx, hive_hnd, key, 0,
85 access_mask, key_hnd);
86 if (!(NT_STATUS_IS_OK(status))) {
87 rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, hive_hnd);
94 static NTSTATUS registry_enumkeys(TALLOC_CTX *ctx,
95 struct rpc_pipe_client *pipe_hnd,
96 struct policy_handle *key_hnd,
97 uint32 *pnum_keys, char ***pnames,
98 char ***pclasses, NTTIME ***pmodtimes)
102 uint32 num_subkeys, max_subkeylen, max_classlen;
103 uint32 num_values, max_valnamelen, max_valbufsize;
105 NTTIME last_changed_time;
107 struct winreg_String classname;
108 char **names, **classes;
111 if (!(mem_ctx = talloc_new(ctx))) {
112 return NT_STATUS_NO_MEMORY;
115 ZERO_STRUCT(classname);
116 status = rpccli_winreg_QueryInfoKey(
117 pipe_hnd, mem_ctx, key_hnd, &classname, &num_subkeys,
118 &max_subkeylen, &max_classlen, &num_values, &max_valnamelen,
119 &max_valbufsize, &secdescsize, &last_changed_time );
121 if (!NT_STATUS_IS_OK(status)) {
125 if (num_subkeys == 0) {
127 TALLOC_FREE(mem_ctx);
131 if ((!(names = TALLOC_ZERO_ARRAY(mem_ctx, char *, num_subkeys))) ||
132 (!(classes = TALLOC_ZERO_ARRAY(mem_ctx, char *, num_subkeys))) ||
133 (!(modtimes = TALLOC_ZERO_ARRAY(mem_ctx, NTTIME *,
135 status = NT_STATUS_NO_MEMORY;
139 for (i=0; i<num_subkeys; i++) {
141 struct winreg_StringBuf class_buf;
142 struct winreg_StringBuf *pclass_buf = &class_buf;
143 struct winreg_StringBuf name_buf;
145 NTTIME *pmodtime = &modtime;
149 class_buf.size = max_classlen+2;
153 name_buf.size = max_subkeylen+2;
155 ZERO_STRUCT(modtime);
157 status = rpccli_winreg_EnumKey(pipe_hnd, mem_ctx, key_hnd,
158 i, &name_buf, &pclass_buf,
161 if (W_ERROR_EQUAL(ntstatus_to_werror(status),
162 WERR_NO_MORE_ITEMS) ) {
163 status = NT_STATUS_OK;
166 if (!NT_STATUS_IS_OK(status)) {
172 if (pclass_buf && pclass_buf->name &&
173 (!(classes[i] = talloc_strdup(classes,
174 pclass_buf->name)))) {
175 status = NT_STATUS_NO_MEMORY;
179 if (!(names[i] = talloc_strdup(names, name_buf.name))) {
180 status = NT_STATUS_NO_MEMORY;
185 (!(modtimes[i] = (NTTIME *)talloc_memdup(
186 modtimes, pmodtime, sizeof(*pmodtime))))) {
187 status = NT_STATUS_NO_MEMORY;
192 *pnum_keys = num_subkeys;
195 *pnames = talloc_move(ctx, &names);
198 *pclasses = talloc_move(ctx, &classes);
201 *pmodtimes = talloc_move(ctx, &modtimes);
204 status = NT_STATUS_OK;
207 TALLOC_FREE(mem_ctx);
211 static NTSTATUS registry_enumvalues(TALLOC_CTX *ctx,
212 struct rpc_pipe_client *pipe_hnd,
213 struct policy_handle *key_hnd,
214 uint32 *pnum_values, char ***pvalnames,
215 struct registry_value ***pvalues)
219 uint32 num_subkeys, max_subkeylen, max_classlen;
220 uint32 num_values, max_valnamelen, max_valbufsize;
222 NTTIME last_changed_time;
224 struct winreg_String classname;
225 struct registry_value **values;
228 if (!(mem_ctx = talloc_new(ctx))) {
229 return NT_STATUS_NO_MEMORY;
232 ZERO_STRUCT(classname);
233 status = rpccli_winreg_QueryInfoKey(
234 pipe_hnd, mem_ctx, key_hnd, &classname, &num_subkeys,
235 &max_subkeylen, &max_classlen, &num_values, &max_valnamelen,
236 &max_valbufsize, &secdescsize, &last_changed_time );
238 if (!NT_STATUS_IS_OK(status)) {
242 if (num_values == 0) {
244 TALLOC_FREE(mem_ctx);
248 if ((!(names = TALLOC_ARRAY(mem_ctx, char *, num_values))) ||
249 (!(values = TALLOC_ARRAY(mem_ctx, struct registry_value *,
251 status = NT_STATUS_NO_MEMORY;
255 for (i=0; i<num_values; i++) {
256 enum winreg_Type type = REG_NONE;
257 enum winreg_Type *ptype = &type;
262 uint32 *pdata_size = &data_size;
265 uint32 *pvalue_length = &value_length;
268 struct winreg_ValNameBuf name_buf;
272 name_buf.size = max_valnamelen + 2;
274 data_size = max_valbufsize;
277 status = rpccli_winreg_EnumValue(pipe_hnd, mem_ctx, key_hnd,
278 i, &name_buf, &ptype,
282 if ( W_ERROR_EQUAL(ntstatus_to_werror(status),
283 WERR_NO_MORE_ITEMS) ) {
284 status = NT_STATUS_OK;
288 if (!(NT_STATUS_IS_OK(status))) {
292 if ((name_buf.name == NULL) || (ptype == NULL) ||
293 (data == NULL) || (pdata_size == 0) ||
294 (pvalue_length == NULL)) {
295 status = NT_STATUS_INVALID_PARAMETER;
299 if (!(names[i] = talloc_strdup(names, name_buf.name))) {
300 status = NT_STATUS_NO_MEMORY;
304 status = registry_pull_value(values, &values[i], *ptype, data,
305 *pdata_size, *pvalue_length);
306 if (!(NT_STATUS_IS_OK(status))) {
311 *pnum_values = num_values;
314 *pvalnames = talloc_move(ctx, &names);
317 *pvalues = talloc_move(ctx, &values);
320 status = NT_STATUS_OK;
323 TALLOC_FREE(mem_ctx);
327 static NTSTATUS registry_setvalue(TALLOC_CTX *mem_ctx,
328 struct rpc_pipe_client *pipe_hnd,
329 struct policy_handle *key_hnd,
331 const struct registry_value *value)
333 struct winreg_String name_string;
337 result = registry_push_value(mem_ctx, value, &blob);
338 if (!NT_STATUS_IS_OK(result)) {
342 name_string.name = name;
343 result = rpccli_winreg_SetValue(pipe_hnd, blob.data, key_hnd,
344 name_string, value->type,
345 blob.data, blob.length);
346 TALLOC_FREE(blob.data);
350 static NTSTATUS rpc_registry_setvalue_internal(const DOM_SID *domain_sid,
351 const char *domain_name,
352 struct cli_state *cli,
353 struct rpc_pipe_client *pipe_hnd,
358 struct policy_handle hive_hnd, key_hnd;
360 struct registry_value value;
362 status = registry_openkey(mem_ctx, pipe_hnd, argv[0], REG_KEY_WRITE,
363 &hive_hnd, &key_hnd);
364 if (!NT_STATUS_IS_OK(status)) {
365 d_fprintf(stderr, "registry_openkey failed: %s\n",
370 if (!strequal(argv[2], "multi_sz") && (argc != 4)) {
371 d_fprintf(stderr, "Too many args for type %s\n", argv[2]);
372 return NT_STATUS_NOT_IMPLEMENTED;
375 if (strequal(argv[2], "dword")) {
376 value.type = REG_DWORD;
377 value.v.dword = strtoul(argv[3], NULL, 10);
379 else if (strequal(argv[2], "sz")) {
381 value.v.sz.len = strlen(argv[3])+1;
382 value.v.sz.str = CONST_DISCARD(char *, argv[3]);
385 d_fprintf(stderr, "type \"%s\" not implemented\n", argv[3]);
386 status = NT_STATUS_NOT_IMPLEMENTED;
390 status = registry_setvalue(mem_ctx, pipe_hnd, &key_hnd,
393 if (!NT_STATUS_IS_OK(status)) {
394 d_fprintf(stderr, "registry_setvalue failed: %s\n",
399 rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &key_hnd);
400 rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &hive_hnd);
405 static int rpc_registry_setvalue( int argc, const char **argv )
408 d_fprintf(stderr, "usage: net rpc registry setvalue <key> "
409 "<valuename> <type> [<val>]+\n");
413 return run_rpc_command( NULL, PI_WINREG, 0,
414 rpc_registry_setvalue_internal, argc, argv );
417 static NTSTATUS rpc_registry_deletevalue_internal(const DOM_SID *domain_sid,
418 const char *domain_name,
419 struct cli_state *cli,
420 struct rpc_pipe_client *pipe_hnd,
425 struct policy_handle hive_hnd, key_hnd;
427 struct winreg_String valuename;
429 status = registry_openkey(mem_ctx, pipe_hnd, argv[0], REG_KEY_WRITE,
430 &hive_hnd, &key_hnd);
431 if (!NT_STATUS_IS_OK(status)) {
432 d_fprintf(stderr, "registry_openkey failed: %s\n",
437 valuename.name = argv[1];
439 status = rpccli_winreg_DeleteValue(pipe_hnd, mem_ctx, &key_hnd,
442 if (!NT_STATUS_IS_OK(status)) {
443 d_fprintf(stderr, "registry_deletevalue failed: %s\n",
447 rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &key_hnd);
448 rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &hive_hnd);
453 static int rpc_registry_deletevalue( int argc, const char **argv )
456 d_fprintf(stderr, "usage: net rpc registry deletevalue <key> "
461 return run_rpc_command( NULL, PI_WINREG, 0,
462 rpc_registry_deletevalue_internal, argc, argv );
465 static NTSTATUS rpc_registry_createkey_internal(const DOM_SID *domain_sid,
466 const char *domain_name,
467 struct cli_state *cli,
468 struct rpc_pipe_client *pipe_hnd,
474 struct policy_handle hive_hnd, key_hnd;
475 struct winreg_String key, keyclass;
476 enum winreg_CreateAction action;
477 enum winreg_CreateAction *paction = &action;
480 if (!reg_hive_key(argv[0], &hive, &key.name)) {
481 return NT_STATUS_INVALID_PARAMETER;
484 status = rpccli_winreg_Connect(pipe_hnd, mem_ctx, hive,
485 REG_KEY_READ|REG_KEY_WRITE,
487 if (!(NT_STATUS_IS_OK(status))) {
491 action = REG_ACTION_NONE;
494 status = rpccli_winreg_CreateKey(pipe_hnd, mem_ctx, &hive_hnd, key,
495 keyclass, 0, REG_KEY_READ, NULL,
497 if (!NT_STATUS_IS_OK(status)) {
498 d_fprintf(stderr, "createkey returned %s\n",
500 rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &hive_hnd);
506 case REG_ACTION_NONE:
507 d_printf("createkey did nothing -- huh?\n");
509 case REG_CREATED_NEW_KEY:
510 d_printf("createkey created %s\n", argv[0]);
512 case REG_OPENED_EXISTING_KEY:
513 d_printf("createkey opened existing %s\n", argv[0]);
518 rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &key_hnd);
519 rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &hive_hnd);
524 static int rpc_registry_createkey( int argc, const char **argv )
527 d_fprintf(stderr, "usage: net rpc registry createkey <key>\n");
531 return run_rpc_command( NULL, PI_WINREG, 0,
532 rpc_registry_createkey_internal, argc, argv );
535 static NTSTATUS rpc_registry_deletekey_internal(const DOM_SID *domain_sid,
536 const char *domain_name,
537 struct cli_state *cli,
538 struct rpc_pipe_client *pipe_hnd,
544 struct policy_handle hive_hnd;
545 struct winreg_String key;
548 if (!reg_hive_key(argv[0], &hive, &key.name)) {
549 return NT_STATUS_INVALID_PARAMETER;
552 status = rpccli_winreg_Connect(pipe_hnd, mem_ctx, hive, REG_KEY_WRITE,
554 if (!(NT_STATUS_IS_OK(status))) {
558 status = rpccli_winreg_DeleteKey(pipe_hnd, mem_ctx, &hive_hnd, key);
559 rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &hive_hnd);
561 if (!NT_STATUS_IS_OK(status)) {
562 d_fprintf(stderr, "deletekey returned %s\n",
569 static int rpc_registry_deletekey( int argc, const char **argv )
572 d_fprintf(stderr, "usage: net rpc registry deletekey <key>\n");
576 return run_rpc_command( NULL, PI_WINREG, 0,
577 rpc_registry_deletekey_internal, argc, argv );
580 /********************************************************************
581 ********************************************************************/
583 static NTSTATUS rpc_registry_enumerate_internal(const DOM_SID *domain_sid,
584 const char *domain_name,
585 struct cli_state *cli,
586 struct rpc_pipe_client *pipe_hnd,
591 POLICY_HND pol_hive, pol_key;
595 char **names, **classes;
598 struct registry_value **values;
601 d_printf("Usage: net rpc enumerate <path> [recurse]\n");
602 d_printf("Example: net rpc enumerate 'HKLM\\Software\\Samba'\n");
606 status = registry_openkey(mem_ctx, pipe_hnd, argv[0], REG_KEY_READ,
607 &pol_hive, &pol_key);
608 if (!NT_STATUS_IS_OK(status)) {
609 d_fprintf(stderr, "registry_openkey failed: %s\n",
614 status = registry_enumkeys(mem_ctx, pipe_hnd, &pol_key, &num_subkeys,
615 &names, &classes, &modtimes);
616 if (!NT_STATUS_IS_OK(status)) {
617 d_fprintf(stderr, "enumerating keys failed: %s\n",
622 for (i=0; i<num_subkeys; i++) {
623 d_printf("Keyname = %s\n", names[i]);
624 d_printf("Modtime = %s\n", modtimes[i]
625 ? http_timestring(nt_time_to_unix(*modtimes[i]))
630 status = registry_enumvalues(mem_ctx, pipe_hnd, &pol_key, &num_values,
632 if (!NT_STATUS_IS_OK(status)) {
633 d_fprintf(stderr, "enumerating values failed: %s\n",
638 for (i=0; i<num_values; i++) {
639 struct registry_value *v = values[i];
640 d_printf("Valuename = %s\n", names[i]);
641 d_printf("Type = %s\n",
642 reg_type_lookup(v->type));
645 d_printf("Value = %d\n", v->v.dword);
649 d_printf("Value = \"%s\"\n", v->v.sz.str);
653 for (j = 0; j < v->v.multi_sz.num_strings; j++) {
654 d_printf("Value[%3.3d] = \"%s\"\n", j,
655 v->v.multi_sz.strings[j]);
660 d_printf("Value = %d bytes\n",
664 d_printf("Value = <unprintable>\n");
671 rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &pol_key );
672 rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &pol_hive );
677 /********************************************************************
678 ********************************************************************/
680 static int rpc_registry_enumerate( int argc, const char **argv )
682 return run_rpc_command( NULL, PI_WINREG, 0,
683 rpc_registry_enumerate_internal, argc, argv );
686 /********************************************************************
687 ********************************************************************/
689 static NTSTATUS rpc_registry_save_internal(const DOM_SID *domain_sid,
690 const char *domain_name,
691 struct cli_state *cli,
692 struct rpc_pipe_client *pipe_hnd,
697 WERROR result = WERR_GENERAL_FAILURE;
698 POLICY_HND pol_hive, pol_key;
699 NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
700 struct winreg_String filename;
703 d_printf("Usage: net rpc backup <path> <file> \n");
707 status = registry_openkey(mem_ctx, pipe_hnd, argv[0], REG_KEY_ALL,
708 &pol_hive, &pol_key);
709 if (!NT_STATUS_IS_OK(status)) {
710 d_fprintf(stderr, "registry_openkey failed: %s\n",
715 filename.name = argv[1];
716 status = rpccli_winreg_SaveKey( pipe_hnd, mem_ctx, &pol_key, &filename, NULL );
717 if ( !W_ERROR_IS_OK(result) ) {
718 d_fprintf(stderr, "Unable to save [%s] to %s:%s\n", argv[0], cli->desthost, argv[1]);
723 rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &pol_key );
724 rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &pol_hive );
729 /********************************************************************
730 ********************************************************************/
732 static int rpc_registry_save( int argc, const char **argv )
734 return run_rpc_command( NULL, PI_WINREG, 0,
735 rpc_registry_save_internal, argc, argv );
739 /********************************************************************
740 ********************************************************************/
742 static void dump_values( REGF_NK_REC *nk )
746 uint32 data_size, data;
751 for ( i=0; i<nk->num_values; i++ ) {
752 d_printf( "\"%s\" = ", nk->values[i].valuename ? nk->values[i].valuename : "(default)" );
753 d_printf( "(%s) ", reg_type_lookup( nk->values[i].type ) );
755 data_size = nk->values[i].data_size & ~VK_DATA_IN_OFFSET;
756 switch ( nk->values[i].type ) {
758 rpcstr_pull( data_str, nk->values[i].data, sizeof(data_str), -1, STR_TERMINATE );
759 d_printf( "%s", data_str );
763 for ( j=0; j<data_size; j++ ) {
764 d_printf( "%c", nk->values[i].data[j] );
768 data = IVAL( nk->values[i].data, 0 );
769 d_printf("0x%x", data );
772 for ( j=0; j<data_size; j++ ) {
773 d_printf( "%x", nk->values[i].data[j] );
786 /********************************************************************
787 ********************************************************************/
789 static BOOL dump_registry_tree( REGF_FILE *file, REGF_NK_REC *nk, const char *parent )
794 /* depth first dump of the registry tree */
796 while ( (key = regfio_fetch_subkey( file, nk )) ) {
797 pstr_sprintf( regpath, "%s\\%s", parent, key->keyname );
798 d_printf("[%s]\n", regpath );
801 dump_registry_tree( file, key, regpath );
807 /********************************************************************
808 ********************************************************************/
810 static BOOL write_registry_tree( REGF_FILE *infile, REGF_NK_REC *nk,
811 REGF_NK_REC *parent, REGF_FILE *outfile,
812 const char *parentpath )
814 REGF_NK_REC *key, *subkey;
816 REGSUBKEY_CTR *subkeys;
820 if ( !( subkeys = TALLOC_ZERO_P( infile->mem_ctx, REGSUBKEY_CTR )) ) {
821 DEBUG(0,("write_registry_tree: talloc() failed!\n"));
825 if ( !(values = TALLOC_ZERO_P( subkeys, REGVAL_CTR )) ) {
826 DEBUG(0,("write_registry_tree: talloc() failed!\n"));
830 /* copy values into the REGVAL_CTR */
832 for ( i=0; i<nk->num_values; i++ ) {
833 regval_ctr_addvalue( values, nk->values[i].valuename, nk->values[i].type,
834 (const char *)nk->values[i].data, (nk->values[i].data_size & ~VK_DATA_IN_OFFSET) );
837 /* copy subkeys into the REGSUBKEY_CTR */
839 while ( (subkey = regfio_fetch_subkey( infile, nk )) ) {
840 regsubkey_ctr_addkey( subkeys, subkey->keyname );
843 key = regfio_write_key( outfile, nk->keyname, values, subkeys, nk->sec_desc->sec_desc, parent );
845 /* write each one of the subkeys out */
847 pstr_sprintf( path, "%s%s%s", parentpath, parent ? "\\" : "", nk->keyname );
848 nk->subkey_index = 0;
849 while ( (subkey = regfio_fetch_subkey( infile, nk )) ) {
850 write_registry_tree( infile, subkey, key, outfile, path );
853 TALLOC_FREE( subkeys );
855 d_printf("[%s]\n", path );
860 /********************************************************************
861 ********************************************************************/
863 static int rpc_registry_dump( int argc, const char **argv )
869 d_printf("Usage: net rpc dump <file> \n");
873 d_printf("Opening %s....", argv[0]);
874 if ( !(registry = regfio_open( argv[0], O_RDONLY, 0)) ) {
875 d_fprintf(stderr, "Failed to open %s for reading\n", argv[0]);
880 /* get the root of the registry file */
882 if ((nk = regfio_rootkey( registry )) == NULL) {
883 d_fprintf(stderr, "Could not get rootkey\n");
884 regfio_close( registry );
887 d_printf("[%s]\n", nk->keyname);
891 dump_registry_tree( registry, nk, nk->keyname );
894 talloc_report_full( registry->mem_ctx, stderr );
896 d_printf("Closing registry...");
897 regfio_close( registry );
903 /********************************************************************
904 ********************************************************************/
906 static int rpc_registry_copy( int argc, const char **argv )
908 REGF_FILE *infile = NULL, *outfile = NULL;
913 d_printf("Usage: net rpc copy <srcfile> <newfile>\n");
917 d_printf("Opening %s....", argv[0]);
918 if ( !(infile = regfio_open( argv[0], O_RDONLY, 0 )) ) {
919 d_fprintf(stderr, "Failed to open %s for reading\n", argv[0]);
924 d_printf("Opening %s....", argv[1]);
925 if ( !(outfile = regfio_open( argv[1], (O_RDWR|O_CREAT|O_TRUNC), (S_IREAD|S_IWRITE) )) ) {
926 d_fprintf(stderr, "Failed to open %s for writing\n", argv[1]);
931 /* get the root of the registry file */
933 if ((nk = regfio_rootkey( infile )) == NULL) {
934 d_fprintf(stderr, "Could not get rootkey\n");
937 d_printf("RootKey: [%s]\n", nk->keyname);
939 write_registry_tree( infile, nk, NULL, outfile, "" );
945 d_printf("Closing %s...", argv[1]);
947 regfio_close( outfile );
951 d_printf("Closing %s...", argv[0]);
953 regfio_close( infile );
960 /********************************************************************
961 ********************************************************************/
963 int net_rpc_registry(int argc, const char **argv)
965 struct functable2 func[] = {
966 { "enumerate", rpc_registry_enumerate,
967 "Enumerate registry keys and values" },
968 { "createkey", rpc_registry_createkey,
969 "Create a new registry key" },
970 { "deletekey", rpc_registry_deletekey,
971 "Delete a registry key" },
972 { "setvalue", rpc_registry_setvalue,
973 "Set a new registry value" },
974 { "deletevalue", rpc_registry_deletevalue,
975 "Delete a registry value" },
976 { "save", rpc_registry_save,
977 "Save a registry file" },
978 { "dump", rpc_registry_dump,
979 "Dump a registry file" },
980 { "copy", rpc_registry_copy,
981 "Copy a registry file" },
985 return net_run_function2(argc, argv, "net rpc registry", func);