2 * Unix SMB/CIFS implementation.
3 * Virtual Windows Registry Layer
4 * Copyright (C) Volker Lendecke 2006
5 * Copyright (C) Michael Adam 2007-2010
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 /* Attempt to wrap the existing API in a more winreg.idl-like way */
24 * Here is a list of winreg.idl functions and corresponding implementations
27 * 0x00 winreg_OpenHKCR
28 * 0x01 winreg_OpenHKCU
29 * 0x02 winreg_OpenHKLM
30 * 0x03 winreg_OpenHKPD
32 * 0x05 winreg_CloseKey
33 * 0x06 winreg_CreateKey reg_createkey
34 * 0x07 winreg_DeleteKey reg_deletekey
35 * 0x08 winreg_DeleteValue reg_deletevalue
36 * 0x09 winreg_EnumKey reg_enumkey
37 * 0x0a winreg_EnumValue reg_enumvalue
38 * 0x0b winreg_FlushKey
39 * 0x0c winreg_GetKeySecurity reg_getkeysecurity
41 * 0x0e winreg_NotifyChangeKeyValue
42 * 0x0f winreg_OpenKey reg_openkey
43 * 0x10 winreg_QueryInfoKey reg_queryinfokey
44 * 0x11 winreg_QueryValue reg_queryvalue
45 * 0x12 winreg_ReplaceKey
46 * 0x13 winreg_RestoreKey reg_restorekey
47 * 0x14 winreg_SaveKey reg_savekey
48 * 0x15 winreg_SetKeySecurity reg_setkeysecurity
49 * 0x16 winreg_SetValue reg_setvalue
50 * 0x17 winreg_UnLoadKey
51 * 0x18 winreg_InitiateSystemShutdown
52 * 0x19 winreg_AbortSystemShutdown
53 * 0x1a winreg_GetVersion reg_getversion
54 * 0x1b winreg_OpenHKCC
55 * 0x1c winreg_OpenHKDD
56 * 0x1d winreg_QueryMultipleValues reg_querymultiplevalues
57 * 0x1e winreg_InitiateSystemShutdownEx
58 * 0x1f winreg_SaveKeyEx
59 * 0x20 winreg_OpenHKPT
60 * 0x21 winreg_OpenHKPN
61 * 0x22 winreg_QueryMultipleValues2 reg_querymultiplevalues
68 #include "reg_cachehook.h"
69 #include "reg_backend_db.h"
70 #include "reg_dispatcher.h"
71 #include "reg_objects.h"
72 #include "../librpc/gen_ndr/ndr_security.h"
75 #define DBGC_CLASS DBGC_REGISTRY
78 /**********************************************************************
80 **********************************************************************/
82 static WERROR fill_value_cache(struct registry_key *key)
86 if (key->values != NULL) {
87 if (!reg_values_need_update(key->key, key->values)) {
92 TALLOC_FREE(key->values);
93 werr = regval_ctr_init(key, &(key->values));
94 W_ERROR_NOT_OK_RETURN(werr);
96 if (fetch_reg_values(key->key, key->values) == -1) {
97 TALLOC_FREE(key->values);
104 static WERROR fill_subkey_cache(struct registry_key *key)
108 if (key->subkeys != NULL) {
109 if (!reg_subkeys_need_update(key->key, key->subkeys)) {
114 werr = regsubkey_ctr_init(key, &(key->subkeys));
115 W_ERROR_NOT_OK_RETURN(werr);
117 if (fetch_reg_keys(key->key, key->subkeys) == -1) {
118 TALLOC_FREE(key->subkeys);
119 return WERR_NO_MORE_ITEMS;
125 static int regkey_destructor(struct registry_key_handle *key)
127 return regdb_close();
130 static WERROR regkey_open_onelevel(TALLOC_CTX *mem_ctx,
131 struct registry_key *parent,
133 const struct security_token *token,
134 uint32 access_desired,
135 struct registry_key **pregkey)
137 WERROR result = WERR_OK;
138 struct registry_key *regkey;
139 struct registry_key_handle *key;
140 struct regsubkey_ctr *subkeys = NULL;
142 DEBUG(7,("regkey_open_onelevel: name = [%s]\n", name));
144 SMB_ASSERT(strchr(name, '\\') == NULL);
146 if (!(regkey = TALLOC_ZERO_P(mem_ctx, struct registry_key)) ||
147 !(regkey->token = dup_nt_token(regkey, token)) ||
148 !(regkey->key = TALLOC_ZERO_P(regkey, struct registry_key_handle)))
154 result = regdb_open();
155 if (!(W_ERROR_IS_OK(result))) {
160 talloc_set_destructor(key, regkey_destructor);
164 key->type = REG_KEY_GENERIC;
166 if (name[0] == '\0') {
168 * Open a copy of the parent key
171 result = WERR_BADFILE;
174 key->name = talloc_strdup(key, parent->key->name);
180 key->name = talloc_asprintf(key, "%s%s%s",
181 parent ? parent->key->name : "",
186 if (key->name == NULL) {
191 /* Tag this as a Performance Counter Key */
193 if( StrnCaseCmp(key->name, KEY_HKPD, strlen(KEY_HKPD)) == 0 )
194 key->type = REG_KEY_HKPD;
196 /* Look up the table of registry I/O operations */
198 key->ops = reghook_cache_find( key->name );
199 if (key->ops == NULL) {
200 DEBUG(0,("reg_open_onelevel: Failed to assign "
201 "registry_ops to [%s]\n", key->name ));
202 result = WERR_BADFILE;
206 /* check if the path really exists; failed is indicated by -1 */
207 /* if the subkey count failed, bail out */
209 result = regsubkey_ctr_init(key, &subkeys);
210 if (!W_ERROR_IS_OK(result)) {
214 if ( fetch_reg_keys( key, subkeys ) == -1 ) {
215 result = WERR_BADFILE;
219 TALLOC_FREE( subkeys );
221 if ( !regkey_access_check( key, access_desired, &key->access_granted,
223 result = WERR_ACCESS_DENIED;
231 if ( !W_ERROR_IS_OK(result) ) {
238 WERROR reg_openhive(TALLOC_CTX *mem_ctx, const char *hive,
239 uint32 desired_access,
240 const struct security_token *token,
241 struct registry_key **pkey)
243 SMB_ASSERT(hive != NULL);
244 SMB_ASSERT(hive[0] != '\0');
245 SMB_ASSERT(strchr(hive, '\\') == NULL);
247 return regkey_open_onelevel(mem_ctx, NULL, hive, token, desired_access,
252 /**********************************************************************
254 **********************************************************************/
256 WERROR reg_openkey(TALLOC_CTX *mem_ctx, struct registry_key *parent,
257 const char *name, uint32 desired_access,
258 struct registry_key **pkey)
260 struct registry_key *direct_parent = parent;
264 TALLOC_CTX *frame = talloc_stackframe();
266 path = talloc_strdup(frame, name);
274 if ((len > 0) && (path[len-1] == '\\')) {
278 while ((p = strchr(path, '\\')) != NULL) {
279 char *name_component;
280 struct registry_key *tmp;
282 name_component = talloc_strndup(frame, path, (p - path));
283 if (name_component == NULL) {
288 err = regkey_open_onelevel(frame, direct_parent,
289 name_component, parent->token,
290 KEY_ENUMERATE_SUB_KEYS, &tmp);
292 if (!W_ERROR_IS_OK(err)) {
300 err = regkey_open_onelevel(mem_ctx, direct_parent, path, parent->token,
301 desired_access, pkey);
308 WERROR reg_enumkey(TALLOC_CTX *mem_ctx, struct registry_key *key,
309 uint32 idx, char **name, NTTIME *last_write_time)
313 if (!(key->key->access_granted & KEY_ENUMERATE_SUB_KEYS)) {
314 return WERR_ACCESS_DENIED;
317 if (!W_ERROR_IS_OK(err = fill_subkey_cache(key))) {
321 if (idx >= regsubkey_ctr_numkeys(key->subkeys)) {
322 return WERR_NO_MORE_ITEMS;
325 if (!(*name = talloc_strdup(mem_ctx,
326 regsubkey_ctr_specific_key(key->subkeys, idx))))
331 if (last_write_time) {
332 *last_write_time = 0;
338 WERROR reg_enumvalue(TALLOC_CTX *mem_ctx, struct registry_key *key,
339 uint32 idx, char **pname, struct registry_value **pval)
341 struct registry_value *val;
342 struct regval_blob *blob;
345 if (!(key->key->access_granted & KEY_QUERY_VALUE)) {
346 return WERR_ACCESS_DENIED;
349 if (!(W_ERROR_IS_OK(err = fill_value_cache(key)))) {
353 if (idx >= regval_ctr_numvals(key->values)) {
354 return WERR_NO_MORE_ITEMS;
357 blob = regval_ctr_specific_value(key->values, idx);
359 val = talloc_zero(mem_ctx, struct registry_value);
364 val->type = regval_type(blob);
365 val->data = data_blob_talloc(mem_ctx, regval_data_p(blob), regval_size(blob));
368 && !(*pname = talloc_strdup(
369 mem_ctx, regval_name(blob)))) {
378 static WERROR reg_enumvalue_nocachefill(TALLOC_CTX *mem_ctx,
379 struct registry_key *key,
380 uint32 idx, char **pname,
381 struct registry_value **pval)
383 struct registry_value *val;
384 struct regval_blob *blob;
386 if (!(key->key->access_granted & KEY_QUERY_VALUE)) {
387 return WERR_ACCESS_DENIED;
390 if (idx >= regval_ctr_numvals(key->values)) {
391 return WERR_NO_MORE_ITEMS;
394 blob = regval_ctr_specific_value(key->values, idx);
396 val = talloc_zero(mem_ctx, struct registry_value);
401 val->type = regval_type(blob);
402 val->data = data_blob_talloc(mem_ctx, regval_data_p(blob), regval_size(blob));
405 && !(*pname = talloc_strdup(
406 mem_ctx, regval_name(blob)))) {
415 WERROR reg_queryvalue(TALLOC_CTX *mem_ctx, struct registry_key *key,
416 const char *name, struct registry_value **pval)
421 if (!(key->key->access_granted & KEY_QUERY_VALUE)) {
422 return WERR_ACCESS_DENIED;
425 if (!(W_ERROR_IS_OK(err = fill_value_cache(key)))) {
429 for (i=0; i < regval_ctr_numvals(key->values); i++) {
430 struct regval_blob *blob;
431 blob = regval_ctr_specific_value(key->values, i);
432 if (strequal(regval_name(blob), name)) {
434 * don't use reg_enumvalue here:
435 * re-reading the values from the disk
436 * would change the indexing and break
439 return reg_enumvalue_nocachefill(mem_ctx, key, i,
447 WERROR reg_querymultiplevalues(TALLOC_CTX *mem_ctx,
448 struct registry_key *key,
452 struct registry_value **pvals)
455 uint32_t i, n, found = 0;
456 struct registry_value *vals;
458 if (num_names == 0) {
462 if (!(key->key->access_granted & KEY_QUERY_VALUE)) {
463 return WERR_ACCESS_DENIED;
466 if (!(W_ERROR_IS_OK(err = fill_value_cache(key)))) {
470 vals = talloc_zero_array(mem_ctx, struct registry_value, num_names);
475 for (n=0; n < num_names; n++) {
476 for (i=0; i < regval_ctr_numvals(key->values); i++) {
477 struct regval_blob *blob;
478 blob = regval_ctr_specific_value(key->values, i);
479 if (strequal(regval_name(blob), names[n])) {
480 struct registry_value *v;
481 err = reg_enumvalue(mem_ctx, key, i, NULL, &v);
482 if (!W_ERROR_IS_OK(err)) {
497 WERROR reg_queryinfokey(struct registry_key *key, uint32_t *num_subkeys,
498 uint32_t *max_subkeylen, uint32_t *max_subkeysize,
499 uint32_t *num_values, uint32_t *max_valnamelen,
500 uint32_t *max_valbufsize, uint32_t *secdescsize,
501 NTTIME *last_changed_time)
507 struct security_descriptor *secdesc;
509 if (!(key->key->access_granted & KEY_QUERY_VALUE)) {
510 return WERR_ACCESS_DENIED;
513 if (!W_ERROR_IS_OK(fill_subkey_cache(key)) ||
514 !W_ERROR_IS_OK(fill_value_cache(key))) {
519 for (i=0; i< regsubkey_ctr_numkeys(key->subkeys); i++) {
520 max_len = MAX(max_len,
521 strlen(regsubkey_ctr_specific_key(key->subkeys, i)));
524 *num_subkeys = regsubkey_ctr_numkeys(key->subkeys);
525 *max_subkeylen = max_len;
526 *max_subkeysize = 0; /* Class length? */
530 for (i=0; i < regval_ctr_numvals(key->values); i++) {
531 struct regval_blob *blob;
532 blob = regval_ctr_specific_value(key->values, i);
533 max_len = MAX(max_len, strlen(regval_name(blob)));
534 max_size = MAX(max_size, regval_size(blob));
537 *num_values = regval_ctr_numvals(key->values);
538 *max_valnamelen = max_len;
539 *max_valbufsize = max_size;
541 if (!(mem_ctx = talloc_new(key))) {
545 err = regkey_get_secdesc(mem_ctx, key->key, &secdesc);
546 if (!W_ERROR_IS_OK(err)) {
547 TALLOC_FREE(mem_ctx);
551 *secdescsize = ndr_size_security_descriptor(secdesc, 0);
552 TALLOC_FREE(mem_ctx);
554 *last_changed_time = 0;
559 WERROR reg_createkey(TALLOC_CTX *ctx, struct registry_key *parent,
560 const char *subkeypath, uint32 desired_access,
561 struct registry_key **pkey,
562 enum winreg_CreateAction *paction)
564 struct registry_key *key = parent;
565 struct registry_key *create_parent;
570 mem_ctx = talloc_new(ctx);
571 if (mem_ctx == NULL) {
575 path = talloc_strdup(mem_ctx, subkeypath);
581 err = regdb_transaction_start();
582 if (!W_ERROR_IS_OK(err)) {
583 DEBUG(0, ("reg_createkey: failed to start transaction: %s\n",
588 while ((end = strchr(path, '\\')) != NULL) {
589 struct registry_key *tmp;
590 enum winreg_CreateAction action;
594 err = reg_createkey(mem_ctx, key, path,
595 KEY_ENUMERATE_SUB_KEYS, &tmp, &action);
596 if (!W_ERROR_IS_OK(err)) {
609 * At this point, "path" contains the one-element subkey of "key". We
610 * can try to open it.
613 err = reg_openkey(ctx, key, path, desired_access, pkey);
614 if (W_ERROR_IS_OK(err)) {
615 if (paction != NULL) {
616 *paction = REG_OPENED_EXISTING_KEY;
621 if (!W_ERROR_EQUAL(err, WERR_BADFILE)) {
623 * Something but "notfound" has happened, so bail out
629 * We have to make a copy of the current key, as we opened it only
630 * with ENUM_SUBKEY access.
633 err = reg_openkey(mem_ctx, key, "", KEY_CREATE_SUB_KEY,
635 if (!W_ERROR_IS_OK(err)) {
640 * Actually create the subkey
643 err = fill_subkey_cache(create_parent);
644 if (!W_ERROR_IS_OK(err)) {
648 err = create_reg_subkey(key->key, path);
649 if (!W_ERROR_IS_OK(err)) {
654 * Now open the newly created key
657 err = reg_openkey(ctx, create_parent, path, desired_access, pkey);
658 if (W_ERROR_IS_OK(err) && (paction != NULL)) {
659 *paction = REG_CREATED_NEW_KEY;
663 if (W_ERROR_IS_OK(err)) {
664 err = regdb_transaction_commit();
665 if (!W_ERROR_IS_OK(err)) {
666 DEBUG(0, ("reg_createkey: Error committing transaction: %s\n", win_errstr(err)));
669 WERROR err1 = regdb_transaction_cancel();
670 if (!W_ERROR_IS_OK(err1)) {
671 DEBUG(0, ("reg_createkey: Error cancelling transaction: %s\n", win_errstr(err1)));
676 TALLOC_FREE(mem_ctx);
680 WERROR reg_deletekey(struct registry_key *parent, const char *path)
684 struct registry_key *tmp_key, *key;
685 TALLOC_CTX *mem_ctx = talloc_stackframe();
687 name = talloc_strdup(mem_ctx, path);
693 /* check if the key has subkeys */
694 err = reg_openkey(mem_ctx, parent, name, REG_KEY_READ, &key);
695 W_ERROR_NOT_OK_GOTO_DONE(err);
697 err = regdb_transaction_start();
698 if (!W_ERROR_IS_OK(err)) {
699 DEBUG(0, ("reg_deletekey: Error starting transaction: %s\n",
704 err = fill_subkey_cache(key);
705 W_ERROR_NOT_OK_GOTO(err, trans_done);
707 if (regsubkey_ctr_numkeys(key->subkeys) > 0) {
708 err = WERR_ACCESS_DENIED;
712 /* no subkeys - proceed with delete */
713 end = strrchr(name, '\\');
717 err = reg_openkey(mem_ctx, parent, name,
718 KEY_CREATE_SUB_KEY, &tmp_key);
719 W_ERROR_NOT_OK_GOTO(err, trans_done);
725 if (name[0] == '\0') {
726 err = WERR_INVALID_PARAM;
730 err = delete_reg_subkey(parent->key, name);
733 if (W_ERROR_IS_OK(err)) {
734 err = regdb_transaction_commit();
735 if (!W_ERROR_IS_OK(err)) {
736 DEBUG(0, ("reg_deletekey: Error committing transaction: %s\n", win_errstr(err)));
739 WERROR err1 = regdb_transaction_cancel();
740 if (!W_ERROR_IS_OK(err1)) {
741 DEBUG(0, ("reg_deletekey: Error cancelling transaction: %s\n", win_errstr(err1)));
746 TALLOC_FREE(mem_ctx);
750 WERROR reg_setvalue(struct registry_key *key, const char *name,
751 const struct registry_value *val)
753 struct regval_blob *existing;
757 if (!(key->key->access_granted & KEY_SET_VALUE)) {
758 return WERR_ACCESS_DENIED;
761 err = regdb_transaction_start();
762 if (!W_ERROR_IS_OK(err)) {
763 DEBUG(0, ("reg_setvalue: Failed to start transaction: %s\n",
768 err = fill_value_cache(key);
769 if (!W_ERROR_IS_OK(err)) {
770 DEBUG(0, ("reg_setvalue: Error filling value cache: %s\n", win_errstr(err)));
774 existing = regval_ctr_getvalue(key->values, name);
776 if ((existing != NULL) &&
777 (regval_size(existing) == val->data.length) &&
778 (memcmp(regval_data_p(existing), val->data.data,
779 val->data.length) == 0))
785 res = regval_ctr_addvalue(key->values, name, val->type,
786 val->data.data, val->data.length);
789 TALLOC_FREE(key->values);
794 if (!store_reg_values(key->key, key->values)) {
795 TALLOC_FREE(key->values);
796 DEBUG(0, ("reg_setvalue: store_reg_values failed\n"));
797 err = WERR_REG_IO_FAILURE;
804 if (W_ERROR_IS_OK(err)) {
805 err = regdb_transaction_commit();
806 if (!W_ERROR_IS_OK(err)) {
807 DEBUG(0, ("reg_setvalue: Error committing transaction: %s\n", win_errstr(err)));
810 WERROR err1 = regdb_transaction_cancel();
811 if (!W_ERROR_IS_OK(err1)) {
812 DEBUG(0, ("reg_setvalue: Error cancelling transaction: %s\n", win_errstr(err1)));
819 static WERROR reg_value_exists(struct registry_key *key, const char *name)
821 struct regval_blob *blob;
823 blob = regval_ctr_getvalue(key->values, name);
832 WERROR reg_deletevalue(struct registry_key *key, const char *name)
836 if (!(key->key->access_granted & KEY_SET_VALUE)) {
837 return WERR_ACCESS_DENIED;
840 err = regdb_transaction_start();
841 if (!W_ERROR_IS_OK(err)) {
842 DEBUG(0, ("reg_deletevalue: Failed to start transaction: %s\n",
847 err = fill_value_cache(key);
848 if (!W_ERROR_IS_OK(err)) {
849 DEBUG(0, ("reg_deletevalue; Error filling value cache: %s\n",
854 err = reg_value_exists(key, name);
855 if (!W_ERROR_IS_OK(err)) {
859 regval_ctr_delvalue(key->values, name);
861 if (!store_reg_values(key->key, key->values)) {
862 TALLOC_FREE(key->values);
863 err = WERR_REG_IO_FAILURE;
864 DEBUG(0, ("reg_deletevalue: store_reg_values failed\n"));
871 if (W_ERROR_IS_OK(err)) {
872 err = regdb_transaction_commit();
873 if (!W_ERROR_IS_OK(err)) {
874 DEBUG(0, ("reg_deletevalue: Error committing transaction: %s\n", win_errstr(err)));
877 WERROR err1 = regdb_transaction_cancel();
878 if (!W_ERROR_IS_OK(err1)) {
879 DEBUG(0, ("reg_deletevalue: Error cancelling transaction: %s\n", win_errstr(err1)));
886 WERROR reg_getkeysecurity(TALLOC_CTX *mem_ctx, struct registry_key *key,
887 struct security_descriptor **psecdesc)
889 return regkey_get_secdesc(mem_ctx, key->key, psecdesc);
892 WERROR reg_setkeysecurity(struct registry_key *key,
893 struct security_descriptor *psecdesc)
895 return regkey_set_secdesc(key->key, psecdesc);
898 WERROR reg_getversion(uint32_t *version)
900 if (version == NULL) {
901 return WERR_INVALID_PARAM;
904 *version = 0x00000005; /* Windows 2000 registry API version */
908 /**********************************************************************
909 * Higher level utility functions
910 **********************************************************************/
912 WERROR reg_deleteallvalues(struct registry_key *key)
917 if (!(key->key->access_granted & KEY_SET_VALUE)) {
918 return WERR_ACCESS_DENIED;
921 if (!W_ERROR_IS_OK(err = fill_value_cache(key))) {
925 for (i=0; i < regval_ctr_numvals(key->values); i++) {
926 struct regval_blob *blob;
927 blob = regval_ctr_specific_value(key->values, i);
928 regval_ctr_delvalue(key->values, regval_name(blob));
931 if (!store_reg_values(key->key, key->values)) {
932 TALLOC_FREE(key->values);
933 return WERR_REG_IO_FAILURE;
940 * Utility function to delete a registry key with all its subkeys.
941 * Note that reg_deletekey returns ACCESS_DENIED when called on a
942 * key that has subkeys.
944 static WERROR reg_deletekey_recursive_internal(struct registry_key *parent,
948 WERROR werr = WERR_OK;
949 struct registry_key *key;
950 char *subkey_name = NULL;
952 TALLOC_CTX *mem_ctx = talloc_stackframe();
954 /* recurse through subkeys first */
955 werr = reg_openkey(mem_ctx, parent, path, REG_KEY_ALL, &key);
956 if (!W_ERROR_IS_OK(werr)) {
960 werr = fill_subkey_cache(key);
961 W_ERROR_NOT_OK_GOTO_DONE(werr);
964 * loop from top to bottom for perfomance:
965 * this way, we need to rehash the regsubkey containers less
967 for (i = regsubkey_ctr_numkeys(key->subkeys) ; i > 0; i--) {
968 subkey_name = regsubkey_ctr_specific_key(key->subkeys, i-1);
969 werr = reg_deletekey_recursive_internal(key, subkey_name, true);
970 W_ERROR_NOT_OK_GOTO_DONE(werr);
974 /* now delete the actual key */
975 werr = reg_deletekey(parent, path);
979 TALLOC_FREE(mem_ctx);
983 static WERROR reg_deletekey_recursive_trans(struct registry_key *parent,
989 werr = regdb_transaction_start();
990 if (!W_ERROR_IS_OK(werr)) {
991 DEBUG(0, ("reg_deletekey_recursive_trans: "
992 "error starting transaction: %s\n",
997 werr = reg_deletekey_recursive_internal(parent, path, del_key);
999 if (!W_ERROR_IS_OK(werr)) {
1002 DEBUG(1, (__location__ " failed to delete key '%s' from key "
1003 "'%s': %s\n", path, parent->key->name,
1006 werr2 = regdb_transaction_cancel();
1007 if (!W_ERROR_IS_OK(werr2)) {
1008 DEBUG(0, ("reg_deletekey_recursive_trans: "
1009 "error cancelling transaction: %s\n",
1010 win_errstr(werr2)));
1012 * return the original werr or the
1013 * error from cancelling the transaction?
1017 werr = regdb_transaction_commit();
1018 if (!W_ERROR_IS_OK(werr)) {
1019 DEBUG(0, ("reg_deletekey_recursive_trans: "
1020 "error committing transaction: %s\n",
1028 WERROR reg_deletekey_recursive(struct registry_key *parent,
1031 return reg_deletekey_recursive_trans(parent, path, true);
1034 WERROR reg_deletesubkeys_recursive(struct registry_key *parent,
1037 return reg_deletekey_recursive_trans(parent, path, false);