1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-09 08:58:35 +03:00
Gerald Carter ab0033d40a r7938: * move the hardcoded registry value names from _reg_query_value()
to a thin layer in fetch_reg_values().  Not entirely efficient
  seeing as the the dynamic value paths are stored in an unsorted
  array but it is one strequal() per path.  If this was really big
  it should be worked into the reghook_cache().
(This used to be commit 63b81ad3cb484090a181fbd13e04922a5c17e7d9)
2007-10-10 10:58:03 -05:00

100 lines
2.5 KiB
C

/*
* Unix SMB/CIFS implementation.
* Virtual Windows Registry Layer (utility functions)
* Copyright (C) Gerald Carter 2002-2005
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* Implementation of registry frontend view functions. */
#include "includes.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_RPC_SRV
/***********************************************************************
Utility function for splitting the base path of a registry path off
by setting base and new_path to the apprapriate offsets withing the
path.
WARNING!! Does modify the original string!
***********************************************************************/
BOOL reg_split_path( char *path, char **base, char **new_path )
{
char *p;
*new_path = *base = NULL;
if ( !path)
return False;
*base = path;
p = strchr( path, '\\' );
if ( p ) {
*p = '\0';
*new_path = p+1;
}
return True;
}
/***********************************************************************
Utility function for splitting the base path of a registry path off
by setting base and new_path to the appropriate offsets withing the
path.
WARNING!! Does modify the original string!
***********************************************************************/
BOOL reg_split_key( char *path, char **base, char **key )
{
char *p;
*key = *base = NULL;
if ( !path)
return False;
*base = path;
p = strrchr( path, '\\' );
if ( p ) {
*p = '\0';
*key = p+1;
}
return True;
}
/**********************************************************************
The full path to the registry key is used as database after the
\'s are converted to /'s. Key string is also normalized to UPPER
case.
**********************************************************************/
void normalize_reg_path( pstring keyname )
{
pstring_sub( keyname, "\\", "/" );
strupper_m( keyname );
}