REGISTRY_HOOK* reghook_cache_find( char *keyname ) { char *key; int len; REGISTRY_HOOK *hook; if ( !keyname ) return NULL; /* prepend the string with a '\' character */ len = strlen( keyname ); if ( !(key = SMB_MALLOC( len + 2 )) ) { DEBUG(0,("reghook_cache_find: malloc failed for string [%s] !?!?!\n", keyname)); return NULL; } *key = '\\'; strncpy( key+1, keyname, len+1); /* swap to a form understood by the SORTED_TREE */ string_sub( key, "\\", "/", 0 ); DEBUG(10,("reghook_cache_find: Searching for keyname [%s]\n", key)); hook = pathtree_find( cache_tree, key ) ; SAFE_FREE( key ); return hook; }
struct registry_ops *reghook_cache_find(const char *keyname) { WERROR werr; char *key = NULL; struct registry_ops *ops = NULL; if (keyname == NULL) { return NULL; } werr = keyname_to_path(talloc_tos(), keyname, &key); if (!W_ERROR_IS_OK(werr)) { goto done; } DEBUG(10,("reghook_cache_find: Searching for keyname [%s]\n", key)); ops = (struct registry_ops *)pathtree_find(cache_tree, key); DEBUG(10, ("reghook_cache_find: found ops %p for key [%s]\n", ops ? (void *)ops : 0, key)); done: TALLOC_FREE(key); return ops; }