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 3 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, see <http://www.gnu.org/licenses/>. */
21 #include "utils/net.h"
23 #include "reg_objects.h"
25 static BOOL reg_hive_key(const char *fullname, uint32 *reg_type,
26 const char **key_name)
31 sep = strchr_m(fullname, '\\');
38 len = strlen(fullname);
42 if (strnequal(fullname, "HKLM", len) ||
43 strnequal(fullname, "HKEY_LOCAL_MACHINE", len))
44 (*reg_type) = HKEY_LOCAL_MACHINE;
45 else if (strnequal(fullname, "HKCR", len) ||
46 strnequal(fullname, "HKEY_CLASSES_ROOT", len))
47 (*reg_type) = HKEY_CLASSES_ROOT;
48 else if (strnequal(fullname, "HKU", len) ||
49 strnequal(fullname, "HKEY_USERS", len))
50 (*reg_type) = HKEY_USERS;
51 else if (strnequal(fullname, "HKPD", len) ||
52 strnequal(fullname, "HKEY_PERFORMANCE_DATA", len))
53 (*reg_type) = HKEY_PERFORMANCE_DATA;
55 DEBUG(10,("reg_hive_key: unrecognised hive key %s\n",
63 static NTSTATUS registry_openkey(TALLOC_CTX *mem_ctx,
64 struct rpc_pipe_client *pipe_hnd,
65 const char *name, uint32 access_mask,
66 struct policy_handle *hive_hnd,
67 struct policy_handle *key_hnd)
71 struct winreg_String key;
73 if (!reg_hive_key(name, &hive, &key.name)) {
74 return NT_STATUS_INVALID_PARAMETER;
77 status = rpccli_winreg_Connect(pipe_hnd, mem_ctx, hive, access_mask,
79 if (!(NT_STATUS_IS_OK(status))) {
83 status = rpccli_winreg_OpenKey(pipe_hnd, mem_ctx, hive_hnd, key, 0,
84 access_mask, key_hnd);
85 if (!(NT_STATUS_IS_OK(status))) {
86 rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, hive_hnd);
93 static NTSTATUS registry_enumkeys(TALLOC_CTX *ctx,
94 struct rpc_pipe_client *pipe_hnd,
95 struct policy_handle *key_hnd,
96 uint32 *pnum_keys, char ***pnames,
97 char ***pclasses, NTTIME ***pmodtimes)
101 uint32 num_subkeys, max_subkeylen, max_classlen;
102 uint32 num_values, max_valnamelen, max_valbufsize;
104 NTTIME last_changed_time;
106 struct winreg_String classname;
107 char **names, **classes;
110 if (!(mem_ctx = talloc_new(ctx))) {
111 return NT_STATUS_NO_MEMORY;
114 ZERO_STRUCT(classname);
115 status = rpccli_winreg_QueryInfoKey(
116 pipe_hnd, mem_ctx, key_hnd, &classname, &num_subkeys,
117 &max_subkeylen, &max_classlen, &num_values, &max_valnamelen,
118 &max_valbufsize, &secdescsize, &last_changed_time );
120 if (!NT_STATUS_IS_OK(status)) {
124 if (num_subkeys == 0) {
126 TALLOC_FREE(mem_ctx);
130 if ((!(names = TALLOC_ZERO_ARRAY(mem_ctx, char *, num_subkeys))) ||
131 (!(classes = TALLOC_ZERO_ARRAY(mem_ctx, char *, num_subkeys))) ||
132 (!(modtimes = TALLOC_ZERO_ARRAY(mem_ctx, NTTIME *,
134 status = NT_STATUS_NO_MEMORY;
138 for (i=0; i<num_subkeys; i++) {
140 struct winreg_StringBuf class_buf;
141 struct winreg_StringBuf name_buf;
146 class_buf.size = max_classlen+2;
150 name_buf.size = max_subkeylen+2;
152 ZERO_STRUCT(modtime);
154 status = rpccli_winreg_EnumKey(pipe_hnd, mem_ctx, key_hnd,
155 i, &name_buf, &class_buf,
158 if (W_ERROR_EQUAL(ntstatus_to_werror(status),
159 WERR_NO_MORE_ITEMS) ) {
160 status = NT_STATUS_OK;
163 if (!NT_STATUS_IS_OK(status)) {
169 if (class_buf.name &&
170 (!(classes[i] = talloc_strdup(classes, class_buf.name)))) {
171 status = NT_STATUS_NO_MEMORY;
175 if (!(names[i] = talloc_strdup(names, name_buf.name))) {
176 status = NT_STATUS_NO_MEMORY;
180 if ((!(modtimes[i] = (NTTIME *)talloc_memdup(
181 modtimes, &modtime, sizeof(modtime))))) {
182 status = NT_STATUS_NO_MEMORY;
187 *pnum_keys = num_subkeys;
190 *pnames = talloc_move(ctx, &names);
193 *pclasses = talloc_move(ctx, &classes);
196 *pmodtimes = talloc_move(ctx, &modtimes);
199 status = NT_STATUS_OK;
202 TALLOC_FREE(mem_ctx);
206 static NTSTATUS registry_enumvalues(TALLOC_CTX *ctx,
207 struct rpc_pipe_client *pipe_hnd,
208 struct policy_handle *key_hnd,
209 uint32 *pnum_values, char ***pvalnames,
210 struct registry_value ***pvalues)
214 uint32 num_subkeys, max_subkeylen, max_classlen;
215 uint32 num_values, max_valnamelen, max_valbufsize;
217 NTTIME last_changed_time;
219 struct winreg_String classname;
220 struct registry_value **values;
223 if (!(mem_ctx = talloc_new(ctx))) {
224 return NT_STATUS_NO_MEMORY;
227 ZERO_STRUCT(classname);
228 status = rpccli_winreg_QueryInfoKey(
229 pipe_hnd, mem_ctx, key_hnd, &classname, &num_subkeys,
230 &max_subkeylen, &max_classlen, &num_values, &max_valnamelen,
231 &max_valbufsize, &secdescsize, &last_changed_time );
233 if (!NT_STATUS_IS_OK(status)) {
237 if (num_values == 0) {
239 TALLOC_FREE(mem_ctx);
243 if ((!(names = TALLOC_ARRAY(mem_ctx, char *, num_values))) ||
244 (!(values = TALLOC_ARRAY(mem_ctx, struct registry_value *,
246 status = NT_STATUS_NO_MEMORY;
250 for (i=0; i<num_values; i++) {
251 enum winreg_Type type = REG_NONE;
257 struct winreg_ValNameBuf name_buf;
262 name_buf.size = max_valnamelen + 2;
264 data_size = max_valbufsize;
265 data = (uint8 *)TALLOC(mem_ctx, data_size);
268 status = rpccli_winreg_EnumValue(pipe_hnd, mem_ctx, key_hnd,
273 if ( W_ERROR_EQUAL(ntstatus_to_werror(status),
274 WERR_NO_MORE_ITEMS) ) {
275 status = NT_STATUS_OK;
279 if (!(NT_STATUS_IS_OK(status))) {
283 if (name_buf.name == NULL) {
284 status = NT_STATUS_INVALID_PARAMETER;
288 if (!(names[i] = talloc_strdup(names, name_buf.name))) {
289 status = NT_STATUS_NO_MEMORY;
293 err = registry_pull_value(values, &values[i], type, data,
294 data_size, value_length);
295 if (!W_ERROR_IS_OK(err)) {
296 status = werror_to_ntstatus(err);
301 *pnum_values = num_values;
304 *pvalnames = talloc_move(ctx, &names);
307 *pvalues = talloc_move(ctx, &values);
310 status = NT_STATUS_OK;
313 TALLOC_FREE(mem_ctx);
317 static NTSTATUS registry_setvalue(TALLOC_CTX *mem_ctx,
318 struct rpc_pipe_client *pipe_hnd,
319 struct policy_handle *key_hnd,
321 const struct registry_value *value)
323 struct winreg_String name_string;
328 err = registry_push_value(mem_ctx, value, &blob);
329 if (!W_ERROR_IS_OK(err)) {
330 return werror_to_ntstatus(err);
333 name_string.name = name;
334 result = rpccli_winreg_SetValue(pipe_hnd, blob.data, key_hnd,
335 name_string, value->type,
336 blob.data, blob.length);
337 TALLOC_FREE(blob.data);
341 static NTSTATUS rpc_registry_setvalue_internal(const DOM_SID *domain_sid,
342 const char *domain_name,
343 struct cli_state *cli,
344 struct rpc_pipe_client *pipe_hnd,
349 struct policy_handle hive_hnd, key_hnd;
351 struct registry_value value;
353 status = registry_openkey(mem_ctx, pipe_hnd, argv[0], REG_KEY_WRITE,
354 &hive_hnd, &key_hnd);
355 if (!NT_STATUS_IS_OK(status)) {
356 d_fprintf(stderr, "registry_openkey failed: %s\n",
361 if (!strequal(argv[2], "multi_sz") && (argc != 4)) {
362 d_fprintf(stderr, "Too many args for type %s\n", argv[2]);
363 return NT_STATUS_NOT_IMPLEMENTED;
366 if (strequal(argv[2], "dword")) {
367 value.type = REG_DWORD;
368 value.v.dword = strtoul(argv[3], NULL, 10);
370 else if (strequal(argv[2], "sz")) {
372 value.v.sz.len = strlen(argv[3])+1;
373 value.v.sz.str = CONST_DISCARD(char *, argv[3]);
376 d_fprintf(stderr, "type \"%s\" not implemented\n", argv[2]);
377 status = NT_STATUS_NOT_IMPLEMENTED;
381 status = registry_setvalue(mem_ctx, pipe_hnd, &key_hnd,
384 if (!NT_STATUS_IS_OK(status)) {
385 d_fprintf(stderr, "registry_setvalue failed: %s\n",
390 rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &key_hnd);
391 rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &hive_hnd);
396 static int rpc_registry_setvalue( int argc, const char **argv )
399 d_fprintf(stderr, "usage: net rpc registry setvalue <key> "
400 "<valuename> <type> [<val>]+\n");
404 return run_rpc_command( NULL, PI_WINREG, 0,
405 rpc_registry_setvalue_internal, argc, argv );
408 static NTSTATUS rpc_registry_deletevalue_internal(const DOM_SID *domain_sid,
409 const char *domain_name,
410 struct cli_state *cli,
411 struct rpc_pipe_client *pipe_hnd,
416 struct policy_handle hive_hnd, key_hnd;
418 struct winreg_String valuename;
420 status = registry_openkey(mem_ctx, pipe_hnd, argv[0], REG_KEY_WRITE,
421 &hive_hnd, &key_hnd);
422 if (!NT_STATUS_IS_OK(status)) {
423 d_fprintf(stderr, "registry_openkey failed: %s\n",
428 valuename.name = argv[1];
430 status = rpccli_winreg_DeleteValue(pipe_hnd, mem_ctx, &key_hnd,
433 if (!NT_STATUS_IS_OK(status)) {
434 d_fprintf(stderr, "registry_deletevalue failed: %s\n",
438 rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &key_hnd);
439 rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &hive_hnd);
444 static int rpc_registry_deletevalue( int argc, const char **argv )
447 d_fprintf(stderr, "usage: net rpc registry deletevalue <key> "
452 return run_rpc_command( NULL, PI_WINREG, 0,
453 rpc_registry_deletevalue_internal, argc, argv );
456 static NTSTATUS rpc_registry_createkey_internal(const DOM_SID *domain_sid,
457 const char *domain_name,
458 struct cli_state *cli,
459 struct rpc_pipe_client *pipe_hnd,
465 struct policy_handle hive_hnd, key_hnd;
466 struct winreg_String key, keyclass;
467 enum winreg_CreateAction action;
470 if (!reg_hive_key(argv[0], &hive, &key.name)) {
471 return NT_STATUS_INVALID_PARAMETER;
474 status = rpccli_winreg_Connect(pipe_hnd, mem_ctx, hive,
475 REG_KEY_READ|REG_KEY_WRITE,
477 if (!(NT_STATUS_IS_OK(status))) {
481 action = REG_ACTION_NONE;
484 status = rpccli_winreg_CreateKey(pipe_hnd, mem_ctx, &hive_hnd, key,
485 keyclass, 0, REG_KEY_READ, NULL,
487 if (!NT_STATUS_IS_OK(status)) {
488 d_fprintf(stderr, "createkey returned %s\n",
490 rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &hive_hnd);
495 case REG_ACTION_NONE:
496 d_printf("createkey did nothing -- huh?\n");
498 case REG_CREATED_NEW_KEY:
499 d_printf("createkey created %s\n", argv[0]);
501 case REG_OPENED_EXISTING_KEY:
502 d_printf("createkey opened existing %s\n", argv[0]);
506 rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &key_hnd);
507 rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &hive_hnd);
512 static int rpc_registry_createkey( int argc, const char **argv )
515 d_fprintf(stderr, "usage: net rpc registry createkey <key>\n");
519 return run_rpc_command( NULL, PI_WINREG, 0,
520 rpc_registry_createkey_internal, argc, argv );
523 static NTSTATUS rpc_registry_deletekey_internal(const DOM_SID *domain_sid,
524 const char *domain_name,
525 struct cli_state *cli,
526 struct rpc_pipe_client *pipe_hnd,
532 struct policy_handle hive_hnd;
533 struct winreg_String key;
536 if (!reg_hive_key(argv[0], &hive, &key.name)) {
537 return NT_STATUS_INVALID_PARAMETER;
540 status = rpccli_winreg_Connect(pipe_hnd, mem_ctx, hive, REG_KEY_WRITE,
542 if (!(NT_STATUS_IS_OK(status))) {
546 status = rpccli_winreg_DeleteKey(pipe_hnd, mem_ctx, &hive_hnd, key);
547 rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &hive_hnd);
549 if (!NT_STATUS_IS_OK(status)) {
550 d_fprintf(stderr, "deletekey returned %s\n",
557 static int rpc_registry_deletekey( int argc, const char **argv )
560 d_fprintf(stderr, "usage: net rpc registry deletekey <key>\n");
564 return run_rpc_command( NULL, PI_WINREG, 0,
565 rpc_registry_deletekey_internal, argc, argv );
568 /********************************************************************
569 ********************************************************************/
571 static NTSTATUS rpc_registry_enumerate_internal(const DOM_SID *domain_sid,
572 const char *domain_name,
573 struct cli_state *cli,
574 struct rpc_pipe_client *pipe_hnd,
579 POLICY_HND pol_hive, pol_key;
581 uint32 num_subkeys = 0;
582 uint32 num_values = 0;
583 char **names = NULL, **classes = NULL;
584 NTTIME **modtimes = NULL;
586 struct registry_value **values = NULL;
589 d_printf("Usage: net rpc enumerate <path> [recurse]\n");
590 d_printf("Example: net rpc enumerate 'HKLM\\Software\\Samba'\n");
594 status = registry_openkey(mem_ctx, pipe_hnd, argv[0], REG_KEY_READ,
595 &pol_hive, &pol_key);
596 if (!NT_STATUS_IS_OK(status)) {
597 d_fprintf(stderr, "registry_openkey failed: %s\n",
602 status = registry_enumkeys(mem_ctx, pipe_hnd, &pol_key, &num_subkeys,
603 &names, &classes, &modtimes);
604 if (!NT_STATUS_IS_OK(status)) {
605 d_fprintf(stderr, "enumerating keys failed: %s\n",
610 for (i=0; i<num_subkeys; i++) {
611 d_printf("Keyname = %s\n", names[i]);
612 d_printf("Modtime = %s\n", modtimes[i]
613 ? http_timestring(nt_time_to_unix(*modtimes[i]))
618 status = registry_enumvalues(mem_ctx, pipe_hnd, &pol_key, &num_values,
620 if (!NT_STATUS_IS_OK(status)) {
621 d_fprintf(stderr, "enumerating values failed: %s\n",
626 for (i=0; i<num_values; i++) {
627 struct registry_value *v = values[i];
628 d_printf("Valuename = %s\n", names[i]);
629 d_printf("Type = %s\n",
630 reg_type_lookup(v->type));
633 d_printf("Value = %d\n", v->v.dword);
637 d_printf("Value = \"%s\"\n", v->v.sz.str);
641 for (j = 0; j < v->v.multi_sz.num_strings; j++) {
642 d_printf("Value[%3.3d] = \"%s\"\n", j,
643 v->v.multi_sz.strings[j]);
648 d_printf("Value = %d bytes\n",
649 (int)v->v.binary.length);
652 d_printf("Value = <unprintable>\n");
659 rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &pol_key );
660 rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &pol_hive );
665 /********************************************************************
666 ********************************************************************/
668 static int rpc_registry_enumerate( int argc, const char **argv )
670 return run_rpc_command( NULL, PI_WINREG, 0,
671 rpc_registry_enumerate_internal, argc, argv );
674 /********************************************************************
675 ********************************************************************/
677 static NTSTATUS rpc_registry_save_internal(const DOM_SID *domain_sid,
678 const char *domain_name,
679 struct cli_state *cli,
680 struct rpc_pipe_client *pipe_hnd,
685 WERROR result = WERR_GENERAL_FAILURE;
686 POLICY_HND pol_hive, pol_key;
687 NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
688 struct winreg_String filename;
691 d_printf("Usage: net rpc backup <path> <file> \n");
695 status = registry_openkey(mem_ctx, pipe_hnd, argv[0], REG_KEY_ALL,
696 &pol_hive, &pol_key);
697 if (!NT_STATUS_IS_OK(status)) {
698 d_fprintf(stderr, "registry_openkey failed: %s\n",
703 filename.name = argv[1];
704 status = rpccli_winreg_SaveKey( pipe_hnd, mem_ctx, &pol_key, &filename, NULL );
705 if ( !W_ERROR_IS_OK(result) ) {
706 d_fprintf(stderr, "Unable to save [%s] to %s:%s\n", argv[0], cli->desthost, argv[1]);
711 rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &pol_key );
712 rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &pol_hive );
717 /********************************************************************
718 ********************************************************************/
720 static int rpc_registry_save( int argc, const char **argv )
722 return run_rpc_command( NULL, PI_WINREG, 0,
723 rpc_registry_save_internal, argc, argv );
727 /********************************************************************
728 ********************************************************************/
730 static void dump_values( REGF_NK_REC *nk )
734 uint32 data_size, data;
739 for ( i=0; i<nk->num_values; i++ ) {
740 d_printf( "\"%s\" = ", nk->values[i].valuename ? nk->values[i].valuename : "(default)" );
741 d_printf( "(%s) ", reg_type_lookup( nk->values[i].type ) );
743 data_size = nk->values[i].data_size & ~VK_DATA_IN_OFFSET;
744 switch ( nk->values[i].type ) {
746 rpcstr_pull( data_str, nk->values[i].data, sizeof(data_str), -1, STR_TERMINATE );
747 d_printf( "%s", data_str );
751 for ( j=0; j<data_size; j++ ) {
752 d_printf( "%c", nk->values[i].data[j] );
756 data = IVAL( nk->values[i].data, 0 );
757 d_printf("0x%x", data );
760 for ( j=0; j<data_size; j++ ) {
761 d_printf( "%x", nk->values[i].data[j] );
774 /********************************************************************
775 ********************************************************************/
777 static BOOL dump_registry_tree( REGF_FILE *file, REGF_NK_REC *nk, const char *parent )
782 /* depth first dump of the registry tree */
784 while ( (key = regfio_fetch_subkey( file, nk )) ) {
785 pstr_sprintf( regpath, "%s\\%s", parent, key->keyname );
786 d_printf("[%s]\n", regpath );
789 dump_registry_tree( file, key, regpath );
795 /********************************************************************
796 ********************************************************************/
798 static BOOL write_registry_tree( REGF_FILE *infile, REGF_NK_REC *nk,
799 REGF_NK_REC *parent, REGF_FILE *outfile,
800 const char *parentpath )
802 REGF_NK_REC *key, *subkey;
804 REGSUBKEY_CTR *subkeys;
808 if ( !( subkeys = TALLOC_ZERO_P( infile->mem_ctx, REGSUBKEY_CTR )) ) {
809 DEBUG(0,("write_registry_tree: talloc() failed!\n"));
813 if ( !(values = TALLOC_ZERO_P( subkeys, REGVAL_CTR )) ) {
814 DEBUG(0,("write_registry_tree: talloc() failed!\n"));
818 /* copy values into the REGVAL_CTR */
820 for ( i=0; i<nk->num_values; i++ ) {
821 regval_ctr_addvalue( values, nk->values[i].valuename, nk->values[i].type,
822 (const char *)nk->values[i].data, (nk->values[i].data_size & ~VK_DATA_IN_OFFSET) );
825 /* copy subkeys into the REGSUBKEY_CTR */
827 while ( (subkey = regfio_fetch_subkey( infile, nk )) ) {
828 regsubkey_ctr_addkey( subkeys, subkey->keyname );
831 key = regfio_write_key( outfile, nk->keyname, values, subkeys, nk->sec_desc->sec_desc, parent );
833 /* write each one of the subkeys out */
835 pstr_sprintf( path, "%s%s%s", parentpath, parent ? "\\" : "", nk->keyname );
836 nk->subkey_index = 0;
837 while ( (subkey = regfio_fetch_subkey( infile, nk )) ) {
838 write_registry_tree( infile, subkey, key, outfile, path );
841 TALLOC_FREE( subkeys );
843 d_printf("[%s]\n", path );
848 /********************************************************************
849 ********************************************************************/
851 static int rpc_registry_dump( int argc, const char **argv )
857 d_printf("Usage: net rpc dump <file> \n");
861 d_printf("Opening %s....", argv[0]);
862 if ( !(registry = regfio_open( argv[0], O_RDONLY, 0)) ) {
863 d_fprintf(stderr, "Failed to open %s for reading\n", argv[0]);
868 /* get the root of the registry file */
870 if ((nk = regfio_rootkey( registry )) == NULL) {
871 d_fprintf(stderr, "Could not get rootkey\n");
872 regfio_close( registry );
875 d_printf("[%s]\n", nk->keyname);
879 dump_registry_tree( registry, nk, nk->keyname );
882 talloc_report_full( registry->mem_ctx, stderr );
884 d_printf("Closing registry...");
885 regfio_close( registry );
891 /********************************************************************
892 ********************************************************************/
894 static int rpc_registry_copy( int argc, const char **argv )
896 REGF_FILE *infile = NULL, *outfile = NULL;
901 d_printf("Usage: net rpc copy <srcfile> <newfile>\n");
905 d_printf("Opening %s....", argv[0]);
906 if ( !(infile = regfio_open( argv[0], O_RDONLY, 0 )) ) {
907 d_fprintf(stderr, "Failed to open %s for reading\n", argv[0]);
912 d_printf("Opening %s....", argv[1]);
913 if ( !(outfile = regfio_open( argv[1], (O_RDWR|O_CREAT|O_TRUNC), (S_IREAD|S_IWRITE) )) ) {
914 d_fprintf(stderr, "Failed to open %s for writing\n", argv[1]);
919 /* get the root of the registry file */
921 if ((nk = regfio_rootkey( infile )) == NULL) {
922 d_fprintf(stderr, "Could not get rootkey\n");
925 d_printf("RootKey: [%s]\n", nk->keyname);
927 write_registry_tree( infile, nk, NULL, outfile, "" );
933 d_printf("Closing %s...", argv[1]);
935 regfio_close( outfile );
939 d_printf("Closing %s...", argv[0]);
941 regfio_close( infile );
948 /********************************************************************
949 ********************************************************************/
951 int net_rpc_registry(int argc, const char **argv)
953 struct functable2 func[] = {
954 { "enumerate", rpc_registry_enumerate,
955 "Enumerate registry keys and values" },
956 { "createkey", rpc_registry_createkey,
957 "Create a new registry key" },
958 { "deletekey", rpc_registry_deletekey,
959 "Delete a registry key" },
960 { "setvalue", rpc_registry_setvalue,
961 "Set a new registry value" },
962 { "deletevalue", rpc_registry_deletevalue,
963 "Delete a registry value" },
964 { "save", rpc_registry_save,
965 "Save a registry file" },
966 { "dump", rpc_registry_dump,
967 "Dump a registry file" },
968 { "copy", rpc_registry_copy,
969 "Copy a registry file" },
973 return net_run_function2(argc, argv, "net rpc registry", func);